I have noticed that logics of generating TypeSig in IntrinsicEmitter can be migrated to Intrinsics.td, with a few enhancements in TableGen, while working on TableGen.
My motivation is to let IntrinsicEmitter free from MachineValueType.h and migrate other CodeGen emitters to another TableGen like llvm-cg-tblgen. I have noticed that MVT is mostly used in the logic of TypeSig in IntrinsicEmitter.
I would like to propose changes along steps below.
- Preparations
- Split out
CodeGenIntrinsicsfromCodeGenTarget. ⚙ D143844 llvm-tblgen: Split out CodeGenIntrinsics.cpp from CodeGenTarget.cpp - Change sort order of TableGen’s
getAllDerivedDefinitions()as numeric order. Character order causes instability when anonymous records are increased or decreased due to wrapping-around issue. ⚙ D145874 TableGen: Let getAllDerivedDefinitions() numeric order. - Enhance TableGen to be able of index accessing of
list.- Introduce
!rangelist generator. ⚙ D145871 TableGen: Introduce `!range` operator for half-opened interval - Let expressions available to list subscriptions. ⚙ D145872 TableGen: Let expressions available to list subscripts and list slices
- Introduce
- Split out
- Enhance
ValueTypes.tdto have more information likeisVectorandElementTypeetc.- [Future plan] Let TableGen emit
MachineValueType.hwithValueTypes.td.
- [Future plan] Let TableGen emit
- Move constants to
Intrinsics.tdand emit them to generated headers.ArgKind– It is defined inIntrinsics.hand used in IntrinsicEmitter as naked constants. ⚙ D145873 Move definitions of ArgKind from Intrinsics.h to Intrinsics.tdIIT_Info– It is defined in bothIntrinsicEmitter.cppandFunction.cpp
- Implement the generator of TypeSig
- Prune TypeSig stuff in
IntrinsicEmitter.cpp
- Prune TypeSig stuff in
Each differential is expected to be applicable to main. Feel free to revise my English sentences in comments and documents.
The prototype is Commits · chapuni/llvm-project · GitHub This includes my differentials above.
See also the squashed differential, ⚙ D145937 Replace `IntrinsicEmitter::ComputeFixedEncoding()` and cleanup
Although I haven’t chosen reviewers to my differentials yet, I am happy if guys would nominate reviews for them.
Thank you.