Commit f9ada2cb authored by Brenden Blanco's avatar Brenden Blanco Committed by GitHub

Merge pull request #668 from iovisor/ast_dev

fix build with 4.0 llvm trunk
parents 545008a0 959e4036
...@@ -44,7 +44,7 @@ add_library(bcc-static STATIC bpf_common.cc bpf_module.cc shared_table.cc export ...@@ -44,7 +44,7 @@ add_library(bcc-static STATIC bpf_common.cc bpf_module.cc shared_table.cc export
set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc) set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc)
set(llvm_raw_libs bitwriter bpfcodegen irreader linker set(llvm_raw_libs bitwriter bpfcodegen irreader linker
mcjit objcarcopts option passes nativecodegen) mcjit objcarcopts option passes nativecodegen lto)
list(FIND LLVM_AVAILABLE_LIBS "LLVMCoverage" _llvm_coverage) list(FIND LLVM_AVAILABLE_LIBS "LLVMCoverage" _llvm_coverage)
if (${_llvm_coverage} GREATER -1) if (${_llvm_coverage} GREATER -1)
list(APPEND llvm_raw_libs coverage) list(APPEND llvm_raw_libs coverage)
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <llvm/Support/TargetSelect.h> #include <llvm/Support/TargetSelect.h>
#include <llvm/Transforms/IPO.h> #include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/PassManagerBuilder.h> #include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm-c/Transforms/IPO.h>
#include "exception.h" #include "exception.h"
#include "frontends/b/loader.h" #include "frontends/b/loader.h"
...@@ -396,7 +397,14 @@ int BPFModule::run_pass_manager(Module &mod) { ...@@ -396,7 +397,14 @@ int BPFModule::run_pass_manager(Module &mod) {
PassManagerBuilder PMB; PassManagerBuilder PMB;
PMB.OptLevel = 3; PMB.OptLevel = 3;
PM.add(createFunctionInliningPass()); PM.add(createFunctionInliningPass());
PM.add(createAlwaysInlinerPass()); /*
* llvm < 4.0 needs
* PM.add(createAlwaysInlinerPass());
* llvm >= 4.0 needs
* PM.add(createAlwaysInlinerLegacyPass());
* use below 'stable' workaround
*/
LLVMAddAlwaysInlinerPass(reinterpret_cast<LLVMPassManagerRef>(&PM));
PMB.populateModulePassManager(PM); PMB.populateModulePassManager(PM);
if (flags_ & 1) if (flags_ & 1)
PM.add(createPrintModulePass(outs())); PM.add(createPrintModulePass(outs()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment