oppc/code: support TRAP
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 14 Jan 2024 20:25:11 +0000 (23:25 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000 (22:10 +0300)
src/openpower/oppc/pc_code.py

index 293a7d64da354ac5db94c0e33851803f3e2ebac7..97810acf9f56a72e407c9f58f5890417c3758792 100644 (file)
@@ -630,9 +630,13 @@ class CodeVisitor(pc_util.Visitor):
     def Symbol(self, node):
         yield node
         with self.pseudocode(node=node):
-            if str(node) not in ("fallthrough",):
-                self.__decls.add(str(node))
-                self[node].emit(stmt=f"&{str(node)}")
+            decl = str(node)
+            if decl not in ("fallthrough",):
+                if decl in ("TRAP",):
+                    self[node].emit(stmt=f"{decl}();")
+                else:
+                    self.__decls.add(decl)
+                    self[node].emit(stmt=f"&{decl}")
 
     @pc_util.Hook(Instruction)
     def Instruction(self, node):