From 2bff80cf8a2aa6aac029386c25303f2fea991503 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 7 Sep 2023 22:07:55 +0300 Subject: [PATCH] libsvp64: support GPR operands --- src/libsvp64/codegen.py | 8 ++++++-- src/libsvp64/svp64.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libsvp64/codegen.py b/src/libsvp64/codegen.py index 0880742c..bbf32d6c 100644 --- a/src/libsvp64/codegen.py +++ b/src/libsvp64/codegen.py @@ -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: diff --git a/src/libsvp64/svp64.h b/src/libsvp64/svp64.h index e2e5776d..023bc612 100644 --- a/src/libsvp64/svp64.h +++ b/src/libsvp64/svp64.h @@ -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; -- 2.30.2