Skip to content

Commit

Permalink
Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLJL committed May 2, 2024
1 parent c9e3863 commit aca5511
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
1 change: 1 addition & 0 deletions osaca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Open Source Architecture Code Analyzer"""

name = "osaca"
__version__ = "0.5.3"

Expand Down
16 changes: 10 additions & 6 deletions osaca/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ def throughput_analysis(self, kernel, show_lineno=False, show_cmnts=True):
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:])
Expand Down Expand Up @@ -366,9 +368,11 @@ def combined_view(
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"
Expand Down
1 change: 1 addition & 0 deletions osaca/parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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
Expand Down
1 change: 1 addition & 0 deletions osaca/semantics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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
Expand Down
24 changes: 13 additions & 11 deletions osaca/semantics/hw_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def __init__(self, arch=None, path_to_yaml=None, isa=None, lazy=False):
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,
Expand All @@ -136,14 +136,16 @@ def __init__(self, arch=None, path_to_yaml=None, isa=None, lazy=False):
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)
Expand Down
8 changes: 2 additions & 6 deletions osaca/semantics/isa_semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,13 @@ def _apply_found_ISA_data(self, isa_data, operands):
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)

Expand Down

0 comments on commit aca5511

Please sign in to comment.