diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-09 04:37:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-09 04:37:31 +0000 |
commit | d21cd809b656d3011ec089536857e048e037159c (patch) | |
tree | 131bf120f81f62962ffbb7520d785b63cf8d4b16 /lib/Transforms | |
parent | 037b8b70d04ce214464c89d2480811484f9ec13d (diff) |
Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/MutateStructTypes.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/IPO/SimpleStructMutation.cpp | 5 | ||||
-rw-r--r-- | lib/Transforms/LevelRaise.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/TransformInternals.cpp | 2 |
4 files changed, 9 insertions, 11 deletions
diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index d5bf4c3bfa..ad18bae42a 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -69,11 +69,10 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) { } case Type::StructTyID: { const StructType *ST = cast<StructType>(Ty); - const StructType::ElementTypes &El = ST->getElementTypes(); std::vector<const Type *> Types; - for (StructType::ElementTypes::const_iterator I = El.begin(), E = El.end(); - I != E; ++I) + for (StructType::element_iterator I = ST->element_begin(), + E = ST->element_end(); I != E; ++I) Types.push_back(ConvertType(*I)); DestTy = StructType::get(Types); break; @@ -115,7 +114,7 @@ void MutateStructTypes::AdjustIndices(const CompositeType *OldTy, if (const StructType *OldST = dyn_cast<StructType>(OldTy)) { // Figure out what the current index is... unsigned ElNum = cast<ConstantUInt>(Idx[i])->getValue(); - assert(ElNum < OldST->getElementTypes().size()); + assert(ElNum < OldST->getNumElements()); std::map<const StructType*, TransformType>::iterator I = Transforms.find(OldST); @@ -198,7 +197,7 @@ void MutateStructTypes::setTransforms(const TransformsType &XForm) { const StructType *OldTy = I->first; const std::vector<int> &InVec = I->second; - assert(OldTy->getElementTypes().size() == InVec.size() && + assert(OldTy->getNumElements() == InVec.size() && "Action not specified for every element of structure type!"); std::vector<const Type *> NewType; diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 809ca403dd..f2061ddb8f 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -109,7 +109,7 @@ static unsigned getIndex(const std::vector<std::pair<unsigned, unsigned> > &Vec, static inline void GetTransformation(const TargetData &TD, const StructType *ST, std::vector<int> &Transform, enum SimpleStructMutation::Transform XForm) { - unsigned NumElements = ST->getElementTypes().size(); + unsigned NumElements = ST->getNumElements(); Transform.reserve(NumElements); switch (XForm) { @@ -124,8 +124,7 @@ static inline void GetTransformation(const TargetData &TD, const StructType *ST, // Build mapping from index to size for (unsigned i = 0; i < NumElements; ++i) - ElList.push_back( - std::make_pair(i, TD.getTypeSize(ST->getElementTypes()[i]))); + ElList.push_back(std::make_pair(i,TD.getTypeSize(ST->getElementType(i)))); sort(ElList.begin(), ElList.end(), ptr_fun(FirstLess)); diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index 12268edbed..edc42b7a56 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -375,12 +375,12 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { const Type *IdxType; if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) { // Check for a zero element struct type... if we have one, bail. - if (CurSTy->getElementTypes().size() == 0) break; + if (CurSTy->getNumElements() == 0) break; // Grab the first element of the struct type, which must lie at // offset zero in the struct. // - ElTy = CurSTy->getElementTypes()[0]; + ElTy = CurSTy->getElementType(0); IdxType = Type::UByteTy; // FIXME when PR82 is fixed. } else { ElTy = cast<ArrayType>(CurCTy)->getElementType(); diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index eb20544344..9039f59095 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -62,7 +62,7 @@ const Type *llvm::getStructOffsetType(const Type *Ty, unsigned &Offset, uint64_t ThisOffset; const Type *NextType; if (const StructType *STy = dyn_cast<StructType>(Ty)) { - if (STy->getElementTypes().empty()) { + if (STy->getNumElements()) { Offset = 0; return STy; } |