mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-04 18:20:09 +01:00
AttrDict bugfix
This commit is contained in:
@@ -24,9 +24,7 @@ def find_marked_kernel_AArch64(lines):
|
||||
|
||||
def find_marked_kernel_x86(lines):
|
||||
nop_bytes = ['100', '103', '144']
|
||||
return find_marked_kernel(
|
||||
lines, ParserX86ATT(), ['mov', 'movl'], 'ebx', [111, 222], nop_bytes
|
||||
)
|
||||
return find_marked_kernel(lines, ParserX86ATT(), ['mov', 'movl'], 'ebx', [111, 222], nop_bytes)
|
||||
|
||||
|
||||
def find_marked_kernel(lines, parser, mov_instr, mov_reg, mov_vals, nop_bytes):
|
||||
@@ -34,15 +32,15 @@ def find_marked_kernel(lines, parser, mov_instr, mov_reg, mov_vals, nop_bytes):
|
||||
index_end = -1
|
||||
for i, line in enumerate(lines):
|
||||
try:
|
||||
if line['instruction'] in mov_instr and lines[i + 1]['directive'] is not None:
|
||||
source = line['operands']['source']
|
||||
destination = line['operands']['destination']
|
||||
if line.instruction in mov_instr and lines[i + 1].directive is not None:
|
||||
source = line.operands.source
|
||||
destination = line.operands.destination
|
||||
# instruction pair matches, check for operands
|
||||
if (
|
||||
'immediate' in source[0]
|
||||
and parser.normalize_imd(source[0]['immediate']) == mov_vals[0]
|
||||
and parser.normalize_imd(source[0].immediate) == mov_vals[0]
|
||||
and 'register' in destination[0]
|
||||
and parser.get_full_reg_name(destination[0]['register']) == mov_reg
|
||||
and parser.get_full_reg_name(destination[0].register) == mov_reg
|
||||
):
|
||||
# operands of first instruction match start, check for second one
|
||||
match, line_count = match_bytes(lines, i + 1, nop_bytes)
|
||||
@@ -51,9 +49,9 @@ def find_marked_kernel(lines, parser, mov_instr, mov_reg, mov_vals, nop_bytes):
|
||||
index_start = i + 1 + line_count
|
||||
elif (
|
||||
'immediate' in source[0]
|
||||
and parser.normalize_imd(source[0]['immediate']) == mov_vals[1]
|
||||
and parser.normalize_imd(source[0].immediate) == mov_vals[1]
|
||||
and 'register' in destination[0]
|
||||
and parser.get_full_reg_name(destination[0]['register']) == mov_reg
|
||||
and parser.get_full_reg_name(destination[0].register) == mov_reg
|
||||
):
|
||||
# operand of first instruction match end, check for second one
|
||||
match, line_count = match_bytes(lines, i + 1, nop_bytes)
|
||||
@@ -73,11 +71,11 @@ def match_bytes(lines, index, byte_list):
|
||||
line_count = 0
|
||||
while (
|
||||
index < len(lines)
|
||||
and lines[index]['directive'] is not None
|
||||
and lines[index]['directive']['name'] == 'byte'
|
||||
and lines[index].directive is not None
|
||||
and lines[index].directive.name == 'byte'
|
||||
):
|
||||
line_count += 1
|
||||
extracted_bytes += lines[index]['directive']['parameters']
|
||||
extracted_bytes += lines[index].directive.parameters
|
||||
index += 1
|
||||
if extracted_bytes[0:len(byte_list)] == byte_list:
|
||||
return True, line_count
|
||||
|
||||
@@ -217,10 +217,10 @@ class ParserAArch64v81(BaseParser):
|
||||
self.directive.parseString(line, parseAll=True).asDict()
|
||||
)
|
||||
result = AttrDict.convert_dict(result)
|
||||
instruction_form[self.DIRECTIVE_ID] = {
|
||||
instruction_form[self.DIRECTIVE_ID] = AttrDict({
|
||||
'name': result[self.DIRECTIVE_ID].name,
|
||||
'parameters': result[self.DIRECTIVE_ID].parameters,
|
||||
}
|
||||
})
|
||||
if self.COMMENT_ID in result[self.DIRECTIVE_ID]:
|
||||
instruction_form[self.COMMENT_ID] = ' '.join(
|
||||
result[self.DIRECTIVE_ID][self.COMMENT_ID]
|
||||
|
||||
@@ -143,10 +143,10 @@ class ParserX86ATT(BaseParser):
|
||||
self.directive.parseString(line, parseAll=True).asDict()
|
||||
)
|
||||
result = AttrDict.convert_dict(result)
|
||||
instruction_form[self.DIRECTIVE_ID] = {
|
||||
instruction_form[self.DIRECTIVE_ID] = AttrDict({
|
||||
'name': result[self.DIRECTIVE_ID]['name'],
|
||||
'parameters': result[self.DIRECTIVE_ID]['parameters'],
|
||||
}
|
||||
})
|
||||
if self.COMMENT_ID in result[self.DIRECTIVE_ID]:
|
||||
instruction_form[self.COMMENT_ID] = ' '.join(
|
||||
result[self.DIRECTIVE_ID][self.COMMENT_ID]
|
||||
|
||||
Reference in New Issue
Block a user