From: Dmitry Selyutin Date: Sun, 14 Jan 2024 20:17:22 +0000 (+0300) Subject: oppc/code: support GRP0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37a017bd68efb22515262b3e217c5d1f90b175ad;p=openpower-isa.git oppc/code: support GRP0 --- diff --git a/src/openpower/oppc/pc_code.py b/src/openpower/oppc/pc_code.py index 47aded9d..293a7d64 100644 --- a/src/openpower/oppc/pc_code.py +++ b/src/openpower/oppc/pc_code.py @@ -389,6 +389,19 @@ class CodeVisitor(pc_util.Visitor): with self.pseudocode(node=node): self[node].emit(stmt=f"&OPPC_GPR[OPPC_GPR_{str(node)}]") + @pc_util.Hook(pc_ast.GPRZero) + def GPRZero(self, node): + yield node + name = str(node) + test = pc_ast.Symbol(name) + body = pc_ast.Scope([pc_ast.GPR(name)]) + orelse = pc_ast.Scope([Transient()]) + ifexpr = pc_ast.IfExpr(test=test, body=body, orelse=orelse) + self.traverse(root=ifexpr) + self.fixup_ternary(node=ifexpr) + for (level, stmt) in self[ifexpr]: + self[node].emit(stmt=stmt, level=level) + @pc_util.Hook(pc_ast.FPR) def FPR(self, node): yield node