about summary refs log tree commit diff
path: root/src/rustllvm/Passes2.cpp
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2011-05-24 13:47:27 -0400
committerRafael Ávila de Espíndola <respindola@mozilla.com>2011-06-08 14:08:24 -0400
commit698022d351e552b51cd9cca878bdc0de3de05b8c (patch)
tree36f0cc07c4f2b66ad914c5022c01b3706c937973 /src/rustllvm/Passes2.cpp
parentd360c481e8bd6079eb92b155a7c5451fc8bd35f6 (diff)
downloadrust-698022d351e552b51cd9cca878bdc0de3de05b8c.tar.gz
rust-698022d351e552b51cd9cca878bdc0de3de05b8c.zip
Update rust to build with newer llvm versions.
Diffstat (limited to 'src/rustllvm/Passes2.cpp')
-rw-r--r--src/rustllvm/Passes2.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/rustllvm/Passes2.cpp b/src/rustllvm/Passes2.cpp
index c4ead0de5aa..dcc549b511f 100644
--- a/src/rustllvm/Passes2.cpp
+++ b/src/rustllvm/Passes2.cpp
@@ -1,5 +1,5 @@
 #include "llvm/Analysis/Passes.h"
-#include "llvm/Support/StandardPasses.h"
+#include "llvm/Support/PassManagerBuilder.h"
 #include "llvm/PassManager.h"
 #include "llvm-c/Core.h"
 #include <cstdlib>
@@ -8,22 +8,29 @@ using namespace llvm;
 
 extern "C" void LLVMAddStandardFunctionPasses(LLVMPassManagerRef PM,
     unsigned int OptimizationLevel) {
-  createStandardFunctionPasses(unwrap(PM), OptimizationLevel);
+  PassManagerBuilder PMBuilder;
+  PMBuilder.OptLevel = OptimizationLevel;
+  FunctionPassManager *FPM = (FunctionPassManager*) unwrap(PM);
+  PMBuilder.populateFunctionPassManager(*FPM);
 }
 
 extern "C" void LLVMAddStandardModulePasses(LLVMPassManagerRef PM,
     unsigned int OptimizationLevel, LLVMBool OptimizeSize,
     LLVMBool UnitAtATime, LLVMBool UnrollLoops, LLVMBool SimplifyLibCalls,
-    LLVMBool HaveExceptions, unsigned int InliningThreshold) {
-  Pass *InliningPass;
+    unsigned int InliningThreshold) {
+
+  PassManagerBuilder PMBuilder;
+  PMBuilder.OptLevel = OptimizationLevel;
+  PMBuilder.SizeLevel = OptimizeSize;
+  PMBuilder.DisableUnitAtATime = !UnitAtATime;
+  PMBuilder.DisableUnrollLoops = !UnrollLoops;
+
+  PMBuilder.DisableSimplifyLibCalls = !SimplifyLibCalls;
+
   if (InliningThreshold)
-    InliningPass = createFunctionInliningPass(InliningThreshold);
-  else
-    InliningPass = NULL;
+    PMBuilder.Inliner = createFunctionInliningPass(InliningThreshold);
 
-  createStandardModulePasses(unwrap(PM), OptimizationLevel, OptimizeSize,
-                             UnitAtATime, UnrollLoops, SimplifyLibCalls,
-                             HaveExceptions, InliningPass);
+  PassManager *MPM = (PassManager*) unwrap(PM);
+  PMBuilder.populateModulePassManager(*MPM);
 }
 
-