Pull RaiseAllocations stuff out of the CleanGCC pass into it's own pass in
the ChangeAllocations.h header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1522 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp
index 24a5e87..211b4cf 100644
--- a/tools/gccas/gccas.cpp
+++ b/tools/gccas/gccas.cpp
@@ -12,6 +12,7 @@
#include "llvm/Transforms/CleanupGCCOutput.h"
#include "llvm/Transforms/LevelChange.h"
#include "llvm/Transforms/ConstantMerge.h"
+#include "llvm/Transforms/LowerAllocations.h"
#include "llvm/Transforms/Scalar/DCE.h"
#include "llvm/Transforms/Scalar/IndVarSimplify.h"
#include "llvm/Transforms/Scalar/InstructionCombining.h"
@@ -65,6 +66,7 @@
//
PassManager Passes;
Passes.add(new DeadCodeElimination()); // Remove Dead code/vars
+ Passes.add(new RaiseAllocations()); // call %malloc -> malloc inst
Passes.add(new CleanupGCCOutput()); // Fix gccisms
Passes.add(new InductionVariableSimplify()); // Simplify indvars
Passes.add(new RaisePointerReferences()); // Eliminate casts
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 36de3bf..60c8683 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -15,6 +15,7 @@
#include "llvm/Transforms/LevelChange.h"
#include "llvm/Transforms/MethodInlining.h"
#include "llvm/Transforms/SymbolStripping.h"
+#include "llvm/Transforms/LowerAllocations.h"
#include "llvm/Transforms/IPO/SimpleStructMutation.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/Scalar/DCE.h"
@@ -34,7 +35,7 @@
dce, constprop, inlining, constmerge, strip, mstrip,
// Miscellaneous Transformations
- trace, tracem, print, cleangcc,
+ trace, tracem, print, raiseallocs, cleangcc,
// More powerful optimizations
indvars, instcombine, sccp, adce, raise,
@@ -61,6 +62,7 @@
{ trace , new InsertTraceCode(true, true) },
{ tracem , new InsertTraceCode(false, true) },
{ print , new PrintMethodPass("Current Method: \n",&cerr) },
+ { raiseallocs, new RaiseAllocations() },
{ cleangcc , new CleanupGCCOutput() },
{ globaldce , new GlobalDCE() },
{ swapstructs, new SimpleStructMutation(SimpleStructMutation::SwapElements) },
@@ -88,6 +90,7 @@
clEnumVal(swapstructs, "Swap structure types around"),
clEnumVal(sortstructs, "Sort structure elements"),
+ clEnumVal(raiseallocs, "Raise allocations from calls to instructions"),
clEnumVal(cleangcc , "Cleanup GCC Output"),
clEnumVal(raise , "Raise to Higher Level"),
clEnumVal(trace , "Insert BB & Method trace code"),