This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, rs6000] Fix PR88845: ICE in lra_set_insn_recog_data


Hi Peter,

On Mon, Mar 04, 2019 at 04:16:23PM -0600, Peter Bergner wrote:
> On 3/4/19 1:27 PM, Segher Boessenkool wrote:
> >> +      /* If LRA is generating a direct move from a GPR to a FPR,
> >> +	 then the splitter is going to need a scratch register.  */
> >> +      rtx insn = gen_movsf_from_si_internal (operands[0], operands[1]);
> >> +      XEXP (XVECEXP (insn, 0, 1), 0) = gen_reg_rtx (DImode);
> >> +      emit_insn (insn);
> >> +      DONE;
> > 
> > This part isn't so great, needing detailed knowledge of the RTL generated
> > by some other pattern.  Maybe there already exists some function that
> > generates a register for every scratch in an insn, or you can make such
> > a function?
> 
> A function that updates one insn does not exist.  There is remove_scratches(),
> but that works on the entire cfg.  As part of my earlier attempts, I did split
> remove_scratches() into a function that traverses the cfg and another that
> replaces the scratches in one insn.  I've included it below.  I went with the
> current patch, because that doesn't touch anything outside of the port.
> If you prefer the patch below, we can go with that instead.  Let me know which
> you prefer.

I meant just like you did in your original patch, just gen_reg_rtx and
nothing more, but finding the SCRATCH locations by itself.  This might also
be useful for the very many splitters we have that allocate regs for
SCRATCHes.


Something like (totally untested)

void itch_scratches (rtx_insn *insn)
{
  subrtx_ptr_iterator::array_type array;
  FOR_EACH_SUBRTX_PTR (iter, array, PATTERN (insn), NONCONST)
    if (GET_CODE (**iter) == SCRATCH)
      **iter = gen_reg_rtx (GET_MODE (**iter));
}

But, it seems you need to keep track of other things on the side for LRA?


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]