From 46fe6b163e1278225e85945eb7c038519791243e Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Tue, 16 Jan 2024 22:09:45 +0300 Subject: [PATCH] oppc/code: adopt pseudocode calls to C realities --- src/openpower/oppc/pc_code.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/openpower/oppc/pc_code.py b/src/openpower/oppc/pc_code.py index b8e30ee1..8e307adf 100644 --- a/src/openpower/oppc/pc_code.py +++ b/src/openpower/oppc/pc_code.py @@ -608,10 +608,17 @@ class CodeVisitor(pc_util.Visitor): @pc_util.Hook(pc_ast.Call) def Call(self, node): yield node - code = tuple(map(lambda arg: self[arg], node.args)) - call = self.call(name=str(node.name), code=code) - for (level, stmt) in self[call]: - self[node].emit(stmt=stmt, level=level) + if node.args: + transient = self.transient() + code = [self[transient]] + else: + code = [] + code.extend(map(lambda arg: self[arg], node.args)) + name = f"OPPC_CALL_{str(node.name)}" + with self.pseudocode(node=node): + call = self.call(name=name, code=code) + for (level, stmt) in self[call]: + self[node].emit(stmt=stmt, level=level) @pc_util.Hook(pc_ast.Attribute.Name) def AttributeName(self, node): -- 2.30.2