Hi Peter, On Fri, Sep 28, 2018 at 10:12:02PM -0500, Peter Bergner wrote: > Currently, both IRA and LRA spill all pseudo regs that are live across a > setjmp call. If the target has a sane setjmp, then the compiler should not > have to treat the setjmp call any differently than is does any other normal > function call. Namely, just mark all pseudos that are live across the setjmp > as conflicting with the volatile registers. > > This issue was discussed in the following gcc mailing list thread: > > https://gcc.gnu.org/ml/gcc/2018-03/msg00014.html > > ...and some people mentioned that some systems do not have sane setjmp > implementations and therefore need the spill all pseudos live across setjmps > to get correct functionality. It was decided in the thread above that we > should create a target hook that can allow targets to tell IRA and LRA > whether or not they have a sane setjmp implementation. The following patch > implements that idea along with converting the rs6000 port to use the hook.
> +bool > +default_is_reg_clobbering_setjmp_p (const rtx_insn *insn) > +{ > + return CALL_P (insn) > + && find_reg_note (insn, REG_SETJMP, NULL_RTX) != NULL_RTX; > +} Since all implementations of this hook will have to do the same, I think it is better if you leave this test at the (only two) callers. The hook doesn't need an argument then, and maybe is better named something like setjmp_is_normal_call? (The original code did not test CALL_P btw). (Whatever you end up with, the rs6000 part is of course pre-approved). Segher