This is the mail archive of the gcc@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]

Re: PATCH: extra machine-dependent passes



> > Here, in get_func_hard_reg_initial_val:
> > 
> > +   push_topmost_sequence ();
> > +   emit_insn_after (gen_rtx_SET (VOIDmode,
> > + 				ivs->pseudos[ivs->num_entries-1],
> > + 				gen_rtx_REG (mode, regno)),
> > + 		   get_insns ());
> > +   pop_topmost_sequence ();
> 
> Then indeed, I don't understand at all.

The purpose of this code is to add the SETs at the beginning of the
function's RTL, before the FUNCTION_BEG note.  This is the same place
where arguments are copied out of their hard regs and is not included
in the insns that get inlined.

This is the same code all the backends use for doing this.

> > 	gen_movsi_pic (operands[0], operands[1],
> > 		       get_hard_reg_initial_value (PIC_REGNO, Pmode));
> 
> This is going to get called during initial code generation.
> Which means that the above sequence is going to get emitted
> into every relevant function before inlining.  Since you don't
> seem to be making any effort to remove that set, don't you 
> wind up with
> 
> 	(set psuedoINNER pseudoOUTER)
> 	(set psuedoINNER somehardreg)
> 
> somewhere in the middle of the final function?
> 
> Seems to me the copy from the hard reg can only happen in the
> non-inlined copy of the function.

The rtl emitted here goes *before* the FUNCTION_BEG note and thus will
not be included in the set of insns inlined.  This is the same spot
where gcc puts the moves from the argument hard regs to the argument
pseudos.

You have to try hard to get the situation you describe to happen.

> > I would think that either an eliminable virtual register or CSE would
> > take care of those cases.
> 
> Maybe.  I wouldn't trust CSE to eliminate a set of a hard register.

I can't remember ever suggesting a set of a hard register.  I've been
using constraints to get the values I need *into* the hard regs, and
the optimizer handles those just fine.  The code I'm adding is only
for getting values *out* of hard regs.


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