[LLVMdev] [LLVMDev] [Question] The TargetRegisterClass has a confusing method.

Jeff Kunkel jdkunk3 at gmail.com
Wed Sep 1 03:46:53 PDT 2010


Aye, I understand it's an index into an array, but what is the difference
between the index i and the return value.

Do I have to worry that register values from a TargetRegisterClass could be
either zero based or some other base? Are there other methods that rely on
zero based in the TargetRegisterClass?

I thought register values were "global," but this transformation makes a
register value dependent on it's TargetRegisterClass.

Basically, I find it confusing to have two integer indexes for the same
value.


On Tue, Aug 31, 2010 at 3:26 PM, Jeff Kunkel <jdkunk3 at gmail.com> wrote:

> The method below takes in a register and returns a register. To me this
> makes no sense because
> when I already have a register, why would I need to get it? Could someone
> please explain the
> transformation that is happening here?
>
>   /// getRegister - Return the specified register in the class.
>   ///
>   unsigned getRegister(unsigned i) const {
>     assert(i < getNumRegs() && "Register number out of range!");
>     return RegsBegin[i];
>   }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100901/71bf0fc7/attachment.html>


More information about the llvm-dev mailing list