Change most remaining use of Addr64 in coregrind and the tools to Addr.
Tracking VEX r3056.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14846 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index ec9c6e9..7f2c7e5 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -1715,17 +1715,17 @@
 // any reason at all: to free up space, because the guest code was
 // unmapped or modified, or for any arbitrary reason.
 static
-void cg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge )
+void cg_discard_superblock_info ( Addr orig_addr64, VexGuestExtents vge )
 {
    SB_info* sbInfo;
-   Addr     orig_addr = (Addr)vge.base[0];
+   Addr     orig_addr = vge.base[0];
 
    tl_assert(vge.n_used > 0);
 
    if (DEBUG_CG)
       VG_(printf)( "discard_basic_block_info: %p, %p, %llu\n", 
-                   (void*)(Addr)orig_addr,
-                   (void*)(Addr)vge.base[0], (ULong)vge.len[0]);
+                   (void*)orig_addr,
+                   (void*)vge.base[0], (ULong)vge.len[0]);
 
    // Get BB info, remove from table, free BB info.  Simple!  Note that we
    // use orig_addr, not the first instruction address in vge.
diff --git a/callgrind/main.c b/callgrind/main.c
index 05df95d..5d10b40 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -1368,16 +1368,14 @@
 // any reason at all: to free up space, because the guest code was
 // unmapped or modified, or for any arbitrary reason.
 static
-void clg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge )
+void clg_discard_superblock_info ( Addr orig_addr, VexGuestExtents vge )
 {
-    Addr orig_addr = (Addr)orig_addr64;
-
     tl_assert(vge.n_used > 0);
 
    if (0)
       VG_(printf)( "discard_superblock_info: %p, %p, %llu\n",
-                   (void*)(Addr)orig_addr,
-                   (void*)(Addr)vge.base[0], (ULong)vge.len[0]);
+                   (void*)orig_addr,
+                   (void*)vge.base[0], (ULong)vge.len[0]);
 
    // Get BB info, remove from table, free BB info.  Simple!  Note that we
    // use orig_addr, not the first instruction address in vge.
@@ -1450,7 +1448,7 @@
 
 /* Ups, this can go very wrong...
    FIXME: We should export this function or provide other means to get a handle */
-extern void VG_(discard_translations) ( Addr64 start, ULong range, const HChar* who );
+extern void VG_(discard_translations) ( Addr start, ULong range, const HChar* who );
 
 void CLG_(set_instrument_state)(const HChar* reason, Bool state)
 {
@@ -1463,7 +1461,7 @@
   CLG_DEBUG(2, "%s: Switching instrumentation %s ...\n",
 	   reason, state ? "ON" : "OFF");
 
-  VG_(discard_translations)( (Addr64)0x1000, (ULong) ~0xfffl, "callgrind");
+  VG_(discard_translations)( (Addr)0x1000, (ULong) ~0xfffl, "callgrind");
 
   /* reset internal state: call stacks, simulator */
   CLG_(forall_threads)(unwind_thread);
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index 5075b06..d87110b 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -733,8 +733,8 @@
     if (VG_(clo_trace_redir)) {
        VG_(message)( Vg_DebugMsg,
                      "Adding redirect for indirect function "
-                     "0x%llx from 0x%llx -> 0x%llx\n",
-                     (ULong)old_from, (ULong)new_from, (ULong)new.to_addr );
+                     "0x%lx from 0x%lx -> 0x%lx\n",
+                     old_from, new_from, new.to_addr );
     }
 }
 
@@ -988,9 +988,9 @@
          they get redirected to 'to'.  So discard them.  Just for
          paranoia (but, I believe, unnecessarily), discard 'to' as
          well. */
-      VG_(discard_translations)( (Addr64)act.from_addr, 1,
+      VG_(discard_translations)( act.from_addr, 1,
                                  "redir_new_DebugInfo(from_addr)");
-      VG_(discard_translations)( (Addr64)act.to_addr, 1,
+      VG_(discard_translations)( act.to_addr, 1,
                                  "redir_new_DebugInfo(to_addr)");
       if (VG_(clo_verbosity) > 2) {
          VG_(message)(Vg_UserMsg, "Adding active redirection:\n");
@@ -1074,9 +1074,9 @@
          VG_(OSetWord_Insert)( tmpSet, act->from_addr );
          /* While we have our hands on both the 'from' and 'to'
             of this Active, do paranoid stuff with tt/tc. */
-         VG_(discard_translations)( (Addr64)act->from_addr, 1,
+         VG_(discard_translations)( act->from_addr, 1,
                                     "redir_del_DebugInfo(from_addr)");
-         VG_(discard_translations)( (Addr64)act->to_addr, 1,
+         VG_(discard_translations)( act->to_addr, 1,
                                     "redir_del_DebugInfo(to_addr)");
       }
    }
@@ -1698,12 +1698,12 @@
 static void show_spec ( const HChar* left, const Spec* spec )
 {
    VG_(message)( Vg_DebugMsg, 
-                 "%s%-25s %-30s %s-> (%04d.%d) 0x%08llx\n",
+                 "%s%-25s %-30s %s-> (%04d.%d) 0x%08lx\n",
                  left,
                  spec->from_sopatt, spec->from_fnpatt,
                  spec->isWrap ? "W" : "R",
                  spec->becTag, spec->becPrio,
-                 (ULong)spec->to_addr );
+                 spec->to_addr );
 }
 
 static void show_active ( const HChar* left, const Active* act )
@@ -1721,12 +1721,12 @@
    ok = VG_(get_fnname_w_offset)(act->to_addr, &name2);
    if (!ok) name2 = "???";
 
-   VG_(message)(Vg_DebugMsg, "%s0x%08llx (%-20s) %s-> (%04d.%d) 0x%08llx %s\n", 
+   VG_(message)(Vg_DebugMsg, "%s0x%08lx (%-20s) %s-> (%04d.%d) 0x%08lx %s\n", 
                              left, 
-                             (ULong)act->from_addr, name1,
+                             act->from_addr, name1,
                              act->isWrap ? "W" : "R",
                              act->becTag, act->becPrio,
-                             (ULong)act->to_addr, name2 );
+                             act->to_addr, name2 );
 }
 
 static void show_redir_state ( const HChar* who )
diff --git a/coregrind/m_sbprofile.c b/coregrind/m_sbprofile.c
index 4befbc8..f64260f 100644
--- a/coregrind/m_sbprofile.c
+++ b/coregrind/m_sbprofile.c
@@ -96,7 +96,7 @@
       Double percent_here =
          score_total == 0 ? 100.0 : score_here * 100.0 / score_total;
         
-      VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%llx %s\n",
+      VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
                   r,
                   score_cumul, percent_cumul,
                   score_here,  percent_here, tops[r].addr, name);
@@ -138,7 +138,7 @@
          VG_(printf)("\n");
          VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= begin SB rank %d "
                      "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r);
-         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%llx %s\n",
+         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
                      r,
                      score_cumul, percent_cumul,
                      score_here,  percent_here, tops[r].addr, name );
@@ -170,7 +170,7 @@
          Double percent_here =
            score_total == 0 ? 100.0 : score_here * 100.0 / score_total;
 
-         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%llx %s\n",
+         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
                      r,
                      score_cumul, percent_cumul,
                      score_here,  percent_here, tops[r].addr, name );
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index a424be6..33642d7 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -1555,7 +1555,7 @@
 
       case VEX_TRC_JMP_INVALICACHE:
          VG_(discard_translations)(
-            (Addr64)VG_(threads)[tid].arch.vex.guest_CMSTART,
+            (Addr)VG_(threads)[tid].arch.vex.guest_CMSTART,
             VG_(threads)[tid].arch.vex.guest_CMLEN,
             "scheduler(VEX_TRC_JMP_INVALICACHE)"
          );
diff --git a/coregrind/m_sigframe/sigframe-ppc32-linux.c b/coregrind/m_sigframe/sigframe-ppc32-linux.c
index aae1d2f..7f35ac0 100644
--- a/coregrind/m_sigframe/sigframe-ppc32-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc32-linux.c
@@ -183,7 +183,7 @@
    VG_TRACK( post_mem_write,  Vg_CoreSignal, tst->tid, 
              (Addr)&mc->mc_pad, sizeof(mc->mc_pad) );
    /* invalidate any translation of this area */
-   VG_(discard_translations)( (Addr64)(Addr)&mc->mc_pad, 
+   VG_(discard_translations)( (Addr)&mc->mc_pad, 
                               sizeof(mc->mc_pad), "stack_mcontext" );   
 
    /* set the signal handler to return to the trampoline */
diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c
index 459d6b1..ce3224a 100644
--- a/coregrind/m_sigframe/sigframe-ppc64-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c
@@ -287,7 +287,7 @@
             (Addr)&frame->tramp, sizeof(frame->tramp));
 
    /* invalidate any translation of this area */
-   VG_(discard_translations)( (Addr64)&frame->tramp[0], 
+   VG_(discard_translations)( (Addr)&frame->tramp[0], 
                               sizeof(frame->tramp), "stack_mcontext" );   
 
    /* set the signal handler to return to the trampoline */
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index c38a4a8..45594ae 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -696,7 +696,7 @@
    /* Deal with bogus LR values caused by function
       interception/wrapping on ppc-TOC platforms; see comment on
       similar code a few lines further down. */
-   if (ULong_to_Ptr(lr) == (void*)&VG_(ppctoc_magic_redirect_return_stub)
+   if (lr == (Addr)&VG_(ppctoc_magic_redirect_return_stub)
        && VG_(is_valid_tid)(tid_if_known)) {
       Word hsp = VG_(threads)[tid_if_known].arch.vex.guest_REDIR_SP;
       redirs_used++;
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
index 955e033..4293800 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -599,7 +599,7 @@
 {
    PRINT("cacheflush (%lx, %#lx, %#lx)",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "cacheflush", void*, addrlow,void*, addrhigh,int, flags);
-   VG_(discard_translations)( (Addr64)ARG1,
+   VG_(discard_translations)( (Addr)ARG1,
                               ((ULong)ARG2) - ((ULong)ARG1) + 1ULL/*paranoia*/,
                               "PRE(sys_cacheflush)" );
    SET_STATUS_Success(0);
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 2c7b459..56fafac 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -703,7 +703,7 @@
 //ZZ {
 //ZZ    PRINT("cacheflush (%lx, %#lx, %#lx)",ARG1,ARG2,ARG3);
 //ZZ    PRE_REG_READ3(long, "cacheflush", void*, addrlow,void*, addrhigh,int, flags);
-//ZZ    VG_(discard_translations)( (Addr64)ARG1,
+//ZZ    VG_(discard_translations)( (Addr)ARG1,
 //ZZ                               ((ULong)ARG2) - ((ULong)ARG1) + 1ULL/*paranoia*/,
 //ZZ                               "PRE(sys_cacheflush)" );
 //ZZ    SET_STATUS_Success(0);
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 057052b..42d134c 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -185,7 +185,7 @@
    d = VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset );
 
    if (d)
-      VG_(discard_translations)( (Addr64)a, (ULong)len,
+      VG_(discard_translations)( a, (ULong)len,
                                  "notify_core_of_mmap" );
 }
 
@@ -243,7 +243,7 @@
    VG_TRACK( die_mem_munmap, a, len );
    VG_(di_notify_munmap)( a, len );
    if (d)
-      VG_(discard_translations)( (Addr64)a, (ULong)len, 
+      VG_(discard_translations)( a, (ULong)len, 
                                  "ML_(notify_core_and_tool_of_munmap)" );
 }
 
@@ -260,7 +260,7 @@
    VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx );
    VG_(di_notify_mprotect)( a, len, prot );
    if (d)
-      VG_(discard_translations)( (Addr64)a, (ULong)len, 
+      VG_(discard_translations)( a, (ULong)len, 
                                  "ML_(notify_core_and_tool_of_mprotect)" );
 }
 
@@ -1945,7 +1945,7 @@
       VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False,
                               0/*di_handle*/ );
       if (d)
-         VG_(discard_translations)( (Addr64)res, 
+         VG_(discard_translations)( (Addr)res, 
                                     (ULong)VG_PGROUNDUP(segmentSize),
                                     "ML_(generic_POST_sys_shmat)" );
    }
@@ -1977,7 +1977,7 @@
       s = NULL; /* s is now invalid */
       VG_TRACK( die_mem_munmap, s_start, s_len );
       if (d)
-         VG_(discard_translations)( (Addr64)s_start,
+         VG_(discard_translations)( s_start,
                                     (ULong)s_len,
                                     "ML_(generic_POST_sys_shmdt)" );
    }
@@ -3757,7 +3757,7 @@
    Addr  a   = ARG1;
    SizeT len = ARG2;
 
-   ML_(notify_core_and_tool_of_munmap)( (Addr64)a, (ULong)len );
+   ML_(notify_core_and_tool_of_munmap)( a, len );
 }
 
 PRE(sys_mincore)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index bc86ead..f0bd3cb 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -1710,7 +1710,7 @@
       Bool d = VG_(am_notify_munmap)( ARG1, size );
       VG_TRACK( die_mem_munmap, ARG1, size );
       if (d)
-         VG_(discard_translations)( (Addr64)ARG1, (ULong)size, 
+        VG_(discard_translations)( (Addr)ARG1, (ULong)size, 
                                     "PRE(sys_io_destroy)" );
    }  
 }  
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
index 0f5359c..bddadd0 100644
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
@@ -365,7 +365,7 @@
    d = VG_(am_notify_client_mmap)( a, len, prot, flags, fd, offset );
 
    if (d)
-      VG_(discard_translations)( (Addr64)a, (ULong)len,
+      VG_(discard_translations)( a, (ULong)len,
                                  "notify_core_of_mmap" );
 }
 
@@ -752,7 +752,7 @@
   PRINT ("cacheflush (%lx, %lx, %lx)", ARG1, ARG2, ARG3);
   PRE_REG_READ3(long, "cacheflush", unsigned long, addr,
                 int, nbytes, int, cache);
-  VG_ (discard_translations) ((Addr64) ARG1, ((ULong) ARG2),
+  VG_ (discard_translations) ((Addr)ARG1, (ULong) ARG2,
                               "PRE(sys_cacheflush)");
   SET_STATUS_Success (0);
 }
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
index 34ea581..c51ab6f 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -387,7 +387,7 @@
    PRINT("cacheflush (%lx, %lx, %lx)", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "cacheflush", unsigned long, addr,
                  int, nbytes, int, cache);
-   VG_ (discard_translations) ((Addr64) ARG1, ((ULong) ARG2),
+   VG_ (discard_translations) ((Addr)ARG1, (ULong) ARG2,
                                "PRE(sys_cacheflush)");
    SET_STATUS_Success(0);
 }
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index 3fd8f82..00006f2 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -219,7 +219,7 @@
 NEEDS(var_info)
 
 void VG_(needs_superblock_discards)(
-   void (*discard)(Addr64, VexGuestExtents)
+   void (*discard)(Addr, VexGuestExtents)
 )
 {
    VG_(needs).superblock_discards = True;
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 6c3c899..8a8f5aa 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -789,8 +789,8 @@
 
    for (i = 0; i < vge->n_used; i++) {
       Bool  check = False;
-      Addr  addr  = (Addr)vge->base[i];
-      SizeT len   = (SizeT)vge->len[i];
+      Addr  addr  = vge->base[i];
+      SizeT len   = vge->len[i];
       NSegment const* segA = NULL;
 
 #     if defined(VGO_darwin)
@@ -1128,10 +1128,10 @@
    intercept the return and restore R2 and L2 to the values saved
    here. */
 
-static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr64 new_R2_value )
+static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr new_R2_value )
 {
 #  if defined(VGP_ppc64be_linux)
-   Addr64 bogus_RA  = (Addr64)&VG_(ppctoc_magic_redirect_return_stub);
+   Addr   bogus_RA  = (Addr)&VG_(ppctoc_magic_redirect_return_stub);
    Int    offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2);
    Int    offB_LR   = offsetof(VexGuestPPC64State,guest_LR);
    gen_PUSH( bb, IRExpr_Get(offB_LR,   Ity_I64) );
@@ -1211,7 +1211,7 @@
 
 static void gen_push_R2_and_set_LR ( IRSB* bb )
 {
-   Addr64 bogus_RA  = (Addr64)&VG_(ppctoc_magic_redirect_return_stub);
+   Addr   bogus_RA  = (Addr)&VG_(ppctoc_magic_redirect_return_stub);
    Int    offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2);
    Int    offB_LR   = offsetof(VexGuestPPC64State,guest_LR);
    gen_PUSH( bb, IRExpr_Get(offB_LR,   Ity_I64) );
@@ -1356,7 +1356,7 @@
 /* --- Helpers to do with PPC related stack redzones. --- */
 
 __attribute__((unused))
-static Bool const_True ( Addr64 guest_addr )
+static Bool const_True ( Addr guest_addr )
 {
    return True;
 }
@@ -1392,13 +1392,13 @@
 */
 
 Bool VG_(translate) ( ThreadId tid, 
-                      Addr64   nraddr,
+                      Addr     nraddr,
                       Bool     debugging_translation,
                       Int      debugging_verbosity,
                       ULong    bbs_done,
                       Bool     allow_redirection )
 {
-   Addr64             addr;
+   Addr               addr;
    T_Kind             kind;
    Int                tmpbuf_used, verbosity, i;
    Bool (*preamble_fn)(void*,IRSB*);
@@ -1425,7 +1425,7 @@
       start from.  Sets (addr,kind). */
    if (allow_redirection) {
       Bool isWrap;
-      Addr64 tmp = VG_(redir_do_lookup)( nraddr, &isWrap );
+      Addr tmp = VG_(redir_do_lookup)( nraddr, &isWrap );
       if (tmp == nraddr) {
          /* no redirection found */
          addr = nraddr;
@@ -1470,7 +1470,7 @@
       if (!ok) name2 = "???";
 
       VG_(message)(Vg_DebugMsg, 
-                   "REDIR: 0x%llx (%s:%s) redirected to 0x%llx (%s)\n",
+                   "REDIR: 0x%lx (%s:%s) redirected to 0x%lx (%s)\n",
                    nraddr, nraddr_soname, name1,
                    addr, name2 );
    }
@@ -1494,7 +1494,7 @@
       Bool ok = VG_(get_fnname_w_offset)(addr, &fnname);
       if (!ok) fnname = "UNKNOWN_FUNCTION";
       VG_(printf)(
-         "==== SB %d (evchecks %lld) [tid %d] 0x%llx %s %s+0x%llx\n",
+         "==== SB %d (evchecks %lld) [tid %d] 0x%lx %s %s+0x%llx\n",
          VG_(get_bbs_translated)(), bbs_done, (Int)tid, addr,
          fnname, objname, (ULong)objoff
       );
@@ -1508,7 +1508,7 @@
    if ( (!translations_allowable_from_seg(seg, addr))
         || addr == TRANSTAB_BOGUS_GUEST_ADDR ) {
       if (VG_(clo_trace_signals))
-         VG_(message)(Vg_DebugMsg, "translations not allowed here (0x%llx)"
+         VG_(message)(Vg_DebugMsg, "translations not allowed here (0x%lx)"
                                    " - throwing SEGV\n", addr);
       /* U R busted, sonny.  Place your hands on your head and step
          away from the orig_addr. */
@@ -1518,7 +1518,7 @@
             aren't allowed to execute code here. */
          if (debugging_translation)
             VG_(printf)("translations not allowed here (segment not executable)"
-                        "(0x%llx)\n", addr);
+                        "(0x%lx)\n", addr);
          else
             VG_(synth_fault_perms)(tid, addr);
       } else {
@@ -1526,7 +1526,7 @@
            the middle of nowhere. */
          if (debugging_translation)
             VG_(printf)("translations not allowed here (no segment)"
-                        "(0x%llx)\n", addr);
+                        "(0x%lx)\n", addr);
          else
             VG_(synth_fault_mapping)(tid, addr);
       }
@@ -1555,8 +1555,7 @@
 
    /* LE we setup the LR */
 #  if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
-   if (ULong_to_Ptr(nraddr)
-       == (void*)&VG_(ppctoc_magic_redirect_return_stub)) {
+   if (nraddr == (Addr)&VG_(ppctoc_magic_redirect_return_stub)) {
       /* If entering the special return stub, this means a wrapped or
          redirected function is returning.  Make this translation one
          which restores R2 and LR from the thread's hidden redir
@@ -1615,7 +1614,7 @@
    vta.archinfo_host    = vex_archinfo;
    vta.abiinfo_both     = vex_abiinfo;
    vta.callback_opaque  = (void*)&closure;
-   vta.guest_bytes      = (UChar*)ULong_to_Ptr(addr);
+   vta.guest_bytes      = (UChar*)addr;
    vta.guest_bytes_addr = addr;
    vta.chase_into_ok    = chase_into_ok;
    vta.guest_extents    = &vge;
@@ -1692,7 +1691,7 @@
       from them.  Optimisation: don't re-look up vge.base[0] since seg
       should already point to it. */
 
-   vg_assert( vge.base[0] == (Addr64)addr );
+   vg_assert( vge.base[0] == addr );
    /* set 'translations taken from this segment' flag */
    VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( seg );
    } /* END new scope specially for 'seg' */
diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c
index 8477b48..d5622e1 100644
--- a/coregrind/m_transtab.c
+++ b/coregrind/m_transtab.c
@@ -161,7 +161,7 @@
          from which this translation was made.  However, .entry may or
          may not be a lie, depending on whether or not we're doing
          redirection. */
-      Addr64 entry;
+      Addr entry;
 
       /* This structure describes precisely what ranges of guest code
          the translation covers, so we can decide whether or not to
@@ -642,7 +642,7 @@
 #define LDEBUG(m) if (DEBUG_TRANSTAB)                           \
       VG_(printf) (m                                            \
                    " start 0x%p len %u sector %d ttslot %u"     \
-                   " tt.entry 0x%llu tt.tcptr 0x%p\n",          \
+                   " tt.entry 0x%lu tt.tcptr 0x%p\n",           \
                    hx->start, hx->len, (int)(sec - sectors),    \
                    hx->tteNo,                                   \
                    sec->tt[tteNo].entry, sec->tt[tteNo].tcptr)
@@ -882,7 +882,7 @@
    Int      evCheckSzB = LibVEX_evCheckSzB(arch_host, endness_host);
    TTEntry* here_tte   = index_tte(here_sNo, here_tteNo);
    if (DEBUG_TRANSTAB)
-      VG_(printf)("... QQQ tt.entry 0x%llu tt.tcptr 0x%p\n",
+      VG_(printf)("... QQQ tt.entry 0x%lu tt.tcptr 0x%p\n",
                   here_tte->entry, here_tte->tcptr);
    vg_assert(here_tte->status == InUse);
 
@@ -939,7 +939,7 @@
 
 /* Return equivalence class number for a range. */
 
-static Int range_to_eclass ( Addr64 start, UInt len )
+static Int range_to_eclass ( Addr start, UInt len )
 {
    UInt mask   = (1 << ECLASS_WIDTH) - 1;
    UInt lo     = (UInt)start;
@@ -975,7 +975,7 @@
 
    n_ec = 0;
    for (i = 0; i < vge->n_used; i++) {
-      r = range_to_eclass( vge->base[i], (UInt)vge->len[i] );
+      r = range_to_eclass( vge->base[i], vge->len[i] );
       if (r == ECLASS_MISC) 
          goto bad;
       /* only add if we haven't already seen it */
@@ -1201,8 +1201,7 @@
    }
    if (tte->status != Empty) {
       for (k = 0; k < tte->vge.n_used; k++)
-         VG_(printf)("0x%llx %d\n", tte->vge.base[k], 
-                                    (Int)tte->vge.len[k]);
+         VG_(printf)("0x%lx %u\n", tte->vge.base[k], (UInt)tte->vge.len[k]);
    }
 #  endif
 
@@ -1312,9 +1311,9 @@
    return True;
 }
 
-static inline UInt HASH_TT ( Addr64 key )
+static inline UInt HASH_TT ( Addr key )
 {
-   UInt kHi = (UInt)(key >> 32);
+   UInt kHi = sizeof(Addr) == 4 ? 0 : (key >> 32);
    UInt kLo = (UInt)key;
    UInt k32 = kHi ^ kLo;
    UInt ror = 7;
@@ -1323,10 +1322,10 @@
    return k32 % N_TTES_PER_SECTOR;
 }
 
-static void setFastCacheEntry ( Addr64 key, ULong* tcptr )
+static void setFastCacheEntry ( Addr key, ULong* tcptr )
 {
    UInt cno = (UInt)VG_TT_FAST_HASH(key);
-   VG_(tt_fast)[cno].guest = (Addr)key;
+   VG_(tt_fast)[cno].guest = key;
    VG_(tt_fast)[cno].host  = (Addr)tcptr;
    n_fast_updates++;
    /* This shouldn't fail.  It should be assured by m_translate
@@ -1513,7 +1512,7 @@
    sector.
 */
 void VG_(add_to_transtab)( const VexGuestExtents* vge,
-                           Addr64           entry,
+                           Addr             entry,
                            Addr             code,
                            UInt             code_len,
                            Bool             is_self_checking,
@@ -1535,7 +1534,7 @@
    vg_assert(n_guest_instrs < 200); /* it can be zero, tho */
 
    if (DEBUG_TRANSTAB)
-      VG_(printf)("add_to_transtab(entry = 0x%llx, len = %d) ...\n",
+      VG_(printf)("add_to_transtab(entry = 0x%lx, len = %u) ...\n",
                   entry, code_len);
 
    n_in_count++;
@@ -1685,7 +1684,7 @@
 Bool VG_(search_transtab) ( /*OUT*/Addr*  res_hcode,
                             /*OUT*/UInt*  res_sNo,
                             /*OUT*/UInt*  res_tteNo,
-                            Addr64        guest_addr, 
+                            Addr          guest_addr, 
                             Bool          upd_cache )
 {
    Int i, j, k, kstart, sno;
@@ -1753,34 +1752,34 @@
 /*-------------------------------------------------------------*/
 
 /* forward */
-static void unredir_discard_translations( Addr64, ULong );
+static void unredir_discard_translations( Addr, ULong );
 
 /* Stuff for deleting translations which intersect with a given
    address range.  Unfortunately, to make this run at a reasonable
    speed, it is complex. */
 
 static inline
-Bool overlap1 ( Addr64 s1, ULong r1, Addr64 s2, ULong r2 )
+Bool overlap1 ( Addr s1, ULong r1, Addr s2, ULong r2 )
 {
-   Addr64 e1 = s1 + r1 - 1ULL;
-   Addr64 e2 = s2 + r2 - 1ULL;
+   Addr e1 = s1 + r1 - 1;
+   Addr e2 = s2 + r2 - 1;
    if (e1 < s2 || e2 < s1) 
       return False;
    return True;
 }
 
 static inline
-Bool overlaps ( Addr64 start, ULong range, const VexGuestExtents* vge )
+Bool overlaps ( Addr start, ULong range, const VexGuestExtents* vge )
 {
-   if (overlap1(start, range, vge->base[0], (UInt)vge->len[0]))
+   if (overlap1(start, range, vge->base[0], vge->len[0]))
       return True;
    if (vge->n_used < 2)
       return False;
-   if (overlap1(start, range, vge->base[1], (UInt)vge->len[1]))
+   if (overlap1(start, range, vge->base[1], vge->len[1]))
       return True;
    if (vge->n_used < 3)
       return False;
-   if (overlap1(start, range, vge->base[2], (UInt)vge->len[2]))
+   if (overlap1(start, range, vge->base[2], vge->len[2]))
       return True;
    return False;
 }
@@ -1841,7 +1840,7 @@
 
 static 
 Bool delete_translations_in_sector_eclass ( /*MOD*/Sector* sec, UInt secNo,
-                                            Addr64 guest_start, ULong range,
+                                            Addr guest_start, ULong range,
                                             Int ec,
                                             VexArch arch_host,
                                             VexEndness endness_host )
@@ -1882,7 +1881,7 @@
 
 static 
 Bool delete_translations_in_sector ( /*MOD*/Sector* sec, UInt secNo,
-                                     Addr64 guest_start, ULong range,
+                                     Addr guest_start, ULong range,
                                      VexArch arch_host,
                                      VexEndness endness_host )
 {
@@ -1901,7 +1900,7 @@
 } 
 
 
-void VG_(discard_translations) ( Addr64 guest_start, ULong range,
+void VG_(discard_translations) ( Addr guest_start, ULong range,
                                  const HChar* who )
 {
    Sector* sec;
@@ -1911,7 +1910,7 @@
    vg_assert(init_done);
 
    VG_(debugLog)(2, "transtab",
-                    "discard_translations(0x%llx, %lld) req by %s\n",
+                    "discard_translations(0x%lx, %llu) req by %s\n",
                     guest_start, range, who );
 
    /* Pre-deletion sanity check */
@@ -2106,7 +2105,7 @@
    is temporarily in code[0 .. code_len-1].
 */
 void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge,
-                                   Addr64           entry,
+                                   Addr             entry,
                                    Addr             code,
                                    UInt             code_len )
 {
@@ -2161,21 +2160,21 @@
 }
 
 Bool VG_(search_unredir_transtab) ( /*OUT*/Addr*  result,
-                                    Addr64        guest_addr )
+                                    Addr          guest_addr )
 {
    Int i;
    for (i = 0; i < N_UNREDIR_TT; i++) {
       if (!unredir_tt[i].inUse)
          continue;
       if (unredir_tt[i].vge.base[0] == guest_addr) {
-         *result = (Addr)unredir_tt[i].hcode;
+         *result = unredir_tt[i].hcode;
          return True;
       }
    }
    return False;
 }
 
-static void unredir_discard_translations( Addr64 guest_start, ULong range )
+static void unredir_discard_translations( Addr guest_start, ULong range )
 {
    Int i;
 
@@ -2202,7 +2201,6 @@
 
    /* Otherwise lots of things go wrong... */
    vg_assert(sizeof(ULong) == 8);
-   vg_assert(sizeof(Addr64) == 8);
    /* check fast cache entries really are 2 words long */
    vg_assert(sizeof(Addr) == sizeof(void*));
    vg_assert(sizeof(FastCacheEntry) == 2 * sizeof(Addr));
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 9b7df35..6968a18 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -133,7 +133,7 @@
    void  (*tool_update_extra_suppression_use) (const Error*, const Supp*);
 
    // VG_(needs).superblock_discards
-   void (*tool_discard_superblock_info)(Addr64, VexGuestExtents);
+   void (*tool_discard_superblock_info)(Addr, VexGuestExtents);
 
    // VG_(needs).command_line_options
    Bool (*tool_process_cmd_line_option)(const HChar*);
diff --git a/coregrind/pub_core_translate.h b/coregrind/pub_core_translate.h
index 81e547c..4866629 100644
--- a/coregrind/pub_core_translate.h
+++ b/coregrind/pub_core_translate.h
@@ -40,7 +40,7 @@
 
 extern 
 Bool VG_(translate) ( ThreadId tid, 
-                      Addr64   orig_addr,
+                      Addr     orig_addr,
                       Bool     debugging_translation,
                       Int      debugging_verbosity,
                       ULong    bbs_done,
diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h
index d079881..892a0b1 100644
--- a/coregrind/pub_core_transtab.h
+++ b/coregrind/pub_core_transtab.h
@@ -82,7 +82,7 @@
 
 extern
 void VG_(add_to_transtab)( const VexGuestExtents* vge,
-                           Addr64           entry,
+                           Addr             entry,
                            Addr             code,
                            UInt             code_len,
                            Bool             is_self_checking,
@@ -98,10 +98,10 @@
 extern Bool VG_(search_transtab) ( /*OUT*/Addr*  res_hcode,
                                    /*OUT*/UInt*  res_sNo,
                                    /*OUT*/UInt*  res_tteNo,
-                                   Addr64        guest_addr, 
+                                   Addr          guest_addr, 
                                    Bool          upd_cache );
 
-extern void VG_(discard_translations) ( Addr64 start, ULong range,
+extern void VG_(discard_translations) ( Addr  start, ULong range,
                                         const HChar* who );
 
 extern void VG_(print_tt_tc_stats) ( void );
@@ -113,17 +113,17 @@
 
 extern
 void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge,
-                                   Addr64           entry,
+                                   Addr             entry,
                                    Addr             code,
                                    UInt             code_len );
 extern 
 Bool VG_(search_unredir_transtab) ( /*OUT*/Addr*  result,
-                                    Addr64        guest_addr );
+                                    Addr          guest_addr );
 
 // SB profiling stuff
 
 typedef struct _SBProfEntry {
-   Addr64 addr;
+   Addr   addr;
    ULong  score;
 } SBProfEntry;
 
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index 6f84ca4..3952f29 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -64,8 +64,8 @@
 */
 typedef 
    struct {
-      Addr64   nraddr; /* non-redirected guest address */
-      Addr64   readdr; /* redirected guest address */
+      Addr     nraddr; /* non-redirected guest address */
+      Addr     readdr; /* redirected guest address */
       ThreadId tid;    /* tid requesting translation */
    }
    VgCallbackClosure;
@@ -381,7 +381,7 @@
    //   translation, and so could be covered by the "extents" of more than
    //   one call to this function.
    // Doing it the first way (as eg. Cachegrind does) is probably easier.
-   void (*discard_superblock_info)(Addr64 orig_addr, VexGuestExtents extents)
+   void (*discard_superblock_info)(Addr orig_addr, VexGuestExtents extents)
 );
 
 /* Tool defines its own command line options? */