aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 37fa303..cf0049e 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -538,6 +538,13 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
return std::make_tuple(!D1.getValueAsBit("isPseudo"), D1.getName()) <
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());
+ unsigned Num = 0;
+ for (const CodeGenInstruction *Inst : InstrsByEnum)
+ InstrToIntMap[Inst->TheDef] = Num++;
}