From 697954c15da58bd8b186dbafdedd8b06db770201 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 20 Jan 2002 22:54:45 +0000 Subject: Changes to build successfully with GCC 3.02 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/ExprTypeConvert.cpp | 40 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'lib/Transforms/ExprTypeConvert.cpp') diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 02e14b6caa..7f33fe280b 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -18,6 +18,8 @@ #include "Support/STLExtras.h" #include #include +#include +using std::cerr; #include "llvm/Assembly/Writer.h" @@ -96,7 +98,8 @@ static bool MallocConvertableToType(MallocInst *MI, const Type *Ty, } static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty, - const string &Name, ValueMapCache &VMC){ + const std::string &Name, + ValueMapCache &VMC){ BasicBlock *BB = MI->getParent(); BasicBlock::iterator It = BB->end(); @@ -270,7 +273,7 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty, // index array. If there are, check to see if removing them causes us to // get to the right type... // - vector Indices = GEP->copyIndices(); + std::vector Indices = GEP->copyIndices(); const Type *BaseType = GEP->getPointerOperand()->getType(); const Type *ElTy = 0; @@ -302,7 +305,7 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty, // Check to see if 'N' is an expression that can be converted to // the appropriate size... if so, allow it. // - vector Indices; + std::vector Indices; const Type *ElTy = ConvertableToGEP(PTy, I->getOperand(1), Indices); if (ElTy) { assert(ElTy == PVTy && "Internal error, setup wrong!"); @@ -378,7 +381,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) { BasicBlock *BB = I->getParent(); BasicBlock::InstListType &BIL = BB->getInstList(); - string Name = I->getName(); if (!Name.empty()) I->setName(""); + std::string Name = I->getName(); if (!Name.empty()) I->setName(""); Instruction *Res; // Result of conversion ValueHandle IHandle(VMC, I); // Prevent I from being removed! @@ -460,7 +463,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) { // index array. If there are, check to see if removing them causes us to // get to the right type... // - vector Indices = GEP->copyIndices(); + std::vector Indices = GEP->copyIndices(); const Type *BaseType = GEP->getPointerOperand()->getType(); const Type *PVTy = cast(Ty)->getElementType(); Res = 0; @@ -491,7 +494,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) { // Check to see if 'N' is an expression that can be converted to // the appropriate size... if so, allow it. // - vector Indices; + std::vector Indices; const Type *ElTy = ConvertableToGEP(NewSrcTy, I->getOperand(1), Indices, &It); if (ElTy) { @@ -634,7 +637,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty, case Instruction::Add: if (isa(Ty)) { Value *IndexVal = I->getOperand(V == I->getOperand(0) ? 1 : 0); - vector Indices; + std::vector Indices; if (const Type *ETy = ConvertableToGEP(Ty, IndexVal, Indices)) { const Type *RetTy = PointerType::get(ETy); @@ -685,7 +688,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty, // They could be loading the first element of a composite type... if (const CompositeType *CT = dyn_cast(LoadedTy)) { unsigned Offset = 0; // No offset, get first leaf. - vector Indices; // Discarded... + std::vector Indices; // Discarded... LoadedTy = getStructOffsetType(CT, Offset, Indices, false); assert(Offset == 0 && "Offset changed from zero???"); } @@ -751,7 +754,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty, // Check to see if the second argument is an expression that can // be converted to the appropriate size... if so, allow it. // - vector Indices; + std::vector Indices; const Type *ElTy = ConvertableToGEP(Ty, Index, Indices); delete TempScale; // Free our temporary multiply if we made it @@ -823,7 +826,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, BasicBlock *BB = I->getParent(); BasicBlock::InstListType &BIL = BB->getInstList(); - string Name = I->getName(); if (!Name.empty()) I->setName(""); + std::string Name = I->getName(); if (!Name.empty()) I->setName(""); Instruction *Res; // Result of conversion //cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I << "BB Before: " << BB << endl; @@ -844,12 +847,12 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, case Instruction::Add: if (isa(NewTy)) { Value *IndexVal = I->getOperand(OldVal == I->getOperand(0) ? 1 : 0); - vector Indices; + std::vector Indices; BasicBlock::iterator It = find(BIL.begin(), BIL.end(), I); if (const Type *ETy = ConvertableToGEP(NewTy, IndexVal, Indices, &It)) { // If successful, convert the add to a GEP - const Type *RetTy = PointerType::get(ETy); + //const Type *RetTy = PointerType::get(ETy); // First operand is actually the given pointer... Res = new GetElementPtrInst(NewVal, Indices, Name); assert(cast(Res->getType())->getElementType() == ETy && @@ -892,7 +895,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, const Type *LoadedTy = cast(NewVal->getType())->getElementType(); - vector Indices; + std::vector Indices; Indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); if (const CompositeType *CT = dyn_cast(LoadedTy)) { @@ -914,7 +917,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC)); } else { // Replace the source pointer const Type *ValTy = cast(NewTy)->getElementType(); - vector Indices; + std::vector Indices; #if 0 Indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); while (ArrayType *AT = dyn_cast(ValTy)) { @@ -948,7 +951,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, // Perform the conversion now... // - vector Indices; + std::vector Indices; const Type *ElTy = ConvertableToGEP(NewVal->getType(), Index, Indices, &It); assert(ElTy != 0 && "GEP Conversion Failure!"); Res = new GetElementPtrInst(NewVal, Indices, Name); @@ -965,7 +968,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, // Check to see if the second argument is an expression that can // be converted to the appropriate size... if so, allow it. // - vector Indices; + std::vector Indices; const Type *ElTy = ConvertableToGEP(NewVal->getType(), I->getOperand(1), Indices, &It); assert(ElTy != 0 && "GEP Conversion Failure!"); @@ -1001,9 +1004,10 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, case Instruction::Call: { Value *Meth = I->getOperand(0); - vector Params(I->op_begin()+1, I->op_end()); + std::vector Params(I->op_begin()+1, I->op_end()); - vector::iterator OI = find(Params.begin(), Params.end(), OldVal); + std::vector::iterator OI = + find(Params.begin(), Params.end(), OldVal); assert (OI != Params.end() && "Not using value!"); *OI = NewVal; -- cgit v1.2.3-70-g09d2