summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-31 00:49:59 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-31 00:49:59 +0000
commit9d30e7208e6b2bc3fa48305e3ae371188f643425 (patch)
treeae1e458e31434ea097a6c2cdc12e04fc63e00f8f /lib
parentd60b8ac64fa161646d50c49d6171cb49e6a2c7ee (diff)
downloadllvm-9d30e7208e6b2bc3fa48305e3ae371188f643425.tar.gz
llvm-9d30e7208e6b2bc3fa48305e3ae371188f643425.tar.bz2
llvm-9d30e7208e6b2bc3fa48305e3ae371188f643425.tar.xz
Remove the getAttributesAtIndex and getNumAttrs methods in favor of using the getAttrSomewhere predicate. This prevents the uses of 'Attribute' as a collection of attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/XCore/XCoreFrameLowering.cpp7
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp5
-rw-r--r--lib/VMCore/Attributes.cpp16
3 files changed, 7 insertions, 21 deletions
diff --git a/lib/Target/XCore/XCoreFrameLowering.cpp b/lib/Target/XCore/XCoreFrameLowering.cpp
index aa185d6738..ffb0c53b3b 100644
--- a/lib/Target/XCore/XCoreFrameLowering.cpp
+++ b/lib/Target/XCore/XCoreFrameLowering.cpp
@@ -100,11 +100,8 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF) const {
bool FP = hasFP(MF);
const AttributeSet &PAL = MF.getFunction()->getAttributes();
- for (unsigned I = 0, E = PAL.getNumAttrs(); I != E; ++I)
- if (PAL.getAttributesAtIndex(I).hasAttribute(Attribute::Nest)) {
- loadFromStack(MBB, MBBI, XCore::R11, 0, dl, TII);
- break;
- }
+ if (PAL.hasAttrSomewhere(Attribute::Nest))
+ loadFromStack(MBB, MBBI, XCore::R11, 0, dl, TII);
// Work out frame sizes.
int FrameSize = MFI->getStackSize();
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 23306b4079..fcd16b82cc 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1248,9 +1248,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
// If the call already has the 'nest' attribute somewhere then give up -
// otherwise 'nest' would occur twice after splicing in the chain.
- for (unsigned I = 0, E = Attrs.getNumAttrs(); I != E; ++I)
- if (Attrs.getAttributesAtIndex(I).hasAttribute(Attribute::Nest))
- return 0;
+ if (Attrs.hasAttrSomewhere(Attribute::Nest))
+ return 0;
assert(Tramp &&
"transformCallThroughTrampoline called with incorrect CallSite.");
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index de83deb2e9..e8c6b2a01c 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -478,7 +478,7 @@ uint64_t AttributeSet::getBitMask(unsigned Index) const {
Attribute AttributeSet::getAttributes(unsigned Idx) const {
if (AttrList == 0) return Attribute();
- const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
+ const SmallVectorImpl<AttributeWithIndex> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
if (Attrs[i].Index == Idx)
return Attrs[i].Attrs;
@@ -499,18 +499,8 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
return false;
}
-unsigned AttributeSet::getNumAttrs() const {
- return AttrList ? AttrList->Attrs.size() : 0;
-}
-
-Attribute &AttributeSet::getAttributesAtIndex(unsigned i) const {
- assert(AttrList && "Trying to get an attribute from an empty list!");
- assert(i < AttrList->Attrs.size() && "Index out of range!");
- return AttrList->Attrs[i].Attrs;
-}
-
AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
- Attribute Attrs) const {
+ Attribute Attrs) const {
Attribute OldAttrs = getAttributes(Idx);
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
@@ -555,7 +545,7 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
}
AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
- Attribute Attrs) const {
+ Attribute Attrs) const {
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't pass in alignment, which no current use does.