Jeff Kunkel
2010-Sep-03 16:37 UTC
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
How do I get the total number of machine registers? I have currently a MachineFunction and some derivatives. How are the machine registers ordered internally? Can I index them off of a zero based array or do I have to create a map to have them be zero based? Thanks, Jeff Kunkel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100903/05733725/attachment.html>
Jim Grosbach
2010-Sep-03 16:57 UTC
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
TargetRegisterInfo::getNumRegs(). Generally, it's best not to make any assumptions about the internal ordering or numbering if you can avoid it. What are you looking to do? -Jim On Sep 3, 2010, at 9:37 AM, Jeff Kunkel wrote:> How do I get the total number of machine registers? I have currently a MachineFunction and some derivatives. > > How are the machine registers ordered internally? Can I index them off of a zero based array or do I have to create a map to have them be zero based? > > Thanks, > Jeff Kunkel > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Jeff Kunkel
2010-Sep-03 17:46 UTC
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
It's not too much of a problem then. I can make a DenseMap between the registers and my registers. It's just one more intermediate step for a lookup. I wish to mimic all the of the registers on the machine with my std::vector<RegisterInfo> RegisterIndexes; vector. Then when a register is used I can assign it easily. I know about alias register and those are taken care of ever so cleverly. If this can be done without an extra lookup, it would improve performance. I have one too many as is in some parts. Thanks, Jeff Kunkel On Fri, Sep 3, 2010 at 12:57 PM, Jim Grosbach <grosbach at apple.com> wrote:> TargetRegisterInfo::getNumRegs(). > > Generally, it's best not to make any assumptions about the internal > ordering or numbering if you can avoid it. What are you looking to do? > > -Jim > > On Sep 3, 2010, at 9:37 AM, Jeff Kunkel wrote: > > > How do I get the total number of machine registers? I have currently a > MachineFunction and some derivatives. > > > > How are the machine registers ordered internally? Can I index them off of > a zero based array or do I have to create a map to have them be zero based? > > > > Thanks, > > Jeff Kunkel > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100903/6d0e2021/attachment.html>
Jakob Stoklund Olesen
2010-Sep-03 22:16 UTC
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
On Sep 3, 2010, at 9:37 AM, Jeff Kunkel wrote:> How do I get the total number of machine registers? I have currently a MachineFunction and some derivatives. > > How are the machine registers ordered internally? Can I index them off of a zero based array or do I have to create a map to have them be zero based?Registers are numbered from 1 to TRI::getNumRegs()-1. Reg 0 is not a register, but it is counted by getNumRegs. They are currently sorted by name by StringRef::compare_numeric(), but try to avoid depending on that. It could easily change, I have been experimenting with the performance impact of a topological order. /jakob
Jeff Kunkel
2010-Sep-29 15:11 UTC
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
Jacob, have you completed the topological sorting or the registers? It seems I iterate through sub/alias-registers quite often, and I think a performance gain might occur if the sub-registers were grouped better. Thanks, Jeff Kunkel
Apparently Analagous Threads
- [LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
- [LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
- [LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
- [LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
- [LLVMdev] [PATCH] increase the max number of physical registers