Question on register class

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. This goes
back to my original intention of having special query functions for a
subset of register classes. Suppose I wanted vector register classes
(more than one, say 2-elements and 4-elements). I want to define
special query functions for these classes, like getVectorLength etc. I
can define them using MethodProtos and MethodBodies, but I have to
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.

Thanks,
Manjunath

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".

-Chris