]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Change the data type of libvex_Backend::emit.
authorFlorian Krohm <flo2030@eich-krohm.de>
Wed, 3 Dec 2025 22:26:57 +0000 (22:26 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Wed, 3 Dec 2025 22:26:57 +0000 (22:26 +0000)
Both the s390 and arm insn emitters need to know the host's hardware
capabilities. Today, these are provided by means of global variables
s390_host_hwcaps and arm_hwcaps. To eliminate that kludge the emit
function is changed. Instead of passing VexEndness we now pass a pointer
to VexArchInfo which provides both the endianess and hardware capabilities.

Those global variables will be removed in a followup patch.

19 files changed:
VEX/priv/host_amd64_defs.c
VEX/priv/host_amd64_defs.h
VEX/priv/host_arm64_defs.c
VEX/priv/host_arm64_defs.h
VEX/priv/host_arm_defs.c
VEX/priv/host_arm_defs.h
VEX/priv/host_mips_defs.c
VEX/priv/host_mips_defs.h
VEX/priv/host_nanomips_defs.c
VEX/priv/host_nanomips_defs.h
VEX/priv/host_ppc_defs.c
VEX/priv/host_ppc_defs.h
VEX/priv/host_riscv64_defs.c
VEX/priv/host_riscv64_defs.h
VEX/priv/host_s390_defs.c
VEX/priv/host_s390_defs.h
VEX/priv/host_x86_defs.c
VEX/priv/host_x86_defs.h
VEX/priv/main_main.c

index d7d1ab1aadf08fefdbb41705a34efb39da7af4b0..e834e825368832cf4967c8c5c2a4ec6b79413256 100644 (file)
@@ -2592,7 +2592,7 @@ static UChar* do_ffree_st ( UChar* p, Int n )
 
 Int emit_AMD64Instr ( /*MB_MOD*/Bool* is_profInc,
                       UChar* buf, Int nbuf, const AMD64Instr* i, 
-                      Bool mode64, VexEndness endness_host,
+                      Bool mode64, const VexArchInfo* archinfo_host,
                       const void* disp_cp_chain_me_to_slowEP,
                       const void* disp_cp_chain_me_to_fastEP,
                       const void* disp_cp_xindir,
index 4c16db17bf36e6efbcd4fc1fd34e6fad74d6dd97..731fd2efd32dd2b8cddd21106ab23a9e43bb8441 100644 (file)
@@ -836,7 +836,7 @@ extern Int          emit_AMD64Instr   ( /*MB_MOD*/Bool* is_profInc,
                                         UChar* buf, Int nbuf,
                                         const AMD64Instr* i, 
                                         Bool mode64,
-                                        VexEndness endness_host,
+                                        const VexArchInfo* archinfo_host,
                                         const void* disp_cp_chain_me_to_slowEP,
                                         const void* disp_cp_chain_me_to_fastEP,
                                         const void* disp_cp_xindir,
index da52748eb95411b2dc1d54678cf66145c1969055..b00aad94d54296d97356bbef133da87ae887272b 100644 (file)
@@ -3627,7 +3627,7 @@ static UInt* do_load_or_store64 ( UInt* p,
 
 Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc,
                       UChar* buf, Int nbuf, const ARM64Instr* i,
-                      Bool mode64, VexEndness endness_host,
+                      Bool mode64, const VexArchInfo* archinfo_host,
                       const void* disp_cp_chain_me_to_slowEP,
                       const void* disp_cp_chain_me_to_fastEP,
                       const void* disp_cp_xindir,
index 4f5b1bce3ef5be0f3c7bafe959e89303f31988e9..83bb6a286e81ba2a6874a32f1611540d41d88bf6 100644 (file)
@@ -1115,7 +1115,7 @@ extern void mapRegs_ARM64Instr     ( HRegRemap*, ARM64Instr*, Bool );
 extern Int  emit_ARM64Instr        ( /*MB_MOD*/Bool* is_profInc,
                                      UChar* buf, Int nbuf, const ARM64Instr* i,
                                      Bool mode64,
-                                     VexEndness endness_host,
+                                     const VexArchInfo *archinfo_host,
                                      const void* disp_cp_chain_me_to_slowEP,
                                      const void* disp_cp_chain_me_to_fastEP,
                                      const void* disp_cp_xindir,
index 39d89f7e8710d3ce58d23725fb46e708ec5b852c..a838565a20149546e121996a7d321a1c80d4d04a 100644 (file)
@@ -3069,7 +3069,7 @@ static UInt* do_load_or_store32 ( UInt* p,
 
 Int emit_ARMInstr ( /*MB_MOD*/Bool* is_profInc,
                     UChar* buf, Int nbuf, const ARMInstr* i, 
-                    Bool mode64, VexEndness endness_host,
+                    Bool mode64, const VexArchInfo* archinfo_host,
                     const void* disp_cp_chain_me_to_slowEP,
                     const void* disp_cp_chain_me_to_fastEP,
                     const void* disp_cp_xindir,
index 904bd0c43c39b8c8af103c1ed15549045b8973a5..d6dbc4ee27cc7291ab7a1468e95d81b7c191feee 100644 (file)
@@ -1057,7 +1057,7 @@ extern void mapRegs_ARMInstr     ( HRegRemap*, ARMInstr*, Bool );
 extern Int  emit_ARMInstr        ( /*MB_MOD*/Bool* is_profInc,
                                    UChar* buf, Int nbuf, const ARMInstr* i, 
                                    Bool mode64,
-                                   VexEndness endness_host,
+                                   const VexArchInfo* archinfo_host,
                                    const void* disp_cp_chain_me_to_slowEP,
                                    const void* disp_cp_chain_me_to_fastEP,
                                    const void* disp_cp_xindir,
index ad92c055c93ffbb41cb024df4067cb2864387d8c..d018aac8417743be0361f9d2bbad71cd0a2c6876 100644 (file)
@@ -3768,7 +3768,7 @@ static UChar *mkMoveReg(UChar * p, UInt r_dst, UInt r_src)
 Int emit_MIPSInstr ( /*MB_MOD*/Bool* is_profInc,
                      UChar* buf, Int nbuf, const MIPSInstr* i,
                      Bool mode64,
-                     VexEndness endness_host,
+                     const VexArchInfo* archinfo_host,
                      const void* disp_cp_chain_me_to_slowEP,
                      const void* disp_cp_chain_me_to_fastEP,
                      const void* disp_cp_xindir,
index 423f68ea09d859053caf71de534276034db1a920..838368b85c115b34b73fed76abb24d39cf5b2902 100644 (file)
@@ -1006,7 +1006,7 @@ extern void mapRegs_MIPSInstr     (HRegRemap *, MIPSInstr *, Bool mode64);
 extern Int        emit_MIPSInstr (/*MB_MOD*/Bool* is_profInc,
                                   UChar* buf, Int nbuf, const MIPSInstr* i,
                                   Bool mode64,
-                                  VexEndness endness_host,
+                                  const VexArchInfo* archinfo_host,
                                   const void* disp_cp_chain_me_to_slowEP,
                                   const void* disp_cp_chain_me_to_fastEP,
                                   const void* disp_cp_xindir,
index 3e91c904f67eb15beb505dc78fb72cb8a2e9168e..19b4ee0fa4b2c742c4b4e7fd53f44d1bc9e09e81 100644 (file)
@@ -1343,7 +1343,7 @@ Int emit_NANOMIPSInstr ( /*MB_MOD*/Bool* is_profInc,
                                    UChar* buf, Int nbuf,
                                    const NANOMIPSInstr* i,
                                    Bool mode64,
-                                   VexEndness endness_host,
+                                   const VexArchInfo* archinfo_host,
                                    const void* disp_cp_chain_me_to_slowEP,
                                    const void* disp_cp_chain_me_to_fastEP,
                                    const void* disp_cp_xindir,
index beb80847975799c8a78ef09df2a66da833d24510..aa40b1e1402e9727c0a6f5f6c0f0fc284e3eb177 100644 (file)
@@ -393,7 +393,7 @@ extern Int emit_NANOMIPSInstr (/*MB_MOD*/Bool* is_profInc,
                                UChar* buf, Int nbuf,
                                const NANOMIPSInstr* i,
                                Bool mode64,
-                               VexEndness endness_host,
+                               const VexArchInfo* archinfo_host,
                                const void* disp_cp_chain_me_to_slowEP,
                                const void* disp_cp_chain_me_to_fastEP,
                                const void* disp_cp_xindir,
index dfefcb3fd41b4a65244524384c8f3e2fea0def3b..7dc9714572f75c3cc208bf3863618510cb016a17 100644 (file)
@@ -4154,7 +4154,7 @@ static UChar* mkFormVA ( UChar* p, UInt opc1, UInt r1, UInt r2,
 */
 Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc,
                     UChar* buf, Int nbuf, const PPCInstr* i, 
-                    Bool mode64, VexEndness endness_host,
+                    Bool mode64, const VexArchInfo* archinfo_host,
                     const void* disp_cp_chain_me_to_slowEP,
                     const void* disp_cp_chain_me_to_fastEP,
                     const void* disp_cp_xindir,
@@ -4167,6 +4167,7 @@ Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc,
       vex_printf("asm  ");ppPPCInstr(i, mode64); vex_printf("\n");
    }
 
+   VexEndness endness_host = archinfo_host->endness;
    switch (i->tag) {
 
    case Pin_LI:
index c57afd50b5d64c6c0df0d019a40de5bc08e9ea69..df376e21c70a04b83f819d4a29a288711c9f06e2 100644 (file)
@@ -1269,7 +1269,7 @@ extern void mapRegs_PPCInstr     ( HRegRemap*, PPCInstr* , Bool mode64);
 extern Int          emit_PPCInstr   ( /*MB_MOD*/Bool* is_profInc,
                                       UChar* buf, Int nbuf, const PPCInstr* i, 
                                       Bool mode64,
-                                      VexEndness endness_host,
+                                      const VexArchInfo* archinfo_host,
                                       const void* disp_cp_chain_me_to_slowEP,
                                       const void* disp_cp_chain_me_to_fastEP,
                                       const void* disp_cp_xindir,
index 152d4ae92c8ad35dec1437da54ec4931ed2a083c..dcb1a968de287cfbaba996be383d5049719a378e 100644 (file)
@@ -1774,7 +1774,7 @@ Int emit_RISCV64Instr(/*MB_MOD*/ Bool*    is_profInc,
                       Int                 nbuf,
                       const RISCV64Instr* i,
                       Bool                mode64,
-                      VexEndness          endness_host,
+                      const VexArchInfo*  archinfo_host,
                       const void*         disp_cp_chain_me_to_slowEP,
                       const void*         disp_cp_chain_me_to_fastEP,
                       const void*         disp_cp_xindir,
index 7a97f90ef4ff39eb5dbb73108af67ad475afa690..97a8420f79a3a71911e048e0dd0bb2d8f107f069 100644 (file)
@@ -612,7 +612,7 @@ Int emit_RISCV64Instr(/*MB_MOD*/ Bool*    is_profInc,
                       Int                 nbuf,
                       const RISCV64Instr* i,
                       Bool                mode64,
-                      VexEndness          endness_host,
+                      const VexArchInfo*  archinfo_host,
                       const void*         disp_cp_chain_me_to_slowEP,
                       const void*         disp_cp_chain_me_to_fastEP,
                       const void*         disp_cp_xindir,
index 04b06c4cfec61ac224359636a2ce7979b7ea3c9c..3479bbc91b9a8883a157f7e0acc0651d82f7e859 100644 (file)
@@ -10896,7 +10896,7 @@ s390_insn_vec_replicate_emit(UChar *buf, const s390_insn *insn)
 
 Int
 emit_S390Instr(Bool *is_profinc, UChar *buf, Int nbuf, const s390_insn *insn,
-               Bool mode64, VexEndness endness_host,
+               Bool mode64, const VexArchInfo *archinfo,
                const void *disp_cp_chain_me_to_slowEP,
                const void *disp_cp_chain_me_to_fastEP,
                const void *disp_cp_xindir,
index 48ea79f18d86a313b11d5e20322611ebecbe7adc..a743abb50191f637a334789f669ff56c983b438b 100644 (file)
@@ -885,7 +885,7 @@ UInt ppHRegS390(HReg);
 void  getRegUsage_S390Instr( HRegUsage *, const s390_insn *, Bool );
 void  mapRegs_S390Instr    ( HRegRemap *, s390_insn *, Bool );
 Int   emit_S390Instr       ( Bool *, UChar *, Int, const s390_insn *, Bool,
-                             VexEndness, const void *, const void *,
+                             const VexArchInfo *, const void *, const void *,
                              const void *, const void *);
 const RRegUniverse *getRRegUniverse_S390( void );
 void  genSpill_S390        ( HInstr **, HInstr **, HReg , Int , Bool );
index 200c122fd86fc02c9d7766565eaddd93ed33c455..5b50d8a5366ae7bce9d10bb275b5c2504a550d26 100644 (file)
@@ -2122,7 +2122,7 @@ static UChar* push_word_from_tags ( UChar* p, UShort tags )
 
 Int emit_X86Instr ( /*MB_MOD*/Bool* is_profInc,
                     UChar* buf, Int nbuf, const X86Instr* i, 
-                    Bool mode64, VexEndness endness_host,
+                    Bool mode64, const VexArchInfo* archinfo_host,
                     const void* disp_cp_chain_me_to_slowEP,
                     const void* disp_cp_chain_me_to_fastEP,
                     const void* disp_cp_xindir,
index ecd74e6a53bcef3239d2d3d5e70a36b8fc7e9ce2..65cca18f6f58fa96af77028dd6c15a002a838d77 100644 (file)
@@ -717,7 +717,7 @@ extern void         mapRegs_X86Instr     ( HRegRemap*, X86Instr*, Bool );
 extern Int          emit_X86Instr   ( /*MB_MOD*/Bool* is_profInc,
                                       UChar* buf, Int nbuf, const X86Instr* i, 
                                       Bool mode64,
-                                      VexEndness endness_host,
+                                      const VexArchInfo* archinfo_host,
                                       const void* disp_cp_chain_me_to_slowEP,
                                       const void* disp_cp_chain_me_to_fastEP,
                                       const void* disp_cp_xindir,
index 32a78190ad73bce04122673696653b39ba077bf2..e979952853582f8a222dfb64c69f350f806ace6f 100644 (file)
@@ -780,9 +780,9 @@ static void libvex_BackEnd ( const VexTranslateArgs *vta,
                                   const VexAbiInfo*, Int, Int, Bool, Bool,
                                   Addr );
    Int          (*emit)         ( /*MB_MOD*/Bool*,
-                                  UChar*, Int, const HInstr*, Bool, VexEndness,
-                                  const void*, const void*, const void*,
-                                  const void* );
+                                  UChar*, Int, const HInstr*, Bool,
+                                  const VexArchInfo*, const void*,
+                                  const void*, const void*, const void* );
    Bool (*preciseMemExnsFn) ( Int, Int, VexRegisterUpdates );
 
    const RRegUniverse* rRegUniv = NULL;
@@ -1232,7 +1232,7 @@ static void libvex_BackEnd ( const VexTranslateArgs *vta,
       }
       j = emit( &hi_isProfInc,
                 insn_bytes, sizeof insn_bytes, hi,
-                mode64, vta->archinfo_host.endness,
+                mode64, &vta->archinfo_host,
                 vta->disp_cp_chain_me_to_slowEP,
                 vta->disp_cp_chain_me_to_fastEP,
                 vta->disp_cp_xindir,