From: Luke Kenneth Casson Leighton Date: Fri, 14 May 2021 20:29:21 +0000 (+0100) Subject: when setting x <- GPR(RA) make sure read_regs is added to in parser X-Git-Tag: 0.0.3~38 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b372e50e47021451c566a966bc3df245375354c4;p=openpower-isa.git when setting x <- GPR(RA) make sure read_regs is added to in parser --- diff --git a/openpower/isa/comparefixed.mdwn b/openpower/isa/comparefixed.mdwn index a4f6d617..e1a365f2 100644 --- a/openpower/isa/comparefixed.mdwn +++ b/openpower/isa/comparefixed.mdwn @@ -126,7 +126,7 @@ X-Form Pseudo-code: - src1 <- (RA) + src1 <- GPR[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 ba997493..b6eba3e2 100644 --- a/src/openpower/decoder/pseudo/parser.py +++ b/src/openpower/decoder/pseudo/parser.py @@ -189,10 +189,10 @@ def identify_sint_mul_pattern(p): return True # yippee! -def apply_trailer(atom, trailer): +def apply_trailer(atom, trailer, read_regs): if trailer[0] == "TLIST": # assume depth of one - atom = apply_trailer(atom, trailer[1]) + atom = apply_trailer(atom, trailer[1], read_regs) trailer = trailer[2] if trailer[0] == "CALL": #p[0] = ast.Expr(ast.Call(p[1], p[2][1], [])) @@ -207,6 +207,8 @@ 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 + fregs: + read_regs.add(idx.id) 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()) @@ -678,7 +680,7 @@ class PowerParser: print(astor.dump_tree(p[1])) print("power dump trailerlist") print(astor.dump_tree(p[2])) - p[0] = apply_trailer(p[1], p[2]) + p[0] = apply_trailer(p[1], p[2], self.read_regs) if isinstance(p[1], ast.Name): name = p[1].id if name in regs + fregs: