}
else if (MEM_P (*op))
{
+ rtx_insn* eh_insn, *movabs = NULL;
rtx tmp = gen_reg_rtx (GET_MODE (*op));
- /* Handle movabs. */
+ /* Emit MOVABS to load from a 64-bit absolute address to a GPR. */
if (!memory_operand (*op, GET_MODE (*op)))
{
rtx tmp2 = gen_reg_rtx (GET_MODE (*op));
+ movabs = emit_insn_before (gen_rtx_SET (tmp2, *op), insn);
- emit_insn_before (gen_rtx_SET (tmp2, *op), insn);
*op = tmp2;
}
- emit_insn_before (gen_rtx_SET (gen_rtx_SUBREG (vmode, tmp, 0),
- gen_gpr_to_xmm_move_src (vmode, *op)),
- insn);
+ eh_insn
+ = emit_insn_before (gen_rtx_SET (gen_rtx_SUBREG (vmode, tmp, 0),
+ gen_gpr_to_xmm_move_src (vmode, *op)),
+ insn);
+
+ if (cfun->can_throw_non_call_exceptions)
+ {
+ /* Handle REG_EH_REGION note. */
+ rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
+ if (note)
+ {
+ if (movabs)
+ eh_insn = movabs;
+ control_flow_insns.safe_push (eh_insn);
+ add_reg_note (eh_insn, REG_EH_REGION, XEXP (note, 0));
+ }
+ }
+
*op = gen_rtx_SUBREG (vmode, tmp, 0);
if (dump_file)
{
basic_block bb;
int converted_insns = 0;
+ auto_vec<rtx_insn *> control_flow_insns;
bitmap_obstack_initialize (NULL);
const machine_mode cand_mode[3] = { SImode, DImode, TImode };
chain->chain_id);
}
+ rtx_insn* iter_insn;
+ unsigned int ii;
+ FOR_EACH_VEC_ELT (chain->control_flow_insns, ii, iter_insn)
+ control_flow_insns.safe_push (iter_insn);
+
delete chain;
}
}
DECL_INCOMING_RTL (parm) = gen_rtx_SUBREG (TImode, r, 0);
}
}
+
+ if (!control_flow_insns.is_empty ())
+ {
+ free_dominance_info (CDI_DOMINATORS);
+
+ unsigned int i;
+ rtx_insn* insn;
+ FOR_EACH_VEC_ELT (control_flow_insns, i, insn)
+ if (control_flow_insn_p (insn))
+ {
+ /* Split the block after insn. There will be a fallthru
+ edge, which is OK so we keep it. We have to create
+ the exception edges ourselves. */
+ bb = BLOCK_FOR_INSN (insn);
+ split_block (bb, insn);
+ rtl_make_eh_edge (NULL, bb, BB_END (bb));
+ }
+ }
}
return 0;
--- /dev/null
+/* PR target/111822 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -flive-range-shrinkage -fno-dce -fnon-call-exceptions" } */
+
+typedef union {
+ int *pNativeClosure;
+ struct SQRefCounted *pRefCounted;
+} SQObjectValue;
+typedef struct {
+ SQObjectValue _unVal;
+} SQObject;
+typedef long SQFUNCTION(struct SQVM *);
+struct SQVM {
+ void CallNative();
+};
+struct SQRefCounted {
+ long long _uiRef;
+};
+void Null();
+struct SQObjectPtr : SQObject {
+ SQObjectPtr() {}
+ SQObjectPtr(int *pNativeClosure) {
+ _unVal.pNativeClosure = pNativeClosure;
+ _unVal.pRefCounted->_uiRef++;
+ }
+ ~SQObjectPtr() { --_unVal.pRefCounted->_uiRef; }
+};
+struct CallInfo {
+ SQObjectPtr _closure;
+};
+long long _top;
+SQFUNCTION _function;
+int *CallNative_nclosure;
+void SQVM::CallNative() {
+ long long oldtop = _top;
+ CallInfo lci;
+ lci._closure = CallNative_nclosure;
+ try {
+ _function(this);
+ } catch (...) {
+ _top = oldtop;
+ }
+ while (oldtop)
+ Null();
+}