diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index cfd0c39569e..becbf4a2d09 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -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 diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index 8e58d4dbb20..9df724ca78e 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -15,18 +15,12 @@ #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 -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(Ty)) return Ty; // Don't convert primitives - map::iterator I = TypeMap.find(Ty); + std::map::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(Ty); const Type *RetTy = ConvertType(MT->getReturnType()); - vector ArgTypes; + std::vector 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(Ty); const StructType::ElementTypes &El = ST->getElementTypes(); - vector Types; + std::vector 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 &Idx, + std::vector &Idx, unsigned i) { assert(i < Idx.size() && "i out of range!"); const CompositeType *NewCT = cast(ConvertType(OldTy)); @@ -114,7 +108,8 @@ void MutateStructTypes::AdjustIndices(const CompositeType *OldTy, unsigned ElNum = cast(Idx[i])->getValue(); assert(ElNum < OldST->getElementTypes().size()); - map::iterator I = Transforms.find(OldST); + std::map::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(V)) { // Check to see if the value is in the map... - map::iterator I = GlobalMap.find(GV); + std::map::iterator I = GlobalMap.find(GV); if (I == GlobalMap.end()) return (Value*)GV; // Not mapped, just return value itself return I->second; } - map::iterator I = LocalValueMap.find(V); + std::map::iterator I = LocalValueMap.find(V); if (I != LocalValueMap.end()) return I->second; if (const BasicBlock *BB = dyn_cast(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_iterator I = XForm.begin(), - E = XForm.end(); I != E; ++I) { + for (std::map >::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_iterator I = XForm.begin(), - E = XForm.end(); I != E; ++I) { + for (std::map >::const_iterator + I = XForm.begin(), E = XForm.end(); I != E; ++I) { const StructType *OldTy = I->first; - const vector &InVec = I->second; + const std::vector &InVec = I->second; assert(OldTy->getElementTypes().size() == InVec.size() && "Action not specified for every element of structure type!"); - vector NewType; + std::vector NewType; // Convert the elements of the type over, including the new position mapping int Idx = 0; - vector::const_iterator TI = find(InVec.begin(), InVec.end(), Idx); + std::vector::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::iterator GMI = GlobalMap.find(M); + std::map::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(I); - vector Indices(GEP.idx_begin(), GEP.idx_end()); + std::vector Indices(GEP.idx_begin(), GEP.idx_end()); if (!Indices.empty()) { const Type *PTy = cast(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 Operands; + std::vector 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::iterator LVMI = LocalValueMap.find(&I); + std::map::iterator LVMI = LocalValueMap.find(&I); if (LVMI != LocalValueMap.end()) { // Yup, make sure it's a placeholder... Instruction *I = cast(LVMI->second); diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 32488d69b53..c9b8748cca3 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -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 vType; - vector vConsts; - for(Module::iterator MI = M.begin(), ME = M.end(); MI!=ME; ++MI) + std::vector vType; + std::vector 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); diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index f7a68e48f8c..55a4f5badc5 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -19,8 +19,6 @@ #include "Support/DepthFirstIterator.h" #include "Support/Statistic.h" #include -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 Succs(succ_begin(BB), succ_end(BB)); + std::vector Succs(succ_begin(BB), succ_end(BB)); if (!Succs.empty()) { // Loop over all of the successors, removing this block from PHI node diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index b56cee9379e..71f286c36e5 100644 --- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp @@ -14,7 +14,6 @@ #include "llvm/iTerminators.h" #include "llvm/iPHINode.h" #include "llvm/Type.h" -using std::vector; static RegisterOpt 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 ReturningBlocks; + std::vector ReturningBlocks; for(Function::iterator I = F.begin(), E = F.end(); I != E; ++I) if (isa(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::iterator I = ReturningBlocks.begin(), - E = ReturningBlocks.end(); I != E; ++I) { + for (std::vector::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