summaryrefslogtreecommitdiffstats
path: root/lib/IR
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-02 00:52:44 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-02 00:52:44 +0000
commitfca0ed28c81a505b0b71605e8b59e4bb6daeda0e (patch)
tree1af295eca1fcbb1558532a5f2eb9c1008b917fc7 /lib/IR
parentbdcbccc710a0528b4abce947782fd502bafb848d (diff)
downloadexternal_llvm-fca0ed28c81a505b0b71605e8b59e4bb6daeda0e.zip
external_llvm-fca0ed28c81a505b0b71605e8b59e4bb6daeda0e.tar.gz
external_llvm-fca0ed28c81a505b0b71605e8b59e4bb6daeda0e.tar.bz2
Remove AttrBuilder::Raw().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Attributes.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index d585843..3b4ece9 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -408,12 +408,23 @@ 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;
+ uint64_t Mask = 0;
for (AttributeSetNode::const_iterator II = ASN->begin(),
- IE = ASN->end(); II != IE; ++II)
- B.addAttribute(*II);
- return B.Raw();
+ IE = ASN->end(); II != IE; ++II) {
+ Attribute Attr = *II;
+ ConstantInt *Kind = cast<ConstantInt>(Attr.getAttributeKind());
+ Attribute::AttrKind KindVal = Attribute::AttrKind(Kind->getZExtValue());
+
+ if (KindVal == Attribute::Alignment)
+ Mask |= (Log2_32(ASN->getAlignment()) + 1) << 16;
+ else if (KindVal == Attribute::StackAlignment)
+ Mask |= (Log2_32(ASN->getStackAlignment()) + 1) << 26;
+ else
+ Mask |= AttributeImpl::getAttrMask(KindVal);
+ }
+
+ return Mask;
}
return 0;
@@ -895,10 +906,10 @@ bool AttrBuilder::hasAttributes(AttributeSet A, uint64_t Index) const {
I != E; ++I) {
Attribute Attr = *I;
// FIXME: Support StringRefs.
- Attribute::AttrKind Kind = Attribute::AttrKind(
- cast<ConstantInt>(Attr.getAttributeKind())->getZExtValue());
+ ConstantInt *Kind = cast<ConstantInt>(Attr.getAttributeKind());
+ Attribute::AttrKind KindVal = Attribute::AttrKind(Kind->getZExtValue());
- if (Attrs.count(Kind))
+ if (Attrs.count(KindVal))
return true;
}
@@ -933,24 +944,6 @@ AttrBuilder &AttrBuilder::addRawValue(uint64_t Val) {
return *this;
}
-uint64_t AttrBuilder::Raw() const {
- uint64_t Mask = 0;
-
- for (DenseSet<Attribute::AttrKind>::const_iterator I = Attrs.begin(),
- E = Attrs.end(); I != E; ++I) {
- Attribute::AttrKind Kind = *I;
-
- if (Kind == Attribute::Alignment)
- Mask |= (Log2_32(Alignment) + 1) << 16;
- else if (Kind == Attribute::StackAlignment)
- Mask |= (Log2_32(StackAlignment) + 1) << 26;
- else
- Mask |= AttributeImpl::getAttrMask(Kind);
- }
-
- return Mask;
-}
-
//===----------------------------------------------------------------------===//
// AttributeFuncs Function Defintions
//===----------------------------------------------------------------------===//