On Mon, 31 Mar 2008, Evan Cheng wrote:>> I just discovered that def_itterator (and presumably, reg_iterator) >> doesn't >> include implicit defs, for example at function calls for caller-save >> physical >> registers. Guh. I'm not sure if it should or not, but it's certainly >> necessary information in some cases. Is this expected behavior, or an >> oversight?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.> MachineRegisterInfo tracks virtual register only.It works for vregs and pregs today.> I also wish it would track physical register defs and uses as well. It > can be used to simplify a lot of code (in livevariable, etc.). Chris, > do you think that's feasible?Really really feasible :) -Chris -- http://nondot.org/sabre/ http://llvm.org/
On Mar 31, 2008, at 4:55 PM, Chris Lattner wrote:> On Mon, 31 Mar 2008, Evan Cheng wrote: >>> I just discovered that def_itterator (and presumably, reg_iterator) >>> doesn't >>> include implicit defs, for example at function calls for caller-save >>> physical >>> registers. Guh. I'm not sure if it should or not, but it's >>> certainly >>> necessary information in some cases. Is this expected behavior, >>> or an >>> oversight? > > 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. > >> MachineRegisterInfo tracks virtual register only. > > It works for vregs and pregs today.Ok! Fooled me with this comment: /// MachineRegisterInfo - Keep track of information for each virtual register, /// including its register class. Evan> > >> I also wish it would track physical register defs and uses as well. >> It >> can be used to simplify a lot of code (in livevariable, etc.). Chris, >> do you think that's feasible? > > Really really feasible :) > > -Chris > > -- > http://nondot.org/sabre/ > http://llvm.org/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Mar 31, 2008, at 5:35 PM, Evan Cheng wrote:>>> MachineRegisterInfo tracks virtual register only. >> >> It works for vregs and pregs today. > > Ok! Fooled me with this comment: > > /// MachineRegisterInfo - Keep track of information for each virtual > register, > /// including its register class.Hrm, my tree [now] says: /// MachineRegisterInfo - Keep track of information for virtual and physical /// registers, including vreg register classes, use/def chains for registers, /// etc. maybe you need to update :-P -Chris
On Monday 31 March 2008 18:55, Chris Lattner wrote:> On Mon, 31 Mar 2008, Evan Cheng wrote: > >> I just discovered that def_itterator (and presumably, reg_iterator) > >> doesn't > >> include implicit defs, for example at function calls for caller-save > >> physical > >> registers. Guh. I'm not sure if it should or not, but it's certainly > >> necessary information in some cases. Is this expected behavior, or an > >> oversight? > > 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. :) We have a very old copy of llvm. Is it possible they got added sometime after reg_iterators were created? Also, just as a point of information, where would I go to find out if a physical register is a caller-save or callee-save register? The closest thing I can find is in the .td files but no interface is generated (as far as I can tell) to categorize physical registers according to calling convention. -Dave
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. -Dave
On Apr 1, 2008, at 8:47 AM, David Greene wrote:> On Monday 31 March 2008 18:55, Chris Lattner wrote: >> On Mon, 31 Mar 2008, Evan Cheng wrote: >>>> I just discovered that def_itterator (and presumably, reg_iterator) >>>> doesn't >>>> include implicit defs, for example at function calls for caller- >>>> save >>>> physical >>>> registers. Guh. I'm not sure if it should or not, but it's >>>> certainly >>>> necessary information in some cases. Is this expected behavior, >>>> or an >>>> oversight? >> >> 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. :) > > We have a very old copy of llvm. Is it possible they got added > sometime > after reg_iterators were created?Not sure.> > > Also, just as a point of information, where would I go to find out > if a > physical register is a caller-save or callee-save register? The > closest > thing I can find is in the .td files but no interface is generated > (as far > as I can tell) to categorize physical registers according to calling > convention.See X86RegisterInfo::getCalleeSavedRegs() etc. Evan> > > -Dave > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev