This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help with define_insn and constraints
Robert Baruch <autophile@gmail.com> writes:
> Well, after stepping through reload() a bunch of times, I determined
> that first, the original instruction looks like this:
>
> [ P56 + 1 ] <- [ R20 + 17 ]
>
> where P56 is a pseudoreg, and R20 is my frame pointer.
>
> In line 840 of reload1.c (this is gcc-3.4.3, BTW, and it's during the
> global reload phase), alter_reg is called for every psuedoreg. This
> sets the reg_equiv_memory_loc for P56 to R20 + 104. I didn't see
> anything in alter_reg which looks at the actual instruction, so there
> doesn't appear to be a chance in alter_reg to prevent this
> substitution from happening.
>
> A little further down in reload(), at line 923, there's a loop over
> the pseudoregs again, setting reg_equiv_mem for P56 to [ R20 + 104 ].
> Again, there doesn't appear to be a chance to prevent this.
>
> Finally, at line 1108 there's a final loop over the pseudoregs, this
> time replacing all references to P56 with [ R20 + 104 ], again
> apparently without any chance of preventing.
>
> So I'm not sure where to look next.
In principle calculate_needs_all_insns(), which is called after
setting reg_equiv_memory_loc and reg_equiv_mem, is supposed to notice
that it needs to reload the reference to P56.
In particular memory addresses will get handed via find_reloads() to
find_reloads_address(). That is supposed to do the right thing for
reg_equiv_memory_loc, etc. This is where you can help out by defining
LEGITIMIZE_RELOAD_ADDRESS. Find out what find_reloads_address is
doing with your addresses.
You may want to double check that spill_indirect_levels is initialized
correctly in init_reload() for your system.
Ian