From 2040a7fa3f672bbca12ce0b310babfb19330d332 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 25 Jan 2006 03:26:27 +0000 Subject: [PATCH] C89 fixes. git-svn-id: svn://svn.valgrind.org/vex/trunk@1549 --- VEX/priv/guest-ppc/toIR.c | 30 ++++++++++++++++++------------ VEX/priv/host-ppc/isel.c | 5 +++-- VEX/priv/ir/irdefs.c | 2 +- VEX/priv/ir/iropt.c | 5 +++-- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/VEX/priv/guest-ppc/toIR.c b/VEX/priv/guest-ppc/toIR.c index cc08a40709..9d218a919c 100644 --- a/VEX/priv/guest-ppc/toIR.c +++ b/VEX/priv/guest-ppc/toIR.c @@ -365,11 +365,12 @@ static UInt float_to_bits ( Float f ) */ static UInt MASK32( UInt begin, UInt end ) { + UInt m1, m2, mask; vassert(begin < 32); vassert(end < 32); - UInt m1 = ((UInt)(-1)) << begin; - UInt m2 = ((UInt)(-1)) << end << 1; - UInt mask = m1 ^ m2; + m1 = ((UInt)(-1)) << begin; + m2 = ((UInt)(-1)) << end << 1; + mask = m1 ^ m2; if (begin > end) mask = ~mask; // wrap mask return mask; } @@ -377,11 +378,12 @@ static UInt MASK32( UInt begin, UInt end ) /* ditto for 64bit mask */ static ULong MASK64( UInt begin, UInt end ) { + ULong m1, m2, mask; vassert(begin < 64); vassert(end < 64); - ULong m1 = ((ULong)(-1)) << begin; - ULong m2 = ((ULong)(-1)) << end << 1; - ULong mask = m1 ^ m2; + m1 = ((ULong)(-1)) << begin; + m2 = ((ULong)(-1)) << end << 1; + mask = m1 ^ m2; if (begin > end) mask = ~mask; // wrap mask return mask; } @@ -848,8 +850,8 @@ static IRExpr* mkSzNarrow32 ( IRType ty, IRExpr* src ) /* Signed/Unsigned IR widens I8/I16/I32 -> I32/I64 */ static IRExpr* mkSzWiden8 ( IRType ty, IRExpr* src, Bool sined ) { - vassert(ty == Ity_I32 || ty == Ity_I64); IROp op; + vassert(ty == Ity_I32 || ty == Ity_I64); if (sined) op = (ty==Ity_I32) ? Iop_8Sto32 : Iop_8Sto64; else op = (ty==Ity_I32) ? Iop_8Uto32 : Iop_8Uto64; return unop(op, src); @@ -857,8 +859,8 @@ static IRExpr* mkSzWiden8 ( IRType ty, IRExpr* src, Bool sined ) static IRExpr* mkSzWiden16 ( IRType ty, IRExpr* src, Bool sined ) { - vassert(ty == Ity_I32 || ty == Ity_I64); IROp op; + vassert(ty == Ity_I32 || ty == Ity_I64); if (sined) op = (ty==Ity_I32) ? Iop_16Sto32 : Iop_16Sto64; else op = (ty==Ity_I32) ? Iop_16Uto32 : Iop_16Uto64; return unop(op, src); @@ -1436,29 +1438,33 @@ static void set_AV_CR6 ( IRExpr* result, Bool test_all_ones ) static void putXER_SO ( IRExpr* e ) { + IRExpr* so; vassert(typeOfIRExpr(irbb->tyenv, e) == Ity_I8); - IRExpr* so = binop(Iop_And8, e, mkU8(1)); + so = binop(Iop_And8, e, mkU8(1)); stmt( IRStmt_Put( OFFB_XER_SO, so ) ); } static void putXER_OV ( IRExpr* e ) { + IRExpr* ov; vassert(typeOfIRExpr(irbb->tyenv, e) == Ity_I8); - IRExpr* ov = binop(Iop_And8, e, mkU8(1)); + ov = binop(Iop_And8, e, mkU8(1)); stmt( IRStmt_Put( OFFB_XER_OV, ov ) ); } static void putXER_CA ( IRExpr* e ) { + IRExpr* ca; vassert(typeOfIRExpr(irbb->tyenv, e) == Ity_I8); - IRExpr* ca = binop(Iop_And8, e, mkU8(1)); + ca = binop(Iop_And8, e, mkU8(1)); stmt( IRStmt_Put( OFFB_XER_CA, ca ) ); } static void putXER_BC ( IRExpr* e ) { + IRExpr* bc; vassert(typeOfIRExpr(irbb->tyenv, e) == Ity_I8); - IRExpr* bc = binop(Iop_And8, e, mkU8(0x7F)); + bc = binop(Iop_And8, e, mkU8(0x7F)); stmt( IRStmt_Put( OFFB_XER_BC, bc ) ); } diff --git a/VEX/priv/host-ppc/isel.c b/VEX/priv/host-ppc/isel.c index 8d941dd0bf..1edb6125f5 100644 --- a/VEX/priv/host-ppc/isel.c +++ b/VEX/priv/host-ppc/isel.c @@ -1517,13 +1517,14 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, IRExpr* e ) break; case Iop_Clz32: case Iop_Clz64: { + HReg r_src, r_dst; PPCUnaryOp op_clz = (op_unop == Iop_Clz32) ? Pun_CLZ32 : Pun_CLZ64; if (op_unop == Iop_Clz64 && !mode64) goto irreducible; /* Count leading zeroes. */ - HReg r_dst = newVRegI(env); - HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg); + r_dst = newVRegI(env); + r_src = iselWordExpr_R(env, e->Iex.Unop.arg); addInstr(env, PPCInstr_Unary(op_clz,r_dst,r_src)); return r_dst; } diff --git a/VEX/priv/ir/irdefs.c b/VEX/priv/ir/irdefs.c index 20da033b76..264b177f08 100644 --- a/VEX/priv/ir/irdefs.c +++ b/VEX/priv/ir/irdefs.c @@ -75,8 +75,8 @@ void ppIRType ( IRType ty ) void ppIRConst ( IRConst* con ) { - vassert(sizeof(ULong) == sizeof(Double)); union { ULong i64; Double f64; } u; + vassert(sizeof(ULong) == sizeof(Double)); switch (con->tag) { case Ico_U1: vex_printf( "%d:I1", con->Ico.U1 ? 1 : 0); break; case Ico_U8: vex_printf( "0x%x:I8", (UInt)(con->Ico.U8)); break; diff --git a/VEX/priv/ir/iropt.c b/VEX/priv/ir/iropt.c index 5aab24c684..3d04fd2f98 100644 --- a/VEX/priv/ir/iropt.c +++ b/VEX/priv/ir/iropt.c @@ -3621,6 +3621,7 @@ static IRStmt* atbSubst_Stmt ( ATmpInfo* env, IRStmt* st ) /* Consider current stmt. */ if (st->tag == Ist_Tmp && uses[st->Ist.Tmp.tmp] <= 1) { + IRExpr *e, *e2; /* optional extra: dump dead bindings as we find them. Removes the need for a prior dead-code removal pass. */ @@ -3632,8 +3633,8 @@ static IRStmt* atbSubst_Stmt ( ATmpInfo* env, IRStmt* st ) /* ok, we have 't = E', occ(t)==1. Do the abovementioned actions. */ - IRExpr* e = st->Ist.Tmp.data; - IRExpr* e2 = atbSubst_Expr(env, e); + e = st->Ist.Tmp.data; + e2 = atbSubst_Expr(env, e); addToEnvFront(env, st->Ist.Tmp.tmp, e2); setHints_Expr(&env[0].doesLoad, &env[0].doesGet, e2); /* don't advance j, as we are deleting this stmt and instead -- 2.47.3