From: Luke Kenneth Casson Leighton Date: Fri, 14 May 2021 20:19:15 +0000 (+0100) Subject: add GPR-underscore read of regs X-Git-Tag: 0.0.3~39 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70147058011f75285fdad403730530ccf19f9ed6;p=openpower-isa.git add GPR-underscore read of regs --- 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]))