diff --git a/osaca/__init__.py b/osaca/__init__.py index 3c345c8..ec58fc2 100644 --- a/osaca/__init__.py +++ b/osaca/__init__.py @@ -1,4 +1,5 @@ """Open Source Architecture Code Analyzer""" + name = "osaca" __version__ = "0.5.3" diff --git a/osaca/frontend.py b/osaca/frontend.py index ae21752..763eb5c 100644 --- a/osaca/frontend.py +++ b/osaca/frontend.py @@ -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:]) @@ -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" diff --git a/osaca/parser/__init__.py b/osaca/parser/__init__.py index cdaf2ed..3b5e8ba 100644 --- a/osaca/parser/__init__.py +++ b/osaca/parser/__init__.py @@ -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 diff --git a/osaca/semantics/__init__.py b/osaca/semantics/__init__.py index 8a0b000..47baf9e 100644 --- a/osaca/semantics/__init__.py +++ b/osaca/semantics/__init__.py @@ -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 diff --git a/osaca/semantics/hw_model.py b/osaca/semantics/hw_model.py index 404f894..6f6437f 100644 --- a/osaca/semantics/hw_model.py +++ b/osaca/semantics/hw_model.py @@ -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, @@ -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) diff --git a/osaca/semantics/isa_semantics.py b/osaca/semantics/isa_semantics.py index 31be19c..a84602d 100644 --- a/osaca/semantics/isa_semantics.py +++ b/osaca/semantics/isa_semantics.py @@ -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)