rustllvm: Add a binding to the LLVM standard module passes
This commit is contained in:
parent
5e2088f2fa
commit
d089d9f9ed
@ -3,7 +3,7 @@
|
||||
######################################################################
|
||||
|
||||
RUSTLLVM_LIB_CS := $(addprefix rustllvm/, \
|
||||
MachOObjectFile.cpp Passes.cpp)
|
||||
MachOObjectFile.cpp Passes.cpp Passes2.cpp)
|
||||
|
||||
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustWrapper.cpp)
|
||||
|
||||
|
@ -802,6 +802,16 @@ native mod llvm = llvm_lib {
|
||||
fn LLVMAddTypeBasedAliasAnalysisPass(PassManagerRef PM);
|
||||
fn LLVMAddBasicAliasAnalysisPass(PassManagerRef PM);
|
||||
|
||||
// FIXME: Native stubs don't allow this many arguments yet.
|
||||
/*fn LLVMAddStandardModulePasses(PassManagerRef PM,
|
||||
uint OptimizationLevel,
|
||||
Bool OptimizeSize,
|
||||
Bool UnitAtATime,
|
||||
Bool UnrollLoops,
|
||||
Bool SimplifyLibCalls,
|
||||
Bool HaveExceptions,
|
||||
uint InliningThreshold);*/
|
||||
|
||||
/** Destroys a memory buffer. */
|
||||
fn LLVMDisposeMemoryBuffer(MemoryBufferRef MemBuf);
|
||||
|
||||
|
24
src/rustllvm/Passes2.cpp
Normal file
24
src/rustllvm/Passes2.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Support/StandardPasses.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
extern "C" void LLVMAddStandardModulePasses(LLVMPassManagerRef PM,
|
||||
unsigned int OptimizationLevel, bool OptimizeSize, bool UnitAtATime,
|
||||
bool UnrollLoops, bool SimplifyLibCalls, bool HaveExceptions,
|
||||
unsigned int InliningThreshold) {
|
||||
Pass *InliningPass;
|
||||
if (InliningThreshold)
|
||||
InliningPass = createFunctionInliningPass(InliningThreshold);
|
||||
else
|
||||
InliningPass = NULL;
|
||||
|
||||
createStandardModulePasses(unwrap(PM), OptimizationLevel, OptimizeSize,
|
||||
UnitAtATime, UnrollLoops, SimplifyLibCalls,
|
||||
HaveExceptions, InliningPass);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ LLVMAddScalarReplAggregatesPass
|
||||
LLVMAddScalarReplAggregatesPassSSA
|
||||
LLVMAddScalarReplAggregatesPassWithThreshold
|
||||
LLVMAddSimplifyLibCallsPass
|
||||
LLVMAddStandardModulePasses
|
||||
LLVMAddStripDeadPrototypesPass
|
||||
LLVMAddStripSymbolsPass
|
||||
LLVMAddTailCallEliminationPass
|
||||
|
Loading…
Reference in New Issue
Block a user