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: help setting a register to a constant


Mihai Burcea wrote:
When I don't use optimizations, just my own simple pass, I get a compiler internal error, because the reload() is called. My stuff works fine when using -Ox, however, precisely because reload() is not called.

We always call reload. It gets called from global_alloc when optimizing.


gen_rtx (REG, SImode, vreg2),

This looks like your problem. pseudo-registers must be unique. We do register allocation by modifying a pseudo-reg in place. If you have two objects that have the same register number, then only one gets modified, and the other ends up being an unallocated pseudo that triggers an ICE.


This should be fairly obvious if you step through reload to see how it works. See alter_reg.

So instead of creating a new reg here, you need to reuse the same rtx that you had before you performed the optimization. There is an array you can get it from if you just want to save the reg number, that is regno_reg_rtx.
--
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]