ir: automatically add read-from/written-to values in IRAction if declared
This commit is contained in:
parent
39c12a360c
commit
6af9c367c6
1 changed files with 14 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ from abc import abstractmethod
|
|||
|
||||
from .errors import OverrideMandatoryError
|
||||
from .logger import Logger
|
||||
from .source import SourceLocation
|
||||
from .source import SourceLocation, IRLocation as Location
|
||||
from .typechecking import typecheck
|
||||
|
||||
logger = Logger(__name__)
|
||||
|
|
@ -28,7 +28,19 @@ class IRItem:
|
|||
|
||||
|
||||
class IRAction(IRItem, abc.ABC):
|
||||
pass
|
||||
def __init__(self, location: SourceLocation, reads: list[IRValue], writes: list[IRAssignable]):
|
||||
super().__init__(location)
|
||||
|
||||
# Must be changed updated in a second pass, when every item has been generated
|
||||
self.ir_location: Location = Location(-1, [])
|
||||
self.reads = reads
|
||||
self.writes = writes
|
||||
|
||||
for read in reads:
|
||||
read.readers += [self]
|
||||
|
||||
for write in writes:
|
||||
write.writers += [self]
|
||||
|
||||
|
||||
class IRNop(IRAction):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue