PUSH and POP next to first/last register use

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Wed Jan 26 14:59:00 GMT 2005


 > I suppose this would require using REGNO_FIRST_UID(N) and
 > REGNO_LAST_UID(N) at some point, however I would be very grateful if
 > you can help me with it, as it seems that REGNO_FIRST_UID(N) is still
 > reset to 0 when TARGET_ASM_FUNCTION_PROLOGUE is called.

REGNO_FIRST_UID and REGNO_LAST_UID are set by reg_scan (see passes.c), 
but they do not take into account the CFG -- i.e. REGNO_FIRST_UID is not 
guaranteed to dominate all uses, and REGNO_LAST_UID is not guaranteed to 
postdominate them.

Using them is almost never the right thing to do -- witness the fact 
that there are only three users in the whole of gcc's middle-end:

1) in CSE, and it is just a way to pick an order for registers

2) in initialize_uninitialized_subregs, and only as an optimization to 
skip insns that surely don't refer to a reg.

3) loop.c, which is 9000 lines of complex code with a lot of heuristics 
that were designed two major releases ago -- a lot of things changed 
since then, and loop.c is going to be removed sooner or later.

What you want to do would mean multiple pushes or pops, right?  You may 
want to do a dominator/postdominator walk, it is quite cheap in HEAD.

Paolo



More information about the Gcc mailing list