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



> I don't like using void* here.  Use a struct tag.  You don't have to
> declare the structure itself, which leaves the value just as opaque,
> but provides documentation and avoids ...
> 
> > + #define IVS(fun) ((initial_value_struct *)((fun)->hard_reg_initial_vals))
> 
> ... this big of ugliness.

OK.

> > +       ivs->pseudos = (rtx *) xrealloc (ivs->pseudos, 5 * sizeof (rtx));
> 
> Thinko on the realloc.  I don't like parallel arrays either.  Put
> the two data elements into a struct.

OK.

> That aside, I don't see how this is supposed to work.  Yes, I see how
> a substitution happens during inlining, but I don't see how the value
> gets initialized in the main function,

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 ();

> nor how the target is supposed to use it.

Like this:

	gen_movsi_pic (operands[0], operands[1],
		       get_hard_reg_initial_value (PIC_REGNO, Pmode));

The constraints in the "movsi_pic" pattern would require that the
value be in the right hard register when it's used, and reload and
optimization take care of the rest.

> Is there some piece missing that's supposed to run _after_ inlining
> that emits the copy from hard reg to pseudo?

Nope.

> How about a target for which the initialization is not a simple move,
> but is actually a small bit of arithmetic?

I would think that either an eliminable virtual register or CSE would
take care of those cases.


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