|
From: <sv...@va...> - 2013-01-16 21:10:15
|
sewardj 2013-01-16 21:10:01 +0000 (Wed, 16 Jan 2013)
New Revision: 2640
Log:
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.
Modified files:
branches/COMEM/priv/host_s390_defs.c
Modified: branches/COMEM/priv/host_s390_defs.c (+15 -0)
===================================================================
--- branches/COMEM/priv/host_s390_defs.c 2013-01-16 14:56:06 +00:00 (rev 2639)
+++ branches/COMEM/priv/host_s390_defs.c 2013-01-16 21:10:01 +00:00 (rev 2640)
@@ -7312,16 +7312,29 @@
}
+/* 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 @@
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 @@
end = s390_insn_xassisted_emit(buf, insn, disp_cp_xassisted);
break;
+ fail:
default:
vpanic("emit_S390Instr");
}
|