diff options
| author | Nikita Popov <npopov@redhat.com> | 2022-04-20 09:25:13 +0200 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2022-04-20 09:36:02 +0200 |
| commit | 6dc0bcc5db00524af73eb7dd2f6e24f38736f1aa (patch) | |
| tree | 9a100df4702f4d8394a5f46a542fd685f7551833 /compiler/rustc_llvm/llvm-wrapper | |
| parent | 3cf0809a8d3ce66f468eed3dea96408d42eec33b (diff) | |
| download | rust-6dc0bcc5db00524af73eb7dd2f6e24f38736f1aa.tar.gz rust-6dc0bcc5db00524af73eb7dd2f6e24f38736f1aa.zip | |
Stub out more PassManagerBuilder functions
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 3f522b0bcef..38fddbdba54 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -187,6 +187,41 @@ extern "C" void LLVMRustAddPass(LLVMPassManagerRef PMR, LLVMPassRef RustPass) { report_fatal_error("Legacy PM not supported with LLVM 15"); #endif } + +extern "C" LLVMPassManagerBuilderRef LLVMRustPassManagerBuilderCreate() { +#if LLVM_VERSION_LT(15, 0) + return LLVMPassManagerBuilderCreate(); +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif +} + +extern "C" void LLVMRustPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB) { +#if LLVM_VERSION_LT(15, 0) + LLVMPassManagerBuilderDispose(PMB); +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif +} + +extern "C" void LLVMRustPassManagerBuilderPopulateFunctionPassManager( + LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM) { +#if LLVM_VERSION_LT(15, 0) + LLVMPassManagerBuilderPopulateFunctionPassManager(PMB, PM); +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif +} + +extern "C" void LLVMRustPassManagerBuilderPopulateModulePassManager( + LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM) { +#if LLVM_VERSION_LT(15, 0) + LLVMPassManagerBuilderPopulateModulePassManager(PMB, PM); +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif +} + extern "C" void LLVMRustPassManagerBuilderPopulateLTOPassManager( LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM, bool Internalize, bool RunInliner) { #if LLVM_VERSION_LT(15, 0) @@ -208,6 +243,15 @@ void LLVMRustPassManagerBuilderPopulateThinLTOPassManager( #endif } +extern "C" void LLVMRustPassManagerBuilderUseInlinerWithThreshold( + LLVMPassManagerBuilderRef PMB, unsigned Threshold) { +#if LLVM_VERSION_LT(15, 0) + LLVMPassManagerBuilderUseInlinerWithThreshold(PMB, Threshold); +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif +} + extern "C" void LLVMRustAddLastExtensionPasses( LLVMPassManagerBuilderRef PMBR, LLVMPassRef *Passes, size_t NumPasses) { @@ -577,12 +621,16 @@ extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) { extern "C" void LLVMRustConfigurePassManagerBuilder( LLVMPassManagerBuilderRef PMBR, LLVMRustCodeGenOptLevel OptLevel, bool MergeFunctions, bool SLPVectorize, bool LoopVectorize, bool PrepareForThinLTO, - const char* PGOGenPath, const char* PGOUsePath, const char* PGOSampleUsePath) { + const char* PGOGenPath, const char* PGOUsePath, const char* PGOSampleUsePath, + int SizeLevel) { +#if LLVM_VERSION_LT(15, 0) unwrap(PMBR)->MergeFunctions = MergeFunctions; unwrap(PMBR)->SLPVectorize = SLPVectorize; unwrap(PMBR)->OptLevel = fromRust(OptLevel); unwrap(PMBR)->LoopVectorize = LoopVectorize; unwrap(PMBR)->PrepareForThinLTO = PrepareForThinLTO; + unwrap(PMBR)->SizeLevel = SizeLevel; + unwrap(PMBR)->DisableUnrollLoops = SizeLevel != 0; if (PGOGenPath) { assert(!PGOUsePath && !PGOSampleUsePath); @@ -594,6 +642,9 @@ extern "C" void LLVMRustConfigurePassManagerBuilder( } else if (PGOSampleUsePath) { unwrap(PMBR)->PGOSampleUse = PGOSampleUsePath; } +#else + report_fatal_error("Legacy PM not supported with LLVM 15"); +#endif } // Unfortunately, the LLVM C API doesn't provide a way to set the `LibraryInfo` |
