From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: "Michael P. Hayes" Cc: egcs@cygnus.com Subject: Re: Reloading index register Date: Fri, 17 Oct 1997 21:50:00 -0000 Message-id: <17423.877147544@hurl.cygnus.com> References: <199710180228.PAA27273@ongaonga.chch.cri.nz> X-SW-Source: 1997-10/msg00798.html In message < 199710180228.PAA27273@ongaonga.chch.cri.nz >you write: > > Can anybody who understands the reload pass enlighten me why it > generates, > > (set (reg index2) (reg dud)) > (set (reg index2) (mem (plus (reg base2) (reg index2)))) > (set (reg r0) (minus (mem (plus (reg base1) (reg index1))) > (reg index2))) > > instead of the better code, > > (set (reg index2) (reg dud)) > (set (reg r0) (minus (mem (plus (reg base1) (reg index1))) > (mem (plus (reg base2) (reg index2))))) > > for the code fragment, > > (set (reg r0) (minus (mem (plus (reg base1) (reg index1))) > (mem (plus (reg base2) (reg dud))))) > > where the global register allocator couldn't assign reg dud to an > index register and so reload spills index register index2 to obtain a > reload register. Nope. But there's ways to figure out why. Break in find_reloads for the insn in question, then look at calls to push_reload and push_secondary_reload to see what pieces of RTL the compiler thinks it needs to reload. It may be the case that it thinks the whole (mem (...)) needs to be reloaded. jeff