Move stuff out of the Optimizations directories into the appropriate Transforms
authorChris Lattner <sabre@nondot.org>
Mon, 21 Jan 2002 23:17:48 +0000 (23:17 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Jan 2002 23:17:48 +0000 (23:17 +0000)
directories.  Eliminate the opt namespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1520 91177308-0d34-0410-b5e6-96231b3b80d8

19 files changed:
include/llvm/Transforms/FunctionInlining.h
include/llvm/Transforms/Scalar/ConstantProp.h
include/llvm/Transforms/Scalar/DCE.h
include/llvm/Transforms/Scalar/SymbolStripping.h
lib/Analysis/Expressions.cpp
lib/Makefile
lib/Transforms/ExprTypeConvert.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/LevelRaise.cpp
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/ConstantProp.cpp
lib/Transforms/Scalar/DCE.cpp
lib/Transforms/Scalar/InductionVars.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Scalar/SymbolStripping.cpp
lib/VMCore/ConstantFold.cpp
tools/gccas/gccas.cpp
tools/opt/opt.cpp

index abc08fdbadfc719311633513e5a720035dc9483f..252489749e9294cb982f50eb66e6ca591cca9ace 100644 (file)
@@ -11,8 +11,6 @@
 #include "llvm/BasicBlock.h"
 class CallInst;
 
 #include "llvm/BasicBlock.h"
 class CallInst;
 
-namespace opt {
-
 struct MethodInlining : public MethodPass {
   // DoMethodInlining - Use a heuristic based approach to inline methods that
   // seem to look good.
 struct MethodInlining : public MethodPass {
   // DoMethodInlining - Use a heuristic based approach to inline methods that
   // seem to look good.
@@ -37,6 +35,4 @@ struct MethodInlining : public MethodPass {
 bool InlineMethod(CallInst *C);
 bool InlineMethod(BasicBlock::iterator CI);  // *CI must be CallInst
 
 bool InlineMethod(CallInst *C);
 bool InlineMethod(BasicBlock::iterator CI);  // *CI must be CallInst
 
-}  // end namespace opt
-
 #endif
 #endif
index f4418665f9d965c57e160bfb8395ce9fcdcb4bd0..d9adf3f399a7b4299c4096d4a15fafc3a41e6585 100644 (file)
@@ -10,8 +10,6 @@
 #include "llvm/Pass.h"
 class TerminatorInst;
 
 #include "llvm/Pass.h"
 class TerminatorInst;
 
-namespace opt {
-
 struct ConstantPropogation : public MethodPass {
   // doConstantPropogation - Do trivial constant propogation and expression
   // folding
 struct ConstantPropogation : public MethodPass {
   // doConstantPropogation - Do trivial constant propogation and expression
   // folding
@@ -47,6 +45,4 @@ struct SCCPPass : public MethodPass {
   }
 };
 
   }
 };
 
-}  // End Namespace opt
-
 #endif
 #endif
index 0e9c620548d2f53cd28072467f3f21f1dca1f874..bc498c34a76316f502c02eb2bd8d186c4e06fbf2 100644 (file)
@@ -11,8 +11,6 @@
 #include "llvm/Pass.h"
 #include "llvm/BasicBlock.h"
 
 #include "llvm/Pass.h"
 #include "llvm/BasicBlock.h"
 
-namespace opt {
-
 struct DeadCodeElimination : public MethodPass {
   // External Interface:
   //
 struct DeadCodeElimination : public MethodPass {
   // External Interface:
   //
@@ -66,6 +64,4 @@ struct AgressiveDCE : public MethodPass {
 //
 bool SimplifyCFG(Method::iterator &BBIt);
 
 //
 bool SimplifyCFG(Method::iterator &BBIt);
 
-}  // End namespace opt
-
 #endif
 #endif
index ff31a4b5323465dacb0e5c421a65f809ca14b084..156e21171f25440e2d862f55e966c574258b9f67 100644 (file)
@@ -10,8 +10,6 @@
 
 #include "llvm/Pass.h"
 
 
 #include "llvm/Pass.h"
 
-namespace opt {
-
 struct SymbolStripping : public MethodPass {
   // doSymbolStripping - Remove all symbolic information from a method
   //
 struct SymbolStripping : public MethodPass {
   // doSymbolStripping - Remove all symbolic information from a method
   //
@@ -38,5 +36,4 @@ struct FullSymbolStripping : public MethodPass {
   }
 };
 
   }
 };
 
-} // End namespace opt 
 #endif
 #endif
index e94c7960596445fb37c32a12b4bbb048f856a8d0..8fdfba6ada6985c3b73daa9c4c99e93ae479f195 100644 (file)
@@ -8,12 +8,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Analysis/Expressions.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Analysis/Expressions.h"
-#include "llvm/Optimizations/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include <iostream>
 
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include <iostream>
 
-using namespace opt;  // Get all the constant handling stuff
 using namespace analysis;
 
 ExprType::ExprType(Value *Val) {
 using namespace analysis;
 
 ExprType::ExprType(Value *Val) {
index 5ff4f16e62fb4d455eedeb6d58b4951750c5fea5..3ec777170076cd7036fcc757401a39fc6b344304 100644 (file)
@@ -1,5 +1,5 @@
 LEVEL = ..
 LEVEL = ..
-DIRS = VMCore Analysis Transforms Assembly Bytecode Optimizations Support CodeGen Target
+DIRS = VMCore Analysis Transforms Assembly Bytecode Support CodeGen Target
 
 include $(LEVEL)/Makefile.common
 
 
 include $(LEVEL)/Makefile.common
 
index 7f33fe280b8fd8daabc1743c85257108a8b816fc..d75a8ac68cbf58f521f0092cdbb82c7d4db35e5e 100644 (file)
@@ -12,8 +12,8 @@
 #include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/ConstantVals.h"
-#include "llvm/Optimizations/ConstantHandling.h"
-#include "llvm/Optimizations/DCE.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/DCE.h"
 #include "llvm/Analysis/Expressions.h"
 #include "Support/STLExtras.h"
 #include <map>
 #include "llvm/Analysis/Expressions.h"
 #include "Support/STLExtras.h"
 #include <map>
@@ -190,7 +190,7 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty,
     // it can convert the value...
     //
     if (Constant *CPV = dyn_cast<Constant>(V))
     // it can convert the value...
     //
     if (Constant *CPV = dyn_cast<Constant>(V))
-      if (opt::ConstantFoldCastInstruction(CPV, Ty))
+      if (ConstantFoldCastInstruction(CPV, Ty))
         return true;  // Don't worry about deallocating, it's a constant.
 
     return false;              // Otherwise, we can't convert!
         return true;  // Don't worry about deallocating, it's a constant.
 
     return false;              // Otherwise, we can't convert!
@@ -369,7 +369,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
     if (Constant *CPV = cast<Constant>(V)) {
       // Constants are converted by constant folding the cast that is required.
       // We assume here that all casts are implemented for constant prop.
     if (Constant *CPV = cast<Constant>(V)) {
       // Constants are converted by constant folding the cast that is required.
       // We assume here that all casts are implemented for constant prop.
-      Value *Result = opt::ConstantFoldCastInstruction(CPV, Ty);
+      Value *Result = ConstantFoldCastInstruction(CPV, Ty);
       assert(Result && "ConstantFoldCastInstruction Failed!!!");
       assert(Result->getType() == Ty && "Const prop of cast failed!");
 
       assert(Result && "ConstantFoldCastInstruction Failed!!!");
       assert(Result->getType() == Ty && "Const prop of cast failed!");
 
index 9d86c8689539cc37cb2e28abdb6fee1818d8a0fb..a71acd2a79f880827e3e111d999417f9b294e846 100644 (file)
@@ -9,17 +9,16 @@
 //   . Has a smart heuristic for when to inline a method
 //
 // Notice that:
 //   . Has a smart heuristic for when to inline a method
 //
 // Notice that:
-//   * This pass has a habit of introducing duplicated constant pool entries, 
-//     and also opens up a lot of opportunities for constant propogation.  It is
-//     a good idea to to run a constant propogation pass, then a DCE pass 
+//   * This pass opens up a lot of opportunities for constant propogation.  It
+//     is a good idea to to run a constant propogation pass, then a DCE pass 
 //     sometime after running this pass.
 //
 // TODO: Currently this throws away all of the symbol names in the method being
 //     sometime after running this pass.
 //
 // TODO: Currently this throws away all of the symbol names in the method being
-//       inlined to try to avoid name clashes.  Use a name if it's not taken
+//       inlined.  This shouldn't happen.
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/MethodInlining.h"
+#include "llvm/Transforms/MethodInlining.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/iTerminators.h"
@@ -32,8 +31,6 @@ using std::cerr;
 
 #include "llvm/Assembly/Writer.h"
 
 
 #include "llvm/Assembly/Writer.h"
 
-using namespace opt;
-
 // RemapInstruction - Convert the instruction operands from referencing the 
 // current values into those specified by ValueMap.
 //
 // RemapInstruction - Convert the instruction operands from referencing the 
 // current values into those specified by ValueMap.
 //
@@ -65,7 +62,7 @@ static inline void RemapInstruction(Instruction *I,
 // exists in the instruction stream.  Similiarly this will inline a recursive
 // method by one level.
 //
 // exists in the instruction stream.  Similiarly this will inline a recursive
 // method by one level.
 //
-bool opt::InlineMethod(BasicBlock::iterator CIIt) {
+bool InlineMethod(BasicBlock::iterator CIIt) {
   assert(isa<CallInst>(*CIIt) && "InlineMethod only works on CallInst nodes!");
   assert((*CIIt)->getParent() && "Instruction not embedded in basic block!");
   assert((*CIIt)->getParent()->getParent() && "Instruction not in method!");
   assert(isa<CallInst>(*CIIt) && "InlineMethod only works on CallInst nodes!");
   assert((*CIIt)->getParent() && "Instruction not embedded in basic block!");
   assert((*CIIt)->getParent()->getParent() && "Instruction not in method!");
@@ -207,7 +204,7 @@ bool opt::InlineMethod(BasicBlock::iterator CIIt) {
   return true;
 }
 
   return true;
 }
 
-bool opt::InlineMethod(CallInst *CI) {
+bool InlineMethod(CallInst *CI) {
   assert(CI->getParent() && "CallInst not embeded in BasicBlock!");
   BasicBlock *PBB = CI->getParent();
 
   assert(CI->getParent() && "CallInst not embeded in BasicBlock!");
   BasicBlock *PBB = CI->getParent();
 
@@ -248,7 +245,7 @@ static inline bool DoMethodInlining(BasicBlock *BB) {
   return false;
 }
 
   return false;
 }
 
-bool opt::MethodInlining::doMethodInlining(Method *M) {
+bool MethodInlining::doMethodInlining(Method *M) {
   bool Changed = false;
 
   // Loop through now and inline instructions a basic block at a time...
   bool Changed = false;
 
   // Loop through now and inline instructions a basic block at a time...
index f140676937152fd0bcf8cf5d1db57e69b0dd242b..38865003bb35e95925ee1bf9fc9f4167fba2a63d 100644 (file)
@@ -12,9 +12,9 @@
 #include "llvm/iOther.h"
 #include "llvm/iMemory.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/iOther.h"
 #include "llvm/iMemory.h"
 #include "llvm/ConstantVals.h"
-#include "llvm/Optimizations/ConstantHandling.h"
-#include "llvm/Optimizations/DCE.h"
-#include "llvm/Optimizations/ConstantProp.h"
+#include "llvm/Transforms/Scalar/DCE.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantProp.h"
 #include "llvm/Analysis/Expressions.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 #include "llvm/Analysis/Expressions.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
@@ -413,8 +413,8 @@ static bool DoRaisePass(Method *M) {
 #if DEBUG_PEEPHOLE_INSTS
       cerr << "Processing: " << *BI;
 #endif
 #if DEBUG_PEEPHOLE_INSTS
       cerr << "Processing: " << *BI;
 #endif
-      if (opt::DeadCodeElimination::dceInstruction(BIL, BI) ||
-         opt::ConstantPropogation::doConstantPropogation(BB, BI)) {
+      if (DeadCodeElimination::dceInstruction(BIL, BI) ||
+         ConstantPropogation::doConstantPropogation(BB, BI)) {
         Changed = true; 
 #ifdef DEBUG_PEEPHOLE_INSTS
         cerr << "DeadCode Elinated!\n";
         Changed = true; 
 #ifdef DEBUG_PEEPHOLE_INSTS
         cerr << "DeadCode Elinated!\n";
index 45a57a2f438659a3315ec7e46de7b640f234556b..01046b00337cdca5baadbdb005586bd126048b20 100644 (file)
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/DCE.h"
+#include "llvm/Transforms/Scalar/DCE.h"
 #include "llvm/Instruction.h"
 #include "llvm/Type.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Instruction.h"
 #include "llvm/Type.h"
 #include "llvm/Analysis/Dominators.h"
@@ -297,7 +297,7 @@ BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks,
 
 // doADCE - Execute the Agressive Dead Code Elimination Algorithm
 //
 
 // doADCE - Execute the Agressive Dead Code Elimination Algorithm
 //
-bool opt::AgressiveDCE::doADCE(Method *M) {
+bool AgressiveDCE::doADCE(Method *M) {
   if (M->isExternal()) return false;
   ADCE DCE(M);
   return DCE.doADCE();
   if (M->isExternal()) return false;
   ADCE DCE(M);
   return DCE.doADCE();
index a961bad927c20cdcccbd9e90dfbdc553a88b452a..190bd4b919c66583a2790072c94d8240509459d6 100644 (file)
@@ -21,8 +21,8 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/ConstantProp.h"
-#include "llvm/Optimizations/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantProp.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
@@ -34,8 +34,7 @@
 inline static bool 
 ConstantFoldUnaryInst(BasicBlock *BB, BasicBlock::iterator &II,
                       UnaryOperator *Op, Constant *D) {
 inline static bool 
 ConstantFoldUnaryInst(BasicBlock *BB, BasicBlock::iterator &II,
                       UnaryOperator *Op, Constant *D) {
-  Constant *ReplaceWith = 
-    opt::ConstantFoldUnaryInstruction(Op->getOpcode(), D);
+  Constant *ReplaceWith = ConstantFoldUnaryInstruction(Op->getOpcode(), D);
 
   if (!ReplaceWith) return false;   // Nothing new to change...
 
 
   if (!ReplaceWith) return false;   // Nothing new to change...
 
@@ -57,8 +56,7 @@ ConstantFoldUnaryInst(BasicBlock *BB, BasicBlock::iterator &II,
 inline static bool 
 ConstantFoldCast(BasicBlock *BB, BasicBlock::iterator &II,
                  CastInst *CI, Constant *D) {
 inline static bool 
 ConstantFoldCast(BasicBlock *BB, BasicBlock::iterator &II,
                  CastInst *CI, Constant *D) {
-  Constant *ReplaceWith = 
-    opt::ConstantFoldCastInstruction(D, CI->getType());
+  Constant *ReplaceWith = ConstantFoldCastInstruction(D, CI->getType());
 
   if (!ReplaceWith) return false;   // Nothing new to change...
 
 
   if (!ReplaceWith) return false;   // Nothing new to change...
 
@@ -81,8 +79,7 @@ inline static bool
 ConstantFoldBinaryInst(BasicBlock *BB, BasicBlock::iterator &II,
                       BinaryOperator *Op,
                       Constant *D1, Constant *D2) {
 ConstantFoldBinaryInst(BasicBlock *BB, BasicBlock::iterator &II,
                       BinaryOperator *Op,
                       Constant *D1, Constant *D2) {
-  Constant *ReplaceWith =
-    opt::ConstantFoldBinaryInstruction(Op->getOpcode(), D1, D2);
+  Constant *ReplaceWith = ConstantFoldBinaryInstruction(Op->getOpcode(), D1,D2);
   if (!ReplaceWith) return false;   // Nothing new to change...
 
   // Replaces all of the uses of a variable with uses of the constant.
   if (!ReplaceWith) return false;   // Nothing new to change...
 
   // Replaces all of the uses of a variable with uses of the constant.
@@ -104,7 +101,7 @@ ConstantFoldBinaryInst(BasicBlock *BB, BasicBlock::iterator &II,
 // constant value, convert it into an unconditional branch to the constant
 // destination.
 //
 // constant value, convert it into an unconditional branch to the constant
 // destination.
 //
-bool opt::ConstantFoldTerminator(TerminatorInst *T) {
+bool ConstantFoldTerminator(TerminatorInst *T) {
   // Branch - See if we are conditional jumping on constant
   if (BranchInst *BI = dyn_cast<BranchInst>(T)) {
     if (BI->isUnconditional()) return false;  // Can't optimize uncond branch
   // Branch - See if we are conditional jumping on constant
   if (BranchInst *BI = dyn_cast<BranchInst>(T)) {
     if (BI->isUnconditional()) return false;  // Can't optimize uncond branch
@@ -156,8 +153,8 @@ bool opt::ConstantFoldTerminator(TerminatorInst *T) {
 // ConstantFoldInstruction - If an instruction references constants, try to fold
 // them together...
 //
 // ConstantFoldInstruction - If an instruction references constants, try to fold
 // them together...
 //
-bool opt::ConstantPropogation::doConstantPropogation(BasicBlock *BB,
-                                                    BasicBlock::iterator &II) {
+bool ConstantPropogation::doConstantPropogation(BasicBlock *BB,
+                                                BasicBlock::iterator &II) {
   Instruction *Inst = *II;
   if (isa<BinaryOperator>(Inst)) {
     Constant *D1 = dyn_cast<Constant>(Inst->getOperand(0));
   Instruction *Inst = *II;
   if (isa<BinaryOperator>(Inst)) {
     Constant *D1 = dyn_cast<Constant>(Inst->getOperand(0));
@@ -174,7 +171,7 @@ bool opt::ConstantPropogation::doConstantPropogation(BasicBlock *BB,
     Constant *D = dyn_cast<Constant>(UInst->getOperand(0));
     if (D) return ConstantFoldUnaryInst(BB, II, UInst, D);
   } else if (TerminatorInst *TInst = dyn_cast<TerminatorInst>(Inst)) {
     Constant *D = dyn_cast<Constant>(UInst->getOperand(0));
     if (D) return ConstantFoldUnaryInst(BB, II, UInst, D);
   } else if (TerminatorInst *TInst = dyn_cast<TerminatorInst>(Inst)) {
-    return opt::ConstantFoldTerminator(TInst);
+    return ConstantFoldTerminator(TInst);
 
   } else if (PHINode *PN = dyn_cast<PHINode>(Inst)) {
     // If it's a PHI node and only has one operand
 
   } else if (PHINode *PN = dyn_cast<PHINode>(Inst)) {
     // If it's a PHI node and only has one operand
@@ -203,7 +200,7 @@ static bool DoConstPropPass(Method *M) {
   for (Method::iterator BBI = M->begin(); BBI != M->end(); ++BBI) {
     BasicBlock *BB = *BBI;
     for (BasicBlock::iterator I = BB->begin(); I != BB->end(); )
   for (Method::iterator BBI = M->begin(); BBI != M->end(); ++BBI) {
     BasicBlock *BB = *BBI;
     for (BasicBlock::iterator I = BB->begin(); I != BB->end(); )
-      if (opt::ConstantPropogation::doConstantPropogation(BB, I))
+      if (ConstantPropogation::doConstantPropogation(BB, I))
        SomethingChanged = true;
       else
        ++I;
        SomethingChanged = true;
       else
        ++I;
@@ -214,7 +211,7 @@ static bool DoConstPropPass(Method *M) {
 
 // returns whether or not the underlying method was modified
 //
 
 // returns whether or not the underlying method was modified
 //
-bool opt::ConstantPropogation::doConstantPropogation(Method *M) {
+bool ConstantPropogation::doConstantPropogation(Method *M) {
   bool Modified = false;
 
   // Fold constants until we make no progress...
   bool Modified = false;
 
   // Fold constants until we make no progress...
index eadf7b18e0ab747d948b450d62be187548292735..218c0add8be3790182f560043f61137d0627fc3e 100644 (file)
@@ -23,7 +23,7 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/DCE.h"
+#include "llvm/Transforms/Scalar/DCE.h"
 #include "llvm/Module.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Method.h"
 #include "llvm/Module.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Method.h"
@@ -39,8 +39,8 @@
 // to point to the instruction that immediately succeeded the original
 // instruction.
 //
 // to point to the instruction that immediately succeeded the original
 // instruction.
 //
-bool opt::DeadCodeElimination::dceInstruction(BasicBlock::InstListType &BBIL,
-                                              BasicBlock::iterator &BBI) {
+bool DeadCodeElimination::dceInstruction(BasicBlock::InstListType &BBIL,
+                                         BasicBlock::iterator &BBI) {
   // Look for un"used" definitions...
   if ((*BBI)->use_empty() && !(*BBI)->hasSideEffects() && 
       !isa<TerminatorInst>(*BBI)) {
   // Look for un"used" definitions...
   if ((*BBI)->use_empty() && !(*BBI)->hasSideEffects() && 
       !isa<TerminatorInst>(*BBI)) {
@@ -54,7 +54,7 @@ static inline bool RemoveUnusedDefs(BasicBlock::InstListType &Vals) {
   bool Changed = false;
   for (BasicBlock::InstListType::iterator DI = Vals.begin(); 
        DI != Vals.end(); )
   bool Changed = false;
   for (BasicBlock::InstListType::iterator DI = Vals.begin(); 
        DI != Vals.end(); )
-    if (opt::DeadCodeElimination::dceInstruction(Vals, DI))
+    if (DeadCodeElimination::dceInstruction(Vals, DI))
       Changed = true;
     else
       ++DI;
       Changed = true;
     else
       ++DI;
@@ -155,7 +155,7 @@ static bool PropogatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
 //
 // WARNING:  The entry node of a method may not be simplified.
 //
 //
 // WARNING:  The entry node of a method may not be simplified.
 //
-bool opt::SimplifyCFG(Method::iterator &BBIt) {
+bool SimplifyCFG(Method::iterator &BBIt) {
   BasicBlock *BB = *BBIt;
   Method *M = BB->getParent();
 
   BasicBlock *BB = *BBIt;
   Method *M = BB->getParent();
 
@@ -282,7 +282,7 @@ static bool DoDCEPass(Method *M) {
   // if they are unneeded...
   //
   for (BBIt = M->begin(), ++BBIt; BBIt != M->end(); ) {
   // if they are unneeded...
   //
   for (BBIt = M->begin(), ++BBIt; BBIt != M->end(); ) {
-    if (opt::SimplifyCFG(BBIt)) {
+    if (SimplifyCFG(BBIt)) {
       Changed = true;
     } else {
       ++BBIt;
       Changed = true;
     } else {
       ++BBIt;
@@ -296,13 +296,13 @@ static bool DoDCEPass(Method *M) {
 // It is possible that we may require multiple passes over the code to fully
 // eliminate dead code.  Iterate until we are done.
 //
 // It is possible that we may require multiple passes over the code to fully
 // eliminate dead code.  Iterate until we are done.
 //
-bool opt::DeadCodeElimination::doDCE(Method *M) {
+bool DeadCodeElimination::doDCE(Method *M) {
   bool Changed = false;
   while (DoDCEPass(M)) Changed = true;
   return Changed;
 }
 
   bool Changed = false;
   while (DoDCEPass(M)) Changed = true;
   return Changed;
 }
 
-bool opt::DeadCodeElimination::RemoveUnusedGlobalValues(Module *Mod) {
+bool DeadCodeElimination::RemoveUnusedGlobalValues(Module *Mod) {
   bool Changed = false;
 
   for (Module::iterator MI = Mod->begin(); MI != Mod->end(); ) {
   bool Changed = false;
 
   for (Module::iterator MI = Mod->begin(); MI != Mod->end(); ) {
index 93ab189dee672a77bd361d540743a32d934485a2..cab778e025b529127d7e7a36e21d9a80fd13d046 100644 (file)
@@ -19,7 +19,7 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/InductionVars.h"
+#include "llvm/Transforms/Scalar/InductionVars.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/Analysis/IntervalPartition.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/Analysis/IntervalPartition.h"
 #include "llvm/Assembly/Writer.h"
index 795418f939b1cef299174440bba60c99d6b95f3b..25590661b77f552b38dd29f7b63eea92c7d31926 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
-#include "../TransformInternals.h"
-#include "llvm/Optimizations/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
 #include "llvm/Method.h"
 #include "llvm/iMemory.h"
 #include "llvm/Method.h"
 #include "llvm/iMemory.h"
-
-using namespace opt;
+#include "../TransformInternals.h"
 
 static Instruction *CombineBinOp(BinaryOperator *I) {
   bool Changed = false;
 
 static Instruction *CombineBinOp(BinaryOperator *I) {
   bool Changed = false;
index 68be8440953af3197fd88b8e1d94a93380d56959..9b2343c936cddf126d4c86f37a62bdc21526be3a 100644 (file)
@@ -15,8 +15,8 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/ConstantProp.h"
-#include "llvm/Optimizations/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantProp.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstantVals.h"
 #include "llvm/Method.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/ConstantVals.h"
@@ -273,7 +273,7 @@ bool SCCP::doSCCP() {
       MadeChanges = true;
       continue;   // Skip the ++II at the end of the loop here...
     } else if (Inst->isTerminator()) {
       MadeChanges = true;
       continue;   // Skip the ++II at the end of the loop here...
     } else if (Inst->isTerminator()) {
-      MadeChanges |= opt::ConstantFoldTerminator(cast<TerminatorInst>(Inst));
+      MadeChanges |= ConstantFoldTerminator(cast<TerminatorInst>(Inst));
     }
 
     ++II;
     }
 
     ++II;
@@ -446,9 +446,8 @@ void SCCP::UpdateInstruction(Instruction *I) {
       markOverdefined(I);
     } else if (VState.isConstant()) {    // Propogate constant value
       Constant *Result = isa<CastInst>(I)
       markOverdefined(I);
     } else if (VState.isConstant()) {    // Propogate constant value
       Constant *Result = isa<CastInst>(I)
-        ? opt::ConstantFoldCastInstruction(VState.getConstant(), I->getType())
-        : opt::ConstantFoldUnaryInstruction(I->getOpcode(),
-                                            VState.getConstant());
+        ? ConstantFoldCastInstruction(VState.getConstant(), I->getType())
+        : ConstantFoldUnaryInstruction(I->getOpcode(), VState.getConstant());
 
       if (Result) {
         // This instruction constant folds!
 
       if (Result) {
         // This instruction constant folds!
@@ -473,9 +472,9 @@ void SCCP::UpdateInstruction(Instruction *I) {
       markOverdefined(I);
     } else if (V1State.isConstant() && V2State.isConstant()) {
       Constant *Result =
       markOverdefined(I);
     } else if (V1State.isConstant() && V2State.isConstant()) {
       Constant *Result =
-        opt::ConstantFoldBinaryInstruction(I->getOpcode(),
-                                             V1State.getConstant(),
-                                             V2State.getConstant());
+        ConstantFoldBinaryInstruction(I->getOpcode(),
+                                      V1State.getConstant(),
+                                      V2State.getConstant());
       if (Result) {
         // This instruction constant folds!
         markConstant(I, Result);
       if (Result) {
         // This instruction constant folds!
         markConstant(I, Result);
@@ -511,7 +510,7 @@ void SCCP::OperandChangedState(User *U) {
 // DoSparseConditionalConstantProp - Use Sparse Conditional Constant Propogation
 // to prove whether a value is constant and whether blocks are used.
 //
 // DoSparseConditionalConstantProp - Use Sparse Conditional Constant Propogation
 // to prove whether a value is constant and whether blocks are used.
 //
-bool opt::SCCPPass::doSCCP(Method *M) {
+bool SCCPPass::doSCCP(Method *M) {
   if (M->isExternal()) return false;
   SCCP S(M);
   return S.doSCCP();
   if (M->isExternal()) return false;
   SCCP S(M);
   return S.doSCCP();
index 417376b89db06e61e167654b89d847af9b2ed7c1..12f8e918b3f142d3cda946eb4128456340dfa190 100644 (file)
@@ -14,7 +14,7 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/AllOpts.h"
+#include "llvm/Transforms/SymbolStripping.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
 #include "llvm/SymbolTable.h"
@@ -44,14 +44,14 @@ static bool StripSymbolTable(SymbolTable *SymTab) {
 
 // DoSymbolStripping - Remove all symbolic information from a method
 //
 
 // DoSymbolStripping - Remove all symbolic information from a method
 //
-bool opt::SymbolStripping::doSymbolStripping(Method *M) {
+bool SymbolStripping::doSymbolStripping(Method *M) {
   return StripSymbolTable(M->getSymbolTable());
 }
 
 // doStripGlobalSymbols - Remove all symbolic information from all methods 
 // in a module, and all module level symbols. (method names, etc...)
 //
   return StripSymbolTable(M->getSymbolTable());
 }
 
 // doStripGlobalSymbols - Remove all symbolic information from all methods 
 // in a module, and all module level symbols. (method names, etc...)
 //
-bool opt::FullSymbolStripping::doStripGlobalSymbols(Module *M) {
+bool FullSymbolStripping::doStripGlobalSymbols(Module *M) {
   // Remove all symbols from methods in this module... and then strip all of the
   // symbols in this module...
   //  
   // Remove all symbols from methods in this module... and then strip all of the
   // symbols in this module...
   //  
index fa561de6a382aaa7666d0c2fd83ee6f6cfa63b92..80374f339c5a930fcc0bd30d81d5483fb56deb5c 100644 (file)
@@ -4,7 +4,7 @@
 //
 //===----------------------------------------------------------------------===//
 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Optimizations/ConstantHandling.h"
+#include "llvm/Transforms/Scalar/ConstantHandling.h"
 
 AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules",
                                                      &ConstRules::find));
 
 AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules",
                                                      &ConstRules::find));
index 7e2b6f3e46c98b88bdd83067b6e00fe8fdf56916..24a5e87b1ba30e24c7d745c0c6a21c22a462a705 100644 (file)
@@ -11,8 +11,8 @@
 #include "llvm/Assembly/Parser.h"
 #include "llvm/Transforms/CleanupGCCOutput.h"
 #include "llvm/Transforms/LevelChange.h"
 #include "llvm/Assembly/Parser.h"
 #include "llvm/Transforms/CleanupGCCOutput.h"
 #include "llvm/Transforms/LevelChange.h"
-#include "llvm/Optimizations/DCE.h"
 #include "llvm/Transforms/ConstantMerge.h"
 #include "llvm/Transforms/ConstantMerge.h"
+#include "llvm/Transforms/Scalar/DCE.h"
 #include "llvm/Transforms/Scalar/IndVarSimplify.h"
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
 #include "llvm/Bytecode/Writer.h"
 #include "llvm/Transforms/Scalar/IndVarSimplify.h"
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
 #include "llvm/Bytecode/Writer.h"
@@ -64,13 +64,13 @@ int main(int argc, char **argv) {
   // a little bit.  Do this now.
   //
   PassManager Passes;
   // a little bit.  Do this now.
   //
   PassManager Passes;
-  Passes.add(new opt::DeadCodeElimination());  // Remove Dead code/vars
+  Passes.add(new DeadCodeElimination());       // Remove Dead code/vars
   Passes.add(new CleanupGCCOutput());          // Fix gccisms
   Passes.add(new InductionVariableSimplify()); // Simplify indvars
   Passes.add(new RaisePointerReferences());    // Eliminate casts
   Passes.add(new ConstantMerge());             // Merge dup global consts
   Passes.add(new InstructionCombining());      // Combine silly seq's
   Passes.add(new CleanupGCCOutput());          // Fix gccisms
   Passes.add(new InductionVariableSimplify()); // Simplify indvars
   Passes.add(new RaisePointerReferences());    // Eliminate casts
   Passes.add(new ConstantMerge());             // Merge dup global consts
   Passes.add(new InstructionCombining());      // Combine silly seq's
-  Passes.add(new opt::DeadCodeElimination());  // Remove Dead code/vars
+  Passes.add(new DeadCodeElimination());       // Remove Dead code/vars
 
   // Run our queue of passes all at once now, efficiently.  This form of
   // runAllPasses frees the Pass objects after runAllPasses completes.
 
   // Run our queue of passes all at once now, efficiently.  This form of
   // runAllPasses frees the Pass objects after runAllPasses completes.
index bbf1489ca62e214ddf00c35bd95d010c4573cd34..36de3bfbf73246e69c0ae76e4d9dde295dbe005c 100644 (file)
@@ -9,20 +9,26 @@
 #include "llvm/Module.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Writer.h"
 #include "llvm/Module.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Writer.h"
-#include "llvm/Optimizations/AllOpts.h"
-#include "llvm/Transforms/Instrumentation/TraceValues.h"
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Transforms/ConstantMerge.h"
 #include "llvm/Transforms/CleanupGCCOutput.h"
 #include "llvm/Transforms/LevelChange.h"
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Transforms/ConstantMerge.h"
 #include "llvm/Transforms/CleanupGCCOutput.h"
 #include "llvm/Transforms/LevelChange.h"
+#include "llvm/Transforms/MethodInlining.h"
+#include "llvm/Transforms/SymbolStripping.h"
 #include "llvm/Transforms/IPO/SimpleStructMutation.h"
 #include "llvm/Transforms/IPO/GlobalDCE.h"
 #include "llvm/Transforms/IPO/SimpleStructMutation.h"
 #include "llvm/Transforms/IPO/GlobalDCE.h"
+#include "llvm/Transforms/Scalar/DCE.h"
+#include "llvm/Transforms/Scalar/ConstantProp.h"
+#include "llvm/Transforms/Scalar/InductionVars.h"
 #include "llvm/Transforms/Scalar/IndVarSimplify.h"
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
 #include "llvm/Transforms/Scalar/IndVarSimplify.h"
 #include "llvm/Transforms/Scalar/InstructionCombining.h"
+#include "llvm/Transforms/Instrumentation/TraceValues.h"
 #include "Support/CommandLine.h"
 #include <fstream>
 #include <memory>
 
 #include "Support/CommandLine.h"
 #include <fstream>
 #include <memory>
 
+
+
 enum Opts {
   // Basic optimizations
   dce, constprop, inlining, constmerge, strip, mstrip,
 enum Opts {
   // Basic optimizations
   dce, constprop, inlining, constmerge, strip, mstrip,
@@ -41,16 +47,16 @@ struct {
   enum Opts OptID;
   Pass *ThePass;
 } OptTable[] = {
   enum Opts OptID;
   Pass *ThePass;
 } OptTable[] = {
-  { dce        , new opt::DeadCodeElimination() },
-  { constprop  , new opt::ConstantPropogation() }, 
-  { inlining   , new opt::MethodInlining() },
+  { dce        , new DeadCodeElimination() },
+  { constprop  , new ConstantPropogation() }, 
+  { inlining   , new MethodInlining() },
   { constmerge , new ConstantMerge() },
   { constmerge , new ConstantMerge() },
-  { strip      , new opt::SymbolStripping() },
-  { mstrip     , new opt::FullSymbolStripping() },
+  { strip      , new SymbolStripping() },
+  { mstrip     , new FullSymbolStripping() },
   { indvars    , new InductionVariableSimplify() },
   { instcombine, new InstructionCombining() },
   { indvars    , new InductionVariableSimplify() },
   { instcombine, new InstructionCombining() },
-  { sccp       , new opt::SCCPPass() },
-  { adce       , new opt::AgressiveDCE() },
+  { sccp       , new SCCPPass() },
+  { adce       , new AgressiveDCE() },
   { raise      , new RaisePointerReferences() },
   { trace      , new InsertTraceCode(true, true) },
   { tracem     , new InsertTraceCode(false, true) },
   { raise      , new RaisePointerReferences() },
   { trace      , new InsertTraceCode(true, true) },
   { tracem     , new InsertTraceCode(false, true) },