[llvm] RuntimeLibcalls: Add LibraryRef for dispatch-with-exclusion (PR #218869)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 02:42:04 PDT 2026


================
@@ -637,13 +662,38 @@ void RuntimeLibcallEmitter::emitRuntimeLibcallsInfoMemberDecls(
 
 void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
     raw_ostream &OS) const {
-  // Emit one function per distinct library name; same-named defs merge.
-  for (const auto &[Name, Libs] : collectLibrariesByName())
-    emitLibraryFunction(OS, Name, Libs);
-
   ArrayRef<const Record *> AllLibs =
       Records.getAllDerivedDefinitions("SystemRuntimeLibrary");
 
+  // Collect each shared library's LibraryRef opt-outs, keyed by library name,
+  // so its library function can emit them.
+  MapVector<StringRef, std::vector<LibraryExclusion>> ExclusionsByLibName;
+  for (const Record *R : AllLibs) {
+    const DagInit *MemberDag =
+        R->getValueAsDef("MemberList")->getValueAsDag("MemberList");
+    for (const Init *Arg : MemberDag->getArgs()) {
+      const auto *DI = dyn_cast<DefInit>(Arg);
+      if (!DI || !DI->getDef()->isSubClassOf("LibraryRef"))
+        continue;
+      const Record *Def = DI->getDef();
+      LibraryExclusion Excl{R->getValueAsDef("TriplePred"), {}};
+      for (const Record *ExcludeRec : Def->getValueAsListOfDefs("Exclude")) {
----------------
RKSimon wrote:

Is this implicity tested in the test file somehow?

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


More information about the llvm-commits mailing list