libsvp64: support GPR operands
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 7 Sep 2023 19:07:55 +0000 (22:07 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Thu, 7 Sep 2023 19:07:55 +0000 (22:07 +0300)
src/libsvp64/codegen.py
src/libsvp64/svp64.h

index 0880742c9a98467241fddab280b2869edca249f9..bbf32d6cd306185642e21636c27a00c4cbaa5ab0 100644 (file)
@@ -274,12 +274,12 @@ class DisGenSource(Source):
     @mdis.dispatcher.Hook(DynamicOperand)
     @contextlib.contextmanager
     def dispatch_operand(self, node, *, path, pathcls):
-        def generic_handler(span):
+        def generic_handler(span, flags="UINT32_C(0)"):
             yield f"value = ("
             with self:
                 yield from fetch(span)
             yield f");"
-            yield "flags = UINT32_C(0);"
+            yield f"flags = {flags};"
             self.emit("break;")
 
         def signed_handler(span):
@@ -301,8 +301,12 @@ class DisGenSource(Source):
             yield "flags = SVP64_OPERAND_SIGNED;"
             self.emit("break;")
 
+        def gpr_handler(span):
+            yield from generic_handler(span, "SVP64_OPERAND_GPR")
+
         handlers = {
             insndb.SignedOperand: signed_handler,
+            insndb.GPROperand: gpr_handler,
         }
         self.emit(f"case 0x{(path + 1):02x}: /* {', '.join(node.names)} */")
         with self:
index e2e5776d8207bec38a19792ec23a931b66841826..023bc612274adb68954b030a918aea44b79ae095 100644 (file)
@@ -33,6 +33,7 @@ struct svp64_operand {
 };
 
 #define SVP64_OPERAND_SIGNED    (UINT32_C(1) << UINT32_C(0))
+#define SVP64_OPERAND_GPR       (UINT32_C(1) << UINT32_C(1))
 
 struct svp64_ctx {
     struct svp64_record const *record;