Bring in the beginnings of 64-bit cleanness for IR mangling in cachegrind:
* use mkIRExpr_HWord to wrap constants
* add a bunch of paranoia to check we're not screwing up too obviously
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3398 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 40fd86c..b4ec110 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -491,15 +491,33 @@
Int argc;
Char* helperName;
void* helperAddr;
+ IRType wordTy;
+
+ // Stay sane ...
+ tl_assert(sizeof(HWord) == sizeof(void*));
+ if (sizeof(HWord) == 4) {
+ wordTy = Ity_I32;
+ } else
+ if (sizeof(HWord) == 8) {
+ wordTy = Ity_I64;
+ } else {
+ VG_(tool_panic)("endOfInstr: strange word size");
+ }
+
+ if (loadAddrExpr)
+ tl_assert(wordTy == typeOfIRExpr(bbOut->tyenv, loadAddrExpr));
+ if (storeAddrExpr)
+ tl_assert(wordTy == typeOfIRExpr(bbOut->tyenv, storeAddrExpr));
+
// Nb: instrLen will be zero if Vex failed to decode it.
tl_assert( 0 == instrLen ||
(instrLen >= MIN_INSTR_SIZE && instrLen <= MAX_INSTR_SIZE) );
// Setup 1st arg: instr_info node's address
- // XXX: not 64-bit clean
+ // Believed to be 64-bit clean
do_details(i_node, bbSeenBefore, instrAddr, instrLen, dataSize );
- arg1 = IRExpr_Const(IRConst_U32( (UInt)i_node ));
+ arg1 = mkIRExpr_HWord( (HWord)i_node );
if (!loadAddrExpr && !storeAddrExpr) {
// no load/store