|
9 | 9 | #include "llvm/Analysis/TargetLibraryInfo.h" |
10 | 10 | #include "llvm/Analysis/TargetTransformInfo.h" |
11 | 11 | #include "llvm/CodeGen/TargetSubtargetInfo.h" |
12 | | -#include "llvm/InitializePasses.h" |
13 | 12 | #include "llvm/IR/AutoUpgrade.h" |
14 | 13 | #include "llvm/IR/AssemblyAnnotationWriter.h" |
15 | 14 | #include "llvm/IR/IntrinsicInst.h" |
@@ -58,22 +57,6 @@ typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef; |
58 | 57 | DEFINE_STDCXX_CONVERSION_FUNCTIONS(Pass, LLVMPassRef) |
59 | 58 | DEFINE_STDCXX_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef) |
60 | 59 |
|
61 | | -extern "C" void LLVMInitializePasses() { |
62 | | - PassRegistry &Registry = *PassRegistry::getPassRegistry(); |
63 | | - initializeCore(Registry); |
64 | | - initializeCodeGen(Registry); |
65 | | - initializeScalarOpts(Registry); |
66 | | - initializeVectorization(Registry); |
67 | | - initializeIPO(Registry); |
68 | | - initializeAnalysis(Registry); |
69 | | - initializeTransformUtils(Registry); |
70 | | - initializeInstCombine(Registry); |
71 | | -#if LLVM_VERSION_LT(16, 0) |
72 | | - initializeInstrumentation(Registry); |
73 | | -#endif |
74 | | - initializeTarget(Registry); |
75 | | -} |
76 | | - |
77 | 60 | extern "C" void LLVMTimeTraceProfilerInitialize() { |
78 | 61 | timeTraceProfilerInitialize( |
79 | 62 | /* TimeTraceGranularity */ 0, |
@@ -1004,23 +987,8 @@ LLVMRustPrintModule(LLVMModuleRef M, const char *Path, DemangleFn Demangle) { |
1004 | 987 | } |
1005 | 988 |
|
1006 | 989 | extern "C" void LLVMRustPrintPasses() { |
1007 | | - LLVMInitializePasses(); |
1008 | | - struct MyListener : PassRegistrationListener { |
1009 | | - void passEnumerate(const PassInfo *Info) { |
1010 | | - StringRef PassArg = Info->getPassArgument(); |
1011 | | - StringRef PassName = Info->getPassName(); |
1012 | | - if (!PassArg.empty()) { |
1013 | | - // These unsigned->signed casts could theoretically overflow, but |
1014 | | - // realistically never will (and even if, the result is implementation |
1015 | | - // defined rather plain UB). |
1016 | | - printf("%15.*s - %.*s\n", (int)PassArg.size(), PassArg.data(), |
1017 | | - (int)PassName.size(), PassName.data()); |
1018 | | - } |
1019 | | - } |
1020 | | - } Listener; |
1021 | | - |
1022 | | - PassRegistry *PR = PassRegistry::getPassRegistry(); |
1023 | | - PR->enumerateWith(&Listener); |
| 990 | + PassBuilder PB; |
| 991 | + PB.printPassNames(outs()); |
1024 | 992 | } |
1025 | 993 |
|
1026 | 994 | extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols, |
|
0 commit comments