Instruction categories in the backend

Dear all,

I would like to classify all target specific instructions in a set of categories. The category of each instruction would then be available in the backend.
Just to illustrate what I am trying to do, the first thing I thought about how to achieve this was to group instruction definitions in InstrInfo.td in the order of categories, and to put pseudo instructions in between to mark category boundaries. However, the Target Instruction Enum in GenInstrNames.inc does not follow the definition order of the .td, but is in fact ordered alphabetically.

Thanks for any suggestions!
Christian

Hi Christian,

This is supported directly: TargetInstrDesc has 32-bits per instruction that your target can do whatever it wants with (TSFlags). tblgen has support for populating these directly. The X86 backend uses this for various encoding and other purposes. See X86InstrInfo.h (the X86II namespace) and related stuff for an example. tblgen is informed about the encoding of the 32-bit field with the TSFlagsFields/TSFlagsShifts entries in X86InstrInfo in X86.td.

-Chris