]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix up the s390 back end to be in sync with infrastructural changes
authorJulian Seward <jseward@acm.org>
Wed, 16 Jan 2013 21:10:01 +0000 (21:10 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 16 Jan 2013 21:10:01 +0000 (21:10 +0000)
w.r.t. conditional dirty helpers that return values.  Does not
actually handle such cases since the s390 front end does not generate
them.  Further ahead, it would be more general to redo this by
incorporating a RetLoc as part of the helper_call struct.  This change
is OK for now, though.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2640

VEX/priv/host_s390_defs.c

index c66dcd4c3a199bbef4d78ffc5121d9569d742774..a8452574097c10a64136a365432ef3248beca325 100644 (file)
@@ -7312,16 +7312,29 @@ s390_insn_clz_emit(UChar *buf, const s390_insn *insn)
 }
 
 
+/* Returns a value == BUF to denote failure, != BUF to denote success. */
 static UChar *
 s390_insn_helper_call_emit(UChar *buf, const s390_insn *insn)
 {
    s390_cc_t cond;
    ULong target;
    UChar *ptmp = buf;
+   UChar *bufIN = buf;
 
    cond = insn->variant.helper_call.cond;
    target = insn->variant.helper_call.target;
 
+   if (cond != S390_CC_ALWAYS
+       && insn->variant.helper_call.dst != INVALID_HREG) {
+      /* The call might not happen (it isn't unconditional) and it
+         returns a result.  In this case we will need to generate a
+         control flow diamond to put 0x555..555 in the return
+         register(s) in the case where the call doesn't happen.  If
+         this ever becomes necessary, maybe copy code from the ARM
+         equivalent.  Until that day, just give up. */
+      return bufIN; /* To denote failure. */
+   }
+
    if (cond != S390_CC_ALWAYS) {
       /* So we have something like this
          if (cond) call X;
@@ -8257,6 +8270,7 @@ emit_S390Instr(Bool *is_profinc, UChar *buf, Int nbuf, s390_insn *insn,
 
    case S390_INSN_HELPER_CALL:
       end = s390_insn_helper_call_emit(buf, insn);
+      if (end == buf) goto fail;
       break;
 
    case S390_INSN_BFP_TRIOP:
@@ -8327,6 +8341,7 @@ emit_S390Instr(Bool *is_profinc, UChar *buf, Int nbuf, s390_insn *insn,
       end = s390_insn_xassisted_emit(buf, insn, disp_cp_xassisted);
       break;
 
+   fail:
    default:
       vpanic("emit_S390Instr");
    }