From: Julian Seward Date: Sun, 31 Oct 2004 20:04:05 +0000 (+0000) Subject: Use new functions for helper-call-construction. X-Git-Tag: svn/VALGRIND_3_0_1^2~864 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6dfd8fd0684425969ddf625a873f0090dac92e36;p=thirdparty%2Fvalgrind.git Use new functions for helper-call-construction. git-svn-id: svn://svn.valgrind.org/vex/trunk@470 --- diff --git a/VEX/head20041019/addrcheck/ac_main.c b/VEX/head20041019/addrcheck/ac_main.c index 70f75e5b35..548ca2bdc3 100644 --- a/VEX/head20041019/addrcheck/ac_main.c +++ b/VEX/head20041019/addrcheck/ac_main.c @@ -980,9 +980,9 @@ IRBB* SK_(instrument)(IRBB* bb_in, VexGuestLayoutInfo* layout) /* Use this rather than eg. -1 because it's a UInt. */ #define INVALID_DATA_SIZE 999999 - Int i; - Int sz; - IRCallee* helper; + Int i, sz, regparms; + Char* hname; + void* haddr; IRStmt* st; IRExpr* data; IRExpr* addr; @@ -1009,32 +1009,35 @@ IRBB* SK_(instrument)(IRBB* bb_in, VexGuestLayoutInfo* layout) addr = data->Iex.LDle.addr; sz = sizeofIRType(data->Iex.LDle.ty); needSz = False; + regparms = 1; switch (sz) { - case 4: helper = mkIRCallee(1, - "ac_helperc_LOAD4", - (HWord)&ac_helperc_LOAD4); break; - case 2: helper = mkIRCallee(1, - "ac_helperc_LOAD2", - (HWord)&ac_helperc_LOAD2); break; - case 1: helper = mkIRCallee(1, - "ac_helperc_LOAD1", - (HWord)&ac_helperc_LOAD1); break; - default: helper = mkIRCallee(2, "ac_helperc_LOADN", - (HWord)&ac_helperc_LOADN); - needSz = True; break; + case 4: hname = "ac_helperc_LOAD4", + haddr = &ac_helperc_LOAD4; + break; + case 2: hname = "ac_helperc_LOAD2"; + haddr = &ac_helperc_LOAD2; + break; + case 1: hname = "ac_helperc_LOAD1"; + haddr = &ac_helperc_LOAD1; + break; + default: hname = "ac_helperc_LOADN"; + haddr = &ac_helperc_LOADN; + regparms = 2; + needSz = True; + break; } if (needSz) { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( regparms, hname, haddr, mkIRExprVec_2(addr, mkIRExpr_HWord(sz))) )); } else { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( regparms, hname, haddr, mkIRExprVec_1(addr) ) )); } @@ -1048,32 +1051,35 @@ IRBB* SK_(instrument)(IRBB* bb_in, VexGuestLayoutInfo* layout) sk_assert(isAtom(addr)); sz = sizeofIRType(typeOfIRExpr(bb_in->tyenv, data)); needSz = False; + regparms = 1; switch (sz) { - case 4: helper = mkIRCallee(1, - "ac_helperc_STORE4", - (HWord)&ac_helperc_STORE4); break; - case 2: helper = mkIRCallee(1, - "ac_helperc_STORE2", - (HWord)&ac_helperc_STORE2); break; - case 1: helper = mkIRCallee(1, - "ac_helperc_STORE1", - (HWord)&ac_helperc_STORE1); break; - default: helper = mkIRCallee(2, "ac_helperc_STOREN", - (HWord)&ac_helperc_STOREN); - needSz = True; break; + case 4: hname = "ac_helperc_STORE4", + haddr = &ac_helperc_STORE4; + break; + case 2: hname = "ac_helperc_STORE2"; + haddr = &ac_helperc_STORE2; + break; + case 1: hname = "ac_helperc_STORE1"; + haddr = &ac_helperc_STORE1; + break; + default: hname = "ac_helperc_STOREN"; + haddr = &ac_helperc_STOREN; + regparms = 2; + needSz = True; + break; } if (needSz) { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( regparms, hname, haddr, mkIRExprVec_2(addr, mkIRExpr_HWord(sz))) )); } else { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( regparms, hname, haddr, mkIRExprVec_1(addr) ) )); } diff --git a/VEX/head20041019/coregrind/vg_translate.c b/VEX/head20041019/coregrind/vg_translate.c index f67022e8a6..9eff006fa1 100644 --- a/VEX/head20041019/coregrind/vg_translate.c +++ b/VEX/head20041019/coregrind/vg_translate.c @@ -1416,9 +1416,10 @@ IRBB* vg_SP_update_pass ( IRBB* bb_in, VexGuestLayoutInfo* layout ) /* I don't know if it's really necessary to say that the */ \ /* call reads the stack pointer. But anyway, we do. */ \ dcall = unsafeIRDirty_0_N( \ - mkIRCallee(1, "track_" #kind "_mem_stack_" #syze, \ - (HWord)VG_(tool_interface) \ - .track_##kind##_mem_stack_##syze), \ + 1/*regparms*/, \ + "track_" #kind "_mem_stack_" #syze, \ + VG_(tool_interface) \ + .track_##kind##_mem_stack_##syze, \ mkIRExprVec_1(IRExpr_Tmp(curr)) \ ); \ dcall->nFxState = 1; \ @@ -1500,8 +1501,8 @@ IRBB* vg_SP_update_pass ( IRBB* bb_in, VexGuestLayoutInfo* layout ) /* I don't know if it's really necessary to say that the call reads the stack pointer. But anyway, we do. */ dcall = unsafeIRDirty_0_N( - mkIRCallee(1, "VG_(unknown_esp_update)", - (HWord)&VG_(unknown_esp_update)), + 1/*regparms*/, + "VG_(unknown_esp_update)", &VG_(unknown_esp_update), mkIRExprVec_1(st->Ist.Put.data) ); dcall->nFxState = 1; diff --git a/VEX/test_main.c b/VEX/test_main.c index 6eab8b1fc7..6db4d3a4ff 100644 --- a/VEX/test_main.c +++ b/VEX/test_main.c @@ -191,27 +191,29 @@ IRBB* ac_instrument (IRBB* bb_in, VexGuestLayoutInfo* layout) needSz = False; switch (sz) { case 4: helper = mkIRCallee(1, "ac_helperc_LOAD4", - 0x12345601); break; + (void*)0x12345601); break; case 2: helper = mkIRCallee(0, "ac_helperc_LOAD2", - 0x12345602); break; + (void*)0x12345602); break; case 1: helper = mkIRCallee(1, "ac_helperc_LOAD1", - 0x12345603); break; + (void*)0x12345603); break; default: helper = mkIRCallee(0, "ac_helperc_LOADN", - 0x12345604); + (void*)0x12345604); needSz = True; break; } if (needSz) { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( helper->regparms, + helper->name, helper->addr, mkIRExprVec_2(addr, mkIRExpr_HWord(sz))) )); } else { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( helper->regparms, + helper->name, helper->addr, mkIRExprVec_1(addr) ) )); } @@ -227,27 +229,29 @@ IRBB* ac_instrument (IRBB* bb_in, VexGuestLayoutInfo* layout) needSz = False; switch (sz) { case 4: helper = mkIRCallee(1, "ac_helperc_STORE4", - 0x12345605); break; + (void*)0x12345605); break; case 2: helper = mkIRCallee(0, "ac_helperc_STORE2", - 0x12345606); break; + (void*)0x12345606); break; case 1: helper = mkIRCallee(1, "ac_helperc_STORE1", - 0x12345607); break; + (void*)0x12345607); break; default: helper = mkIRCallee(0, "ac_helperc_STOREN", - 0x12345608); + (void*)0x12345608); needSz = True; break; } if (needSz) { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( helper->regparms, + helper->name, helper->addr, mkIRExprVec_2(addr, mkIRExpr_HWord(sz))) )); } else { addStmtToIRBB( bb, IRStmt_Dirty( - unsafeIRDirty_0_N( helper, + unsafeIRDirty_0_N( helper->regparms, + helper->name, helper->addr, mkIRExprVec_1(addr) ) )); }