Updated list/range register resolver & applied black formatting

This commit is contained in:
stefandesouza
2023-08-26 14:51:04 +02:00
parent 76f3baf74e
commit 36549dd679
13 changed files with 486 additions and 398 deletions

View File

@@ -2,6 +2,7 @@
from osaca.parser.directive import DirectiveOperand
class InstructionForm:
# Identifiers for operand types
COMMENT_ID = "comment"
@@ -15,9 +16,17 @@ class InstructionForm:
INSTRUCTION_ID = "instruction"
OPERANDS_ID = "operands"
def __init__(self, INSTRUCTION_ID = None, OPERANDS_ID = [], DIRECTIVE_ID = None
, COMMENT_ID = None, LABEL_ID = None, LINE = None, LINE_NUMBER = None
, SEMANTIC_OPERANDS = None):
def __init__(
self,
INSTRUCTION_ID=None,
OPERANDS_ID=[],
DIRECTIVE_ID=None,
COMMENT_ID=None,
LABEL_ID=None,
LINE=None,
LINE_NUMBER=None,
SEMANTIC_OPERANDS=None,
):
self._INSTRUCTION_ID = INSTRUCTION_ID
self._OPERANDS_ID = OPERANDS_ID
self._DIRECTIVE_ID = DIRECTIVE_ID
@@ -28,7 +37,7 @@ class InstructionForm:
self._SEMANTIC_OPERANDS = SEMANTIC_OPERANDS
self._UOPS = None
#self.semantic_operands = {"source": [], "destination": [], "src_dst": []}
# self.semantic_operands = {"source": [], "destination": [], "src_dst": []}
self._LATENCY = None
self._THROUGHPUT = None
self._LATENCY_CP = []
@@ -45,7 +54,7 @@ class InstructionForm:
@property
def instruction(self):
return self._INSTRUCTION_ID
@property
def label(self):
return self._LABEL_ID
@@ -61,11 +70,11 @@ class InstructionForm:
@property
def line_number(self):
return self._LINE_NUMBER
@property
def line(self):
return self._LINE
@property
def operands(self):
return self._OPERANDS_ID
@@ -73,11 +82,11 @@ class InstructionForm:
@property
def port_pressure(self):
return self._PORT_PRESSURE
@property
def port_uops(self):
return self._PORT_UOPS
@property
def flags(self):
return self._FLAGS
@@ -93,11 +102,11 @@ class InstructionForm:
@line_number.setter
def line_number(self, line_number):
self._LINE_NUMBER = line_number
@line.setter
def line(self, line):
self._LINE = line
@operands.setter
def operands(self, operands):
self._OPERANDS_ID = operands
@@ -105,19 +114,19 @@ class InstructionForm:
@instruction.setter
def instruction(self, instruction):
self._INSTRUCTION_ID = instruction
@label.setter
def label(self, label):
self._LABEL_ID = label
@comment.setter
def comment(self, comment):
self._COMMENT_ID =comment
self._COMMENT_ID = comment
@port_pressure.setter
def port_pressure(self, port_pressure):
self._PORT_PRESSURE = port_pressure
@port_uops.setter
def port_uops(self, port_uops):
self._PORT_UOPS = port_uops
@@ -135,14 +144,13 @@ class InstructionForm:
def __eq__(self, other):
if isinstance(other, InstructionForm):
return (
self._INSTRUCTION_ID == other._INSTRUCTION_ID and
self._OPERANDS_ID == other._OPERANDS_ID and
self._DIRECTIVE_ID == other._DIRECTIVE_ID and
self._COMMENT_ID == other._COMMENT_ID and
self._LABEL_ID == other._LABEL_ID and
self._LINE == other._LINE and
self._LINE_NUMBER == other._LINE_NUMBER and
self._SEMANTIC_OPERANDS == other._SEMANTIC_OPERANDS
self._INSTRUCTION_ID == other._INSTRUCTION_ID
and self._OPERANDS_ID == other._OPERANDS_ID
and self._DIRECTIVE_ID == other._DIRECTIVE_ID
and self._COMMENT_ID == other._COMMENT_ID
and self._LABEL_ID == other._LABEL_ID
and self._LINE == other._LINE
and self._LINE_NUMBER == other._LINE_NUMBER
and self._SEMANTIC_OPERANDS == other._SEMANTIC_OPERANDS
)
return False