[LLVMdev] reg_iterator Caveats

David Greene dag at cray.com
Tue Apr 1 09:32:47 PDT 2008

On Tuesday 01 April 2008 10:47, David Greene wrote:

> > reg iterators will return everything that is in the function.  If the
> > implicit operands haven't been added to the machieninstrs yet, then they
> > won't be returned.
> Hmm...this is definitely NOT true in my copy.  During register allocation
> these implicit defs are not returned.  By then the instructions are most
> definitely fully constructed.  :)

Urk.  It seems things are worse than that, even.

By the time things hit regalloc, the def/use lists seem to be completely
out of date.  Instructions that exist in the function are not reflected in the
def lists, for example.  Simple register-to-register copies are completely
missed.  So far I've only discovered this to be the case for physical 
registers, though that doesn't mean virtual register information isn't also 
out of date.

Who constructs this information?  I don't see any interfaces in 
MachineRegisterInfo to keep the information up to date as instructions
are added or deleted.  Do I need to depend on some Pass?

What does coalescing do with this information?  Does it update it as
intervals are merged and instructions are changed?  I thought 
MachineRegisterInfo::replaceRegWith might handle this but it doesn't
update MachineRegisterInfo::VRegInfo.


More information about the llvm-dev mailing list