[llvm] [LLVM] Change Intrinsic::ID to encode target and intrinsic index (PR #113576)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 25 11:02:30 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);
----------------
rnk wrote:
Are the Target indices stable when enabling and disabling targets? If I understand correctly currently, the contents of IntrinsicsX86.h should look something like:
```
enum X86Intrinsics : unsigned {
// Enum values for intrinsics
x86_aadd32 = (9 << 16) + 0 + 1,
x86_aadd64,
...
```
Does the target index (`9` here) change if you enable an unrelated target? If so, I don't think this achieves the goal of enum stability.
Maybe we need some kind of stable target identifier abstraction. I looked in Targets.def.in and TargetSelect.h, and the closest thing we have to a stable Target id is llvm::Triple::ArchType, but those map to subtargets, not backends, and it is not available at this layer.
https://github.com/llvm/llvm-project/pull/113576
More information about the llvm-commits
mailing list