]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor refactoring to avoid special handling of emulation
authorFlorian Krohm <florian@eich-krohm.de>
Sat, 6 Sep 2014 21:43:28 +0000 (21:43 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sat, 6 Sep 2014 21:43:28 +0000 (21:43 +0000)
failures in s390_irgen_PFPO.

git-svn-id: svn://svn.valgrind.org/vex/trunk@2948

VEX/priv/guest_s390_toIR.c

index 1f6bc6b238c03edc0849c860c697df3fbcbc1c85..2bcbf348733b9245eab113afd3b70f652e44b9f4 100644 (file)
@@ -482,22 +482,38 @@ put_dpr_pair(UInt archreg, IRExpr *expr)
 
 /* Terminate the current IRSB with an emulation failure. */
 static void
-emulation_failure(VexEmNote fail_kind)
+emulation_failure_with_expr(IRExpr *emfailure)
 {
-   stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkU32(fail_kind)));
+   vassert(typeOfIRExpr(irsb->tyenv, emfailure) == Ity_I32);
+
+   stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), emfailure));
    dis_res->whatNext = Dis_StopHere;
    dis_res->jk_StopHere = Ijk_EmFail;
 }
 
+static void
+emulation_failure(VexEmNote fail_kind)
+{
+   emulation_failure_with_expr(mkU32(fail_kind));
+}
+
 /* Terminate the current IRSB with an emulation warning. */
 static void
-emulation_warning(VexEmNote warn_kind)
+emulation_warning_with_expr(IRExpr *emwarning)
 {
-   stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkU32(warn_kind)));
+   vassert(typeOfIRExpr(irsb->tyenv, emwarning) == Ity_I32);
+
+   stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), emwarning));
    dis_res->whatNext = Dis_StopHere;
    dis_res->jk_StopHere = Ijk_EmWarn;
 }
 
+static void
+emulation_warning(VexEmNote warn_kind)
+{
+   emulation_warning_with_expr(mkU32(warn_kind));
+}
+
 /*------------------------------------------------------------*/
 /*--- IR Debugging aids.                                   ---*/
 /*------------------------------------------------------------*/
@@ -7262,12 +7278,7 @@ s390_irgen_PFPO(void)
 
    /* Check validity of function code in GR 0 */
    assign(ef, s390_call_pfpo_helper(unop(Iop_32Uto64, mkexpr(gr0))));
-
-   /* fixs390: Function emulation_failure can be used if it takes argument as
-      IRExpr * instead of VexEmNote. */
-   stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_EMNOTE), mkexpr(ef)));
-   dis_res->whatNext = Dis_StopHere;
-   dis_res->jk_StopHere = Ijk_EmFail;
+   emulation_failure_with_expr(mkexpr(ef));
 
    stmt(
         IRStmt_Exit(