diff options
| author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-03-15 16:56:45 +0100 |
|---|---|---|
| committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-03-25 03:30:06 +0200 |
| commit | e155ecdc9714f3ac76b554dc15ba06e219f576e0 (patch) | |
| tree | b8cbf88cec2f0be8f3442c667875a1cc049ddc36 /src/rustllvm/PassWrapper.cpp | |
| parent | 4053e25bfb55b6e1bf6766158ccd06cb87de79c7 (diff) | |
| download | rust-e155ecdc9714f3ac76b554dc15ba06e219f576e0.tar.gz rust-e155ecdc9714f3ac76b554dc15ba06e219f576e0.zip | |
try to fix the build on older LLVM versions.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index bee8ae5853f..3d5cce81278 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -44,6 +44,10 @@ #include "llvm-c/Transforms/PassManagerBuilder.h" +#if LLVM_VERSION_GE(4, 0) +#define PGO_AVAILABLE +#endif + using namespace llvm; using namespace llvm::legacy; @@ -435,6 +439,8 @@ extern "C" void LLVMRustConfigurePassManagerBuilder( unwrap(PMBR)->SLPVectorize = SLPVectorize; unwrap(PMBR)->OptLevel = fromRust(OptLevel); unwrap(PMBR)->LoopVectorize = LoopVectorize; + +#ifdef PGO_AVAILABLE if (PGOGenPath) { assert(!PGOUsePath); unwrap(PMBR)->EnablePGOInstrGen = true; @@ -444,6 +450,9 @@ extern "C" void LLVMRustConfigurePassManagerBuilder( assert(!PGOGenPath); unwrap(PMBR)->PGOInstrUse = PGOUsePath; } +#else + assert(!PGOGenPath && !PGOUsePath && "Should've caught earlier"); +#endif } // Unfortunately, the LLVM C API doesn't provide a way to set the `LibraryInfo` @@ -776,6 +785,15 @@ LLVMRustThinLTOAvailable() { #endif } +extern "C" bool +LLVMRustPGOAvailable() { +#ifdef PGO_AVAILABLE + return true; +#else + return false; +#endif +} + #if LLVM_VERSION_GE(4, 0) // Here you'll find an implementation of ThinLTO as used by the Rust compiler |
