aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-04 00:03:30 +0000
committerChris Lattner <sabre@nondot.org>2001-12-04 00:03:30 +0000
commit7a1767520611d9ff6face702068de858e1cadf2c (patch)
tree84849800c5f0e86af2757f911bc65010e016259e /lib/Transforms
parente9bb2df410f7a22decad9a883f7139d5857c1520 (diff)
downloadexternal_llvm-7a1767520611d9ff6face702068de858e1cadf2c.zip
external_llvm-7a1767520611d9ff6face702068de858e1cadf2c.tar.gz
external_llvm-7a1767520611d9ff6face702068de858e1cadf2c.tar.bz2
Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator -> const_op_iterator Renamed PointerType::getValueType() -> PointerType::getElementType() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp38
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp4
-rw-r--r--lib/Transforms/IPO/MutateStructTypes.cpp4
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp4
-rw-r--r--lib/Transforms/LevelRaise.cpp14
-rw-r--r--lib/Transforms/TransformInternals.h2
-rw-r--r--lib/Transforms/Utils/Linker.cpp2
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp2
8 files changed, 35 insertions, 35 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 57d533d..66da6b1 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -34,7 +34,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
// pointer value.
//
static bool AllIndicesZero(const MemAccessInst *MAI) {
- for (User::op_const_iterator S = MAI->idx_begin(), E = MAI->idx_end();
+ for (User::const_op_iterator S = MAI->idx_begin(), E = MAI->idx_end();
S != E; ++S)
if (!isa<Constant>(*S) || !cast<Constant>(*S)->isNullValue())
return false;
@@ -66,7 +66,7 @@ static bool MallocConvertableToType(MallocInst *MI, const Type *Ty,
!isa<PointerType>(Ty)) return false; // Malloc always returns pointers
// Deal with the type to allocate, not the pointer type...
- Ty = cast<PointerType>(Ty)->getValueType();
+ Ty = cast<PointerType>(Ty)->getElementType();
// Analyze the number of bytes allocated...
analysis::ExprType Expr = analysis::ClassifyExpression(MI->getArraySize());
@@ -117,7 +117,7 @@ static bool MallocConvertableToType(MallocInst *MI, const Type *Ty,
if (CastInst *CI = dyn_cast<CastInst>(*I))
if (const PointerType *PT =
dyn_cast<PointerType>(CI->getOperand(0)->getType()))
- if (getBaseTypeSize(PT->getValueType()) > ReqTypeSize)
+ if (getBaseTypeSize(PT->getElementType()) > ReqTypeSize)
return false; // We found a type bigger than this one!
return true;
@@ -133,10 +133,10 @@ static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty,
analysis::ExprType Expr = analysis::ClassifyExpression(MI->getArraySize());
const PointerType *AllocTy = cast<PointerType>(Ty);
- const Type *ElType = AllocTy->getValueType();
+ const Type *ElType = AllocTy->getElementType();
if (Expr.Var && !isa<ArrayType>(ElType)) {
- ElType = ArrayType::get(AllocTy->getValueType());
+ ElType = ArrayType::get(AllocTy->getElementType());
AllocTy = PointerType::get(ElType);
}
@@ -216,8 +216,8 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty,
//
if (PointerType *SPT = dyn_cast<PointerType>(I->getOperand(0)->getType()))
if (PointerType *DPT = dyn_cast<PointerType>(I->getType()))
- if (ArrayType *AT = dyn_cast<ArrayType>(SPT->getValueType()))
- if (AT->getElementType() == DPT->getValueType())
+ if (ArrayType *AT = dyn_cast<ArrayType>(SPT->getElementType()))
+ if (AT->getElementType() == DPT->getElementType())
return false;
#endif
break;
@@ -290,7 +290,7 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty,
Indices.pop_back();
ElTy = GetElementPtrInst::getIndexedType(BaseType, Indices,
true);
- if (ElTy == PTy->getValueType())
+ if (ElTy == PTy->getElementType())
break; // Found a match!!
ElTy = 0;
}
@@ -430,7 +430,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
//
vector<Value*> Indices = GEP->copyIndices();
const Type *BaseType = GEP->getPointerOperand()->getType();
- const Type *PVTy = cast<PointerType>(Ty)->getValueType();
+ const Type *PVTy = cast<PointerType>(Ty)->getElementType();
Res = 0;
while (!Indices.empty() && isa<ConstantUInt>(Indices.back()) &&
cast<ConstantUInt>(Indices.back())->getValue() == 0) {
@@ -546,8 +546,8 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
//
if (PointerType *SPT = dyn_cast<PointerType>(I->getOperand(0)->getType()))
if (PointerType *DPT = dyn_cast<PointerType>(I->getType()))
- if (ArrayType *AT = dyn_cast<ArrayType>(SPT->getValueType()))
- if (AT->getElementType() == DPT->getValueType())
+ if (ArrayType *AT = dyn_cast<ArrayType>(SPT->getElementType()))
+ if (AT->getElementType() == DPT->getElementType())
return false;
#endif
return true;
@@ -595,7 +595,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
if (LI->hasIndices() && !AllIndicesZero(LI))
return false;
- const Type *LoadedTy = PT->getValueType();
+ const Type *LoadedTy = PT->getElementType();
// They could be loading the first element of a composite type...
if (const CompositeType *CT = dyn_cast<CompositeType>(LoadedTy)) {
@@ -625,16 +625,16 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
return ExpressionConvertableToType(I->getOperand(1), PointerType::get(Ty),
CTMap);
} else if (const PointerType *PT = dyn_cast<PointerType>(Ty)) {
- if (isa<ArrayType>(PT->getValueType()))
+ if (isa<ArrayType>(PT->getElementType()))
return false; // Avoid getDataSize on unsized array type!
assert(V == I->getOperand(1));
// Must move the same amount of data...
- if (TD.getTypeSize(PT->getValueType()) !=
+ if (TD.getTypeSize(PT->getElementType()) !=
TD.getTypeSize(I->getOperand(0)->getType())) return false;
// Can convert store if the incoming value is convertable...
- return ExpressionConvertableToType(I->getOperand(0), PT->getValueType(),
+ return ExpressionConvertableToType(I->getOperand(0), PT->getElementType(),
CTMap);
}
return false;
@@ -667,7 +667,7 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
return false; // Can't convert method pointer type yet. FIXME
const PointerType *MPtr = cast<PointerType>(I->getOperand(0)->getType());
- const MethodType *MTy = cast<MethodType>(MPtr->getValueType());
+ const MethodType *MTy = cast<MethodType>(MPtr->getElementType());
if (!MTy->isVarArg()) return false;
if ((OpNum-1) < MTy->getParamTypes().size())
@@ -743,7 +743,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
const Type *RetTy = PointerType::get(ETy);
// First operand is actually the given pointer...
Res = new GetElementPtrInst(NewVal, Indices);
- assert(cast<PointerType>(Res->getType())->getValueType() == ETy &&
+ assert(cast<PointerType>(Res->getType())->getElementType() == ETy &&
"ConvertableToGEP broken!");
break;
}
@@ -774,7 +774,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
case Instruction::Load: {
assert(I->getOperand(0) == OldVal && isa<PointerType>(NewVal->getType()));
- const Type *LoadedTy = cast<PointerType>(NewVal->getType())->getValueType();
+ const Type *LoadedTy = cast<PointerType>(NewVal->getType())->getElementType();
vector<Value*> Indices;
@@ -796,7 +796,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
VMC.ExprMap[I] = Res;
Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
} else { // Replace the source pointer
- const Type *ValTy = cast<PointerType>(NewTy)->getValueType();
+ const Type *ValTy = cast<PointerType>(NewTy)->getElementType();
Res = new StoreInst(Constant::getNullConstant(ValTy), NewVal);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0), ValTy, VMC));
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index 8599118..e194bf4 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -87,7 +87,7 @@ bool CleanupGCCOutput::PatchUpMethodReferences(Module *M) {
//
for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
if (const PointerType *PT = dyn_cast<PointerType>(I->first))
- if (const MethodType *MT = dyn_cast<MethodType>(PT->getValueType())) {
+ if (const MethodType *MT = dyn_cast<MethodType>(PT->getElementType())) {
SymbolTable::VarMap &Plane = I->second;
for (SymbolTable::type_iterator PI = Plane.begin(), PE = Plane.end();
PI != PE; ++PI) {
@@ -208,7 +208,7 @@ static inline bool ShouldNukeSymtabEntry(const pair<string, Value*> &E) {
// Nuke all pointers to primitive types as well...
if (const PointerType *PT = dyn_cast<PointerType>(E.second))
- if (PT->getValueType()->isPrimitiveType()) return true;
+ if (PT->getElementType()->isPrimitiveType()) return true;
// The only types that could contain .'s in the program are things generated
// by GCC itself, including "complex.float" and friends. Nuke them too.
diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp
index c9f7917..c91c00c 100644
--- a/lib/Transforms/IPO/MutateStructTypes.cpp
+++ b/lib/Transforms/IPO/MutateStructTypes.cpp
@@ -86,7 +86,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
case Type::PointerTyID:
DestTy = PointerType::get(
- ConvertType(cast<PointerType>(Ty)->getValueType()));
+ ConvertType(cast<PointerType>(Ty)->getElementType()));
break;
default:
assert(0 && "Unknown type!");
@@ -432,7 +432,7 @@ bool MutateStructTypes::doPerMethodWork(Method *m) {
const Value *Ptr = MAI->getPointerOperand();
Value *NewPtr = ConvertValue(Ptr);
if (!Indices.empty()) {
- const Type *PTy = cast<PointerType>(Ptr->getType())->getValueType();
+ const Type *PTy = cast<PointerType>(Ptr->getType())->getElementType();
AdjustIndices(cast<CompositeType>(PTy), Indices);
}
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index b42bb7b..d6f5a57 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -39,10 +39,10 @@ PrintMethodNameForType(const Type* type)
if (PointerType* pty = dyn_cast<PointerType>(type))
{
const Type* elemTy;
- if (ArrayType* aty = dyn_cast<ArrayType>(pty->getValueType()))
+ if (ArrayType* aty = dyn_cast<ArrayType>(pty->getElementType()))
elemTy = aty->getElementType();
else
- elemTy = pty->getValueType();
+ elemTy = pty->getElementType();
if (elemTy == Type::SByteTy || elemTy == Type::UByteTy)
return "printString";
}
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index e0ca4db..ff16f7d 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -220,7 +220,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
// type.
//
if (!HasAddUse) {
- const Type *DestPointedTy = DestPTy->getValueType();
+ const Type *DestPointedTy = DestPTy->getElementType();
unsigned Depth = 1;
const CompositeType *CurCTy = CTy;
const Type *ElTy = 0;
@@ -313,12 +313,12 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType
if (PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType()))
// convertable types?
- if (Val->getType()->isLosslesslyConvertableTo(CSPT->getValueType()) &&
+ if (Val->getType()->isLosslesslyConvertableTo(CSPT->getElementType()) &&
!SI->hasIndices()) { // No subscripts yet!
PRINT_PEEPHOLE3("st-src-cast:in ", Pointer, Val, SI);
// Insert the new T cast instruction... stealing old T's name
- CastInst *NCI = new CastInst(Val, CSPT->getValueType(),
+ CastInst *NCI = new CastInst(Val, CSPT->getElementType(),
CI->getName());
CI->setName("");
BI = BB->getInstList().insert(BI, NCI)+1;
@@ -372,7 +372,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
if (CastInst *CI = dyn_cast<CastInst>(Pointer)) {
Value *SrcVal = CI->getOperand(0);
const PointerType *SrcTy = dyn_cast<PointerType>(SrcVal->getType());
- const Type *ElTy = SrcTy ? SrcTy->getValueType() : 0;
+ const Type *ElTy = SrcTy ? SrcTy->getElementType() : 0;
// Make sure that nothing will be lost in the new cast...
if (!LI->hasIndices() && SrcTy &&
@@ -445,7 +445,7 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
const PointerType *ThePtrType = dyn_cast<PointerType>(V->getType());
if (!ThePtrType) return false;
- const Type *ElTy = ThePtrType->getValueType();
+ const Type *ElTy = ThePtrType->getElementType();
if (isa<MethodType>(ElTy) || isa<ArrayType>(ElTy)) return false;
unsigned ElementSize = TD.getTypeSize(ElTy);
@@ -456,8 +456,8 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
switch (Inst->getOpcode()) {
case Instruction::Cast: // There is already a cast instruction!
if (const PointerType *PT = dyn_cast<const PointerType>(Inst->getType()))
- if (const ArrayType *AT = dyn_cast<const ArrayType>(PT->getValueType()))
- if (AT->getElementType() == ThePtrType->getValueType()) {
+ if (const ArrayType *AT = dyn_cast<const ArrayType>(PT->getElementType()))
+ if (AT->getElementType() == ThePtrType->getElementType()) {
// Cast already exists! Don't mess around with it.
return false; // No changes made to program though...
}
diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h
index d3ef47a..3131b8d 100644
--- a/lib/Transforms/TransformInternals.h
+++ b/lib/Transforms/TransformInternals.h
@@ -43,7 +43,7 @@ static inline bool isFirstClassType(const Type *Ty) {
//
static inline const CompositeType *getPointedToComposite(const Type *Ty) {
const PointerType *PT = dyn_cast<PointerType>(Ty);
- return PT ? dyn_cast<CompositeType>(PT->getValueType()) : 0;
+ return PT ? dyn_cast<CompositeType>(PT->getElementType()) : 0;
}
diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp
index 8a02946..f04c8a4 100644
--- a/lib/Transforms/Utils/Linker.cpp
+++ b/lib/Transforms/Utils/Linker.cpp
@@ -179,7 +179,7 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
// later by LinkGlobalInits...
//
GlobalVariable *DGV =
- new GlobalVariable(SGV->getType()->getValueType(), SGV->isConstant(),
+ new GlobalVariable(SGV->getType()->getElementType(), SGV->isConstant(),
SGV->hasInternalLinkage(), 0, SGV->getName());
// Add the new global to the dest module
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index ceb45f5..882485f 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -67,7 +67,7 @@ bool LowerAllocations::doPerMethodWork(Method *M) {
if (MallocInst *MI = dyn_cast<MallocInst>(*(BBIL.begin()+i))) {
BBIL.remove(BBIL.begin()+i); // remove the malloc instr...
- const Type *AllocTy = cast<PointerType>(MI->getType())->getValueType();
+ const Type *AllocTy =cast<PointerType>(MI->getType())->getElementType();
// If the user is allocating an unsized array with a dynamic size arg,
// start by getting the size of one element.