[LLVMdev] Question on register class

Chris Lattner clattner at apple.com
Mon May 11 10:26:25 PDT 2009

On May 9, 2009, at 1:20 PM, Manjunath Kudlur wrote:

> Hello,
> Given a TargetRegisterClass *RC, I was wondering if there is a way to
> find out what register class it is directly, instead of comparing it
> against all the &mytarget::Class1, &mytarget::Class2 etc.

Sure, just use RC->getID(), which returns an enum.

> define them for each one the classes in the set. It will be nice if
> there is a way to build a hierarchy of register classes, and dispatch
> handlers by finding what class a given RC is. I will appreciate
> suggestions on how to do this, or alternative ways to solve this
> problem.

I don't think that there is a visitor mechanism set up, but you can  
build one base on "switching on the enum".


More information about the llvm-dev mailing list