when setting x <- GPR(RA) make sure read_regs is added to in parser
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 May 2021 20:29:21 +0000 (21:29 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 May 2021 20:29:21 +0000 (21:29 +0100)
openpower/isa/comparefixed.mdwn
src/openpower/decoder/pseudo/parser.py

index a4f6d61734172b3779b07ab2248e7a6264bb4aed..e1a365f2a2af11244e8263405398e2ca1109651f 100644 (file)
@@ -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]) |
index ba99749341cb95934f402a99af02075647e4c893..b6eba3e2c9696a05b013c2a29bf848c022bd6d4f 100644 (file)
@@ -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: