How to handle subreg(mem(X)) after reload?

James E Wilson wilson@specifixinc.com
Thu Jan 13 22:48:00 GMT 2005


Robert Baruch wrote:
> Well, I've been staring and staring at the GCC code, and I still
> can't, for the life of me, figure out where GCC will prevent
> subreg(mem) from being created. Is it something that I should be doing
> to prevent subreg(mem) when it is created out of subreg(pseudo)?

If you look at memory_operand in recog.c, you will see that (subreg 
(mem)) is a valid operand when reload_completed is true.  If you look at 
reload, you will see that cleanup_subreg_operands is called after 
reload_completed is set.  There should be no need to avoid creating the 
(subreg (mem)) because it is a valid operand when 
cleanup_subreg_operands is called.

Perhaps you have defined your own predicates, which you are using 
instead of memory_operand, and you failed to handle (subreg (mem)) 
correctly in your predicates?  It is generally unwise to try to replace 
the standard predicate functions.  If you need your own predicate 
functions, they should include/exclude special cases, and then call the 
standard ones at the end to handle the rest of the cases.

It is hard to handle questions like this when given limited info.  It 
would help if you gave us the before reload and after reload RTL for the 
insn in question, the list of reloads generated for it (from the .greg 
file), and the patterns being matched in the md file.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list