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