From: Julian Seward Date: Mon, 22 Nov 2004 11:29:33 +0000 (+0000) Subject: gcc-2.95 build fixes. X-Git-Tag: svn/VALGRIND_3_0_1^2~757 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f109e708577cb5e53b2dd8f87279fabbe555f4eb;p=thirdparty%2Fvalgrind.git gcc-2.95 build fixes. git-svn-id: svn://svn.valgrind.org/vex/trunk@577 --- diff --git a/VEX/priv/guest-x86/ghelpers.c b/VEX/priv/guest-x86/ghelpers.c index 2253bfd4be..df50144749 100644 --- a/VEX/priv/guest-x86/ghelpers.c +++ b/VEX/priv/guest-x86/ghelpers.c @@ -131,19 +131,20 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_ADD(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, res; \ - argL = CC_DEP1; \ - argR = CC_DEP2; \ - res = argL + argR; \ - cf = (DATA_UTYPE)res < (DATA_UTYPE)argL; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = lshift((argL ^ argR ^ -1) & (argL ^ res), \ - 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, res; \ + argL = CC_DEP1; \ + argR = CC_DEP2; \ + res = argL + argR; \ + cf = (DATA_UTYPE)res < (DATA_UTYPE)argL; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = lshift((argL ^ argR ^ -1) & (argL ^ res), \ + 12 - DATA_BITS) & CC_MASK_O; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -151,19 +152,20 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_SUB(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, res; \ - argL = CC_DEP1; \ - argR = CC_DEP2; \ - res = argL - argR; \ - cf = (DATA_UTYPE)argL < (DATA_UTYPE)argR; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = lshift((argL ^ argR) & (argL ^ res), \ - 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, res; \ + argL = CC_DEP1; \ + argR = CC_DEP2; \ + res = argL - argR; \ + cf = (DATA_UTYPE)argL < (DATA_UTYPE)argR; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = lshift((argL ^ argR) & (argL ^ res), \ + 12 - DATA_BITS) & CC_MASK_O; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -171,23 +173,24 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_ADC(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, oldC, res; \ - oldC = CC_NDEP & CC_MASK_C; \ - argL = CC_DEP1; \ - argR = CC_DEP2 ^ oldC; \ - res = (argL + argR) + oldC; \ - if (oldC) \ - cf = (DATA_UTYPE)res <= (DATA_UTYPE)argL; \ - else \ - cf = (DATA_UTYPE)res < (DATA_UTYPE)argL; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = lshift((argL ^ argR ^ -1) & (argL ^ res), \ - 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, oldC, res; \ + oldC = CC_NDEP & CC_MASK_C; \ + argL = CC_DEP1; \ + argR = CC_DEP2 ^ oldC; \ + res = (argL + argR) + oldC; \ + if (oldC) \ + cf = (DATA_UTYPE)res <= (DATA_UTYPE)argL; \ + else \ + cf = (DATA_UTYPE)res < (DATA_UTYPE)argL; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = lshift((argL ^ argR ^ -1) & (argL ^ res), \ + 12 - DATA_BITS) & CC_MASK_O; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -195,23 +198,24 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_SBB(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, oldC, res; \ - oldC = CC_NDEP & CC_MASK_C; \ - argL = CC_DEP1; \ - argR = CC_DEP2 ^ oldC; \ - res = (argL - argR) - oldC; \ - if (oldC) \ - cf = (DATA_UTYPE)argL <= (DATA_UTYPE)argR; \ - else \ - cf = (DATA_UTYPE)argL < (DATA_UTYPE)argR; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = lshift((argL ^ argR) & (argL ^ res), \ - 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, oldC, res; \ + oldC = CC_NDEP & CC_MASK_C; \ + argL = CC_DEP1; \ + argR = CC_DEP2 ^ oldC; \ + res = (argL - argR) - oldC; \ + if (oldC) \ + cf = (DATA_UTYPE)argL <= (DATA_UTYPE)argR; \ + else \ + cf = (DATA_UTYPE)argL < (DATA_UTYPE)argR; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = lshift((argL ^ argR) & (argL ^ res), \ + 12 - DATA_BITS) & CC_MASK_O; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -219,14 +223,15 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_LOGIC(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - cf = 0; \ - pf = parity_table[(UChar)CC_DEP1]; \ - af = 0; \ - zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ - sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ - of = 0; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + cf = 0; \ + pf = parity_table[(UChar)CC_DEP1]; \ + af = 0; \ + zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ + sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ + of = 0; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -234,18 +239,19 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_INC(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, res; \ - res = CC_DEP1; \ - argL = res - 1; \ - argR = 1; \ - cf = CC_NDEP & CC_MASK_C; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = ((res & DATA_MASK) == SIGN_MASK) << 11; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, res; \ + res = CC_DEP1; \ + argL = res - 1; \ + argR = 1; \ + cf = CC_NDEP & CC_MASK_C; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = ((res & DATA_MASK) == SIGN_MASK) << 11; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -253,19 +259,20 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_DEC(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - Int argL, argR, res; \ - res = CC_DEP1; \ - argL = res + 1; \ - argR = 1; \ - cf = CC_NDEP & CC_MASK_C; \ - pf = parity_table[(UChar)res]; \ - af = (res ^ argL ^ argR) & 0x10; \ - zf = ((DATA_UTYPE)res == 0) << 6; \ - sf = lshift(res, 8 - DATA_BITS) & 0x80; \ - of = ((res & DATA_MASK) \ - == ((UInt)SIGN_MASK - 1)) << 11; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + Int argL, argR, res; \ + res = CC_DEP1; \ + argL = res + 1; \ + argR = 1; \ + cf = CC_NDEP & CC_MASK_C; \ + pf = parity_table[(UChar)res]; \ + af = (res ^ argL ^ argR) & 0x10; \ + zf = ((DATA_UTYPE)res == 0) << 6; \ + sf = lshift(res, 8 - DATA_BITS) & 0x80; \ + of = ((res & DATA_MASK) \ + == ((UInt)SIGN_MASK - 1)) << 11; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -273,15 +280,16 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_SHL(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - cf = (CC_DEP2 >> (DATA_BITS - 1)) & CC_MASK_C; \ - pf = parity_table[(UChar)CC_DEP1]; \ - af = 0; /* undefined */ \ - zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ - sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ - /* of is defined if shift count == 1 */ \ - of = lshift(CC_DEP2 ^ CC_DEP1, 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + cf = (CC_DEP2 >> (DATA_BITS - 1)) & CC_MASK_C; \ + pf = parity_table[(UChar)CC_DEP1]; \ + af = 0; /* undefined */ \ + zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ + sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ + /* of is defined if shift count == 1 */ \ + of = lshift(CC_DEP2 ^ CC_DEP1, 12 - DATA_BITS) & CC_MASK_O;\ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -289,15 +297,16 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_SHR(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - cf = CC_DEP2 & 1; \ - pf = parity_table[(UChar)CC_DEP1]; \ - af = 0; /* undefined */ \ - zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ - sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ - /* of is defined if shift count == 1 */ \ - of = lshift(CC_DEP2 ^ CC_DEP1, 12 - DATA_BITS) & CC_MASK_O; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + cf = CC_DEP2 & 1; \ + pf = parity_table[(UChar)CC_DEP1]; \ + af = 0; /* undefined */ \ + zf = ((DATA_UTYPE)CC_DEP1 == 0) << 6; \ + sf = lshift(CC_DEP1, 8 - DATA_BITS) & 0x80; \ + /* of is defined if shift count == 1 */ \ + of = lshift(CC_DEP2 ^ CC_DEP1, 12 - DATA_BITS) & CC_MASK_O;\ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -307,12 +316,13 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_ROL(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int fl \ - = (CC_NDEP & ~(CC_MASK_O | CC_MASK_C)) \ - | (CC_MASK_C & CC_DEP1) \ - | (CC_MASK_O & (lshift(CC_DEP1, 11-(DATA_BITS-1)) \ - ^ lshift(CC_DEP1, 11))); \ - return fl; \ + { Int fl \ + = (CC_NDEP & ~(CC_MASK_O | CC_MASK_C)) \ + | (CC_MASK_C & CC_DEP1) \ + | (CC_MASK_O & (lshift(CC_DEP1, 11-(DATA_BITS-1)) \ + ^ lshift(CC_DEP1, 11))); \ + return fl; \ + } \ } /*-------------------------------------------------------------*/ @@ -322,12 +332,13 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_ROR(DATA_BITS,DATA_UTYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int fl \ - = (CC_NDEP & ~(CC_MASK_O | CC_MASK_C)) \ - | (CC_MASK_C & (CC_DEP1 >> (DATA_BITS-1))) \ - | (CC_MASK_O & (lshift(CC_DEP1, 11-(DATA_BITS-1)) \ - ^ lshift(CC_DEP1, 11-(DATA_BITS-1)+1))); \ - return fl; \ + { Int fl \ + = (CC_NDEP & ~(CC_MASK_O | CC_MASK_C)) \ + | (CC_MASK_C & (CC_DEP1 >> (DATA_BITS-1))) \ + | (CC_MASK_O & (lshift(CC_DEP1, 11-(DATA_BITS-1)) \ + ^ lshift(CC_DEP1, 11-(DATA_BITS-1)+1))); \ + return fl; \ + } \ } /*-------------------------------------------------------------*/ @@ -335,20 +346,21 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_UMUL(DATA_BITS,DATA_UTYPE,DATA_U2TYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - DATA_UTYPE hi; \ - DATA_UTYPE lo = ((DATA_UTYPE)CC_DEP1) \ - * ((DATA_UTYPE)CC_DEP2); \ - DATA_U2TYPE rr = ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP1)) \ - * ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP2)); \ - hi = (DATA_UTYPE)(rr >>/*u*/ DATA_BITS); \ - cf = (hi != 0); \ - pf = parity_table[(UChar)lo]; \ - af = 0; /* undefined */ \ - zf = (lo == 0) << 6; \ - sf = lshift(lo, 8 - DATA_BITS) & 0x80; \ - of = cf << 11; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + DATA_UTYPE hi; \ + DATA_UTYPE lo = ((DATA_UTYPE)CC_DEP1) \ + * ((DATA_UTYPE)CC_DEP2); \ + DATA_U2TYPE rr = ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP1)) \ + * ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP2)); \ + hi = (DATA_UTYPE)(rr >>/*u*/ DATA_BITS); \ + cf = (hi != 0); \ + pf = parity_table[(UChar)lo]; \ + af = 0; /* undefined */ \ + zf = (lo == 0) << 6; \ + sf = lshift(lo, 8 - DATA_BITS) & 0x80; \ + of = cf << 11; \ + return cf | pf | af | zf | sf | of; \ + } \ } /*-------------------------------------------------------------*/ @@ -356,20 +368,21 @@ inline static Int lshift ( Int x, Int n ) #define ACTIONS_SMUL(DATA_BITS,DATA_STYPE,DATA_S2TYPE) \ { \ PREAMBLE(DATA_BITS); \ - Int cf, pf, af, zf, sf, of; \ - DATA_STYPE hi; \ - DATA_STYPE lo = ((DATA_STYPE)CC_DEP1) \ - * ((DATA_STYPE)CC_DEP2); \ - DATA_S2TYPE rr = ((DATA_S2TYPE)((DATA_STYPE)CC_DEP1)) \ - * ((DATA_S2TYPE)((DATA_STYPE)CC_DEP2)); \ - hi = (DATA_STYPE)(rr >>/*s*/ DATA_BITS); \ - cf = (hi != (lo >>/*s*/ (DATA_BITS-1))); \ - pf = parity_table[(UChar)lo]; \ - af = 0; /* undefined */ \ - zf = (lo == 0) << 6; \ - sf = lshift(lo, 8 - DATA_BITS) & 0x80; \ - of = cf << 11; \ - return cf | pf | af | zf | sf | of; \ + { Int cf, pf, af, zf, sf, of; \ + DATA_STYPE hi; \ + DATA_STYPE lo = ((DATA_STYPE)CC_DEP1) \ + * ((DATA_STYPE)CC_DEP2); \ + DATA_S2TYPE rr = ((DATA_S2TYPE)((DATA_STYPE)CC_DEP1)) \ + * ((DATA_S2TYPE)((DATA_STYPE)CC_DEP2)); \ + hi = (DATA_STYPE)(rr >>/*s*/ DATA_BITS); \ + cf = (hi != (lo >>/*s*/ (DATA_BITS-1))); \ + pf = parity_table[(UChar)lo]; \ + af = 0; /* undefined */ \ + zf = (lo == 0) << 6; \ + sf = lshift(lo, 8 - DATA_BITS) & 0x80; \ + of = cf << 11; \ + return cf | pf | af | zf | sf | of; \ + } \ } @@ -2403,22 +2416,24 @@ VexGuestLayout /* flags thunk: OP and NDEP are always defd, whereas DEP1 and DEP2 have to be tracked. See detailed comment in gdefs.h on meaning of thunk fields. */ - .alwaysDefd[0] = ALWAYSDEFD(guest_CC_OP), - .alwaysDefd[1] = ALWAYSDEFD(guest_CC_NDEP), - - .alwaysDefd[2] = ALWAYSDEFD(guest_DFLAG), - .alwaysDefd[3] = ALWAYSDEFD(guest_IDFLAG), - .alwaysDefd[4] = ALWAYSDEFD(guest_EIP), - .alwaysDefd[5] = ALWAYSDEFD(guest_FTOP), - .alwaysDefd[6] = ALWAYSDEFD(guest_FPTAG), - .alwaysDefd[7] = ALWAYSDEFD(guest_FPUCW), - .alwaysDefd[8] = ALWAYSDEFD(guest_FC3210), - .alwaysDefd[9] = ALWAYSDEFD(guest_CS), - .alwaysDefd[10] = ALWAYSDEFD(guest_DS), - .alwaysDefd[11] = ALWAYSDEFD(guest_ES), - .alwaysDefd[12] = ALWAYSDEFD(guest_FS), - .alwaysDefd[13] = ALWAYSDEFD(guest_GS), - .alwaysDefd[14] = ALWAYSDEFD(guest_SS) + + .alwaysDefd + = { /* 0 */ ALWAYSDEFD(guest_CC_OP), + /* 1 */ ALWAYSDEFD(guest_CC_NDEP), + /* 2 */ ALWAYSDEFD(guest_DFLAG), + /* 3 */ ALWAYSDEFD(guest_IDFLAG), + /* 4 */ ALWAYSDEFD(guest_EIP), + /* 5 */ ALWAYSDEFD(guest_FTOP), + /* 6 */ ALWAYSDEFD(guest_FPTAG), + /* 7 */ ALWAYSDEFD(guest_FPUCW), + /* 8 */ ALWAYSDEFD(guest_FC3210), + /* 9 */ ALWAYSDEFD(guest_CS), + /* 10 */ ALWAYSDEFD(guest_DS), + /* 11 */ ALWAYSDEFD(guest_ES), + /* 12 */ ALWAYSDEFD(guest_FS), + /* 13 */ ALWAYSDEFD(guest_GS), + /* 14 */ ALWAYSDEFD(guest_SS) + } }; diff --git a/VEX/priv/host-x86/isel.c b/VEX/priv/host-x86/isel.c index 4b6b2de84a..641a7e5ee5 100644 --- a/VEX/priv/host-x86/isel.c +++ b/VEX/priv/host-x86/isel.c @@ -580,8 +580,9 @@ static X86AMode* genGuestArrayOffset ( ISelEnv* env, IRArray* descr, IRExpr* off, Int bias ) { - Int elemSz = sizeofIRType(descr->elemTy); - Int nElems = descr->nElems; + HReg tmp, roff; + Int elemSz = sizeofIRType(descr->elemTy); + Int nElems = descr->nElems; /* throw out any cases not generated by an x86 front end. In theory there might be a day where we need to handle them -- if @@ -597,8 +598,8 @@ X86AMode* genGuestArrayOffset ( ISelEnv* env, IRArray* descr, andl %tmp, 7 ... base(%ebp, %tmp, shift) ... */ - HReg tmp = newVRegI(env); - HReg roff = iselIntExpr_R(env, off); + tmp = newVRegI(env); + roff = iselIntExpr_R(env, off); addInstr(env, mk_MOVsd_RR(roff, tmp)); if (bias != 0) { addInstr(env, @@ -1414,8 +1415,9 @@ static X86CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e ) /* Constant 1:Bit */ if (e->tag == Iex_Const && e->Iex.Const.con->Ico.U1 == True) { + HReg r; vassert(e->Iex.Const.con->tag == Ico_U1); - HReg r = newVRegI(env); + r = newVRegI(env); addInstr(env, X86Instr_Alu32R(Xalu_MOV,X86RMI_Imm(0),r)); addInstr(env, X86Instr_Alu32R(Xalu_XOR,X86RMI_Reg(r),r)); return Xcc_Z; @@ -1608,10 +1610,11 @@ static void iselIntExpr64_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e ) if (e->tag == Iex_LDle) { /* It would be better to generate the address into an amode and then do advance4 to get the hi-half address. */ + HReg tLo, tHi, rA; vassert(e->Iex.LDle.ty == Ity_I64); - HReg tLo = newVRegI(env); - HReg tHi = newVRegI(env); - HReg rA = iselIntExpr_R(env, e->Iex.LDle.addr); + tLo = newVRegI(env); + tHi = newVRegI(env); + rA = iselIntExpr_R(env, e->Iex.LDle.addr); addInstr(env, X86Instr_Alu32R( Xalu_MOV, X86RMI_Mem(X86AMode_IR(0, rA)), tLo)); diff --git a/VEX/test_main.c b/VEX/test_main.c index cb77fdb245..05fdc5100c 100644 --- a/VEX/test_main.c +++ b/VEX/test_main.c @@ -753,11 +753,13 @@ static IRAtom* mkImproveOR32 ( MCEnv* mce, IRAtom* data, IRAtom* vbits ) static IRAtom* mkPCastTo( MCEnv* mce, IRType dst_ty, IRAtom* vbits ) { + IRType ty; + IRAtom* tmp1; /* Note, dst_ty is a shadow type, not an original type. */ /* First of all, collapse vbits down to a single bit. */ sk_assert(isShadowAtom(mce,vbits)); - IRType ty = typeOfIRExpr(mce->bb->tyenv, vbits); - IRAtom* tmp1 = NULL; + ty = typeOfIRExpr(mce->bb->tyenv, vbits); + tmp1 = NULL; switch (ty) { case Ity_I1: tmp1 = vbits; @@ -829,24 +831,29 @@ static void setHelperAnns ( MCEnv* mce, IRDirty* di ) { */ static void complainIfUndefined ( MCEnv* mce, IRAtom* atom ) { + Int sz; + IRType ty; + IRAtom* vatom; + IRAtom* cond; + IRDirty* di; + /* Since the original expression is atomic, there's no duplicated work generated by making multiple V-expressions for it. So we don't really care about the possibility that someone else may also create a V-interpretion for it. */ sk_assert(isOriginalAtom(mce, atom)); - IRAtom* vatom = expr2vbits( mce, atom ); + vatom = expr2vbits( mce, atom ); sk_assert(isShadowAtom(mce, vatom)); sk_assert(sameKindedAtoms(atom, vatom)); - IRType ty = typeOfIRExpr(mce->bb->tyenv, vatom); + ty = typeOfIRExpr(mce->bb->tyenv, vatom); /* sz is only used for constructing the error message */ - Int sz = ty==Ity_I1 ? 0 : sizeofIRType(ty); + sz = ty==Ity_I1 ? 0 : sizeofIRType(ty); - IRAtom* cond = mkPCastTo( mce, Ity_I1, vatom ); + cond = mkPCastTo( mce, Ity_I1, vatom ); /* cond will be 0 if all defined, and 1 if any not defined. */ - IRDirty* di; switch (sz) { case 0: di = unsafeIRDirty_0_N( 0/*regparms*/, @@ -939,6 +946,7 @@ static void do_shadow_PUT ( MCEnv* mce, Int offset, IRAtom* atom, IRAtom* vatom ) { + IRType ty; if (atom) { sk_assert(!vatom); sk_assert(isOriginalAtom(mce, atom)); @@ -948,7 +956,7 @@ void do_shadow_PUT ( MCEnv* mce, Int offset, sk_assert(isShadowAtom(mce, vatom)); } - IRType ty = typeOfIRExpr(mce->bb->tyenv, vatom); + ty = typeOfIRExpr(mce->bb->tyenv, vatom); sk_assert(ty != Ity_I1); if (isAlwaysDefd(mce, offset, sizeofIRType(ty))) { /* later: no ... */ @@ -968,12 +976,16 @@ static void do_shadow_PUTI ( MCEnv* mce, IRArray* descr, IRAtom* ix, Int bias, IRAtom* atom ) { + IRAtom* vatom; + IRType ty, tyS; + Int arrSize; + sk_assert(isOriginalAtom(mce,atom)); - IRAtom* vatom = expr2vbits( mce, atom ); + vatom = expr2vbits( mce, atom ); sk_assert(sameKindedAtoms(atom, vatom)); - IRType ty = descr->elemTy; - IRType tyS = shadowType(ty); - Int arrSize = descr->nElems * sizeofIRType(ty); + ty = descr->elemTy; + tyS = shadowType(ty); + arrSize = descr->nElems * sizeofIRType(ty); sk_assert(ty != Ity_I1); sk_assert(isOriginalAtom(mce,ix)); complainIfUndefined(mce,ix); @@ -1100,6 +1112,10 @@ static IRAtom* expensiveAdd32 ( MCEnv* mce, IRAtom* qaa, IRAtom* qbb, IRAtom* aa, IRAtom* bb ) { + IRType ty; + IROp opAND, opOR, opXOR, opNOT, opADD; + IRAtom *a_min, *b_min, *a_max, *b_max; + sk_assert(isShadowAtom(mce,qaa)); sk_assert(isShadowAtom(mce,qbb)); sk_assert(isOriginalAtom(mce,aa)); @@ -1107,14 +1123,12 @@ IRAtom* expensiveAdd32 ( MCEnv* mce, IRAtom* qaa, IRAtom* qbb, sk_assert(sameKindedAtoms(qaa,aa)); sk_assert(sameKindedAtoms(qbb,bb)); - IRType ty = Ity_I32; - IROp opAND = Iop_And32; - IROp opOR = Iop_Or32; - IROp opXOR = Iop_Xor32; - IROp opNOT = Iop_Not32; - IROp opADD = Iop_Add32; - - IRAtom *a_min, *b_min, *a_max, *b_max; + ty = Ity_I32; + opAND = Iop_And32; + opOR = Iop_Or32; + opXOR = Iop_Xor32; + opNOT = Iop_Not32; + opADD = Iop_Add32; // a_min = aa & ~qaa a_min = assignNew(mce,ty, @@ -1432,9 +1446,9 @@ IRAtom* expr2vbits_LDle ( MCEnv* mce, IRType ty, IRAtom* addr, UInt bias ) addrAct = addr; } else { IRType tyAddr = mce->hWordTy; - sk_assert( tyAddr == Ity_I32 || tyAddr == Ity_I64 ); IROp mkAdd = tyAddr==Ity_I32 ? Iop_Add32 : Iop_Add64; IRAtom* eBias = tyAddr==Ity_I32 ? mkU32(bias) : mkU64(bias); + sk_assert( tyAddr == Ity_I32 || tyAddr == Ity_I64 ); addrAct = assignNew(mce, tyAddr, binop(mkAdd, addr, eBias) ); } @@ -1536,12 +1550,12 @@ IRExpr* expr2vbits ( MCEnv* mce, IRExpr* e ) static IRExpr* zwidenToHostWord ( MCEnv* mce, IRAtom* vatom ) { - /* vatom is vbits-value and as such can only have a shadow type. */ - sk_assert(isShadowAtom(mce,vatom)); - IRType ty = typeOfIRExpr(mce->bb->tyenv, vatom); IRType tyH = mce->hWordTy; + /* vatom is vbits-value and as such can only have a shadow type. */ + sk_assert(isShadowAtom(mce,vatom)); + if (tyH == Ity_I32) { switch (ty) { case Ity_I32: return vatom; @@ -1614,9 +1628,9 @@ void do_shadow_STle ( MCEnv* mce, addrAct = addr; } else { IRType tyAddr = mce->hWordTy; - sk_assert( tyAddr == Ity_I32 || tyAddr == Ity_I64 ); IROp mkAdd = tyAddr==Ity_I32 ? Iop_Add32 : Iop_Add64; IRAtom* eBias = tyAddr==Ity_I32 ? mkU32(bias) : mkU64(bias); + sk_assert( tyAddr == Ity_I32 || tyAddr == Ity_I64 ); addrAct = assignNew(mce, tyAddr, binop(mkAdd, addr, eBias) ); } @@ -1660,13 +1674,13 @@ void do_shadow_Dirty ( MCEnv* mce, IRDirty* d ) IRAtom* src; IRType tyAddr, tySrc, tyDst; IRTemp dst; + IRAtom *here, *curr; /* First check the guard. */ complainIfUndefined(mce, d->guard); /* Now round up all inputs and PCast over them. */ - IRAtom* here; - IRAtom* curr = definedOfType(Ity_I32); + curr = definedOfType(Ity_I32); /* Inputs: unmasked args */ for (i = 0; d->args[i]; i++) {