This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Reloading index register
- To: "Michael P. Hayes" <michaelh at ongaonga dot chch dot cri dot nz>
- Subject: Re: Reloading index register
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 17 Oct 1997 22:05:44 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
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