[llvm-commits] [llvm] r171271 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Instructions.h lib/Target/XCore/XCoreFrameLowering.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp lib/VMCore/Attributes.cpp
Bill Wendling
isanbard at gmail.com
Sun Dec 30 16:49:59 PST 2012
Author: void
Date: Sun Dec 30 18:49:59 2012
New Revision: 171271
URL: http://llvm.org/viewvc/llvm-project?rev=171271&view=rev
Log:
Remove the getAttributesAtIndex and getNumAttrs methods in favor of using the getAttrSomewhere predicate. This prevents the uses of 'Attribute' as a collection of attributes.
Modified:
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=171271&r1=171270&r2=171271&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Sun Dec 30 18:49:59 2012
@@ -358,9 +358,6 @@
/// parameter or for the return value.
bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
- unsigned getNumAttrs() const;
- Attribute &getAttributesAtIndex(unsigned i) const;
-
/// operator==/!= - Provide equality predicates.
bool operator==(const AttributeSet &RHS) const {
return AttrList == RHS.AttrList;
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=171271&r1=171270&r2=171271&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Sun Dec 30 18:49:59 2012
@@ -1352,10 +1352,7 @@
/// \brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const {
- for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
- if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attribute::ByVal))
- return true;
- return false;
+ return AttributeList.hasAttrSomewhere(Attribute::ByVal);
}
/// getCalledFunction - Return the function called, or null if this is an
@@ -3092,10 +3089,7 @@
/// \brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const {
- for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
- if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attribute::ByVal))
- return true;
- return false;
+ return AttributeList.hasAttrSomewhere(Attribute::ByVal);
}
/// getCalledFunction - Return the function called, or null if this is an
Modified: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp?rev=171271&r1=171270&r2=171271&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp Sun Dec 30 18:49:59 2012
@@ -100,11 +100,8 @@
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();
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=171271&r1=171270&r2=171271&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Sun Dec 30 18:49:59 2012
@@ -1248,9 +1248,8 @@
// 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.");
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=171271&r1=171270&r2=171271&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Sun Dec 30 18:49:59 2012
@@ -478,7 +478,7 @@
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 @@
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::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.
More information about the llvm-commits
mailing list