if referred to through GPR (GPR[RA]), add to read_regs in parser
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Jun 2020 12:12:19 +0000 (13:12 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Jun 2020 12:12:19 +0000 (13:12 +0100)
src/soc/decoder/isa/comparefixed.patch
src/soc/decoder/pseudo/parser.py

index b80e7be450528ffb96ebc98ba64b27e91f568653..56cdefccf34defa1a5b99397e980acc5459eeb81 100644 (file)
@@ -51,7 +51,7 @@
          return (CR,)
  
      @inject()
--    def op_cmpeqb(self, RB, CR):
+-    def op_cmpeqb(self, RA, RB, CR):
 -        src1 = GPR[RA]
 -        src1 = src1[56:64]
 +    def op_cmpeqb(self, RA, RB, CR):
          return (CR,)
  
      comparefixed_instrs = {}
-@@ -136,7 +135,7 @@
-                 form='X',
-                 asmregs=[['BF', 'L', 'RA', 'RB']])
-     comparefixed_instrs['cmpeqb'] = instruction_info(func=op_cmpeqb,
--                read_regs=OrderedSet(['RB']),
-+                read_regs=OrderedSet(['RA', 'RB']),
-                 uninit_regs=OrderedSet(), write_regs=OrderedSet(['CR']),
-                 special_regs=OrderedSet(['CR']), op_fields=OrderedSet(['BF']),
-                 form='X',
index 3e84646ba6baa7b45dadbe9bd299c25377d81bd0..53f4afcc8b7b89da0fc99440302c84567d941065 100644 (file)
@@ -369,6 +369,9 @@ class PowerParser:
                 print(astor.dump_tree(p[1]))
                 # replace GPR(x) with GPR[x]
                 idx = p[1].args[0]
+                # and add index to read_regs if it is a gpr
+                if idx in self.gprs:
+                    self.read_regs.add(name)
                 p[1] = ast.Subscript(p[1].func, idx, ast.Load())
             elif isinstance(p[1], ast.Call) and p[1].func.id == 'MEM':
                 print("mem assign")