From 70147058011f75285fdad403730530ccf19f9ed6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 14 May 2021 21:19:15 +0100 Subject: [PATCH] add GPR-underscore read of regs --- openpower/isa/comparefixed.mdwn | 2 +- src/openpower/decoder/pseudo/parser.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openpower/isa/comparefixed.mdwn b/openpower/isa/comparefixed.mdwn index e1a365f2..a4f6d617 100644 --- a/openpower/isa/comparefixed.mdwn +++ b/openpower/isa/comparefixed.mdwn @@ -126,7 +126,7 @@ X-Form Pseudo-code: - src1 <- GPR[RA] + src1 <- (RA) src1 <- src1[56:63] match <- ((src1 = (RB)[00:07]) | (src1 = (RB)[08:15]) | diff --git a/src/openpower/decoder/pseudo/parser.py b/src/openpower/decoder/pseudo/parser.py index 39b6485c..ba997493 100644 --- a/src/openpower/decoder/pseudo/parser.py +++ b/src/openpower/decoder/pseudo/parser.py @@ -207,6 +207,9 @@ def apply_trailer(atom, trailer): subs = trailer[1] if len(subs) == 1: idx = subs[0] + if isinstance(idx, ast.Name) and idx.id in regs: + print ("single atom subscript, underscored", idx.id) + idx = ast.Name("_%s" % idx.id, ast.Load()) else: idx = ast.Slice(subs[0], subs[1], None) # if isinstance(atom, ast.Name) and atom.id == 'CR': @@ -408,8 +411,10 @@ class PowerParser: ['GPR', 'FPR', 'SPR']: print(astor.dump_tree(p[1])) # replace GPR(x) with GPR[x] - idx = p[1].args[0] - p[1] = ast.Subscript(p[1].func, idx, ast.Load()) + idx = p[1].args[0].id + ridx = ast.Name("_%s" % idx, ast.Load()) + p[1] = ast.Subscript(p[1].func, ridx, ast.Load()) + self.read_regs.add(idx) # add to list of regs to read elif isinstance(p[1], ast.Call) and p[1].func.id == 'MEM': print("mem assign") print(astor.dump_tree(p[1])) -- 2.30.2