|
From: Nicholas N. <nj...@ca...> - 2004-04-18 12:23:10
|
CVS commit by nethercote:
Introduce uWiden, similar to uCCall, uCond, etc.
M +9 -24 coregrind/vg_to_ucode.c 1.136
M +11 -0 coregrind/vg_translate.c 1.77
M +2 -0 include/vg_skin.h.base 1.17
--- valgrind/coregrind/vg_to_ucode.c #1.135:1.136
@@ -562,10 +562,4 @@ static void setFlagsFromUOpcode ( UCodeB
}
-__inline__
-void VG_(set_cond_field) ( UCodeBlock* cb, Condcode cond )
-{
- LAST_UINSTR(cb).cond = cond;
-}
-
/*------------------------------------------------------------*/
/*--- JMP helpers ---*/
@@ -1330,6 +1324,5 @@ Addr dis_movx_E_G ( UCodeBlock* 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',
@@ -1346,6 +1339,5 @@ Addr dis_movx_E_G ( UCodeBlock* cb,
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',
@@ -2720,6 +2712,5 @@ 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);
}
@@ -5351,6 +5342,5 @@ static Addr disInstr ( UCodeBlock* cb, A
/* 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);
@@ -5370,6 +5360,5 @@ static Addr disInstr ( UCodeBlock* cb, A
/* 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);
@@ -5391,6 +5380,5 @@ static Addr disInstr ( UCodeBlock* cb, A
/* 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);
@@ -5411,6 +5399,5 @@ static Addr disInstr ( UCodeBlock* cb, A
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");
@@ -5419,6 +5406,5 @@ static Addr disInstr ( UCodeBlock* cb, A
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");
@@ -6344,6 +6330,5 @@ static Addr disInstr ( UCodeBlock* cb, A
/* 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 */
--- valgrind/coregrind/vg_translate.c #1.76:1.77
@@ -235,4 +235,15 @@ void VG_(set_flag_fields) ( UCodeBlock*
}
+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 )
--- valgrind/include/vg_skin.h.base #1.16:1.17
@@ -1103,4 +1103,5 @@
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 );
@@ -1116,4 +1117,5 @@
#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)
|