]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use new functions for helper-call-construction.
authorJulian Seward <jseward@acm.org>
Sun, 31 Oct 2004 20:04:05 +0000 (20:04 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 31 Oct 2004 20:04:05 +0000 (20:04 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@470

VEX/head20041019/addrcheck/ac_main.c
VEX/head20041019/coregrind/vg_translate.c
VEX/test_main.c

index 70f75e5b35ef8be6c7314432ecd6f94b25bdb78f..548ca2bdc32b3adcf4470ff4e40e52cae4445962 100644 (file)
@@ -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) )
                ));
             }
index f67022e8a61f1e52d7054a16a830090241547dbd..9eff006fa1f903ab2bd4c02b3e6f0c01d6df45d3 100644 (file)
@@ -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;
index 6eab8b1fc7180ebd360ebc77892de1cfbf8f1215..6db4d3a4ff6ad4af3570579b7bfe81279e91c929 100644 (file)
@@ -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) )
                ));
             }