From b41ae52a642d1546c266994c7b96181f377d380d Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Fri, 12 Jan 2024 22:52:30 +0300 Subject: [PATCH] oppc/code: support calls --- src/openpower/oppc/pc_code.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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): -- 2.30.2