diff --git a/compiler/ir.py b/compiler/ir.py index beafd7c..0ea1569 100644 --- a/compiler/ir.py +++ b/compiler/ir.py @@ -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 "" + + class IRAssignable(IRValue, metaclass=abc.ABCMeta): pass