ir: add IRNop and IRVoid action and value (resp.)

This commit is contained in:
Antoine Viallon 2023-05-23 00:37:36 +02:00
parent a832cd1214
commit 7bb14210a7
Signed by: aviallon
GPG key ID: D126B13AB555E16F

View file

@ -31,6 +31,17 @@ class IRAction(IRItem, abc.ABC):
pass
class IRNop(IRAction):
def __init__(self, location: SourceLocation):
super().__init__(location)
def codegen(self) -> str:
return "NOP"
def destination(self) -> IRValue:
return IRVoid(self.location)
class IRValue(IRItem, abc.ABC):
def destination(self) -> IRValue:
return self
@ -61,6 +72,15 @@ class IRImmediate(IRValue):
return f"{self.value}"
class IRVoid(IRValue):
@typecheck
def __init__(self, location: SourceLocation):
super().__init__(location)
def codegen(self) -> str:
return "<VOID>"
class IRAssignable(IRValue, metaclass=abc.ABCMeta):
pass