This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Register objects question


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]