From: Dmitry Selyutin Date: Fri, 12 Jan 2024 19:52:30 +0000 (+0300) Subject: oppc/code: support calls X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b41ae52a642d1546c266994c7b96181f377d380d;p=openpower-isa.git oppc/code: support calls --- diff --git a/src/openpower/oppc/pc_code.py b/src/openpower/oppc/pc_code.py index c7205946..69dfad85 100644 --- a/src/openpower/oppc/pc_code.py +++ b/src/openpower/oppc/pc_code.py @@ -192,6 +192,7 @@ class CodeVisitor(pc_util.Visitor): @pc_util.Hook(pc_ast.Call.Name) def CallName(self, node): yield node + self[node].emit(stmt=str(node)) @pc_util.Hook(pc_ast.Call.Arguments) def CallArguments(self, node): @@ -199,6 +200,16 @@ class CodeVisitor(pc_util.Visitor): for subnode in node: if isinstance(subnode, (pc_ast.GPR, pc_ast.FPR)): self.__regfetch[str(subnode)].append(subnode) + stmt = ", ".join(map(lambda subnode: str(self[subnode]), node)) + self[node].emit(stmt=stmt) + + @pc_util.Hook(pc_ast.Call) + def Call(self, node): + yield node + name = str(self[node.name]) + args = str(self[node.args]) + stmt = f"{name}({args})" + self[node].emit(stmt=stmt) @pc_util.Hook(pc_ast.Symbol) def Symbol(self, node):