I'd appreciate some help in figuring out how to determine which InstrItinClass an instruction belongs to.
For example, an InstrItinClass is defined in Schedule.td as:
def FOO : InstrItinClass;
Which is then used to build an InstrItinData in ProcessorItineraries and to specify the class of a particular instruction.
I'd like to find out from a given instruction which class it belongs to, "FOO" or any other.
I believe MCInstrDesc::getSchedClass() is what you're looking for.
That's what I thought of initially, but with it I can only get to the InstrItinerary for a given instruction which is fine, but I can't call it by an arbitrary label.
The reason I need this is because the array of InstrItinerary is built arbitrarily by tablegen. So while, say, ALU instructions are the 2nd item in this array, ALU instructions cannot be scheduled together with, say, loads, the 9th item in this array, I'd rather not hard-code the check for the result of getSchedClass to be "2" or "9", but something more readable like "MyALU" or "MyLD".
I think that I could provide this extra information as a bit-field in TSFlags. But I was hoping that tablegen would give me an enum for the InstrInstClass corresponding to its position in the InstrItinerary array.