oppc/code: support more special symbols
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 14 Jan 2024 14:40:46 +0000 (17:40 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000 (22:10 +0300)
src/openpower/oppc/pc_code.py

index 28dfb34a50c1181919c1589e2887082d5c5ebdef..bbacaff1464976c1f17be9aa59b5998e150f6efc 100644 (file)
@@ -307,14 +307,12 @@ class CodeVisitor(pc_util.Visitor):
             for (level, stmt) in self[transient]:
                 self[node].emit(stmt=stmt, level=level)
 
-    @pc_util.Hook(pc_ast.Overflow)
-    def Overflow(self, node):
+    @pc_util.Hook(pc_ast.Overflow, pc_ast.CR3, pc_ast.CR5,
+            pc_ast.XER, pc_ast.Reserve, pc_ast.Special)
+    def Special(self, node):
         yield node
-        (value, bits) = ("OPPC_OVERFLOW", "(uint8_t)OPPC_OVERFLOW")
-        transient = self.transient(node=node, value=value, bits=bits)
         with self.pseudocode(node=node):
-            for (level, stmt) in self[transient]:
-                self[node].emit(stmt=stmt, level=level)
+            self[node].emit(stmt=f"&OPPC_{str(node).upper()}")
 
     @pc_util.Hook(pc_ast.SubscriptExpr)
     def SubscriptExpr(self, node):