[llvm] [TableGen] Extend direct lookup to instruction values in generic tables. (PR #80486)

Jason Eckhardt via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 16:59:02 PST 2024


================
@@ -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)
----------------
nvjle wrote:

> Sorry I'm late to this, but why not make this a field of CodeGenInstruction? We already have a map from Record to CodeGenInstruction.

Thanks for your comments @topperc, much appreciated. I'll make your suggested change in a new PR shortly, with you as reviewer/committer if you wouldn't mind. 

https://github.com/llvm/llvm-project/pull/80486


More information about the llvm-commits mailing list