This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Register objects question
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Jared Buttles <jared at cylant dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 29 Mar 2004 17:16:40 -0800
- Subject: Re: Register objects question
- References: <B2E52E72-7E88-11D8-8D6F-003065982268@cylant.com>
Jared Buttles wrote:
I'm looking to create some rtl statements that reference registers, but
it is my understanding that registers, as objects, are unique and stored
in the regno_reg_rtx[] array. If that is the case, then why does
regno_reg_rtx[] return a different rtl address than that used (as is
evident when I print the rtl list)? How do I access the register object
actually being used in the rtl? Am I fundamentally misunderstanding the
storage of these things?
pseudo-regs are unique. Hard regs are not. This is a function of how
register allocation works. We allocate pseudos to hard regs by
modifying the unique pseudo-reg rtx in place. Since multiple pseudos
with non-overlapping lifetimes can be allocated to the same hard reg,
clearly, hard regs can not be unique. Since they can't be unique, gcc
doesn't even try to save hard reg values. We often generate new rtx for
a hard reg rather than trying to reuse old rtx values.
regno_reg_rtx really only works for pseudos. If you have found a pseudo
reg that differs from regno_reg_rtx, then you have probably found a bug.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com