mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-15 16:40:05 +01:00
Black formatting
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Open Source Architecture Code Analyzer"""
|
||||
|
||||
name = "osaca"
|
||||
__version__ = "0.5.3"
|
||||
|
||||
|
||||
@@ -85,9 +85,11 @@ class Frontend(object):
|
||||
self._get_port_pressure(
|
||||
instruction_form.port_pressure, port_len, separator=sep_list
|
||||
),
|
||||
self._get_flag_symbols(instruction_form.flags)
|
||||
if instruction_form.mnemonic is not None
|
||||
else " ",
|
||||
(
|
||||
self._get_flag_symbols(instruction_form.flags)
|
||||
if instruction_form.mnemonic is not None
|
||||
else " "
|
||||
),
|
||||
instruction_form.line.strip().replace("\t", " "),
|
||||
)
|
||||
line = line if show_lineno else col_sep + col_sep.join(line.split(col_sep)[1:])
|
||||
@@ -366,9 +368,11 @@ class Frontend(object):
|
||||
cp_kernel if line_number in cp_lines else None,
|
||||
lcd_lines.get(line_number),
|
||||
),
|
||||
self._get_flag_symbols(instruction_form.flags)
|
||||
if instruction_form.mnemonic is not None
|
||||
else " ",
|
||||
(
|
||||
self._get_flag_symbols(instruction_form.flags)
|
||||
if instruction_form.mnemonic is not None
|
||||
else " "
|
||||
),
|
||||
instruction_form.line.strip().replace("\t", " "),
|
||||
)
|
||||
s += "\n"
|
||||
|
||||
@@ -3,6 +3,7 @@ Collection of parsers supported by OSACA.
|
||||
|
||||
Only the parser below will be exported, so please add new parsers to __all__.
|
||||
"""
|
||||
|
||||
from .base_parser import BaseParser
|
||||
from .parser_x86att import ParserX86ATT
|
||||
from .parser_AArch64 import ParserAArch64
|
||||
|
||||
@@ -3,6 +3,7 @@ Tools for semantic analysis of parser result.
|
||||
|
||||
Only the classes below will be exported, so please add new semantic tools to __all__.
|
||||
"""
|
||||
|
||||
from .isa_semantics import ISASemantics, INSTR_FLAGS
|
||||
from .arch_semantics import ArchSemantics
|
||||
from .hw_model import MachineModel
|
||||
|
||||
@@ -124,9 +124,9 @@ class MachineModel(object):
|
||||
new_iform = InstructionForm(
|
||||
mnemonic=iform["name"].upper() if "name" in iform else None,
|
||||
operands=iform["operands"] if "operands" in iform else [],
|
||||
hidden_operands=iform["hidden_operands"]
|
||||
if "hidden_operands" in iform
|
||||
else [],
|
||||
hidden_operands=(
|
||||
iform["hidden_operands"] if "hidden_operands" in iform else []
|
||||
),
|
||||
directive_id=iform["directive"] if "directive" in iform else None,
|
||||
comment_id=iform["comment"] if "comment" in iform else None,
|
||||
line=iform["line"] if "line" in iform else None,
|
||||
@@ -136,14 +136,16 @@ class MachineModel(object):
|
||||
uops=iform["uops"] if "uops" in iform else None,
|
||||
port_pressure=iform["port_pressure"] if "port_pressure" in iform else None,
|
||||
operation=iform["operation"] if "operation" in iform else None,
|
||||
breaks_dependency_on_equal_operands=iform[
|
||||
"breaks_dependency_on_equal_operands"
|
||||
]
|
||||
if "breaks_dependency_on_equal_operands" in iform
|
||||
else False,
|
||||
semantic_operands=iform["semantic_operands"]
|
||||
if "semantic_operands" in iform
|
||||
else {"source": [], "destination": [], "src_dst": []},
|
||||
breaks_dependency_on_equal_operands=(
|
||||
iform["breaks_dependency_on_equal_operands"]
|
||||
if "breaks_dependency_on_equal_operands" in iform
|
||||
else False
|
||||
),
|
||||
semantic_operands=(
|
||||
iform["semantic_operands"]
|
||||
if "semantic_operands" in iform
|
||||
else {"source": [], "destination": [], "src_dst": []}
|
||||
),
|
||||
)
|
||||
# List containing classes with same name/instruction
|
||||
self._data["instruction_forms_dict"][iform["name"]].append(new_iform)
|
||||
|
||||
@@ -287,17 +287,13 @@ class ISASemantics(object):
|
||||
dict_key = (
|
||||
"src_dst"
|
||||
if op.source and op.destination
|
||||
else "source"
|
||||
if op.source
|
||||
else "destination"
|
||||
else "source" if op.source else "destination"
|
||||
)
|
||||
else:
|
||||
dict_key = (
|
||||
"src_dst"
|
||||
if op["source"] and op["destination"]
|
||||
else "source"
|
||||
if op["source"]
|
||||
else "destination"
|
||||
else "source" if op["source"] else "destination"
|
||||
)
|
||||
op_dict[dict_key].append(op)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user