only place underscore in front of index if it is a GPR or FPR
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 20 May 2021 22:02:38 +0000 (23:02 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 20 May 2021 22:02:38 +0000 (23:02 +0100)
src/openpower/decoder/pseudo/parser.py

index d403a089246c05f316efd5ec247d76d6aa609b90..314c89e8bde4a813de8f6b93972c431840e36bf6 100644 (file)
@@ -423,7 +423,10 @@ class PowerParser:
                 print(astor.dump_tree(p[1]))
                 # replace GPR(x) with GPR[x]
                 idx = p[1].args[0].id
-                ridx = ast.Name("_%s" % idx, ast.Load())
+                if idx in regs + fregs:
+                    ridx = ast.Name("_%s" % idx, ast.Load())
+                else:
+                    ridx = ast.Name(idx, ast.Load())
                 p[1] = ast.Subscript(p[1].func, ridx, ast.Load())
                 if idx in self.gprs:
                     self.read_regs.add(idx)  # add to list of regs to read