]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bring in the beginnings of 64-bit cleanness for IR mangling in cachegrind:
authorJulian Seward <jseward@acm.org>
Mon, 21 Mar 2005 01:35:02 +0000 (01:35 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 21 Mar 2005 01:35:02 +0000 (01:35 +0000)
* 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

cachegrind/cg_main.c

index 40fd86c3c523ba00ee4bf4d0217397d0a77d3d68..b4ec110eb77607e3a51a77d81b59def0a4067e3e 100644 (file)
@@ -491,15 +491,33 @@ void endOfInstr(IRBB* bbOut, instr_info* i_node, Bool bbSeenBefore,
    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