[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Sep 3 15:16:23 PDT 2010


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





More information about the llvm-dev mailing list