]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Introduce uWiden, similar to uCCall, uCond, etc.
authorNicholas Nethercote <n.nethercote@gmail.com>
Sun, 18 Apr 2004 12:23:02 +0000 (12:23 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Sun, 18 Apr 2004 12:23:02 +0000 (12:23 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2374

coregrind/vg_to_ucode.c
coregrind/vg_translate.c
include/vg_skin.h.base

index a375c08d0276cafca0d9379af0045706cbe81e9d..8a94a0b412786186f6bb975c16187b436b2f64bd 100644 (file)
@@ -561,12 +561,6 @@ static void setFlagsFromUOpcode ( UCodeBlock* cb, Int uopc )
    }
 }
 
-__inline__
-void VG_(set_cond_field) ( UCodeBlock* cb, Condcode cond )
-{
-   LAST_UINSTR(cb).cond = cond;
-}
-
 /*------------------------------------------------------------*/
 /*--- JMP helpers                                          ---*/
 /*------------------------------------------------------------*/
@@ -1329,8 +1323,7 @@ Addr dis_movx_E_G ( UCodeBlock* cb,
       Int tmpv = newTemp(cb);
       uInstr2(cb, GET, szs, ArchReg, eregOfRM(rm), TempReg, tmpv);
       uInstr1(cb, WIDEN, szd, TempReg, tmpv);
-      LAST_UINSTR(cb).extra4b = szs;
-      LAST_UINSTR(cb).signed_widen = sign_extend;
+      uWiden(cb, szs, sign_extend);
       uInstr2(cb, PUT, szd, TempReg, tmpv, ArchReg, gregOfRM(rm));
       DIP("mov%c%c%c %s,%s\n", sign_extend ? 's' : 'z',
                                nameISize(szs), nameISize(szd),
@@ -1345,8 +1338,7 @@ Addr dis_movx_E_G ( UCodeBlock* cb,
       Int  tmpa = LOW24(pair);
       uInstr2(cb, LOAD, szs, TempReg, tmpa, TempReg, tmpa);
       uInstr1(cb, WIDEN, szd, TempReg, tmpa);
-      LAST_UINSTR(cb).extra4b = szs;
-      LAST_UINSTR(cb).signed_widen = sign_extend;
+      uWiden(cb, szs, sign_extend);
       uInstr2(cb, PUT, szd, TempReg, tmpa, ArchReg, gregOfRM(rm));
       DIP("mov%c%c%c %s,%s\n", sign_extend ? 's' : 'z',
                                nameISize(szs), nameISize(szd),
@@ -2719,8 +2711,7 @@ Addr dis_bt_G_E ( UCodeBlock* cb,
 
    if (sz == 2) {
       uInstr1(cb, WIDEN, 4, TempReg, t_bitno);
-      LAST_UINSTR(cb).extra4b = 2;
-      LAST_UINSTR(cb).signed_widen = False;
+      uWiden(cb, 2, False);
    }
    
    if (epartIsReg(modrm)) {
@@ -5350,8 +5341,7 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd )
       uInstr2(cb, GET, 1, ArchReg, R_AL, TempReg, t1);
       /* Widen %AL to 32 bits, so it's all defined when we push it. */
       uInstr1(cb, WIDEN, 4, TempReg, t1);
-      LAST_UINSTR(cb).extra4b = 1;
-      LAST_UINSTR(cb).signed_widen = False;
+      uWiden(cb, 1, False);
       uInstr0(cb, CALLM_S, 0);
       uInstr1(cb, PUSH, 4, TempReg, t1);
       uInstr1(cb, CALLM, 0, Lit16, 
@@ -5369,8 +5359,7 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd )
       uInstr2(cb, GET, 2, ArchReg, R_EAX, TempReg, t1);
       /* Widen %AL to 32 bits, so it's all defined when we push it. */
       uInstr1(cb, WIDEN, 4, TempReg, t1);
-      LAST_UINSTR(cb).extra4b = 2;
-      LAST_UINSTR(cb).signed_widen = False;
+      uWiden(cb, 2, False);
       uInstr0(cb, CALLM_S, 0);
       uInstr1(cb, PUSH, 4, TempReg, t1);
       uInstr1(cb, CALLM, 0, Lit16, 
@@ -5390,8 +5379,7 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd )
       uInstr2(cb, GET, 2, ArchReg, R_EAX, TempReg, t1);
       /* Widen %AX to 32 bits, so it's all defined when we push it. */
       uInstr1(cb, WIDEN, 4, TempReg, t1);
-      LAST_UINSTR(cb).extra4b = 2;
-      LAST_UINSTR(cb).signed_widen = False;
+      uWiden(cb, 2, False);
       uInstr0(cb, CALLM_S, 0);
       uInstr1(cb, PUSH, 4, TempReg, t1);
       uInstr1(cb, CALLM, 0, Lit16, 
@@ -5410,16 +5398,14 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd )
       if (sz == 4) {
          uInstr2(cb, GET,   2, ArchReg, R_EAX, TempReg, t1);
          uInstr1(cb, WIDEN, 4, TempReg, t1); /* 4 == dst size */
-         LAST_UINSTR(cb).extra4b = 2; /* the source size */
-         LAST_UINSTR(cb).signed_widen = True;
+         uWiden(cb, 2, True);
          uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_EAX);
          DIP("cwd\n");
       } else {
          vg_assert(sz == 2);
          uInstr2(cb, GET,   1, ArchReg, R_EAX, TempReg, t1);
          uInstr1(cb, WIDEN, 2, TempReg, t1); /* 2 == dst size */
-         LAST_UINSTR(cb).extra4b = 1; /* the source size */
-         LAST_UINSTR(cb).signed_widen = True;
+         uWiden(cb, 1, True);
          uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX);
          DIP("cbw\n");
       }
@@ -6343,8 +6329,7 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd )
       uInstr2(cb, GET, 1, ArchReg, R_AL, TempReg, t2); /* get AL */
       /* Widen %AL to 32 bits, so it's all defined when we add it. */
       uInstr1(cb, WIDEN, 4, TempReg, t2);
-      LAST_UINSTR(cb).extra4b = 1;
-      LAST_UINSTR(cb).signed_widen = False;
+      uWiden(cb, 1, False);
       uInstr2(cb, ADD, sz, TempReg, t2, TempReg, t1);  /* add AL to eBX */
       uInstr2(cb, LOAD, 1, TempReg, t1,  TempReg, t2); /* get byte at t1 into t2 */
       uInstr2(cb, PUT, 1, TempReg, t2, ArchReg, R_AL); /* put byte into AL */
index e5899295957216b72ef8796f4e139e795705a7b0..31e57e2eac89d5403cd410ac1a35046c1feb241d 100644 (file)
@@ -234,6 +234,17 @@ void VG_(set_flag_fields) ( UCodeBlock* cb,
    LAST_UINSTR(cb).flags_w = uw;
 }
 
+void VG_(set_cond_field) ( UCodeBlock* cb, Condcode cond )
+{
+   LAST_UINSTR(cb).cond = cond;
+}
+
+void VG_(set_widen_fields) ( UCodeBlock* cb, UInt szs, Bool is_signed )
+{
+   LAST_UINSTR(cb).extra4b = szs;
+   LAST_UINSTR(cb).signed_widen = is_signed;
+}
+
 
 Bool VG_(any_flag_use) ( UInstr* u )
 {
index d31622931805273b3dcc50bfc0f80feafa0a5140..60c50d97e59f56eed79f838c0ca9668f7365870d 100644 (file)
@@ -1102,6 +1102,7 @@ extern void VG_(set_lit_field)    ( UCodeBlock* cb, UInt lit32 );
 extern void VG_(set_ccall_fields) ( UCodeBlock* cb, Addr fn, UChar argc,
                                     UChar regparms_n, Bool has_ret_val );
 extern void VG_(set_cond_field)   ( UCodeBlock* cb, Condcode code );
+extern void VG_(set_widen_fields) ( UCodeBlock* cb, UInt szs, Bool is_signed );
 
 extern void VG_(copy_UInstr) ( UCodeBlock* cb, UInstr* instr );
 
@@ -1115,6 +1116,7 @@ extern Bool VG_(any_flag_use)( UInstr* u );
 #define uLiteral  VG_(set_lit_field)
 #define uCCall    VG_(set_ccall_fields)
 #define uCond     VG_(set_cond_field)
+#define uWiden    VG_(set_widen_fields)
 #define uFlagsRWU VG_(set_flag_fields)
 #define newTemp   VG_(get_new_temp)
 #define newShadow VG_(get_new_shadow)