Remove using declarations
authorChris Lattner <sabre@nondot.org>
Thu, 22 May 2003 22:00:07 +0000 (22:00 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 22 May 2003 22:00:07 +0000 (22:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6306 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/DeadTypeElimination.cpp
lib/Transforms/IPO/MutateStructTypes.cpp
lib/Transforms/Instrumentation/EmitFunctions.cpp
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Utils/UnifyFunctionExitNodes.cpp

index cfd0c39569e11b9bf4d5b450d0e8d07131e2777b..becbf4a2d09809996e143f0d66c4d0954388d0e9 100644 (file)
@@ -12,8 +12,6 @@
 #include "llvm/DerivedTypes.h"
 #include "Support/Statistic.h"
 
-using std::vector;
-
 namespace {
   struct DTE : public Pass {
     // doPassInitialization - For this pass, it removes global symbol table
index 8e58d4dbb20820f5bb75a602c8aff00629dbf430..9df724ca78ea8e3b023ad73d664a34791bcbd3a9 100644 (file)
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/SymbolTable.h"
-#include "llvm/iPHINode.h"
-#include "llvm/iMemory.h"
-#include "llvm/iTerminators.h"
-#include "llvm/iOther.h"
+#include "llvm/Instructions.h"
 #include "llvm/Constants.h"
 #include "Support/STLExtras.h"
 #include "Support/Statistic.h"
 #include <algorithm>
 
-using std::map;
-using std::vector;
-
 // ValuePlaceHolder - A stupid little marker value.  It appears as an
 // instruction of type Instruction::UserOp1.
 //
@@ -43,7 +37,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
   if (Ty->isPrimitiveType() ||
       isa<OpaqueType>(Ty)) return Ty;  // Don't convert primitives
 
-  map<const Type *, PATypeHolder>::iterator I = TypeMap.find(Ty);
+  std::map<const Type *, PATypeHolder>::iterator I = TypeMap.find(Ty);
   if (I != TypeMap.end()) return I->second;
 
   const Type *DestTy = 0;
@@ -55,7 +49,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
   case Type::FunctionTyID: {
     const FunctionType *MT = cast<FunctionType>(Ty);
     const Type *RetTy = ConvertType(MT->getReturnType());
-    vector<const Type*> ArgTypes;
+    std::vector<const Type*> ArgTypes;
 
     for (FunctionType::ParamTypes::const_iterator I = MT->getParamTypes().begin(),
            E = MT->getParamTypes().end(); I != E; ++I)
@@ -67,7 +61,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
   case Type::StructTyID: {
     const StructType *ST = cast<StructType>(Ty);
     const StructType::ElementTypes &El = ST->getElementTypes();
-    vector<const Type *> Types;
+    std::vector<const Type *> Types;
 
     for (StructType::ElementTypes::const_iterator I = El.begin(), E = El.end();
          I != E; ++I)
@@ -103,7 +97,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
 // using the specified OldTy as the base type being indexed into.
 //
 void MutateStructTypes::AdjustIndices(const CompositeType *OldTy,
-                                      vector<Value*> &Idx,
+                                      std::vector<Value*> &Idx,
                                       unsigned i) {
   assert(i < Idx.size() && "i out of range!");
   const CompositeType *NewCT = cast<CompositeType>(ConvertType(OldTy));
@@ -114,7 +108,8 @@ void MutateStructTypes::AdjustIndices(const CompositeType *OldTy,
     unsigned ElNum = cast<ConstantUInt>(Idx[i])->getValue();
     assert(ElNum < OldST->getElementTypes().size());
 
-    map<const StructType*, TransformType>::iterator I = Transforms.find(OldST);
+    std::map<const StructType*, TransformType>::iterator
+      I = Transforms.find(OldST);
     if (I != Transforms.end()) {
       assert(ElNum < I->second.second.size());
       // Apply the XForm specified by Transforms map...
@@ -149,13 +144,13 @@ Value *MutateStructTypes::ConvertValue(const Value *V) {
   // Check to see if this is an out of function reference first...
   if (const GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
     // Check to see if the value is in the map...
-    map<const GlobalValue*, GlobalValue*>::iterator I = GlobalMap.find(GV);
+    std::map<const GlobalValue*, GlobalValue*>::iterator I = GlobalMap.find(GV);
     if (I == GlobalMap.end())
       return (Value*)GV;  // Not mapped, just return value itself
     return I->second;
   }
   
-  map<const Value*, Value*>::iterator I = LocalValueMap.find(V);
+  std::map<const Value*, Value*>::iterator I = LocalValueMap.find(V);
   if (I != LocalValueMap.end()) return I->second;
 
   if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
@@ -182,26 +177,26 @@ void MutateStructTypes::setTransforms(const TransformsType &XForm) {
 
   // Loop over the types and insert dummy entries into the type map so that 
   // recursive types are resolved properly...
-  for (map<const StructType*, vector<int> >::const_iterator I = XForm.begin(),
-         E = XForm.end(); I != E; ++I) {
+  for (std::map<const StructType*, std::vector<int> >::const_iterator
+         I = XForm.begin(), E = XForm.end(); I != E; ++I) {
     const StructType *OldTy = I->first;
     TypeMap.insert(std::make_pair(OldTy, OpaqueType::get()));
   }
 
   // Loop over the type specified and figure out what types they should become
-  for (map<const StructType*, vector<int> >::const_iterator I = XForm.begin(),
-         E = XForm.end(); I != E; ++I) {
+  for (std::map<const StructType*, std::vector<int> >::const_iterator
+         I = XForm.begin(), E = XForm.end(); I != E; ++I) {
     const StructType  *OldTy = I->first;
-    const vector<int> &InVec = I->second;
+    const std::vector<int> &InVec = I->second;
 
     assert(OldTy->getElementTypes().size() == InVec.size() &&
            "Action not specified for every element of structure type!");
 
-    vector<const Type *> NewType;
+    std::vector<const Type *> NewType;
 
     // Convert the elements of the type over, including the new position mapping
     int Idx = 0;
-    vector<int>::const_iterator TI = find(InVec.begin(), InVec.end(), Idx);
+    std::vector<int>::const_iterator TI = find(InVec.begin(), InVec.end(), Idx);
     while (TI != InVec.end()) {
       unsigned Offset = TI-InVec.begin();
       const Type *NewEl = ConvertType(OldTy->getContainedType(Offset));
@@ -308,7 +303,7 @@ void MutateStructTypes::removeDeadGlobals(Module &M) {
 //
 void MutateStructTypes::transformFunction(Function *m) {
   const Function *M = m;
-  map<const GlobalValue*, GlobalValue*>::iterator GMI = GlobalMap.find(M);
+  std::map<const GlobalValue*, GlobalValue*>::iterator GMI = GlobalMap.find(M);
   if (GMI == GlobalMap.end())
     return;  // Do not affect one of our new functions that we are creating
 
@@ -417,7 +412,7 @@ void MutateStructTypes::transformFunction(Function *m) {
         break;
       case Instruction::GetElementPtr: {
         const GetElementPtrInst &GEP = cast<GetElementPtrInst>(I);
-        vector<Value*> Indices(GEP.idx_begin(), GEP.idx_end());
+        std::vector<Value*> Indices(GEP.idx_begin(), GEP.idx_end());
         if (!Indices.empty()) {
           const Type *PTy =
             cast<PointerType>(GEP.getOperand(0)->getType())->getElementType();
@@ -444,7 +439,7 @@ void MutateStructTypes::transformFunction(Function *m) {
         break;
       case Instruction::Call: {
         Value *Meth = ConvertValue(I.getOperand(0));
-        vector<Value*> Operands;
+        std::vector<Value*> Operands;
         for (unsigned i = 1; i < I.getNumOperands(); ++i)
           Operands.push_back(ConvertValue(I.getOperand(i)));
         NewI = new CallInst(Meth, Operands);
@@ -460,7 +455,7 @@ void MutateStructTypes::transformFunction(Function *m) {
       NewBB->getInstList().push_back(NewI);
 
       // Check to see if we had to make a placeholder for this value...
-      map<const Value*,Value*>::iterator LVMI = LocalValueMap.find(&I);
+      std::map<const Value*,Value*>::iterator LVMI = LocalValueMap.find(&I);
       if (LVMI != LocalValueMap.end()) {
         // Yup, make sure it's a placeholder...
         Instruction *I = cast<Instruction>(LVMI->second);
index 32488d69b53ae9a0e7716ae4808807d22504fd7f..c9b8748cca3c3f3024d15370283ff74e41a81b94 100644 (file)
@@ -9,8 +9,6 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 
-using std::vector;
-
 namespace {
   struct EmitFunctionTable : public Pass {
     bool run(Module &M);
@@ -21,13 +19,12 @@ namespace {
 
 // Per Module pass for inserting function table
 bool EmitFunctionTable::run(Module &M){
-  vector<const Type*> vType;
-  vector<Constant *> vConsts;
-  for(Module::iterator MI = M.begin(), ME = M.end(); MI!=ME; ++MI)
+  std::vector<const Type*> vType;
+  std::vector<Constant *> vConsts;
+  for(Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
     if (!MI->isExternal()) {
-      ConstantPointerRef *CP = ConstantPointerRef::get(MI);
       vType.push_back(MI->getType());
-      vConsts.push_back(CP);
+      vConsts.push_back(ConstantPointerRef::get(MI));
     }
   
   StructType *sttype = StructType::get(vType);
index f7a68e48f8cfe46a716c0dc77a2e88ab609a1e06..55a4f5badc5743c64e29d6a29075e6dcedd85fcd 100644 (file)
@@ -19,8 +19,6 @@
 #include "Support/DepthFirstIterator.h"
 #include "Support/Statistic.h"
 #include <algorithm>
-using std::cerr;
-using std::vector;
 
 namespace {
   Statistic<> NumBlockRemoved("adce", "Number of basic blocks removed");
@@ -77,13 +75,13 @@ private:
 
   inline void markInstructionLive(Instruction *I) {
     if (LiveSet.count(I)) return;
-    DEBUG(cerr << "Insn Live: " << I);
+    DEBUG(std::cerr << "Insn Live: " << I);
     LiveSet.insert(I);
     WorkList.push_back(I);
   }
 
   inline void markTerminatorLive(const BasicBlock *BB) {
-    DEBUG(cerr << "Terminat Live: " << BB->getTerminator());
+    DEBUG(std::cerr << "Terminat Live: " << BB->getTerminator());
     markInstructionLive((Instruction*)BB->getTerminator());
   }
 };
@@ -168,7 +166,7 @@ bool ADCE::doADCE() {
     }
   }
 
-  DEBUG(cerr << "Processing work list\n");
+  DEBUG(std::cerr << "Processing work list\n");
 
   // AliveBlocks - Set of basic blocks that we know have instructions that are
   // alive in them...
@@ -208,14 +206,14 @@ bool ADCE::doADCE() {
        markInstructionLive(Operand);
   }
 
-  if (DebugFlag) {
-    cerr << "Current Function: X = Live\n";
+  DEBUG(
+    std::cerr << "Current Function: X = Live\n";
     for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I)
       for (BasicBlock::iterator BI = I->begin(), BE = I->end(); BI != BE; ++BI){
-        if (LiveSet.count(BI)) cerr << "X ";
-        cerr << *BI;
+        if (LiveSet.count(BI)) std::cerr << "X ";
+        std::cerr << *BI;
       }
-  }
+    );
 
   // Find the first postdominator of the entry node that is alive.  Make it the
   // new entry node...
@@ -346,7 +344,7 @@ bool ADCE::doADCE() {
     if (!AliveBlocks.count(BB)) {
       // Remove all outgoing edges from this basic block and convert the
       // terminator into a return instruction.
-      vector<BasicBlock*> Succs(succ_begin(BB), succ_end(BB));
+      std::vector<BasicBlock*> Succs(succ_begin(BB), succ_end(BB));
       
       if (!Succs.empty()) {
         // Loop over all of the successors, removing this block from PHI node
index b56cee9379e05e5637d690929e2eb814a375c167..71f286c36e5fe8147ade8c33a10e999dabe2b9b2 100644 (file)
@@ -14,7 +14,6 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
 #include "llvm/Type.h"
-using std::vector;
 
 static RegisterOpt<UnifyFunctionExitNodes>
 X("mergereturn", "Unify function exit nodes");
@@ -34,7 +33,7 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
   // Loop over all of the blocks in a function, tracking all of the blocks that
   // return.
   //
-  vector<BasicBlock*> ReturningBlocks;
+  std::vector<BasicBlock*> ReturningBlocks;
   for(Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
     if (isa<ReturnInst>(I->getTerminator()))
       ReturningBlocks.push_back(I);
@@ -67,8 +66,8 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
   // Loop over all of the blocks, replacing the return instruction with an
   // unconditional branch.
   //
-  for (vector<BasicBlock*>::iterator I = ReturningBlocks.begin(), 
-                                     E = ReturningBlocks.end(); I != E; ++I) {
+  for (std::vector<BasicBlock*>::iterator I = ReturningBlocks.begin(), 
+         E = ReturningBlocks.end(); I != E; ++I) {
     BasicBlock *BB = *I;
 
     // Add an incoming element to the PHI node for every return instruction that