oppc/code: support repeat expr
authorDmitry Selyutin <ghostmansd@gmail.com>
Fri, 12 Jan 2024 19:24:22 +0000 (22:24 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 12 Jan 2024 19:24:44 +0000 (22:24 +0300)
src/openpower/oppc/pc_code.py

index a4bbe66563fd0d6ca06d0d31574ad75e960c2752..0c64d40ecae678e034aa8dc77c55ac19ad7d25fd 100644 (file)
@@ -141,6 +141,13 @@ class CodeVisitor(pc_util.Visitor):
         yield node
         self[node].emit(stmt=f"ctx->fpr[OPPC_FPR_{str(node)}]")
 
+    @pc_util.Hook(pc_ast.RepeatExpr)
+    def RepeatExpr(self, node):
+        yield node
+        subject = str(self[node.subject])
+        times = str(self[node.times])
+        self[node].emit(f"oppc_repeat({subject}, {times})")
+
     @pc_util.Hook(pc_ast.Call.Name)
     def CallName(self, node):
         yield node