Changing operand matching for class operand style

This commit is contained in:
stefandesouza
2023-09-25 21:35:17 +02:00
parent 2f8c2f56cf
commit bc058233a3
4 changed files with 60 additions and 58 deletions

View File

@@ -182,19 +182,19 @@ class ISASemantics(object):
isa_data = self._isa_model.get_instruction(
instruction_form.instruction[:suffix_start], instruction_form.operands
)
"""
if only_postindexed:
for o in instruction_form.operands:
if isinstance(o, MemoryOperand) and o.base!=None:
if isinstance(o, MemoryOperand) and o.base!=None and o.post_indexed!=False:
base_name = o.base.prefix if o.base.prefix!=None else "" + o.base.name
return {
base_name: {
"name": o.base.prefix if o.base.prefix!=None else "" + o.base.name,
"value": o.post_indexed["value"],
"value": o.post_indexed['value'],
}
}
return {}
"""
reg_operand_names = {} # e.g., {'rax': 'op1'}
operand_state = {} # e.g., {'op1': {'name': 'rax', 'value': 0}} 0 means unchanged
@@ -253,13 +253,12 @@ class ISASemantics(object):
op_dict["destination"] += operands
if "hidden_operands" in isa_data:
op_dict["destination"] += [
AttrDict.convert_dict(
{
hop["class"]: {
k: hop[k] for k in ["name", "class", "source", "destination"]
}
}
)
for hop in isa_data["hidden_operands"]
]
return op_dict
@@ -267,6 +266,7 @@ class ISASemantics(object):
for i, op in enumerate(isa_data["operands"]):
if isinstance(op, RegisterOperand):
continue
'''
if op["source"] and op["destination"]:
op_dict["src_dst"].append(operands[i])
continue
@@ -276,6 +276,7 @@ class ISASemantics(object):
if op["destination"]:
op_dict["destination"].append(operands[i])
continue
'''
# check for hidden operands like flags or registers
if "hidden_operands" in isa_data:
# add operand(s) to semantic_operands of instruction form