when calling multi-arg function with regs, add to read list
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 15 May 2021 18:47:17 +0000 (19:47 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 15 May 2021 18:47:17 +0000 (19:47 +0100)
src/openpower/decoder/pseudo/parser.py

index b24baeacf24d94ec01c66a2288ba749961c5e800..f7d694f7a4bcf4043c3ca681bcad47302aa08688 100644 (file)
@@ -196,6 +196,11 @@ def apply_trailer(atom, trailer, read_regs):
         trailer = trailer[2]
     if trailer[0] == "CALL":
         #p[0] = ast.Expr(ast.Call(p[1], p[2][1], []))
+        for arg in trailer[1]:
+            if isinstance(arg, ast.Name):
+                name = arg.id
+                if name in regs + fregs:
+                    read_regs.add(name)
         return ast.Call(atom, trailer[1], [])
         # if p[1].id == 'print':
         #    p[0] = ast.Printnl(ast.Tuple(p[2][1]), None, None)