aboutsummaryrefslogtreecommitdiff
path: root/src/rustllvm/Passes2.cpp
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-05-06 12:02:04 -0700
committerPatrick Walton <[email protected]>2011-05-06 12:38:00 -0700
commitd089d9f9ed01464940ef6e383ec239bbd5612e8c (patch)
treebbf2f7067e12ab91ae9536dd49fe49e6bfbebb9d /src/rustllvm/Passes2.cpp
parentrustc: For stack local derived tydescs, allocate the root tydesc separately f... (diff)
downloadrust-d089d9f9ed01464940ef6e383ec239bbd5612e8c.tar.xz
rust-d089d9f9ed01464940ef6e383ec239bbd5612e8c.zip
rustllvm: Add a binding to the LLVM standard module passes
Diffstat (limited to 'src/rustllvm/Passes2.cpp')
-rw-r--r--src/rustllvm/Passes2.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/rustllvm/Passes2.cpp b/src/rustllvm/Passes2.cpp
new file mode 100644
index 00000000..a0a6a20c
--- /dev/null
+++ b/src/rustllvm/Passes2.cpp
@@ -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);
+}
+
+