Question about 4.5.x register allocation

William Mahoney wmahoney@mail.unomaha.edu
Tue Aug 31 04:45:00 GMT 2010


Hi! Apologies if this looks like a duplicate but my email did not show up 
in the archive so I think it got lost. 

I have some code that I have added to GCCs in the past for doing 
instrumentation at a basic block level. Recently I grabbed 4.5.1 and added 
in my changes. 

First, so you know:

Target: x86_64-unknown-linux-gnu
Configured with: /home/bmahoney/Projects/gcc-4.5.1/configure 
--disable-multilib --prefix=/home/bmahoney/Projects/native_451_out 
--enable-libjava --enable-languages=c,c++,java,fortran

Now, I need to be aware of the live-in set for each block, so that I can 
save and restore the registers that are live around the instrumentation 
code that is inserted. In the past, looking at the live-in set for the 
basic block header has always worked but now I have something that is 
confusing.  I put some debugging in to look at things at the RTL level and 
my debugging output (hopefully self-evident) is:

Starting on basic block 12 it looks like it DOES have code
global_live_at_start =  6 [bp] 7 [sp] 16 [argp] 20 [frame] 75
global_live_at_end =  6 [bp] 7 [sp] 16 [argp] 20 [frame] 74
Block after this one is block 13
FIRST_PSEUDO_REGISTER = 53
Here is the basic block before adding code:
(note 170 70 71 [bb 12] NOTE_INSN_BASIC_BLOCK)
(insn 71 170 190 (set (reg:DF 21 xmm0 [74])
        (float:DF (reg:DI 0 ax [75]))) play.cpp:91 219 
{*floatdidf2_sse_interunit}
     (nil))

My pass is right after pass_convert_to_eh_region_ranges, so it is right at 
the end and should be past the hard register assignment. 

Finally my question. In the past, checking the register set from 0 to 
FIRST_PSEUDO_REGISTER has always worked because this should be the range 
of the hard registers. It certainly looks to me like 74 and 75 are above 
the range of the hard registers and thus would not really be "live" in 
that sense.  I couldn't find the #define for FIRST_PSEUDO_REGISTER so I 
just printed it out, but on this hardware it is 53 as you can see.

What am I missing here?

Thanks!

Bill Mahoney
U. Nebraska at Omaha




More information about the Gcc-help mailing list