mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-04 18:20:09 +01:00
added fallback search in arch/ISA model for ARM instructions with shape/cc suffixes
This commit is contained in:
@@ -192,11 +192,25 @@ class ArchSemantics(ISASemantics):
|
||||
instruction_data = self._machine_model.get_instruction(
|
||||
instruction_form["instruction"], instruction_form["operands"]
|
||||
)
|
||||
if not instruction_data and instruction_form["instruction"][-1] in self.GAS_SUFFIXES:
|
||||
if (
|
||||
not instruction_data
|
||||
and self._isa == "x86"
|
||||
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
|
||||
):
|
||||
# check for instruction without GAS suffix
|
||||
instruction_data = self._machine_model.get_instruction(
|
||||
instruction_form["instruction"][:-1], instruction_form["operands"]
|
||||
)
|
||||
if (
|
||||
instruction_data is None
|
||||
and self._isa == "aarch64"
|
||||
and "." in instruction_form["instruction"]
|
||||
):
|
||||
# Check for instruction without shape/cc suffix
|
||||
suffix_start = instruction_form["instruction"].index(".")
|
||||
instruction_data = self._machine_model.get_instruction(
|
||||
instruction_form["instruction"][:suffix_start], instruction_form["operands"]
|
||||
)
|
||||
if instruction_data:
|
||||
# instruction form in DB
|
||||
(
|
||||
@@ -223,12 +237,23 @@ class ArchSemantics(ISASemantics):
|
||||
)
|
||||
if (
|
||||
not instruction_data_reg
|
||||
and self._isa == "x86"
|
||||
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
|
||||
):
|
||||
# check for instruction without GAS suffix
|
||||
instruction_data_reg = self._machine_model.get_instruction(
|
||||
instruction_form["instruction"][:-1], operands
|
||||
)
|
||||
if (
|
||||
instruction_data_reg is None
|
||||
and self._isa == "aarch64"
|
||||
and "." in instruction_form["instruction"]
|
||||
):
|
||||
# Check for instruction without shape/cc suffix
|
||||
suffix_start = instruction_form["instruction"].index(".")
|
||||
instruction_data_reg = self._machine_model.get_instruction(
|
||||
instruction_form["instruction"][:suffix_start], operands
|
||||
)
|
||||
if instruction_data_reg:
|
||||
assign_unknown = False
|
||||
reg_type = self._parser.get_reg_type(
|
||||
|
||||
@@ -55,11 +55,25 @@ class ISASemantics(object):
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"], instruction_form["operands"]
|
||||
)
|
||||
if isa_data is None and instruction_form["instruction"][-1] in self.GAS_SUFFIXES:
|
||||
if (
|
||||
isa_data is None
|
||||
and self._isa == "x86"
|
||||
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
|
||||
):
|
||||
# Check for instruction without GAS suffix
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:-1], instruction_form["operands"]
|
||||
)
|
||||
if (
|
||||
isa_data is None
|
||||
and self._isa == "aarch64"
|
||||
and "." in instruction_form["instruction"]
|
||||
):
|
||||
# Check for instruction without shape/cc suffix
|
||||
suffix_start = instruction_form["instruction"].index(".")
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:suffix_start], instruction_form["operands"]
|
||||
)
|
||||
operands = instruction_form["operands"]
|
||||
op_dict = {}
|
||||
assign_default = False
|
||||
@@ -77,12 +91,23 @@ class ISASemantics(object):
|
||||
)
|
||||
if (
|
||||
isa_data_reg is None
|
||||
and self._isa == "x86"
|
||||
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
|
||||
):
|
||||
# Check for instruction without GAS suffix
|
||||
isa_data_reg = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:-1], operands_reg
|
||||
)
|
||||
if (
|
||||
isa_data_reg is None
|
||||
and self._isa == "aarch64"
|
||||
and "." in instruction_form["instruction"]
|
||||
):
|
||||
# Check for instruction without shape/cc suffix
|
||||
suffix_start = instruction_form["instruction"].index(".")
|
||||
isa_data_reg = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:suffix_start], operands_reg
|
||||
)
|
||||
if isa_data_reg:
|
||||
assign_default = False
|
||||
op_dict = self._apply_found_ISA_data(isa_data_reg, operands)
|
||||
@@ -159,11 +184,25 @@ class ISASemantics(object):
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"], instruction_form["operands"]
|
||||
)
|
||||
if isa_data is None and instruction_form["instruction"][-1] in self.GAS_SUFFIXES:
|
||||
if (
|
||||
isa_data is None
|
||||
and self._isa == "x86"
|
||||
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
|
||||
):
|
||||
# Check for instruction without GAS suffix
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:-1], instruction_form["operands"]
|
||||
)
|
||||
if (
|
||||
isa_data is None
|
||||
and self._isa == "aarch64"
|
||||
and "." in instruction_form["instruction"]
|
||||
):
|
||||
# Check for instruction without shape/cc suffix
|
||||
suffix_start = instruction_form["instruction"].index(".")
|
||||
isa_data = self._isa_model.get_instruction(
|
||||
instruction_form["instruction"][:suffix_start], instruction_form["operands"]
|
||||
)
|
||||
|
||||
if only_postindexed:
|
||||
for o in instruction_form.operands:
|
||||
|
||||
@@ -159,6 +159,10 @@ class TestSemanticTools(unittest.TestCase):
|
||||
test_mm_arm.get_instruction("b.ne", [{"class": "identifier"}]),
|
||||
test_mm_arm.get_instruction("b.ne", [{"class": "identifier"}]),
|
||||
)
|
||||
self.assertEqual(
|
||||
test_mm_arm.get_instruction("b.someNameThatDoesNotExist", [{"class": "identifier"}]),
|
||||
test_mm_arm.get_instruction("b.someOtherName", [{"class": "identifier"}]),
|
||||
)
|
||||
|
||||
# test full instruction name
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user