From: Florian Krohm Date: Sun, 21 Oct 2012 02:09:51 +0000 (+0000) Subject: Constify VEX's external interface. X-Git-Tag: svn/VALGRIND_3_9_0^2~219 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd4e9cbfdda5dc194c8f10fe2b3add7298f085a6;p=thirdparty%2Fvalgrind.git Constify VEX's external interface. git-svn-id: svn://svn.valgrind.org/vex/trunk@2555 --- diff --git a/VEX/priv/guest_amd64_defs.h b/VEX/priv/guest_amd64_defs.h index f44c6f89ea..bbcc95f60a 100644 --- a/VEX/priv/guest_amd64_defs.h +++ b/VEX/priv/guest_amd64_defs.h @@ -64,7 +64,7 @@ DisResult disInstr_AMD64 ( IRSB* irbb, /* Used by the optimiser to specialise calls to helpers. */ extern -IRExpr* guest_amd64_spechelper ( HChar* function_name, +IRExpr* guest_amd64_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ); diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index 4b3508b2f6..5f2c6c5d5e 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -870,7 +870,7 @@ static Bool isU64 ( IRExpr* e, ULong n ) && e->Iex.Const.con->Ico.U64 == n ); } -IRExpr* guest_amd64_spechelper ( HChar* function_name, +IRExpr* guest_amd64_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ) diff --git a/VEX/priv/guest_arm_defs.h b/VEX/priv/guest_arm_defs.h index 1325991dea..e064b40bc5 100644 --- a/VEX/priv/guest_arm_defs.h +++ b/VEX/priv/guest_arm_defs.h @@ -56,7 +56,7 @@ DisResult disInstr_ARM ( IRSB* irbb, /* Used by the optimiser to specialise calls to helpers. */ extern -IRExpr* guest_arm_spechelper ( HChar* function_name, +IRExpr* guest_arm_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ); diff --git a/VEX/priv/guest_arm_helpers.c b/VEX/priv/guest_arm_helpers.c index 5c5d35055d..2c452e35e0 100644 --- a/VEX/priv/guest_arm_helpers.c +++ b/VEX/priv/guest_arm_helpers.c @@ -551,7 +551,7 @@ static Bool isU32 ( IRExpr* e, UInt n ) && e->Iex.Const.con->Ico.U32 == n ); } -IRExpr* guest_arm_spechelper ( HChar* function_name, +IRExpr* guest_arm_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ) diff --git a/VEX/priv/guest_mips_defs.h b/VEX/priv/guest_mips_defs.h index 8977f2ecc9..74f1259e36 100644 --- a/VEX/priv/guest_mips_defs.h +++ b/VEX/priv/guest_mips_defs.h @@ -55,7 +55,7 @@ extern DisResult disInstr_MIPS ( IRSB* irbb, Bool host_bigendian ); /* Used by the optimiser to specialise calls to helpers. */ -extern IRExpr *guest_mips32_spechelper(HChar * function_name, IRExpr ** args, +extern IRExpr *guest_mips32_spechelper(const HChar * function_name, IRExpr ** args, IRStmt ** precedingStmts, Int n_precedingStmts); diff --git a/VEX/priv/guest_mips_helpers.c b/VEX/priv/guest_mips_helpers.c index 0606ed5ae9..61b16465f4 100644 --- a/VEX/priv/guest_mips_helpers.c +++ b/VEX/priv/guest_mips_helpers.c @@ -47,7 +47,7 @@ { offsetof(VexGuestMIPS32State, field), \ (sizeof ((VexGuestMIPS32State*)0)->field) } -IRExpr *guest_mips32_spechelper(HChar * function_name, IRExpr ** args, +IRExpr *guest_mips32_spechelper(const HChar * function_name, IRExpr ** args, IRStmt ** precedingStmts, Int n_precedingStmts) { return NULL; diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h index 7ce6cf562b..00b4ee7529 100644 --- a/VEX/priv/guest_ppc_defs.h +++ b/VEX/priv/guest_ppc_defs.h @@ -65,13 +65,13 @@ DisResult disInstr_PPC ( IRSB* irbb, /* Used by the optimiser to specialise calls to helpers. */ extern -IRExpr* guest_ppc32_spechelper ( HChar* function_name, +IRExpr* guest_ppc32_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ); extern -IRExpr* guest_ppc64_spechelper ( HChar* function_name, +IRExpr* guest_ppc64_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ); diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index bb1bd79ef2..906f9b4546 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -188,7 +188,7 @@ void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst, /* Helper-function specialiser. */ -IRExpr* guest_ppc32_spechelper ( HChar* function_name, +IRExpr* guest_ppc32_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ) @@ -196,7 +196,7 @@ IRExpr* guest_ppc32_spechelper ( HChar* function_name, return NULL; } -IRExpr* guest_ppc64_spechelper ( HChar* function_name, +IRExpr* guest_ppc64_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ) diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h index de59f95746..f28151c454 100644 --- a/VEX/priv/guest_s390_defs.h +++ b/VEX/priv/guest_s390_defs.h @@ -53,7 +53,7 @@ DisResult disInstr_S390 ( IRSB* irbb, Bool host_bigendian ); /* Used by the optimiser to specialise calls to helpers. */ -IRExpr* guest_s390x_spechelper ( HChar *function_name, +IRExpr* guest_s390x_spechelper ( const HChar *function_name, IRExpr **args, IRStmt **precedingStmts, Int n_precedingStmts); diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 66f05fef36..eaddd29342 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -1375,7 +1375,7 @@ isC64(IRExpr *expr) case the helper function will be called. Otherwise, the expression has type Ity_I32 and a Boolean value. */ IRExpr * -guest_s390x_spechelper(HChar *function_name, IRExpr **args, +guest_s390x_spechelper(const HChar *function_name, IRExpr **args, IRStmt **precedingStmts, Int n_precedingStmts) { UInt i, arity = 0; diff --git a/VEX/priv/guest_x86_defs.h b/VEX/priv/guest_x86_defs.h index d982612e27..af83cb7a3d 100644 --- a/VEX/priv/guest_x86_defs.h +++ b/VEX/priv/guest_x86_defs.h @@ -64,7 +64,7 @@ DisResult disInstr_X86 ( IRSB* irbb, /* Used by the optimiser to specialise calls to helpers. */ extern -IRExpr* guest_x86_spechelper ( HChar* function_name, +IRExpr* guest_x86_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ); diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c index 1ae1d3cf13..4676276618 100644 --- a/VEX/priv/guest_x86_helpers.c +++ b/VEX/priv/guest_x86_helpers.c @@ -773,7 +773,7 @@ static inline Bool isU32 ( IRExpr* e, UInt n ) && e->Iex.Const.con->Ico.U32 == n ); } -IRExpr* guest_x86_spechelper ( HChar* function_name, +IRExpr* guest_x86_spechelper ( const HChar* function_name, IRExpr** args, IRStmt** precedingStmts, Int n_precedingStmts ) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 3ffe0eb58c..279d83d7ab 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -4644,7 +4644,7 @@ s390_insn_compare(UChar size, HReg src1, s390_opnd_RMI src2, s390_insn * s390_insn_helper_call(s390_cc_t cond, Addr64 target, UInt num_args, - HChar *name, HReg dst) + const HChar *name, HReg dst) { s390_insn *insn = LibVEX_Alloc(sizeof(s390_insn)); diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index 6034b48dce..37a7dc9bf7 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -387,11 +387,11 @@ typedef struct { i.e. in registers r2, r3, r4, r5, and r6, with argument #0 being passed in r2 and so forth. */ struct { - s390_cc_t cond; - Addr64 target; - UInt num_args; - HReg dst; /* if not INVALID_HREG, put return value here */ - HChar *name; /* callee's name (for debugging) */ + s390_cc_t cond; + Addr64 target; + UInt num_args; + HReg dst; /* if not INVALID_HREG, put return value here */ + const HChar *name; /* callee's name (for debugging) */ } helper_call; /* Floating point instructions (including conversion to/from floating @@ -532,7 +532,7 @@ s390_insn *s390_insn_test(UChar size, s390_opnd_RMI src); s390_insn *s390_insn_compare(UChar size, HReg dst, s390_opnd_RMI opnd, Bool signed_comparison); s390_insn *s390_insn_helper_call(s390_cc_t cond, Addr64 target, UInt num_args, - HChar *name, HReg dst); + const HChar *name, HReg dst); s390_insn *s390_insn_bfp_triop(UChar size, s390_bfp_triop_t, HReg dst, HReg op2, HReg op3); s390_insn *s390_insn_bfp_binop(UChar size, s390_bfp_binop_t, HReg dst, diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 0d0d151d5f..99b2266c23 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -118,7 +118,7 @@ void ppIRTemp ( IRTemp tmp ) void ppIROp ( IROp op ) { - HChar* str = NULL; + const HChar* str = NULL; IROp base; switch (op) { case Iop_Add8 ... Iop_Add64: @@ -1461,7 +1461,7 @@ IRConst* IRConst_V256 ( UInt con ) /* Constructors -- IRCallee */ -IRCallee* mkIRCallee ( Int regparms, HChar* name, void* addr ) +IRCallee* mkIRCallee ( Int regparms, const HChar* name, void* addr ) { IRCallee* ce = LibVEX_Alloc(sizeof(IRCallee)); ce->regparms = regparms; @@ -3138,7 +3138,7 @@ static inline Int countArgs ( IRExpr** args ) static __attribute((noreturn)) -void sanityCheckFail ( IRSB* bb, IRStmt* stmt, HChar* what ) +void sanityCheckFail ( IRSB* bb, IRStmt* stmt, const HChar* what ) { vex_printf("\nIR SANITY CHECK FAILURE\n\n"); ppIRSB(bb); @@ -3738,7 +3738,7 @@ void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy ) } } -void sanityCheckIRSB ( IRSB* bb, HChar* caller, +void sanityCheckIRSB ( IRSB* bb, const HChar* caller, Bool require_flat, IRType guest_word_size ) { Int i; @@ -3927,7 +3927,7 @@ IRExpr* mkIRExpr_HWord ( HWord hw ) vpanic("mkIRExpr_HWord"); } -IRDirty* unsafeIRDirty_0_N ( Int regparms, HChar* name, void* addr, +IRDirty* unsafeIRDirty_0_N ( Int regparms, const HChar* name, void* addr, IRExpr** args ) { IRDirty* d = emptyIRDirty(); @@ -3938,7 +3938,7 @@ IRDirty* unsafeIRDirty_0_N ( Int regparms, HChar* name, void* addr, } IRDirty* unsafeIRDirty_1_N ( IRTemp dst, - Int regparms, HChar* name, void* addr, + Int regparms, const HChar* name, void* addr, IRExpr** args ) { IRDirty* d = emptyIRDirty(); @@ -3950,7 +3950,7 @@ IRDirty* unsafeIRDirty_1_N ( IRTemp dst, } IRExpr* mkIRExprCCall ( IRType retty, - Int regparms, HChar* name, void* addr, + Int regparms, const HChar* name, void* addr, IRExpr** args ) { return IRExpr_CCall ( mkIRCallee ( regparms, name, addr ), diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index d53db40e0d..b7e3d9a75d 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2811,7 +2811,7 @@ static Bool isOneU1 ( IRExpr* e ) static IRSB* spec_helpers_BB( IRSB* bb, - IRExpr* (*specHelper) (HChar*, IRExpr**, IRStmt**, Int) + IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int) ) { Int i; @@ -5294,7 +5294,7 @@ static Bool iropt_verbose = False; /* True; */ static IRSB* cheap_transformations ( IRSB* bb, - IRExpr* (*specHelper) (HChar*, IRExpr**, IRStmt**, Int), + IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int), Bool (*preciseMemExnsFn)(Int,Int) ) { @@ -5455,7 +5455,7 @@ static void considerExpensives ( /*OUT*/Bool* hasGetIorPutI, IRSB* do_iropt_BB( IRSB* bb0, - IRExpr* (*specHelper) (HChar*, IRExpr**, IRStmt**, Int), + IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int), Bool (*preciseMemExnsFn)(Int,Int), Addr64 guest_addr, VexArch guest_arch diff --git a/VEX/priv/ir_opt.h b/VEX/priv/ir_opt.h index c215fa2645..9a40c0e89f 100644 --- a/VEX/priv/ir_opt.h +++ b/VEX/priv/ir_opt.h @@ -45,7 +45,7 @@ extern IRSB* do_iropt_BB( IRSB* bb, - IRExpr* (*specHelper) (HChar*, IRExpr**, IRStmt**, Int), + IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int), Bool (*preciseMemExnsFn)(Int,Int), Addr64 guest_addr, VexArch guest_arch diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 8d812586e2..cf66cf1abc 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -203,7 +203,7 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta ) Int (*emit) ( /*MB_MOD*/Bool*, UChar*, Int, HInstr*, Bool, void*, void*, void*, void* ); - IRExpr* (*specHelper) ( HChar*, IRExpr**, IRStmt**, Int ); + IRExpr* (*specHelper) ( const HChar*, IRExpr**, IRStmt**, Int ); Bool (*preciseMemExnsFn) ( Int, Int ); DisOneInstrFn disInstrFn; @@ -1005,7 +1005,7 @@ VexInvalRange LibVEX_PatchProfInc ( VexArch arch_host, /* --------- Emulation warnings. --------- */ -HChar* LibVEX_EmNote_string ( VexEmNote ew ) +const HChar* LibVEX_EmNote_string ( VexEmNote ew ) { switch (ew) { case EmNote_NONE: diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index abcedc1a8d..091b3b7643 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -113,7 +113,7 @@ typedef /* Produces a short string describing the warning. */ -extern HChar* LibVEX_EmNote_string ( VexEmNote ); +extern const HChar* LibVEX_EmNote_string ( VexEmNote ); #endif /* ndef __LIBVEX_EMNOTE_H */ diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 3ab417a12a..f399bb25cd 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -344,15 +344,15 @@ extern Bool eqIRConst ( IRConst*, IRConst* ); typedef struct { - Int regparms; - HChar* name; - void* addr; - UInt mcx_mask; + Int regparms; + const HChar* name; + void* addr; + UInt mcx_mask; } IRCallee; /* Create an IRCallee. */ -extern IRCallee* mkIRCallee ( Int regparms, HChar* name, void* addr ); +extern IRCallee* mkIRCallee ( Int regparms, const HChar* name, void* addr ); /* Deep-copy an IRCallee. */ extern IRCallee* deepCopyIRCallee ( IRCallee* ); @@ -1813,7 +1813,7 @@ extern IRExpr* mkIRExpr_HWord ( HWord ); /* Convenience function for constructing clean helper calls. */ extern IRExpr* mkIRExprCCall ( IRType retty, - Int regparms, HChar* name, void* addr, + Int regparms, const HChar* name, void* addr, IRExpr** args ); @@ -2008,14 +2008,14 @@ extern IRDirty* deepCopyIRDirty ( IRDirty* ); designation) -- you can change this marking later if need be. A suitable IRCallee is constructed from the supplied bits. */ extern -IRDirty* unsafeIRDirty_0_N ( Int regparms, HChar* name, void* addr, +IRDirty* unsafeIRDirty_0_N ( Int regparms, const HChar* name, void* addr, IRExpr** args ); /* Similarly, make a zero-annotation dirty call which returns a value, and assign that to the given temp. */ extern IRDirty* unsafeIRDirty_1_N ( IRTemp dst, - Int regparms, HChar* name, void* addr, + Int regparms, const HChar* name, void* addr, IRExpr** args ); @@ -2498,7 +2498,7 @@ extern IRType typeOfIRExpr ( IRTypeEnv*, IRExpr* ); /* Sanity check a BB of IR */ extern void sanityCheckIRSB ( IRSB* bb, - HChar* caller, + const HChar* caller, Bool require_flatness, IRType guest_word_size ); extern Bool isFlatIRStmt ( IRStmt* );