[llvm] [TableGen] Add PrintError family overload that take a print function (PR #107333)

Tomas Matheson via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 06:08:36 PDT 2024


================
@@ -122,21 +121,24 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
   // Find the TargetSet for which to generate enums. There will be an initial
   // set with an empty target prefix which will include target independent
   // intrinsics like dbg.value.
-  const CodeGenIntrinsicTable::TargetSet *Set = nullptr;
+  using TargetSet = CodeGenIntrinsicTable::TargetSet;
+  const TargetSet *Set = nullptr;
   for (const auto &Target : Ints.Targets) {
     if (Target.Name == IntrinsicPrefix) {
       Set = &Target;
       break;
     }
   }
   if (!Set) {
-    std::vector<std::string> KnownTargets;
-    for (const auto &Target : Ints.Targets)
-      if (!Target.Name.empty())
-        KnownTargets.push_back(Target.Name.str());
-    PrintFatalError("tried to generate intrinsics for unknown target " +
-                    IntrinsicPrefix +
-                    "\nKnown targets are: " + join(KnownTargets, ", ") + "\n");
+    // The first entry is for target independent intrinsics, so drop it.
+    auto KnowTargets = ArrayRef<TargetSet>(Ints.Targets).drop_front();
----------------
tmatheson-arm wrote:

Mixing in unrelated refactoring like this makes it harder to review. Same with the `OpNo -= NumResults` change above.

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


More information about the llvm-commits mailing list