ir: add IRCall

This commit is contained in:
Antoine Viallon 2023-05-23 23:16:23 +02:00
parent 5b42c05eab
commit 39a5f084ba
Signed by: aviallon
GPG key ID: D126B13AB555E16F

View file

@ -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):