summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-28 00:21:34 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-28 00:21:34 +0000
commit9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae (patch)
tree465a06ad0706751c2d02aa48bc6b8ee0805f201d /llvm/lib/IR/Attributes.cpp
parentad6217c76f37bf6333bf6a5b35c241bc8e004a79 (diff)
downloadbcm5719-llvm-9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae.tar.gz
bcm5719-llvm-9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae.zip
Remove a use of AttributeWithIndex.
We want to remove AttributeWithIndex because it provides a non-encapsulated view of the AttributeSetImpl object. Instead, use accessor methods and iterators. Eventually, this code can be simplified because the Attribute object will hold only one attribute instead of multiple attributes. llvm-svn: 173641
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 361f3d6c8cc..59d3ef03dd8 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -197,17 +197,21 @@ AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx)
AttributeSetImpl *pImpl = AS.pImpl;
if (!pImpl) return;
- ArrayRef<AttributeWithIndex> AttrList = pImpl->getAttributes();
- const AttributeWithIndex *AWI = 0;
- for (unsigned I = 0, E = AttrList.size(); I != E; ++I)
- if (AttrList[I].Index == Idx) {
- AWI = &AttrList[I];
- break;
- }
+ AttrBuilder B;
+
+ for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I) {
+ if (pImpl->getSlotIndex(I) != Idx) continue;
+
+ for (AttributeSetNode::const_iterator II = pImpl->begin(I),
+ IE = pImpl->end(I); II != IE; ++II)
+ B.addAttributes(*II);
+
+ break;
+ }
- if (!AWI) return;
+ if (!B.hasAttributes()) return;
- uint64_t Mask = AWI->Attrs.Raw();
+ uint64_t Mask = B.Raw();
for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds;
I = Attribute::AttrKind(I + 1)) {
@@ -861,8 +865,8 @@ AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
}
void AttributeSet::dump() const {
- dbgs() << "PAL[ ";
- for (unsigned i = 0; i < getNumSlots(); ++i) {
+ dbgs() << "PAL[\n";
+ for (unsigned i = 0, e = getNumSlots(); i < e; ++i) {
uint64_t Index = getSlotIndex(i);
dbgs() << " { ";
if (Index == ~0U)
OpenPOWER on IntegriCloud