[LLVMdev] [LLVMDev] [Question] The TargetRegisterClass has a confusing method.
Bill Wendling
wendling at apple.com
Wed Sep 1 17:27:36 PDT 2010
The registers themselves are part of a "register class". They may not start at 0 and may not be in order. For instance, target classes for control registers, floating point registers, etc. Look at the "*.inc" files in one of the back-ends for examples of how the TargetRegisterClass objects are created. They are in the build directory under lib/Target/X86/X86Gen*.inc (replace X86 with your favorite architecture).
-bw
On Sep 1, 2010, at 3:46 AM, Jeff Kunkel wrote:
> 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];
> }
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list