]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
C89 fixes.
authorJulian Seward <jseward@acm.org>
Wed, 25 Jan 2006 03:26:27 +0000 (03:26 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 25 Jan 2006 03:26:27 +0000 (03:26 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1549

VEX/priv/guest-ppc/toIR.c
VEX/priv/host-ppc/isel.c
VEX/priv/ir/irdefs.c
VEX/priv/ir/iropt.c

index cc08a407099a1bcb2a72525ef71de2350fc736f1..9d218a919ca9f6ddbbc74db44c97e9513bfb108d 100644 (file)
@@ -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 ) );
 }
 
index 8d941dd0bf0b0b5739f1fa36937e89efeb0dbf6a..1edb6125f5b09b4c7283a894bc1ed7d90d31279b 100644 (file)
@@ -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;
       }
index 20da033b768ed19ccd8c261fe676553023318f0f..264b177f08aa93a3e0c483c818f3cad812540597 100644 (file)
@@ -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;
index 5aab24c684a8ebf122af5ae9ce5c426e0fc3514f..3d04fd2f98c36520a7d9f305037325be1eeea0f4 100644 (file)
@@ -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