diff --git a/compiler/ir.py b/compiler/ir.py index 0ea1569..360f2b8 100644 --- a/compiler/ir.py +++ b/compiler/ir.py @@ -62,6 +62,20 @@ class IRMove(IRAction): return f"MOVE {self.source} -> {self.dest}" +class IRCall(IRAction): + def __init__(self, location: SourceLocation, dest: IRAssignable, function: IRVariable, arguments: list[IRValue]): + super().__init__(location) + self.dest = dest + self.function = function + self.arguments = arguments + + def codegen(self) -> str: + return f"CALL {self.function} -> {self.dest} : {', '.join(repr(arg) for arg in self.arguments)}" + + def destination(self) -> IRValue: + return self.dest + + class IRImmediate(IRValue): @typecheck def __init__(self, location: SourceLocation, value: int | float | str):