From: Julian Seward Date: Wed, 16 Jan 2013 21:10:01 +0000 (+0000) Subject: Fix up the s390 back end to be in sync with infrastructural changes X-Git-Tag: svn/VALGRIND_3_9_0^2~152^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3550bb8388c7795564f21ac7e7ddae9ebd5abbcc;p=thirdparty%2Fvalgrind.git Fix up the s390 back end to be in sync with infrastructural changes 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 --- diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index c66dcd4c3a..a845257409 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -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"); }