aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorJason Eckhardt <jeckhardt@nvidia.com>2024-02-07 21:33:16 -0600
committerGitHub <noreply@github.com>2024-02-07 19:33:16 -0800
commitd01864eb2f21d56cf432da7d80c505f510533c46 (patch)
tree8f42bd648bcc86719480dd927bc4f6e5e8e2ff22 /llvm/utils/TableGen/CodeGenTarget.cpp
parent5c4a630ab70f98138d6f95d19712bb114d92323d (diff)
downloadllvm-d01864eb2f21d56cf432da7d80c505f510533c46.zip
llvm-d01864eb2f21d56cf432da7d80c505f510533c46.tar.gz
llvm-d01864eb2f21d56cf432da7d80c505f510533c46.tar.bz2
[TableGen] Remove map CodeGenTarget::InstrToIntMap. (#81079)
This patch removes CodeGenTarget::InstrToIntMap, using instead a new member CodeGenInstruction::EnumVal to store each enum value. This value is computed and set by CodeGenTarget::computeInstrsByEnum and queried by CodeGenTarget::getInstrIntValue.
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index cf0049e..ceaa51b1 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -539,12 +539,10 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
std::make_tuple(!D2.getValueAsBit("isPseudo"), D2.getName());
});
- // Build the instruction-to-int map using the same values emitted by
- // InstrInfoEmitter::emitEnums.
- assert(InstrToIntMap.empty());
+ // Assign an enum value to each instruction according to the sorted order.
unsigned Num = 0;
for (const CodeGenInstruction *Inst : InstrsByEnum)
- InstrToIntMap[Inst->TheDef] = Num++;
+ Inst->EnumVal = Num++;
}