ir: IRValue: track readers
This commit is contained in:
parent
18a813f4c7
commit
27ccb1a68a
1 changed files with 16 additions and 0 deletions
|
|
@ -43,9 +43,25 @@ class IRNop(IRAction):
|
||||||
|
|
||||||
|
|
||||||
class IRValue(IRItem, abc.ABC):
|
class IRValue(IRItem, abc.ABC):
|
||||||
|
values: list[IRValue] = []
|
||||||
|
|
||||||
|
def __init__(self, location: SourceLocation):
|
||||||
|
super().__init__(location)
|
||||||
|
self.readers: list[IRAction] = []
|
||||||
|
IRValue.values += [self]
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
IRValue.values.remove(self)
|
||||||
|
|
||||||
def destination(self) -> IRValue:
|
def destination(self) -> IRValue:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.codegen()
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f"{self.codegen()} (readers: {repr(self.readers)})"
|
||||||
|
|
||||||
|
|
||||||
class IRMove(IRAction):
|
class IRMove(IRAction):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue