From: Julian Seward Date: Sun, 24 Dec 2006 02:24:11 +0000 (+0000) Subject: Non-functional commit: track IR renaming in vex r1689. X-Git-Tag: svn/VALGRIND_3_3_0~470 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1083ded7e266ae75ff06c240391dee8f693b2cba;p=thirdparty%2Fvalgrind.git Non-functional commit: track IR renaming in vex r1689. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6416 --- diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index f61c801ccd..a9d92a5c12 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -115,11 +115,11 @@ static OSet* CC_table; //------------------------------------------------------------ // Primary data structure #2: InstrInfo table // - Holds the cached info about each instr that is used for simulation. -// - table(BB_start_addr, list(InstrInfo)) -// - For each BB, each InstrInfo in the list holds info about the +// - table(SB_start_addr, list(InstrInfo)) +// - For each SB, each InstrInfo in the list holds info about the // instruction (instrLen, instrAddr, etc), plus a pointer to its line // CC. This node is what's passed to the simulation function. -// - When BBs are discarded the relevant list(instr_details) is freed. +// - When SBs are discarded the relevant list(instr_details) is freed. typedef struct _InstrInfo InstrInfo; struct _InstrInfo { @@ -128,9 +128,9 @@ struct _InstrInfo { LineCC* parent; // parent line-CC }; -typedef struct _BB_info BB_info; -struct _BB_info { - Addr BB_addr; // key; MUST BE FIRST +typedef struct _SB_info SB_info; +struct _SB_info { + Addr SB_addr; // key; MUST BE FIRST Int n_instrs; InstrInfo instrs[0]; }; @@ -407,13 +407,13 @@ typedef Int events_used; /* The array of InstrInfo bins for the BB. */ - BB_info* bbInfo; + SB_info* sbInfo; /* Number InstrInfo bins 'used' so far. */ - Int bbInfo_i; + Int sbInfo_i; - /* The output BB being constructed. */ - IRBB* bbOut; + /* The output SB being constructed. */ + IRSB* sbOut; } CgState; @@ -425,16 +425,16 @@ typedef // Note that origAddr is the real origAddr, not the address of the first // instruction in the block (they can be different due to redirection). static -BB_info* get_BB_info(IRBB* bbIn, Addr origAddr) +SB_info* get_SB_info(IRSB* sbIn, Addr origAddr) { Int i, n_instrs; IRStmt* st; - BB_info* bbInfo; + SB_info* sbInfo; - // Count number of original instrs in BB + // Count number of original instrs in SB n_instrs = 0; - for (i = 0; i < bbIn->stmts_used; i++) { - st = bbIn->stmts[i]; + for (i = 0; i < sbIn->stmts_used; i++) { + st = sbIn->stmts[i]; if (Ist_IMark == st->tag) n_instrs++; } @@ -442,19 +442,19 @@ BB_info* get_BB_info(IRBB* bbIn, Addr origAddr) // If this assertion fails, there has been some screwup: some // translations must have been discarded but Cachegrind hasn't discarded // the corresponding entries in the instr-info table. - bbInfo = VG_(OSet_Lookup)(instrInfoTable, &origAddr); - tl_assert(NULL == bbInfo); + sbInfo = VG_(OSet_Lookup)(instrInfoTable, &origAddr); + tl_assert(NULL == sbInfo); // BB never translated before (at this address, at least; could have // been unloaded and then reloaded elsewhere in memory) - bbInfo = VG_(OSet_AllocNode)(instrInfoTable, - sizeof(BB_info) + n_instrs*sizeof(InstrInfo)); - bbInfo->BB_addr = origAddr; - bbInfo->n_instrs = n_instrs; - VG_(OSet_Insert)( instrInfoTable, bbInfo ); + sbInfo = VG_(OSet_AllocNode)(instrInfoTable, + sizeof(SB_info) + n_instrs*sizeof(InstrInfo)); + sbInfo->SB_addr = origAddr; + sbInfo->n_instrs = n_instrs; + VG_(OSet_Insert)( instrInfoTable, sbInfo ); distinct_instrs++; - return bbInfo; + return sbInfo; } @@ -490,20 +490,20 @@ static InstrInfo* setup_InstrInfo ( CgState* cgs, Addr instr_addr, UInt instr_len ) { InstrInfo* i_node; - tl_assert(cgs->bbInfo_i >= 0); - tl_assert(cgs->bbInfo_i < cgs->bbInfo->n_instrs); - i_node = &cgs->bbInfo->instrs[ cgs->bbInfo_i ]; + tl_assert(cgs->sbInfo_i >= 0); + tl_assert(cgs->sbInfo_i < cgs->sbInfo->n_instrs); + i_node = &cgs->sbInfo->instrs[ cgs->sbInfo_i ]; i_node->instr_addr = instr_addr; i_node->instr_len = instr_len; i_node->parent = get_lineCC(instr_addr); - cgs->bbInfo_i++; + cgs->sbInfo_i++; return i_node; } /* Generate code for all outstanding memory events, and mark the queue empty. Code is generated into cgs->bbOut, and this activity - 'consumes' slots in cgs->bbInfo. */ + 'consumes' slots in cgs->sbInfo. */ static void flushEvents ( CgState* cgs ) { @@ -632,7 +632,7 @@ static void flushEvents ( CgState* cgs ) di = unsafeIRDirty_0_N( regparms, helperName, VG_(fnptr_to_fnentry)( helperAddr ), argv ); - addStmtToIRBB( cgs->bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( cgs->sbOut, IRStmt_Dirty(di) ); } cgs->events_used = 0; @@ -706,8 +706,8 @@ void addEvent_Dw ( CgState* cgs, InstrInfo* inode, Int datasize, IRAtom* ea ) static -IRBB* cg_instrument ( VgCallbackClosure* closure, - IRBB* bbIn, +IRSB* cg_instrument ( VgCallbackClosure* closure, + IRSB* sbIn, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) @@ -716,7 +716,7 @@ IRBB* cg_instrument ( VgCallbackClosure* closure, IRStmt* st; Addr64 cia; /* address of current insn */ CgState cgs; - IRTypeEnv* tyenv = bbIn->tyenv; + IRTypeEnv* tyenv = sbIn->tyenv; InstrInfo* curr_inode = NULL; if (gWordTy != hWordTy) { @@ -724,37 +724,37 @@ IRBB* cg_instrument ( VgCallbackClosure* closure, VG_(tool_panic)("host/guest word size mismatch"); } - // Set up new BB - cgs.bbOut = dopyIRBBExceptStmts(bbIn); + // Set up new SB + cgs.sbOut = deepCopyIRSBExceptStmts(sbIn); // Copy verbatim any IR preamble preceding the first IMark i = 0; - while (i < bbIn->stmts_used && bbIn->stmts[i]->tag != Ist_IMark) { - addStmtToIRBB( cgs.bbOut, bbIn->stmts[i] ); + while (i < sbIn->stmts_used && sbIn->stmts[i]->tag != Ist_IMark) { + addStmtToIRSB( cgs.sbOut, sbIn->stmts[i] ); i++; } // Get the first statement, and initial cia from it - tl_assert(bbIn->stmts_used > 0); - tl_assert(i < bbIn->stmts_used); - st = bbIn->stmts[i]; + tl_assert(sbIn->stmts_used > 0); + tl_assert(i < sbIn->stmts_used); + st = sbIn->stmts[i]; tl_assert(Ist_IMark == st->tag); cia = st->Ist.IMark.addr; // Set up running state and get block info tl_assert(closure->readdr == vge->base[0]); cgs.events_used = 0; - cgs.bbInfo = get_BB_info(bbIn, (Addr)closure->readdr); - cgs.bbInfo_i = 0; + cgs.sbInfo = get_SB_info(sbIn, (Addr)closure->readdr); + cgs.sbInfo_i = 0; if (DEBUG_CG) VG_(printf)("\n\n---------- cg_instrument ----------\n"); // Traverse the block, initialising inodes, adding events and flushing as // necessary. - for (/*use current i*/; i < bbIn->stmts_used; i++) { + for (/*use current i*/; i < sbIn->stmts_used; i++) { - st = bbIn->stmts[i]; + st = sbIn->stmts[i]; tl_assert(isFlatIRStmt(st)); switch (st->tag) { @@ -785,8 +785,8 @@ IRBB* cg_instrument ( VgCallbackClosure* closure, addEvent_Ir( &cgs, curr_inode ); break; - case Ist_Tmp: { - IRExpr* data = st->Ist.Tmp.data; + case Ist_WrTmp: { + IRExpr* data = st->Ist.WrTmp.data; if (data->tag == Iex_Load) { IRExpr* aexpr = data->Iex.Load.addr; // Note also, endianness info is ignored. I guess @@ -842,7 +842,7 @@ IRBB* cg_instrument ( VgCallbackClosure* closure, } /* Copy the original statement */ - addStmtToIRBB( cgs.bbOut, st ); + addStmtToIRSB( cgs.sbOut, st ); if (DEBUG_CG) { ppIRStmt(st); @@ -854,17 +854,17 @@ IRBB* cg_instrument ( VgCallbackClosure* closure, flushEvents( &cgs ); /* done. stay sane ... */ - tl_assert(cgs.bbInfo_i == cgs.bbInfo->n_instrs); + tl_assert(cgs.sbInfo_i == cgs.sbInfo->n_instrs); if (DEBUG_CG) { VG_(printf)( "goto {"); - ppIRJumpKind(bbIn->jumpkind); + ppIRJumpKind(sbIn->jumpkind); VG_(printf)( "} "); - ppIRExpr( bbIn->next ); + ppIRExpr( sbIn->next ); VG_(printf)( "}\n"); } - return cgs.bbOut; + return cgs.sbOut; } /*------------------------------------------------------------*/ @@ -1232,9 +1232,9 @@ static void cg_fini(Int exitcode) // 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_basic_block_info ( Addr64 orig_addr64, VexGuestExtents vge ) +void cg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge ) { - BB_info* bbInfo; + SB_info* sbInfo; Addr orig_addr = (Addr)vge.base[0]; tl_assert(vge.n_used > 0); @@ -1246,9 +1246,9 @@ void cg_discard_basic_block_info ( Addr64 orig_addr64, VexGuestExtents vge ) // Get BB info, remove from table, free BB info. Simple! Note that we // use orig_addr, not the first instruction address in vge. - bbInfo = VG_(OSet_Remove)(instrInfoTable, &orig_addr); - tl_assert(NULL != bbInfo); - VG_(OSet_FreeNode)(instrInfoTable, bbInfo); + sbInfo = VG_(OSet_Remove)(instrInfoTable, &orig_addr); + tl_assert(NULL != sbInfo); + VG_(OSet_FreeNode)(instrInfoTable, sbInfo); } /*--------------------------------------------------------------------*/ @@ -1349,7 +1349,7 @@ static void cg_pre_clo_init(void) cg_instrument, cg_fini); - VG_(needs_basic_block_discards)(cg_discard_basic_block_info); + VG_(needs_superblock_discards)(cg_discard_superblock_info); VG_(needs_command_line_options)(cg_process_cmd_line_option, cg_print_usage, cg_print_debug_usage); diff --git a/callgrind/bb.c b/callgrind/bb.c index 32b1dfebf8..d3258bcbec 100644 --- a/callgrind/bb.c +++ b/callgrind/bb.c @@ -235,7 +235,7 @@ obj_node* obj_of_address(Addr addr) * bbIn==0 is possible for artifical BB without real code. * Such a BB is created when returning to an unknown function. */ -BB* CLG_(get_bb)(Addr addr, IRBB* bbIn, /*OUT*/ Bool *seen_before) +BB* CLG_(get_bb)(Addr addr, IRSB* bbIn, /*OUT*/ Bool *seen_before) { BB* bb; obj_node* obj; diff --git a/callgrind/global.h b/callgrind/global.h index 96d3f251c0..810a5d09af 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -668,7 +668,7 @@ void CLG_(init_eventsets)(Int user); /* from main.c */ Bool CLG_(get_debug_info)(Addr, Char filename[FILENAME_LEN], Char fn_name[FN_NAME_LEN], UInt*, SegInfo**); -void CLG_(collectBlockInfo)(IRBB* bbIn, UInt*, UInt*, Bool*); +void CLG_(collectBlockInfo)(IRSB* bbIn, UInt*, UInt*, Bool*); void CLG_(set_instrument_state)(Char*,Bool); void CLG_(dump_profile)(Char* trigger,Bool only_current_thread); void CLG_(zero_all_cost)(Bool only_current_thread); @@ -683,7 +683,7 @@ void CLG_(finish_command)(void); /* from bb.c */ void CLG_(init_bb_hash)(void); bb_hash* CLG_(get_bb_hash)(void); -BB* CLG_(get_bb)(Addr addr, IRBB* bb_in, Bool *seen_before); +BB* CLG_(get_bb)(Addr addr, IRSB* bb_in, Bool *seen_before); void CLG_(delete_bb)(Addr addr); static __inline__ Addr bb_addr(BB* bb) diff --git a/callgrind/main.c b/callgrind/main.c index b18147e036..5b31e90323 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -112,7 +112,7 @@ static Bool loadStoreAddrsMatch(IRExpr* loadAddrExpr, IRExpr* storeAddrExpr) } static -EventSet* insert_simcall(IRBB* bbOut, InstrInfo* ii, UInt dataSize, +EventSet* insert_simcall(IRSB* bbOut, InstrInfo* ii, UInt dataSize, Bool instrIssued, IRExpr* loadAddrExpr, IRExpr* storeAddrExpr) { @@ -228,7 +228,7 @@ EventSet* insert_simcall(IRBB* bbOut, InstrInfo* ii, UInt dataSize, di = unsafeIRDirty_0_N( argc, helperName, VG_(fnptr_to_fnentry)( helperAddr ), argv); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); return es; } @@ -239,7 +239,7 @@ EventSet* insert_simcall(IRBB* bbOut, InstrInfo* ii, UInt dataSize, * Fills the InstrInfo struct if not seen before */ static -void endOfInstr(IRBB* bbOut, InstrInfo* ii, Bool bb_seen_before, +void endOfInstr(IRSB* bbOut, InstrInfo* ii, Bool bb_seen_before, UInt instr_offset, UInt instrLen, UInt dataSize, UInt* cost_offset, Bool instrIssued, IRExpr* loadAddrExpr, IRExpr* storeAddrExpr) @@ -344,7 +344,7 @@ Addr IRConst2Addr(IRConst* con) * * Called from CLG_(get_bb) */ -void CLG_(collectBlockInfo)(IRBB* bbIn, +void CLG_(collectBlockInfo)(IRSB* bbIn, /*INOUT*/ UInt* instrs, /*INOUT*/ UInt* cjmps, /*INOUT*/ Bool* cjmp_inverted) @@ -389,7 +389,7 @@ void CLG_(collectBlockInfo)(IRBB* bbIn, } static -void collectStatementInfo(IRTypeEnv* tyenv, IRBB* bbOut, IRStmt* st, +void collectStatementInfo(IRTypeEnv* tyenv, IRSB* bbOut, IRStmt* st, Addr* instrAddr, UInt* instrLen, IRExpr** loadAddrExpr, IRExpr** storeAddrExpr, UInt* dataSize, IRType hWordTy) @@ -419,8 +419,8 @@ void collectStatementInfo(IRTypeEnv* tyenv, IRBB* bbOut, IRStmt* st, *instrLen = st->Ist.IMark.len; break; - case Ist_Tmp: { - IRExpr* data = st->Ist.Tmp.data; + case Ist_WrTmp: { + IRExpr* data = st->Ist.WrTmp.data; if (data->tag == Iex_Load) { IRExpr* aexpr = data->Iex.Load.addr; CLG_ASSERT( isIRAtom(aexpr) ); @@ -481,9 +481,9 @@ void collectStatementInfo(IRTypeEnv* tyenv, IRBB* bbOut, IRStmt* st, } static -void addConstMemStoreStmt( IRBB* bbOut, UWord addr, UInt val, IRType hWordTy) +void addConstMemStoreStmt( IRSB* bbOut, UWord addr, UInt val, IRType hWordTy) { - addStmtToIRBB( bbOut, + addStmtToIRSB( bbOut, IRStmt_Store(CLGEndness, IRExpr_Const(hWordTy == Ity_I32 ? IRConst_U32( addr ) : @@ -492,14 +492,14 @@ void addConstMemStoreStmt( IRBB* bbOut, UWord addr, UInt val, IRType hWordTy) } static -IRBB* CLG_(instrument)( VgCallbackClosure* closure, - IRBB* bbIn, +IRSB* CLG_(instrument)( VgCallbackClosure* closure, + IRSB* bbIn, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { Int i; - IRBB* bbOut; + IRSB* bbOut; IRStmt* st, *stnext; Addr instrAddr, origAddr; UInt instrLen = 0, dataSize; @@ -529,13 +529,13 @@ IRBB* CLG_(instrument)( VgCallbackClosure* closure, CLG_DEBUG(3, "+ instrument(BB %p)\n", (Addr)closure->readdr); - /* Set up BB for instrumented IR */ - bbOut = dopyIRBBExceptStmts(bbIn); + /* Set up SB for instrumented IR */ + bbOut = deepCopyIRSBExceptStmts(bbIn); // Copy verbatim any IR preamble preceding the first IMark i = 0; while (i < bbIn->stmts_used && bbIn->stmts[i]->tag != Ist_IMark) { - addStmtToIRBB( bbOut, bbIn->stmts[i] ); + addStmtToIRSB( bbOut, bbIn->stmts[i] ); i++; } @@ -580,7 +580,7 @@ IRBB* CLG_(instrument)( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 1, "setup_bbcc", VG_(fnptr_to_fnentry)( & CLG_(setup_bbcc) ), argv); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); instrCount = 0; costOffset = 0; @@ -640,7 +640,7 @@ IRBB* CLG_(instrument)( VgCallbackClosure* closure, cJumps++; } - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); st = stnext; } while (!beforeIBoundary); @@ -701,14 +701,14 @@ IRBB* CLG_(instrument)( VgCallbackClosure* closure, // 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_basic_block_info ( Addr64 orig_addr64, VexGuestExtents vge ) +void clg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge ) { Addr orig_addr = (Addr)orig_addr64; tl_assert(vge.n_used > 0); if (0) - VG_(printf)( "discard_basic_block_info: %p, %p, %llu\n", + VG_(printf)( "discard_superblock_info: %p, %p, %llu\n", (void*)(Addr)orig_addr, (void*)(Addr)vge.base[0], (ULong)vge.len[0]); @@ -1096,7 +1096,7 @@ void CLG_(pre_clo_init)(void) CLG_(instrument), CLG_(fini)); - VG_(needs_basic_block_discards)(clg_discard_basic_block_info); + VG_(needs_superblock_discards)(clg_discard_superblock_info); VG_(needs_command_line_options)(CLG_(process_cmd_line_option), diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 4dbf196ca8..cb0bef9943 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -40,7 +40,7 @@ VgToolInterface VG_(tdict); void VG_(basic_tool_funcs)( void(*post_clo_init)(void), - IRBB*(*instrument)(VgCallbackClosure*, IRBB*, + IRSB*(*instrument)(VgCallbackClosure*, IRSB*, VexGuestLayout*, VexGuestExtents*, IRType, IRType), void(*fini)(Int) ) @@ -86,7 +86,7 @@ VgNeeds VG_(needs) = { .core_errors = False, .tool_errors = False, .libc_freeres = False, - .basic_block_discards = False, + .superblock_discards = False, .command_line_options = False, .client_requests = False, .syscall_wrapper = False, @@ -164,12 +164,12 @@ NEEDS(core_errors) NEEDS(data_syms) NEEDS(xml_output) -void VG_(needs_basic_block_discards)( +void VG_(needs_superblock_discards)( void (*discard)(Addr64, VexGuestExtents) ) { - VG_(needs).basic_block_discards = True; - VG_(tdict).tool_discard_basic_block_info = discard; + VG_(needs).superblock_discards = True; + VG_(tdict).tool_discard_superblock_info = discard; } void VG_(needs_tool_errors)( diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 45bf33c6c6..1eab5185f0 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -208,26 +208,26 @@ static void update_SP_aliases(Long delta) we fall back to the case that handles an unknown SP change. */ static -IRBB* vg_SP_update_pass ( void* closureV, - IRBB* bb_in, +IRSB* vg_SP_update_pass ( void* closureV, + IRSB* sb_in, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { - Int i, j, minoff_ST, maxoff_ST, sizeof_SP, offset_SP; - IRDirty *dcall, *d; - IRStmt* st; - IRExpr* e; - IRArray* descr; - IRType typeof_SP; - Long delta, con; + Int i, j, minoff_ST, maxoff_ST, sizeof_SP, offset_SP; + IRDirty *dcall, *d; + IRStmt* st; + IRExpr* e; + IRRegArray* descr; + IRType typeof_SP; + Long delta, con; /* Set up BB */ - IRBB* bb = emptyIRBB(); - bb->tyenv = dopyIRTypeEnv(bb_in->tyenv); - bb->next = dopyIRExpr(bb_in->next); - bb->jumpkind = bb_in->jumpkind; + IRSB* bb = emptyIRSB(); + bb->tyenv = deepCopyIRTypeEnv(sb_in->tyenv); + bb->next = deepCopyIRExpr(sb_in->next); + bb->jumpkind = sb_in->jumpkind; delta = 0; @@ -258,14 +258,14 @@ IRBB* vg_SP_update_pass ( void* closureV, "track_" #kind "_mem_stack_" #syze, \ VG_(fnptr_to_fnentry)( \ VG_(tdict).track_##kind##_mem_stack_##syze ), \ - mkIRExprVec_1(IRExpr_Tmp(tmpp)) \ + mkIRExprVec_1(IRExpr_RdTmp(tmpp)) \ ); \ dcall->nFxState = 1; \ dcall->fxState[0].fx = Ifx_Read; \ dcall->fxState[0].offset = layout->offset_SP; \ dcall->fxState[0].size = layout->sizeof_SP; \ \ - addStmtToIRBB( bb, IRStmt_Dirty(dcall) ); \ + addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \ \ update_SP_aliases(-delta); \ \ @@ -275,75 +275,75 @@ IRBB* vg_SP_update_pass ( void* closureV, clear_SP_aliases(); - for (i = 0; i < bb_in->stmts_used; i++) { + for (i = 0; i < sb_in->stmts_used; i++) { - st = bb_in->stmts[i]; + st = sb_in->stmts[i]; /* t = Get(sp): curr = t, delta = 0 */ - if (st->tag != Ist_Tmp) goto case2; - e = st->Ist.Tmp.data; + if (st->tag != Ist_WrTmp) goto case2; + e = st->Ist.WrTmp.data; if (e->tag != Iex_Get) goto case2; if (e->Iex.Get.offset != offset_SP) goto case2; if (e->Iex.Get.ty != typeof_SP) goto case2; - add_SP_alias(st->Ist.Tmp.tmp, 0); - addStmtToIRBB( bb, st ); + add_SP_alias(st->Ist.WrTmp.tmp, 0); + addStmtToIRSB( bb, st ); continue; case2: /* t' = curr +/- const: curr = t', delta +=/-= const */ - if (st->tag != Ist_Tmp) goto case3; - e = st->Ist.Tmp.data; + if (st->tag != Ist_WrTmp) goto case3; + e = st->Ist.WrTmp.data; if (e->tag != Iex_Binop) goto case3; - if (e->Iex.Binop.arg1->tag != Iex_Tmp) goto case3; - if (!get_SP_delta(e->Iex.Binop.arg1->Iex.Tmp.tmp, &delta)) goto case3; + if (e->Iex.Binop.arg1->tag != Iex_RdTmp) goto case3; + if (!get_SP_delta(e->Iex.Binop.arg1->Iex.RdTmp.tmp, &delta)) goto case3; if (e->Iex.Binop.arg2->tag != Iex_Const) goto case3; if (!IS_ADD_OR_SUB(e->Iex.Binop.op)) goto case3; con = GET_CONST(e->Iex.Binop.arg2->Iex.Const.con); if (IS_ADD(e->Iex.Binop.op)) { - add_SP_alias(st->Ist.Tmp.tmp, delta + con); + add_SP_alias(st->Ist.WrTmp.tmp, delta + con); } else { - add_SP_alias(st->Ist.Tmp.tmp, delta - con); + add_SP_alias(st->Ist.WrTmp.tmp, delta - con); } - addStmtToIRBB( bb, st ); + addStmtToIRSB( bb, st ); continue; case3: /* t' = curr: curr = t' */ - if (st->tag != Ist_Tmp) goto case4; - e = st->Ist.Tmp.data; - if (e->tag != Iex_Tmp) goto case4; - if (!get_SP_delta(e->Iex.Tmp.tmp, &delta)) goto case4; - add_SP_alias(st->Ist.Tmp.tmp, delta); - addStmtToIRBB( bb, st ); + if (st->tag != Ist_WrTmp) goto case4; + e = st->Ist.WrTmp.data; + if (e->tag != Iex_RdTmp) goto case4; + if (!get_SP_delta(e->Iex.RdTmp.tmp, &delta)) goto case4; + add_SP_alias(st->Ist.WrTmp.tmp, delta); + addStmtToIRSB( bb, st ); continue; case4: /* Put(sp) = curr */ if (st->tag != Ist_Put) goto case5; if (st->Ist.Put.offset != offset_SP) goto case5; - if (st->Ist.Put.data->tag != Iex_Tmp) goto case5; - if (get_SP_delta(st->Ist.Put.data->Iex.Tmp.tmp, &delta)) { - IRTemp tttmp = st->Ist.Put.data->Iex.Tmp.tmp; + if (st->Ist.Put.data->tag != Iex_RdTmp) goto case5; + if (get_SP_delta(st->Ist.Put.data->Iex.RdTmp.tmp, &delta)) { + IRTemp tttmp = st->Ist.Put.data->Iex.RdTmp.tmp; switch (delta) { - case 0: addStmtToIRBB(bb,st); continue; - case 4: DO(die, 4, tttmp); addStmtToIRBB(bb,st); continue; - case -4: DO(new, 4, tttmp); addStmtToIRBB(bb,st); continue; - case 8: DO(die, 8, tttmp); addStmtToIRBB(bb,st); continue; - case -8: DO(new, 8, tttmp); addStmtToIRBB(bb,st); continue; - case 12: DO(die, 12, tttmp); addStmtToIRBB(bb,st); continue; - case -12: DO(new, 12, tttmp); addStmtToIRBB(bb,st); continue; - case 16: DO(die, 16, tttmp); addStmtToIRBB(bb,st); continue; - case -16: DO(new, 16, tttmp); addStmtToIRBB(bb,st); continue; - case 32: DO(die, 32, tttmp); addStmtToIRBB(bb,st); continue; - case -32: DO(new, 32, tttmp); addStmtToIRBB(bb,st); continue; - case 112: DO(die, 112, tttmp); addStmtToIRBB(bb,st); continue; - case -112: DO(new, 112, tttmp); addStmtToIRBB(bb,st); continue; - case 128: DO(die, 128, tttmp); addStmtToIRBB(bb,st); continue; - case -128: DO(new, 128, tttmp); addStmtToIRBB(bb,st); continue; - case 144: DO(die, 144, tttmp); addStmtToIRBB(bb,st); continue; - case -144: DO(new, 144, tttmp); addStmtToIRBB(bb,st); continue; - case 160: DO(die, 160, tttmp); addStmtToIRBB(bb,st); continue; - case -160: DO(new, 160, tttmp); addStmtToIRBB(bb,st); continue; + case 0: addStmtToIRSB(bb,st); continue; + case 4: DO(die, 4, tttmp); addStmtToIRSB(bb,st); continue; + case -4: DO(new, 4, tttmp); addStmtToIRSB(bb,st); continue; + case 8: DO(die, 8, tttmp); addStmtToIRSB(bb,st); continue; + case -8: DO(new, 8, tttmp); addStmtToIRSB(bb,st); continue; + case 12: DO(die, 12, tttmp); addStmtToIRSB(bb,st); continue; + case -12: DO(new, 12, tttmp); addStmtToIRSB(bb,st); continue; + case 16: DO(die, 16, tttmp); addStmtToIRSB(bb,st); continue; + case -16: DO(new, 16, tttmp); addStmtToIRSB(bb,st); continue; + case 32: DO(die, 32, tttmp); addStmtToIRSB(bb,st); continue; + case -32: DO(new, 32, tttmp); addStmtToIRSB(bb,st); continue; + case 112: DO(die, 112, tttmp); addStmtToIRSB(bb,st); continue; + case -112: DO(new, 112, tttmp); addStmtToIRSB(bb,st); continue; + case 128: DO(die, 128, tttmp); addStmtToIRSB(bb,st); continue; + case -128: DO(new, 128, tttmp); addStmtToIRSB(bb,st); continue; + case 144: DO(die, 144, tttmp); addStmtToIRSB(bb,st); continue; + case -144: DO(new, 144, tttmp); addStmtToIRSB(bb,st); continue; + case 160: DO(die, 160, tttmp); addStmtToIRSB(bb,st); continue; + case -160: DO(new, 160, tttmp); addStmtToIRSB(bb,st); continue; default: /* common values for ppc64: 144 128 160 112 176 */ n_SP_updates_generic_known++; @@ -359,23 +359,23 @@ IRBB* vg_SP_update_pass ( void* closureV, generic: /* Pass both the old and new SP values to this helper. */ old_SP = newIRTemp(bb->tyenv, typeof_SP); - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_Tmp( old_SP, IRExpr_Get(offset_SP, typeof_SP) ) + IRStmt_WrTmp( old_SP, IRExpr_Get(offset_SP, typeof_SP) ) ); dcall = unsafeIRDirty_0_N( 2/*regparms*/, "VG_(unknown_SP_update)", VG_(fnptr_to_fnentry)( &VG_(unknown_SP_update) ), - mkIRExprVec_2( IRExpr_Tmp(old_SP), st->Ist.Put.data ) + mkIRExprVec_2( IRExpr_RdTmp(old_SP), st->Ist.Put.data ) ); - addStmtToIRBB( bb, IRStmt_Dirty(dcall) ); + addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); - addStmtToIRBB( bb, st ); + addStmtToIRSB( bb, st ); clear_SP_aliases(); - add_SP_alias(st->Ist.Put.data->Iex.Tmp.tmp, 0); + add_SP_alias(st->Ist.Put.data->Iex.RdTmp.tmp, 0); continue; } @@ -403,9 +403,9 @@ IRBB* vg_SP_update_pass ( void* closureV, } /* well, not interesting. Just copy and keep going. */ - addStmtToIRBB( bb, st ); + addStmtToIRSB( bb, st ); - } /* for (i = 0; i < bb_in->stmts_used; i++) */ + } /* for (i = 0; i < sb_in->stmts_used; i++) */ return bb; @@ -617,11 +617,11 @@ static IRExpr* narrowTo32 ( IRTypeEnv* tyenv, IRExpr* e ) { redir stack, checking for stack overflow and generating code to bomb out if so. */ -static void gen_PUSH ( IRBB* bb, IRExpr* e ) +static void gen_PUSH ( IRSB* bb, IRExpr* e ) { - IRArray* descr; - IRTemp t1; - IRExpr* one; + IRRegArray* descr; + IRTemp t1; + IRExpr* one; # if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5) Int stack_size = VEX_GUEST_PPC64_REDIR_STACK_SIZE; @@ -655,16 +655,16 @@ static void gen_PUSH ( IRBB* bb, IRExpr* e ) vg_assert(sizeof(Word) == VG_WORDSIZE); vg_assert(sizeof(Addr) == VG_WORDSIZE); - descr = mkIRArray( offB_REDIR_STACK, ty_Word, stack_size ); + descr = mkIRRegArray( offB_REDIR_STACK, ty_Word, stack_size ); t1 = newIRTemp( bb->tyenv, ty_Word ); one = mkU(1); vg_assert(typeOfIRExpr(bb->tyenv, e) == ty_Word); /* t1 = guest_REDIR_SP + 1 */ - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_Tmp( + IRStmt_WrTmp( t1, IRExpr_Binop(op_Add, IRExpr_Get( offB_REDIR_SP, ty_Word ), one) ) @@ -675,18 +675,18 @@ static void gen_PUSH ( IRBB* bb, IRExpr* e ) this is an unrecoverable error and will lead to Valgrind shutting down. _EMWARN is set regardless - that's harmless since is only has a meaning if the exit is taken. */ - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put(offB_EMWARN, mkU32(EmWarn_PPC64_redir_overflow)) ); - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Exit( IRExpr_Binop( op_CmpNE, IRExpr_Binop( op_Sar, - IRExpr_Binop(op_Sub,mkU(stack_size-1),IRExpr_Tmp(t1)), + IRExpr_Binop(op_Sub,mkU(stack_size-1),IRExpr_RdTmp(t1)), mkU8(8 * VG_WORDSIZE - 1) ), mkU(0) @@ -697,13 +697,13 @@ static void gen_PUSH ( IRBB* bb, IRExpr* e ) ); /* guest_REDIR_SP = t1 */ - addStmtToIRBB(bb, IRStmt_Put(offB_REDIR_SP, IRExpr_Tmp(t1))); + addStmtToIRSB(bb, IRStmt_Put(offB_REDIR_SP, IRExpr_RdTmp(t1))); /* guest_REDIR_STACK[t1+0] = e */ /* PutI/GetI have I32-typed indexes regardless of guest word size */ - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_PutI(descr, narrowTo32(bb->tyenv,IRExpr_Tmp(t1)), 0, e) + IRStmt_PutI(descr, narrowTo32(bb->tyenv,IRExpr_RdTmp(t1)), 0, e) ); } @@ -712,7 +712,7 @@ static void gen_PUSH ( IRBB* bb, IRExpr* e ) stack, binding it to a new temporary, which is returned. As with gen_PUSH, an overflow check is also performed. */ -static IRTemp gen_POP ( IRBB* bb ) +static IRTemp gen_POP ( IRSB* bb ) { # if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5) Int stack_size = VEX_GUEST_PPC64_REDIR_STACK_SIZE; @@ -738,34 +738,34 @@ static IRTemp gen_POP ( IRBB* bb ) IRExpr*(*mkU)(UInt) = mkU32; # endif - IRArray* descr = mkIRArray( offB_REDIR_STACK, ty_Word, stack_size ); - IRTemp t1 = newIRTemp( bb->tyenv, ty_Word ); - IRTemp res = newIRTemp( bb->tyenv, ty_Word ); - IRExpr* one = mkU(1); + IRRegArray* descr = mkIRRegArray( offB_REDIR_STACK, ty_Word, stack_size ); + IRTemp t1 = newIRTemp( bb->tyenv, ty_Word ); + IRTemp res = newIRTemp( bb->tyenv, ty_Word ); + IRExpr* one = mkU(1); vg_assert(sizeof(void*) == VG_WORDSIZE); vg_assert(sizeof(Word) == VG_WORDSIZE); vg_assert(sizeof(Addr) == VG_WORDSIZE); /* t1 = guest_REDIR_SP */ - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_Tmp( t1, IRExpr_Get( offB_REDIR_SP, ty_Word ) ) + IRStmt_WrTmp( t1, IRExpr_Get( offB_REDIR_SP, ty_Word ) ) ); /* Bomb out if t1 < 0. Same comments as gen_PUSH apply. */ - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put(offB_EMWARN, mkU32(EmWarn_PPC64_redir_underflow)) ); - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Exit( IRExpr_Binop( op_CmpNE, IRExpr_Binop( op_Sar, - IRExpr_Tmp(t1), + IRExpr_RdTmp(t1), mkU8(8 * VG_WORDSIZE - 1) ), mkU(0) @@ -777,18 +777,18 @@ static IRTemp gen_POP ( IRBB* bb ) /* res = guest_REDIR_STACK[t1+0] */ /* PutI/GetI have I32-typed indexes regardless of guest word size */ - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_Tmp( + IRStmt_WrTmp( res, - IRExpr_GetI(descr, narrowTo32(bb->tyenv,IRExpr_Tmp(t1)), 0) + IRExpr_GetI(descr, narrowTo32(bb->tyenv,IRExpr_RdTmp(t1)), 0) ) ); /* guest_REDIR_SP = t1-1 */ - addStmtToIRBB( + addStmtToIRSB( bb, - IRStmt_Put(offB_REDIR_SP, IRExpr_Binop(op_Sub, IRExpr_Tmp(t1), one)) + IRStmt_Put(offB_REDIR_SP, IRExpr_Binop(op_Sub, IRExpr_RdTmp(t1), one)) ); return res; @@ -801,7 +801,7 @@ static IRTemp gen_POP ( IRBB* bb ) intercept the return and restore R2 and L2 to the values saved here. */ -static void gen_push_and_set_LR_R2 ( IRBB* bb, Addr64 new_R2_value ) +static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr64 new_R2_value ) { # if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5) Addr64 bogus_RA = (Addr64)&VG_(ppctoc_magic_redirect_return_stub); @@ -809,8 +809,8 @@ static void gen_push_and_set_LR_R2 ( IRBB* bb, Addr64 new_R2_value ) Int offB_LR = offsetof(VexGuestPPC64State,guest_LR); gen_PUSH( bb, IRExpr_Get(offB_LR, Ity_I64) ); gen_PUSH( bb, IRExpr_Get(offB_GPR2, Ity_I64) ); - addStmtToIRBB( bb, IRStmt_Put( offB_LR, mkU64( bogus_RA )) ); - addStmtToIRBB( bb, IRStmt_Put( offB_GPR2, mkU64( new_R2_value )) ); + addStmtToIRSB( bb, IRStmt_Put( offB_LR, mkU64( bogus_RA )) ); + addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, mkU64( new_R2_value )) ); # elif defined(VGP_ppc32_aix5) Addr32 bogus_RA = (Addr32)&VG_(ppctoc_magic_redirect_return_stub); @@ -818,15 +818,15 @@ static void gen_push_and_set_LR_R2 ( IRBB* bb, Addr64 new_R2_value ) Int offB_LR = offsetof(VexGuestPPC32State,guest_LR); gen_PUSH( bb, IRExpr_Get(offB_LR, Ity_I32) ); gen_PUSH( bb, IRExpr_Get(offB_GPR2, Ity_I32) ); - addStmtToIRBB( bb, IRStmt_Put( offB_LR, mkU32( bogus_RA )) ); - addStmtToIRBB( bb, IRStmt_Put( offB_GPR2, mkU32( new_R2_value )) ); + addStmtToIRSB( bb, IRStmt_Put( offB_LR, mkU32( bogus_RA )) ); + addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, mkU32( new_R2_value )) ); # else # error Platform is not TOC-afflicted, fortunately # endif } -static void gen_pop_R2_LR_then_bLR ( IRBB* bb ) +static void gen_pop_R2_LR_then_bLR ( IRSB* bb ) { # if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5) Int offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2); @@ -835,16 +835,16 @@ static void gen_pop_R2_LR_then_bLR ( IRBB* bb ) IRTemp old_LR = newIRTemp( bb->tyenv, Ity_I64 ); /* Restore R2 */ old_R2 = gen_POP( bb ); - addStmtToIRBB( bb, IRStmt_Put( offB_GPR2, IRExpr_Tmp(old_R2)) ); + addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, IRExpr_RdTmp(old_R2)) ); /* Restore LR */ old_LR = gen_POP( bb ); - addStmtToIRBB( bb, IRStmt_Put( offB_LR, IRExpr_Tmp(old_LR)) ); + addStmtToIRSB( bb, IRStmt_Put( offB_LR, IRExpr_RdTmp(old_LR)) ); /* Branch to LR */ /* re boring, we arrived here precisely because a wrapped fn did a blr (hence Ijk_Ret); so we should just mark this jump as Boring, else one _Call will have resulted in two _Rets. */ bb->jumpkind = Ijk_Boring; - bb->next = IRExpr_Binop(Iop_And64, IRExpr_Tmp(old_LR), mkU64(~(3ULL))); + bb->next = IRExpr_Binop(Iop_And64, IRExpr_RdTmp(old_LR), mkU64(~(3ULL))); # elif defined(VGP_ppc32_aix5) Int offB_GPR2 = offsetof(VexGuestPPC32State,guest_GPR2); @@ -853,17 +853,17 @@ static void gen_pop_R2_LR_then_bLR ( IRBB* bb ) IRTemp old_LR = newIRTemp( bb->tyenv, Ity_I32 ); /* Restore R2 */ old_R2 = gen_POP( bb ); - addStmtToIRBB( bb, IRStmt_Put( offB_GPR2, IRExpr_Tmp(old_R2)) ); + addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, IRExpr_RdTmp(old_R2)) ); /* Restore LR */ old_LR = gen_POP( bb ); - addStmtToIRBB( bb, IRStmt_Put( offB_LR, IRExpr_Tmp(old_LR)) ); + addStmtToIRSB( bb, IRStmt_Put( offB_LR, IRExpr_RdTmp(old_LR)) ); /* Branch to LR */ /* re boring, we arrived here precisely because a wrapped fn did a blr (hence Ijk_Ret); so we should just mark this jump as Boring, else one _Call will have resulted in two _Rets. */ bb->jumpkind = Ijk_Boring; - bb->next = IRExpr_Binop(Iop_And32, IRExpr_Tmp(old_LR), mkU32(~3)); + bb->next = IRExpr_Binop(Iop_And32, IRExpr_RdTmp(old_LR), mkU32(~3)); # else # error Platform is not TOC-afflicted, fortunately @@ -871,13 +871,13 @@ static void gen_pop_R2_LR_then_bLR ( IRBB* bb ) } static -Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRBB* bb ) +Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRSB* bb ) { VgCallbackClosure* closure = (VgCallbackClosure*)closureV; - /* Since we're creating the entire IRBB right here, give it a + /* Since we're creating the entire IRSB right here, give it a proper IMark, as it won't get one any other way, and cachegrind will barf if it doesn't have one (fair enough really). */ - addStmtToIRBB( bb, IRStmt_IMark( closure->readdr, 4 ) ); + addStmtToIRSB( bb, IRStmt_IMark( closure->readdr, 4 ) ); /* Generate the magic sequence: pop R2 from hidden stack pop LR from hidden stack @@ -911,13 +911,13 @@ Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRBB* bb ) return stub address, and that in that case it can get the real LR value from the hidden stack instead. */ static -Bool mk_preamble__set_NRADDR_to_zero ( void* closureV, IRBB* bb ) +Bool mk_preamble__set_NRADDR_to_zero ( void* closureV, IRSB* bb ) { Int nraddr_szB = sizeof(((VexGuestArchState*)0)->guest_NRADDR); vg_assert(nraddr_szB == 4 || nraddr_szB == 8); vg_assert(nraddr_szB == VG_WORDSIZE); - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put( offsetof(VexGuestArchState,guest_NRADDR), @@ -926,7 +926,7 @@ Bool mk_preamble__set_NRADDR_to_zero ( void* closureV, IRBB* bb ) ); # if defined(VG_PLAT_USES_PPCTOC) { VgCallbackClosure* closure = (VgCallbackClosure*)closureV; - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put( offsetof(VexGuestArchState,guest_NRADDR_GPR2), @@ -944,14 +944,14 @@ Bool mk_preamble__set_NRADDR_to_zero ( void* closureV, IRBB* bb ) can read _NRADDR and find the address of the function being wrapped. On toc-afflicted platforms we must also snarf r2. */ static -Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRBB* bb ) +Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRSB* bb ) { VgCallbackClosure* closure = (VgCallbackClosure*)closureV; Int nraddr_szB = sizeof(((VexGuestArchState*)0)->guest_NRADDR); vg_assert(nraddr_szB == 4 || nraddr_szB == 8); vg_assert(nraddr_szB == VG_WORDSIZE); - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put( offsetof(VexGuestArchState,guest_NRADDR), @@ -962,7 +962,7 @@ Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRBB* bb ) ); # if defined(VGP_ppc64_linux) || defined(VGP_ppc32_aix5) \ || defined(VGP_ppc64_aix5) - addStmtToIRBB( + addStmtToIRSB( bb, IRStmt_Put( offsetof(VexGuestArchState,guest_NRADDR_GPR2), @@ -1067,10 +1067,10 @@ Bool VG_(translate) ( ThreadId tid, Int tmpbuf_used, verbosity, i; Bool notrace_until_done, do_self_check; UInt notrace_until_limit = 0; - Bool (*preamble_fn)(void*,IRBB*); + Bool (*preamble_fn)(void*,IRSB*); VexArch vex_arch; VexArchInfo vex_archinfo; - VexMiscInfo vex_miscinfo; + VexAbiInfo vex_abiinfo; VexGuestExtents vge; VexTranslateArgs vta; VexTranslateResult tres; @@ -1217,27 +1217,27 @@ Bool VG_(translate) ( ThreadId tid, /* Get the CPU info established at startup. */ VG_(machine_get_VexArchInfo)( &vex_arch, &vex_archinfo ); - /* Set up 'misc info' structure with stuff Vex needs to know about + /* Set up 'abiinfo' structure with stuff Vex needs to know about the guest and host ABIs. */ - LibVEX_default_VexMiscInfo( &vex_miscinfo ); - vex_miscinfo.guest_stack_redzone_size = VG_STACK_REDZONE_SZB; + LibVEX_default_VexAbiInfo( &vex_abiinfo ); + vex_abiinfo.guest_stack_redzone_size = VG_STACK_REDZONE_SZB; # if defined(VGP_ppc32_linux) - vex_miscinfo.guest_ppc_zap_RZ_at_blr = False; - vex_miscinfo.guest_ppc_zap_RZ_at_bl = NULL; - vex_miscinfo.host_ppc32_regalign_int64_args = True; + vex_abiinfo.guest_ppc_zap_RZ_at_blr = False; + vex_abiinfo.guest_ppc_zap_RZ_at_bl = NULL; + vex_abiinfo.host_ppc32_regalign_int64_args = True; # endif # if defined(VGP_ppc64_linux) - vex_miscinfo.guest_ppc_zap_RZ_at_blr = True; - vex_miscinfo.guest_ppc_zap_RZ_at_bl = const_True; - vex_miscinfo.host_ppc_calls_use_fndescrs = True; + vex_abiinfo.guest_ppc_zap_RZ_at_blr = True; + vex_abiinfo.guest_ppc_zap_RZ_at_bl = const_True; + vex_abiinfo.host_ppc_calls_use_fndescrs = True; # endif # if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) - vex_miscinfo.guest_ppc_zap_RZ_at_blr = False; - vex_miscinfo.guest_ppc_zap_RZ_at_bl = bl_RZ_zap_ok_for_AIX; - vex_miscinfo.guest_ppc_sc_continues_at_LR = True; - vex_miscinfo.host_ppc_calls_use_fndescrs = True; + vex_abiinfo.guest_ppc_zap_RZ_at_blr = False; + vex_abiinfo.guest_ppc_zap_RZ_at_bl = bl_RZ_zap_ok_for_AIX; + vex_abiinfo.guest_ppc_sc_continues_at_LR = True; + vex_abiinfo.host_ppc_calls_use_fndescrs = True; # endif /* Set up closure args. */ @@ -1250,7 +1250,7 @@ Bool VG_(translate) ( ThreadId tid, vta.archinfo_guest = vex_archinfo; vta.arch_host = vex_arch; vta.archinfo_host = vex_archinfo; - vta.miscinfo_both = vex_miscinfo; + vta.abiinfo_both = vex_abiinfo; vta.guest_bytes = (UChar*)ULong_to_Ptr(addr); vta.guest_bytes_addr = (Addr64)addr; vta.callback_opaque = (void*)&closure; @@ -1266,14 +1266,14 @@ Bool VG_(translate) ( ThreadId tid, VgCallbackClosure*. Hence the following longwinded casts. They are entirely legal but longwinded so as to maximise the chance of the C typechecker picking up any type snafus. */ - IRBB*(*f)(VgCallbackClosure*, - IRBB*,VexGuestLayout*,VexGuestExtents*, + IRSB*(*f)(VgCallbackClosure*, + IRSB*,VexGuestLayout*,VexGuestExtents*, IRType,IRType) = VG_(tdict).tool_instrument; - IRBB*(*g)(void*, - IRBB*,VexGuestLayout*,VexGuestExtents*, + IRSB*(*g)(void*, + IRSB*,VexGuestLayout*,VexGuestExtents*, IRType,IRType) - = (IRBB*(*)(void*,IRBB*,VexGuestLayout*,VexGuestExtents*,IRType,IRType))f; + = (IRSB*(*)(void*,IRSB*,VexGuestLayout*,VexGuestExtents*,IRType,IRType))f; vta.instrument1 = g; } /* No need for type kludgery here. */ diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index 551aa2350f..f18f91960f 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -701,8 +701,8 @@ static void initialiseSector ( Int sno ) vg_assert(sec->tt[i].n_tte2ec <= 3); n_dump_osize += vge_osize(&sec->tt[i].vge); /* Tell the tool too. */ - if (VG_(needs).basic_block_discards) { - VG_TDICT_CALL( tool_discard_basic_block_info, + if (VG_(needs).superblock_discards) { + VG_TDICT_CALL( tool_discard_superblock_info, sec->tt[i].entry, sec->tt[i].vge ); } @@ -1034,8 +1034,8 @@ static void delete_tte ( /*MOD*/Sector* sec, Int tteno ) n_disc_osize += vge_osize(&tte->vge); /* Tell the tool too. */ - if (VG_(needs).basic_block_discards) { - VG_TDICT_CALL( tool_discard_basic_block_info, + if (VG_(needs).superblock_discards) { + VG_TDICT_CALL( tool_discard_superblock_info, tte->entry, tte->vge ); } diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 603dee1d31..f74f24e32a 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -83,7 +83,7 @@ typedef Bool libc_freeres; Bool core_errors; Bool tool_errors; - Bool basic_block_discards; + Bool superblock_discards; Bool command_line_options; Bool client_requests; Bool syscall_wrapper; @@ -105,8 +105,8 @@ typedef struct { // Basic functions void (*tool_pre_clo_init) (void); void (*tool_post_clo_init)(void); - IRBB* (*tool_instrument) (VgCallbackClosure*, - IRBB*, + IRSB* (*tool_instrument) (VgCallbackClosure*, + IRSB*, VexGuestLayout*, VexGuestExtents*, IRType, IRType); void (*tool_fini) (Int); @@ -124,8 +124,8 @@ typedef struct { Char* (*tool_get_error_name) (Error*); void (*tool_print_extra_suppression_info)(Error*); - // VG_(needs).basic_block_discards - void (*tool_discard_basic_block_info)(Addr64, VexGuestExtents); + // VG_(needs).superblock_discards + void (*tool_discard_superblock_info)(Addr64, VexGuestExtents); // VG_(needs).command_line_options Bool (*tool_process_cmd_line_option)(Char*); diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index cda5858fc6..f4ef59185a 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -2297,8 +2297,8 @@ UCodeBlock* TL_(instrument) ( UCodeBlock* cb_in, Addr not_used ) } #endif static -IRBB* hg_instrument ( VgCallbackClosure* closure, - IRBB* bb, +IRSB* hg_instrument ( VgCallbackClosure* closure, + IRSB* bb, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index a3f1b6ce4b..664a19dde9 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -130,8 +130,8 @@ extern void VG_(basic_tool_funcs)( // with code addresses it will get into deep trouble if it does // make this assumption. // - // IRBB* bb_in is the incoming bb to be instrumented, in flat IR - // form. + // IRSB* sb_in is the incoming superblock to be instrumented, + // in flat IR form. // // VexGuestLayout* layout contains limited info on the layout of // the guest state: where the stack pointer and program counter @@ -232,8 +232,8 @@ extern void VG_(basic_tool_funcs)( comment in MC_(instrument) in memcheck/mc_translate.c for details. */ - IRBB*(*instrument)(VgCallbackClosure* closure, - IRBB* bb_in, + IRSB*(*instrument)(VgCallbackClosure* closure, + IRSB* sb_in, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, @@ -345,7 +345,7 @@ extern void VG_(needs_tool_errors) ( .so unloading, or otherwise at the discretion of m_transtab, eg when the table becomes too full) to avoid stale information being reused for new translations. */ -extern void VG_(needs_basic_block_discards) ( +extern void VG_(needs_superblock_discards) ( // Discard any information that pertains to specific translations // or instructions within the address range given. There are two // possible approaches. @@ -362,7 +362,7 @@ extern void VG_(needs_basic_block_discards) ( // 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_basic_block_info)(Addr64 orig_addr, VexGuestExtents extents) + void (*discard_superblock_info)(Addr64 orig_addr, VexGuestExtents extents) ); /* Tool defines its own command line options? */ diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 4a8745d0c1..646200ba62 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -302,7 +302,7 @@ void increment_detail(ULong* detail) } /* A helper that adds the instrumentation for a detail. */ -static void instrument_detail(IRBB* bb, Op op, IRType type) +static void instrument_detail(IRSB* bb, Op op, IRType type) { IRDirty* di; IRExpr** argv; @@ -315,7 +315,7 @@ static void instrument_detail(IRBB* bb, Op op, IRType type) di = unsafeIRDirty_0_N( 1, "increment_detail", VG_(fnptr_to_fnentry)( &increment_detail ), argv); - addStmtToIRBB( bb, IRStmt_Dirty(di) ); + addStmtToIRSB( bb, IRStmt_Dirty(di) ); } /* Summarize and print the details. */ @@ -417,7 +417,7 @@ static VG_REGPARM(2) void trace_modify(Addr addr, SizeT size) } -static void flushEvents(IRBB* bb) +static void flushEvents(IRSB* bb) { Int i; Char* helperName; @@ -452,7 +452,7 @@ static void flushEvents(IRBB* bb) di = unsafeIRDirty_0_N( /*regparms*/2, helperName, VG_(fnptr_to_fnentry)( helperAddr ), argv ); - addStmtToIRBB( bb, IRStmt_Dirty(di) ); + addStmtToIRSB( bb, IRStmt_Dirty(di) ); } events_used = 0; @@ -463,7 +463,7 @@ static void flushEvents(IRBB* bb) // must still call this function, addEvent_Ir() -- it is necessary to add // the Ir events to the events list so that merging of paired load/store // events into modify events works correctly. -static void addEvent_Ir ( IRBB* bb, IRAtom* iaddr, UInt isize ) +static void addEvent_Ir ( IRSB* bb, IRAtom* iaddr, UInt isize ) { Event* evt; tl_assert( (VG_MIN_INSTR_SZB <= isize && isize <= VG_MAX_INSTR_SZB) @@ -479,7 +479,7 @@ static void addEvent_Ir ( IRBB* bb, IRAtom* iaddr, UInt isize ) } static -void addEvent_Dr ( IRBB* bb, IRAtom* daddr, Int dsize ) +void addEvent_Dr ( IRSB* bb, IRAtom* daddr, Int dsize ) { Event* evt; tl_assert(isIRAtom(daddr)); @@ -495,7 +495,7 @@ void addEvent_Dr ( IRBB* bb, IRAtom* daddr, Int dsize ) } static -void addEvent_Dw ( IRBB* bb, IRAtom* daddr, Int dsize ) +void addEvent_Dw ( IRSB* bb, IRAtom* daddr, Int dsize ) { Event* lastEvt; Event* evt; @@ -541,15 +541,15 @@ static void lk_post_clo_init(void) } static -IRBB* lk_instrument ( VgCallbackClosure* closure, - IRBB* bbIn, +IRSB* lk_instrument ( VgCallbackClosure* closure, + IRSB* bbIn, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { IRDirty* di; Int i; - IRBB* bbOut; + IRSB* bbOut; Char fnname[100]; IRType type; IRTypeEnv* tyenv = bbIn->tyenv; @@ -560,12 +560,12 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, } /* Set up BB */ - bbOut = dopyIRBBExceptStmts(bbIn); + bbOut = deepCopyIRSBExceptStmts(bbIn); // Copy verbatim any IR preamble preceding the first IMark i = 0; while (i < bbIn->stmts_used && bbIn->stmts[i]->tag != Ist_IMark) { - addStmtToIRBB( bbOut, bbIn->stmts[i] ); + addStmtToIRSB( bbOut, bbIn->stmts[i] ); i++; } @@ -574,7 +574,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 0, "add_one_BB_entered", VG_(fnptr_to_fnentry)( &add_one_BB_entered ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } if (clo_trace_mem) { @@ -590,7 +590,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 0, "add_one_IRStmt", VG_(fnptr_to_fnentry)( &add_one_IRStmt ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } switch (st->tag) { @@ -599,7 +599,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, case Ist_Put: case Ist_PutI: case Ist_MFence: - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); break; case Ist_IMark: @@ -608,10 +608,10 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 0, "add_one_guest_instr", VG_(fnptr_to_fnentry)( &add_one_guest_instr ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); /* An unconditional branch to a known destination in the - * guest's instructions can be represented, in the IRBB to + * guest's instructions can be represented, in the IRSB to * instrument, by the VEX statements that are the * translation of that known destination. This feature is * called 'BB chasing' and can be influenced by command @@ -631,7 +631,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, 0, "add_one_func_call", VG_(fnptr_to_fnentry)( &add_one_func_call ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } } if (clo_trace_mem) { @@ -641,20 +641,20 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, addEvent_Ir( bbOut, mkIRExpr_HWord( (HWord)st->Ist.IMark.addr ), st->Ist.IMark.len ); } - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); break; - case Ist_Tmp: + case Ist_WrTmp: // Add a call to trace_load() if --trace-mem=yes. if (clo_trace_mem) { - IRExpr* data = st->Ist.Tmp.data; + IRExpr* data = st->Ist.WrTmp.data; if (data->tag == Iex_Load) { addEvent_Dr( bbOut, data->Iex.Load.addr, sizeofIRType(data->Iex.Load.ty) ); } } if (clo_detailed_counts) { - IRExpr* expr = st->Ist.Tmp.data; + IRExpr* expr = st->Ist.WrTmp.data; type = typeOfIRExpr(bbOut->tyenv, expr); tl_assert(type != Ity_INVALID); switch (expr->tag) { @@ -672,7 +672,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, break; } } - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); break; case Ist_Store: @@ -686,7 +686,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, tl_assert(type != Ity_INVALID); instrument_detail( bbOut, OpStore, type ); } - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); break; case Ist_Dirty: { @@ -705,7 +705,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, tl_assert(d->mAddr == NULL); tl_assert(d->mSize == 0); } - addStmtToIRBB( bbOut, st ); + addStmtToIRSB( bbOut, st ); break; } @@ -715,13 +715,13 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 0, "add_one_Jcc", VG_(fnptr_to_fnentry)( &add_one_Jcc ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } if (clo_trace_mem) { flushEvents(bbOut); } - addStmtToIRBB( bbOut, st ); // Original statement + addStmtToIRSB( bbOut, st ); // Original statement if (clo_basic_counts) { /* Count non-taken Jcc */ @@ -729,7 +729,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, VG_(fnptr_to_fnentry)( &add_one_Jcc_untaken ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } break; @@ -743,7 +743,7 @@ IRBB* lk_instrument ( VgCallbackClosure* closure, di = unsafeIRDirty_0_N( 0, "add_one_BB_completed", VG_(fnptr_to_fnentry)( &add_one_BB_completed ), mkIRExprVec_0() ); - addStmtToIRBB( bbOut, IRStmt_Dirty(di) ); + addStmtToIRSB( bbOut, IRStmt_Dirty(di) ); } if (clo_trace_mem) { diff --git a/massif/ms_main.c b/massif/ms_main.c index 5a0f13274d..e4c6343877 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1096,8 +1096,8 @@ static Bool ms_handle_client_request ( ThreadId tid, UWord* argv, UWord* ret ) /*------------------------------------------------------------*/ static -IRBB* ms_instrument ( VgCallbackClosure* closure, - IRBB* bb_in, +IRSB* ms_instrument ( VgCallbackClosure* closure, + IRSB* bb_in, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 0c79c44710..1d415fbca3 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -314,8 +314,8 @@ extern void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len ); /* Functions defined in mc_translate.c */ extern -IRBB* MC_(instrument) ( VgCallbackClosure* closure, - IRBB* bb_in, +IRSB* MC_(instrument) ( VgCallbackClosure* closure, + IRSB* bb_in, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ); diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 219880f5c6..cf8e98c434 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -69,8 +69,9 @@ static IRExpr* expr2vbits ( struct _MCEnv* mce, IRExpr* e ); /* Carries around state during memcheck instrumentation. */ typedef struct _MCEnv { - /* MODIFIED: the bb being constructed. IRStmts are added. */ - IRBB* bb; + /* MODIFIED: the superblock being constructed. IRStmts are + added. */ + IRSB* bb; /* MODIFIED: a table [0 .. #temps_in_original_bb-1] which maps original temps to their current their current shadow temp. @@ -169,7 +170,7 @@ static Bool isOriginalAtom ( MCEnv* mce, IRAtom* a1 ) { if (a1->tag == Iex_Const) return True; - if (a1->tag == Iex_Tmp && a1->Iex.Tmp.tmp < mce->n_originalTmps) + if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp < mce->n_originalTmps) return True; return False; } @@ -180,7 +181,7 @@ static Bool isShadowAtom ( MCEnv* mce, IRAtom* a1 ) { if (a1->tag == Iex_Const) return True; - if (a1->tag == Iex_Tmp && a1->Iex.Tmp.tmp >= mce->n_originalTmps) + if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp >= mce->n_originalTmps) return True; return False; } @@ -189,7 +190,7 @@ static Bool isShadowAtom ( MCEnv* mce, IRAtom* a1 ) are identically-kinded. */ static Bool sameKindedAtoms ( IRAtom* a1, IRAtom* a2 ) { - if (a1->tag == Iex_Tmp && a2->tag == Iex_Tmp) + if (a1->tag == Iex_RdTmp && a2->tag == Iex_RdTmp) return True; if (a1->tag == Iex_Const && a2->tag == Iex_Const) return True; @@ -244,11 +245,11 @@ static IRExpr* definedOfType ( IRType ty ) { /* assign value to tmp */ #define assign(_bb,_tmp,_expr) \ - addStmtToIRBB((_bb), IRStmt_Tmp((_tmp),(_expr))) + addStmtToIRSB((_bb), IRStmt_WrTmp((_tmp),(_expr))) /* add stmt to a bb */ #define stmt(_bb,_stmt) \ - addStmtToIRBB((_bb), (_stmt)) + addStmtToIRSB((_bb), (_stmt)) /* build various kinds of expressions */ #define binop(_op, _arg1, _arg2) IRExpr_Binop((_op),(_arg1),(_arg2)) @@ -258,7 +259,7 @@ static IRExpr* definedOfType ( IRType ty ) { #define mkU32(_n) IRExpr_Const(IRConst_U32(_n)) #define mkU64(_n) IRExpr_Const(IRConst_U64(_n)) #define mkV128(_n) IRExpr_Const(IRConst_V128(_n)) -#define mkexpr(_tmp) IRExpr_Tmp((_tmp)) +#define mkexpr(_tmp) IRExpr_RdTmp((_tmp)) /* bind the given expression to a new temporary, and return the temporary. This effectively converts an arbitrary expression into @@ -900,10 +901,10 @@ static void complainIfUndefined ( MCEnv* mce, IRAtom* atom ) getting a new value. */ tl_assert(isIRAtom(vatom)); /* sameKindedAtoms ... */ - if (vatom->tag == Iex_Tmp) { - tl_assert(atom->tag == Iex_Tmp); - newShadowTmp(mce, atom->Iex.Tmp.tmp); - assign(mce->bb, findShadowTmp(mce, atom->Iex.Tmp.tmp), + if (vatom->tag == Iex_RdTmp) { + tl_assert(atom->tag == Iex_RdTmp); + newShadowTmp(mce, atom->Iex.RdTmp.tmp); + assign(mce->bb, findShadowTmp(mce, atom->Iex.RdTmp.tmp), definedOfType(ty)); } } @@ -988,7 +989,8 @@ void do_shadow_PUT ( MCEnv* mce, Int offset, */ static void do_shadow_PUTI ( MCEnv* mce, - IRArray* descr, IRAtom* ix, Int bias, IRAtom* atom ) + IRRegArray* descr, + IRAtom* ix, Int bias, IRAtom* atom ) { IRAtom* vatom; IRType ty, tyS; @@ -1016,9 +1018,9 @@ void do_shadow_PUTI ( MCEnv* mce, } else { /* Do a cloned version of the Put that refers to the shadow area. */ - IRArray* new_descr - = mkIRArray( descr->base + mce->layout->total_sizeB, - tyS, descr->nElems); + IRRegArray* new_descr + = mkIRRegArray( descr->base + mce->layout->total_sizeB, + tyS, descr->nElems); stmt( mce->bb, IRStmt_PutI( new_descr, ix, bias, vatom )); } } @@ -1047,7 +1049,8 @@ IRExpr* shadow_GET ( MCEnv* mce, Int offset, IRType ty ) given GETI (passed in in pieces). */ static -IRExpr* shadow_GETI ( MCEnv* mce, IRArray* descr, IRAtom* ix, Int bias ) +IRExpr* shadow_GETI ( MCEnv* mce, + IRRegArray* descr, IRAtom* ix, Int bias ) { IRType ty = descr->elemTy; IRType tyS = shadowType(ty); @@ -1061,9 +1064,9 @@ IRExpr* shadow_GETI ( MCEnv* mce, IRArray* descr, IRAtom* ix, Int bias ) } else { /* return a cloned version of the Get that refers to the shadow area. */ - IRArray* new_descr - = mkIRArray( descr->base + mce->layout->total_sizeB, - tyS, descr->nElems); + IRRegArray* new_descr + = mkIRRegArray( descr->base + mce->layout->total_sizeB, + tyS, descr->nElems); return IRExpr_GetI( new_descr, ix, bias ); } } @@ -2634,8 +2637,8 @@ IRExpr* expr2vbits ( MCEnv* mce, IRExpr* e ) return shadow_GETI( mce, e->Iex.GetI.descr, e->Iex.GetI.ix, e->Iex.GetI.bias ); - case Iex_Tmp: - return IRExpr_Tmp( findShadowTmp(mce, e->Iex.Tmp.tmp) ); + case Iex_RdTmp: + return IRExpr_RdTmp( findShadowTmp(mce, e->Iex.RdTmp.tmp) ); case Iex_Const: return definedOfType(shadowType(typeOfIRExpr(mce->bb->tyenv, e))); @@ -3127,7 +3130,7 @@ static Bool isBogusAtom ( IRAtom* at ) ULong n = 0; IRConst* con; tl_assert(isIRAtom(at)); - if (at->tag == Iex_Tmp) + if (at->tag == Iex_RdTmp) return False; tl_assert(at->tag == Iex_Const); con = at->Iex.Const.con; @@ -3159,11 +3162,11 @@ static Bool checkForBogusLiterals ( /*FLAT*/ IRStmt* st ) IRExpr* e; IRDirty* d; switch (st->tag) { - case Ist_Tmp: - e = st->Ist.Tmp.data; + case Ist_WrTmp: + e = st->Ist.WrTmp.data; switch (e->tag) { case Iex_Get: - case Iex_Tmp: + case Iex_RdTmp: return False; case Iex_Const: return isBogusAtom(e); @@ -3231,8 +3234,8 @@ static Bool checkForBogusLiterals ( /*FLAT*/ IRStmt* st ) } -IRBB* MC_(instrument) ( VgCallbackClosure* closure, - IRBB* bb_in, +IRSB* MC_(instrument) ( VgCallbackClosure* closure, + IRSB* bb_in, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) @@ -3242,7 +3245,7 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, Int i, j, first_stmt; IRStmt* st; MCEnv mce; - IRBB* bb; + IRSB* bb; if (gWordTy != hWordTy) { /* We don't currently support this case. */ @@ -3257,8 +3260,8 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, tl_assert(sizeof(UInt) == 4); tl_assert(sizeof(Int) == 4); - /* Set up BB */ - bb = dopyIRBBExceptStmts(bb_in); + /* Set up SB */ + bb = deepCopyIRSBExceptStmts(bb_in); /* Set up the running environment. Only .bb is modified as we go along. */ @@ -3309,7 +3312,7 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, tl_assert(st); tl_assert(isFlatIRStmt(st)); - addStmtToIRBB( bb, bb_in->stmts[i] ); + addStmtToIRSB( bb, bb_in->stmts[i] ); i++; } @@ -3332,10 +3335,10 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, 'tmp = CONSTANT'. */ for (j = 0; j < i; j++) { - if (bb_in->stmts[j]->tag == Ist_Tmp) { + if (bb_in->stmts[j]->tag == Ist_WrTmp) { /* findShadowTmp checks its arg is an original tmp; no need to assert that here. */ - IRTemp tmp_o = bb_in->stmts[j]->Ist.Tmp.tmp; + IRTemp tmp_o = bb_in->stmts[j]->Ist.WrTmp.tmp; IRTemp tmp_s = findShadowTmp(&mce, tmp_o); IRType ty_s = typeOfIRTemp(bb->tyenv, tmp_s); assign( bb, tmp_s, definedOfType( ty_s ) ); @@ -3368,9 +3371,9 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, switch (st->tag) { - case Ist_Tmp: - assign( bb, findShadowTmp(&mce, st->Ist.Tmp.tmp), - expr2vbits( &mce, st->Ist.Tmp.data) ); + case Ist_WrTmp: + assign( bb, findShadowTmp(&mce, st->Ist.WrTmp.tmp), + expr2vbits( &mce, st->Ist.WrTmp.data) ); break; case Ist_Put: @@ -3430,7 +3433,7 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure, } /* ... and finally copy the stmt itself to the output. */ - addStmtToIRBB(bb, st); + addStmtToIRSB(bb, st); } diff --git a/none/nl_main.c b/none/nl_main.c index b7fe2fdcc0..b9b4c898e7 100644 --- a/none/nl_main.c +++ b/none/nl_main.c @@ -36,8 +36,8 @@ static void nl_post_clo_init(void) } static -IRBB* nl_instrument ( VgCallbackClosure* closure, - IRBB* bb, +IRSB* nl_instrument ( VgCallbackClosure* closure, + IRSB* bb, VexGuestLayout* layout, VexGuestExtents* vge, IRType gWordTy, IRType hWordTy )