[llvm] [PassBuilder] Table-drive pass name printing (PR #202656)
David Zbarsky via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 10:51:45 PDT 2026
================
@@ -2850,92 +2796,157 @@ PassBuilder::parseRegAllocFilter(StringRef FilterName) {
return std::nullopt;
}
-static void printPassName(StringRef PassName, raw_ostream &OS) {
- OS << " " << PassName << "\n";
+namespace {
+struct PassNameWithParams {
+ StringLiteral Name;
+ StringLiteral Params;
+};
+} // namespace
+
+LLVM_ATTRIBUTE_NOINLINE static void
+printPassNameList(ArrayRef<StringLiteral> PassNames, raw_ostream &OS) {
+ for (StringRef PassName : PassNames)
+ OS << " " << PassName << '\n';
}
-static void printPassName(StringRef PassName, StringRef Params,
- raw_ostream &OS) {
- OS << " " << PassName << "<" << Params << ">\n";
+
+LLVM_ATTRIBUTE_NOINLINE static void
+printPassNameList(ArrayRef<PassNameWithParams> PassNames, raw_ostream &OS) {
+ for (const PassNameWithParams &PassName : PassNames)
+ OS << " " << PassName.Name << "<" << PassName.Params << ">\n";
}
void PassBuilder::printPassNames(raw_ostream &OS) {
// TODO: print pass descriptions when they are available
OS << "Module passes:\n";
-#define MODULE_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
+ static constexpr StringLiteral ModulePassNames[] = {
+#define MODULE_PASS(NAME, CREATE_PASS) NAME,
----------------
dzbarsky wrote:
ok, swapped to StringTable-style storage to avoid the relocations
https://github.com/llvm/llvm-project/pull/202656
More information about the llvm-commits
mailing list