add in FPR.getz and support for FPR(x) in ISA parser
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 May 2021 19:07:00 +0000 (20:07 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 May 2021 19:07:00 +0000 (20:07 +0100)
src/openpower/decoder/pseudo/parser.py

index dce891212626689be388a09993460dc3306650b6..39b6485c02a94bbfcb754a5906ce12bde7b81a18 100644 (file)
@@ -404,7 +404,8 @@ class PowerParser:
                         self.uninit_regs.add(name)
                     autoassign = (name not in self.declared_vars and
                                   name not in self.special_regs)
-            elif isinstance(p[1], ast.Call) and p[1].func.id in ['GPR', 'SPR']:
+            elif isinstance(p[1], ast.Call) and p[1].func.id in \
+                            ['GPR', 'FPR', 'SPR']:
                 print(astor.dump_tree(p[1]))
                 # replace GPR(x) with GPR[x]
                 idx = p[1].args[0]
@@ -736,8 +737,11 @@ class PowerParser:
                     p[2].left.id in self.gprs:
                 rid = p[2].left.id
                 self.read_regs.add(rid)  # add to list of regs to read
-                # create special call to GPR.getz
-                gprz = ast.Name("GPR", ast.Load())
+                # create special call to GPR.getz or FPR.getz
+                if rid in fregs:
+                    gprz = ast.Name("FPR", ast.Load())
+                else:
+                    gprz = ast.Name("GPR", ast.Load())
                 # get testzero function
                 gprz = ast.Attribute(gprz, "getz", ast.Load())
                 # *sigh* see class GPR.  we need index itself not reg value