[llvm] [GISel][TableGen] Generate getRegBankFromRegClass (PR #99896)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 23:09:05 PDT 2024


================
@@ -287,8 +291,88 @@ void RegisterBankEmitter::emitBaseClassImplementation(
      << "  for (auto RB : enumerate(RegBanks))\n"
      << "    assert(RB.index() == RB.value()->getID() && \"Index != ID\");\n"
      << "#endif // NDEBUG\n"
-     << "}\n"
-     << "} // end namespace llvm\n";
+     << "}\n";
+
+  uint32_t NoRegBanks = Banks.size();
+  uint32_t BitSize = NextPowerOf2(Log2_32(NoRegBanks));
+  uint32_t ElemsPerWord = 32 / BitSize;
+  uint32_t BitMask = (1 << BitSize) - 1;
+  bool HasAmbigousOrMissingEntry = false;
+  struct Entry {
+    std::string RCIdName;
+    std::string RBIdName;
+  };
+  std::vector<Entry> Entries;
----------------
Pierre-vh wrote:

`SmallVector` is generally preferred

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


More information about the llvm-commits mailing list