ir: IRAssignable: track writers

This commit is contained in:
Antoine Viallon 2024-01-05 23:14:40 +01:00
parent 27ccb1a68a
commit fb62c3b34a
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -112,7 +112,16 @@ class IRVoid(IRValue):
class IRAssignable(IRValue, metaclass=abc.ABCMeta):
pass
def __init__(self, location: SourceLocation):
super().__init__(location)
self.writers: list[IRAction] = []
def __str__(self):
return self.codegen()
def __repr__(self) -> str:
return f"{self.codegen()} (readers: {repr([reader for reader in self.readers])}, " + \
f"writers: {repr([writer for writer in self.writers])})"
class IRRegister(IRAssignable):