From: Dmitry Selyutin Date: Tue, 16 Jan 2024 19:09:45 +0000 (+0300) Subject: oppc/code: adopt pseudocode calls to C realities X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46fe6b163e1278225e85945eb7c038519791243e;p=openpower-isa.git oppc/code: adopt pseudocode calls to C realities --- 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):