mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-16 00:50:06 +01:00
- Enhanced RISC-V parser to support reloc_type and symbol in ImmediateOperand. - Added missing attributes (reloc_type, symbol) to ImmediateOperand and updated __eq__ for backward compatibility. - Fixed all flake8 (E501, E265, F401, F841) and Black formatting issues across the codebase. - Improved docstrings and split long lines for better readability. - Fixed test failures related to ImmediateOperand instantiation and attribute errors. - Ensured all tests pass, including edge cases for RISC-V, x86, and AArch64. - Updated .gitignore and documentation as needed. - Renamed example files for consistency (rv6 -> rv64).
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
|
|
from osaca.parser.operand import Operand
|
|
|
|
|
|
class DirectiveOperand(Operand):
|
|
def __init__(self, name=None, parameters=None):
|
|
self._name = name
|
|
self._parameters = parameters
|
|
|
|
@property
|
|
def name(self):
|
|
return self._name
|
|
|
|
@name.setter
|
|
def name(self, name):
|
|
self._name = name
|
|
|
|
@property
|
|
def parameters(self):
|
|
return self._parameters
|
|
|
|
@parameters.setter
|
|
def parameters(self, parameters):
|
|
self._parameters = parameters
|
|
|
|
def __eq__(self, other):
|
|
if isinstance(other, DirectiveOperand):
|
|
return self._name == other._name and self._parameters == other._parameters
|
|
elif isinstance(other, dict):
|
|
return (
|
|
self._name == other["name"] and self._parameters == other["parameters"]
|
|
)
|
|
return False
|
|
|
|
def __str__(self):
|
|
return f"Directive(name={self._name}, parameters={self._parameters})"
|
|
|
|
def __repr__(self):
|
|
return self.__str__()
|