[llvm] [LLVM] Change Intrinsic::ID to encode target and intrinsic index (PR #113576)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 25 14:26:26 PDT 2024
================
@@ -155,13 +158,13 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
OS << "// Enum values for intrinsics.\n";
bool First = true;
- for (const auto &Int : Ints[*Set]) {
+ for (const auto &Int : Set->getIntrinsics()) {
OS << " " << Int.EnumName;
// Assign a value to the first intrinsic in this target set so that all
// intrinsic ids are distinct.
if (First) {
- OS << " = " << Set->Offset + 1;
+ Intrinsic::PrintIntrinsicIDEncoding(OS, Set->TargetIndex, 0);
----------------
jurahul wrote:
Also, I don't know how much value the `TargetPrefixIndex` provides. Across different LLVM source versions (which is when a new target prefix will appear), intrinsic IDs won't be stable in any case even if the TargetPrefixIndex stays stable, since intrinsics themselves for a given target may have changed, causing a change in the intrinsic index that's encoded in the enum. To be truly stable, we need to be able to specify in TableGen both the index of the target prefix as well as the index of the intrinsic within that target (i.e, change the `Intrinsic` class to be able to specify it) and then add checks for duplicates, which seems quite invasive change.
https://github.com/llvm/llvm-project/pull/113576
More information about the llvm-commits
mailing list