mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-05 18:50:08 +01:00
Black formatting
This commit is contained in:
@@ -24,13 +24,9 @@ class DirectiveOperand(Operand):
|
||||
def parameters(self, parameters):
|
||||
self._parameters = parameters
|
||||
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, DirectiveOperand):
|
||||
return (
|
||||
self._name == other._name
|
||||
and self._parameters == other._parameters
|
||||
)
|
||||
return self._name == other._name and self._parameters == other._parameters
|
||||
elif isinstance(other, dict):
|
||||
return self._name == other["name"] and self._parameters == other["parameters"]
|
||||
return False
|
||||
|
||||
@@ -17,9 +17,7 @@ class FlagOperand(Operand):
|
||||
self._name = name
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
f"Flag(name={self._name}, source={self._source}, relocation={self._destination})"
|
||||
)
|
||||
return f"Flag(name={self._name}, source={self._source}, relocation={self._destination})"
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
@@ -392,10 +392,13 @@ class ParserAArch64(BaseParser):
|
||||
return operand
|
||||
|
||||
def process_directive_operand(self, operand):
|
||||
return DirectiveOperand(
|
||||
name=operand["name"],
|
||||
parameters=operand["parameters"],
|
||||
), operand["comment"] if "comment" in operand else None
|
||||
return (
|
||||
DirectiveOperand(
|
||||
name=operand["name"],
|
||||
parameters=operand["parameters"],
|
||||
),
|
||||
operand["comment"] if "comment" in operand else None,
|
||||
)
|
||||
|
||||
def process_register_operand(self, operand):
|
||||
return RegisterOperand(
|
||||
@@ -524,9 +527,7 @@ class ParserAArch64(BaseParser):
|
||||
# normal integer value
|
||||
immediate["type"] = "int"
|
||||
# convert hex/bin immediates to dec
|
||||
new_immediate = ImmediateOperand(
|
||||
imd_type=immediate["type"], value=immediate["value"]
|
||||
)
|
||||
new_immediate = ImmediateOperand(imd_type=immediate["type"], value=immediate["value"])
|
||||
new_immediate.value = self.normalize_imd(new_immediate)
|
||||
return new_immediate
|
||||
if "base_immediate" in immediate:
|
||||
@@ -547,9 +548,7 @@ class ParserAArch64(BaseParser):
|
||||
dict_name = "double"
|
||||
if "exponent" in immediate[dict_name]:
|
||||
immediate["type"] = dict_name
|
||||
return ImmediateOperand(
|
||||
imd_type=immediate["type"], value=immediate[immediate["type"]]
|
||||
)
|
||||
return ImmediateOperand(imd_type=immediate["type"], value=immediate[immediate["type"]])
|
||||
else:
|
||||
# change 'mantissa' key to 'value'
|
||||
return ImmediateOperand(value=immediate[dict_name]["mantissa"], imd_type=dict_name)
|
||||
@@ -557,7 +556,10 @@ class ParserAArch64(BaseParser):
|
||||
def process_label(self, label):
|
||||
"""Post-process label asm line"""
|
||||
# remove duplicated 'name' level due to identifier
|
||||
return LabelOperand(name=label["name"]["name"]), label["comment"] if self.comment_id in label else None
|
||||
return (
|
||||
LabelOperand(name=label["name"]["name"]),
|
||||
label["comment"] if self.comment_id in label else None,
|
||||
)
|
||||
|
||||
def process_identifier(self, identifier):
|
||||
"""Post-process identifier operand"""
|
||||
|
||||
@@ -317,7 +317,10 @@ class ParserX86ATT(BaseParser):
|
||||
)
|
||||
|
||||
def process_directive(self, directive):
|
||||
directive_new = DirectiveOperand(name=directive["name"], parameters=directive["parameters"] if "parameters" in directive else [])
|
||||
directive_new = DirectiveOperand(
|
||||
name=directive["name"],
|
||||
parameters=directive["parameters"] if "parameters" in directive else [],
|
||||
)
|
||||
return directive_new, directive["comment"] if "comment" in directive else None
|
||||
|
||||
def process_memory_address(self, memory_address):
|
||||
@@ -346,9 +349,7 @@ class ParserX86ATT(BaseParser):
|
||||
)
|
||||
if isinstance(offset, dict) and "identifier" in offset:
|
||||
offset = IdentifierOperand(name=offset["identifier"]["name"])
|
||||
new_dict = MemoryOperand(
|
||||
offset=offset, base=baseOp, index=indexOp, scale=scale
|
||||
)
|
||||
new_dict = MemoryOperand(offset=offset, base=baseOp, index=indexOp, scale=scale)
|
||||
# Add segmentation extension if existing
|
||||
if self.segment_ext in memory_address:
|
||||
new_dict.segment_ext = memory_address[self.segment_ext]
|
||||
|
||||
@@ -46,7 +46,7 @@ class RegisterOperand(Operand):
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
return self._width
|
||||
|
||||
Reference in New Issue
Block a user