From: Dmitry Selyutin Date: Sun, 14 Jan 2024 12:30:42 +0000 (+0300) Subject: oppc/code: drop explicit ctx argument X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e5b102bcf016b9a025c09a166df036f1e07277a;p=openpower-isa.git oppc/code: drop explicit ctx argument --- diff --git a/src/openpower/oppc/pc_code.py b/src/openpower/oppc/pc_code.py index f351f5b8..1b66a1ca 100644 --- a/src/openpower/oppc/pc_code.py +++ b/src/openpower/oppc/pc_code.py @@ -7,7 +7,7 @@ import openpower.oppc.pc_pseudocode as pc_pseudocode class Transient(pc_ast.Node): - def __init__(self, value="UINT64_C(0)", bits="(uint8_t)ctx->XLEN"): + def __init__(self, value="UINT64_C(0)", bits="(uint8_t)OPPC_XLEN"): self.__value = value self.__bits = bits @@ -51,7 +51,7 @@ class CodeVisitor(pc_util.Visitor): def __getitem__(self, node): return self.__code[node] - def transient(self, node, value="UINT64_C(0)", bits="(uint8_t)ctx->XLEN"): + def transient(self, node, value="UINT64_C(0)", bits="(uint8_t)OPPC_XLEN"): transient = Transient(value=value, bits=bits) with self.pseudocode(node=node): self.traverse(root=transient) @@ -209,7 +209,7 @@ class CodeVisitor(pc_util.Visitor): bits = f"UINT8_C({str(len(value[2:]) * 4)})" value = int(value, 16) else: - bits = "ctx->XLEN" + bits = "(uint8_t)OPPC_XLEN" value = int(value) fmt = str if (value > ((2**64) - 1)): @@ -251,13 +251,13 @@ class CodeVisitor(pc_util.Visitor): def GPR(self, node): yield node with self.pseudocode(node=node): - self[node].emit(stmt=f"&ctx->gpr[OPPC_GPR_{str(node)}]") + self[node].emit(stmt=f"&OPPC_GPR[OPPC_GPR_{str(node)}]") @pc_util.Hook(pc_ast.FPR) def FPR(self, node): yield node with self.pseudocode(node=node): - self[node].emit(stmt=f"&ctx->fpr[OPPC_FPR_{str(node)}]") + self[node].emit(stmt=f"&OPPC_FPR[OPPC_FPR_{str(node)}]") @pc_util.Hook(pc_ast.RepeatExpr) def RepeatExpr(self, node): @@ -274,7 +274,7 @@ class CodeVisitor(pc_util.Visitor): @pc_util.Hook(pc_ast.XLEN) def XLEN(self, node): yield node - (value, bits) = ("ctx->XLEN", "(uint8_t)ctx->XLEN") + (value, bits) = ("OPPC_XLEN", "(uint8_t)OPPC_XLEN") transient = self.transient(node=node, value=value, bits=bits) for (level, stmt) in self[transient]: self[node].emit(stmt=stmt, level=level)