]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: update VEX to support speculative conditional branching
authorPetar Jovanovic <mips32r2@gmail.com>
Fri, 17 Apr 2020 18:02:39 +0000 (18:02 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Fri, 17 Apr 2020 18:02:39 +0000 (18:02 +0000)
This partially fixes KDE #417187.

VEX/priv/guest_generic_bb_to_IR.c
VEX/priv/host_mips_isel.c

index 5932eb8043e23d3e19a3c15fb1bb0ce3565238a8..2f204c5b0aa3f2a3afa4a5ccf77d7f009f3f8c5b 100644 (file)
@@ -1448,10 +1448,7 @@ IRSB* bb_to_IR (
       // Try for an extend based on a conditional branch, specifically in the
       // hope of identifying and recovering, an "A && B" condition spread across
       // two basic blocks.
-      if (irsb_be.tag == Be_Cond
-          /* sewardj 2019Dec14: It also causes crashing on MIPS, even for
-             --tool=none. */
-          && arch_guest != VexArchMIPS64 && arch_guest != VexArchMIPS32)
+      if (irsb_be.tag == Be_Cond)
       {
          if (debug_print) {
             vex_printf("\n-+-+ (ext# %d) Considering cbranch to"
index 51ac757731f24e23c81f2cd8e7cc21eea1502c6a..899c7868e0254fcd47a7a039a87b86683dd182a8 100644 (file)
@@ -2366,13 +2366,9 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e)
          case Ico_U8:
             l = (Long) (Int) (Char) con->Ico.U8;
             break;
-#if 0
-         // Not needed until chasing cond branches in bb_to_IR is enabled on
-         // MIPS.  See comment on And1/Or1 below.
          case Ico_U1:
             l = con->Ico.U1 ? 1 : 0;
             break;
-#endif
          default:
             vpanic("iselIntExpr_R.const(mips)");
       }
@@ -2773,11 +2769,7 @@ static MIPSCondCode iselCondCode_wrk(ISelEnv * env, IRExpr * e)
                r_dst, mode64));
       return MIPScc_NE;
    }
-#if 0
-   // sewardj 2019Dec14: this is my best attempt at And1/Or1, but I am not
-   // sure if it is correct.  In any case it is not needed until chasing cond
-   // branches is enabled on MIPS.  Currently it is disabled, in function bb_to_IR
-   // (see comments there).
+
    if (e->tag == Iex_Binop
        && (e->Iex.Binop.op == Iop_And1 || e->Iex.Binop.op == Iop_Or1)) {
       HReg r_argL = iselWordExpr_R(env, e->Iex.Binop.arg1);
@@ -2798,7 +2790,7 @@ static MIPSCondCode iselCondCode_wrk(ISelEnv * env, IRExpr * e)
                r_dst, mode64));
       return MIPScc_EQ;
    }
-#endif
+
    if (e->tag == Iex_RdTmp) {
       HReg r_dst = iselWordExpr_R_wrk(env, e);
       /* Store result to guest_COND */