[llvm-commits] [llvm] r173637 - Push the calculation of the 'Raw' attribute mask down into the implementation. It in turn uses the correct list for calculating the 'Raw' value.
Bill Wendling
isanbard at gmail.com
Sun Jan 27 15:41:29 PST 2013
Author: void
Date: Sun Jan 27 17:41:29 2013
New Revision: 173637
URL: http://llvm.org/viewvc/llvm-project?rev=173637&view=rev
Log:
Push the calculation of the 'Raw' attribute mask down into the implementation. It in turn uses the correct list for calculating the 'Raw' value.
Modified:
llvm/trunk/include/llvm/IR/Attributes.h
llvm/trunk/lib/IR/AttributeImpl.h
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=173637&r1=173636&r2=173637&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Sun Jan 27 17:41:29 2013
@@ -234,7 +234,10 @@ private:
public:
AttributeSet() : pImpl(0) {}
AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
- const AttributeSet &operator=(const AttributeSet &RHS);
+ const AttributeSet &operator=(const AttributeSet &RHS) {
+ pImpl = RHS.pImpl;
+ return *this;
+ }
//===--------------------------------------------------------------------===//
// Attribute List Construction and Mutation
Modified: llvm/trunk/lib/IR/AttributeImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=173637&r1=173636&r2=173637&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AttributeImpl.h (original)
+++ llvm/trunk/lib/IR/AttributeImpl.h Sun Jan 27 17:41:29 2013
@@ -165,6 +165,9 @@ public:
ID.AddPointer(Nodes[i].second);
}
}
+
+ // FIXME: This atrocity is temporary.
+ uint64_t Raw(uint64_t Index) const;
};
} // end llvm namespace
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=173637&r1=173636&r2=173637&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Sun Jan 27 17:41:29 2013
@@ -574,6 +574,24 @@ AttributeSetImpl(LLVMContext &C,
#endif
}
+uint64_t AttributeSetImpl::Raw(uint64_t Index) const {
+ for (unsigned I = 0, E = getNumAttributes(); I != E; ++I) {
+ if (getSlotIndex(I) != Index) continue;
+ const AttributeSetNode *ASN = AttrNodes[I].second;
+ AttrBuilder B;
+
+ for (AttributeSetNode::const_iterator II = ASN->begin(),
+ IE = ASN->end(); II != IE; ++II)
+ B.addAttributes(*II);
+
+ assert(B.Raw() == AttrList[I].Attrs.Raw() &&
+ "Attributes aren't the same!");
+ return B.Raw();
+ }
+
+ return 0;
+}
+
//===----------------------------------------------------------------------===//
// AttributeSet Method Implementations
//===----------------------------------------------------------------------===//
@@ -669,14 +687,9 @@ AttributeSet AttributeSet::get(LLVMConte
return get(C, AttrList);
}
-const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
- pImpl = RHS.pImpl;
- return *this;
-}
-
-/// getNumSlots - Return the number of slots used in this attribute list.
-/// This is the number of arguments that have an attribute set on them
-/// (including the function itself).
+/// \brief Return the number of slots used in this attribute list. This is the
+/// number of arguments that have an attribute set on them (including the
+/// function itself).
unsigned AttributeSet::getNumSlots() const {
return pImpl ? pImpl->getNumAttributes() : 0;
}
@@ -715,7 +728,7 @@ unsigned AttributeSet::getStackAlignment
uint64_t AttributeSet::Raw(unsigned Index) const {
// FIXME: Remove this.
- return getAttributes(Index).Raw();
+ return pImpl ? pImpl->Raw(Index) : 0;
}
/// getAttributes - The attributes for the specified index are returned.
More information about the llvm-commits
mailing list