diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:11:39 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:11:39 +0000 |
commit | 775438952693c261bf1b5a85143dea4f5852dcdf (patch) | |
tree | fa8e7f5c9677bc1375634402ce35a98c2c98160f /llvm/lib/IR/Attributes.cpp | |
parent | 8bee90d5f33f49d4ebcb89aac780916fe3bfc65d (diff) | |
download | bcm5719-llvm-775438952693c261bf1b5a85143dea4f5852dcdf.tar.gz bcm5719-llvm-775438952693c261bf1b5a85143dea4f5852dcdf.zip |
Push some more methods down to hide the use of the Attribute class.
Because the Attribute class is going to stop representing a collection of
attributes, limit the use of it as an aggregate in favor of using AttributeSet.
This replaces some of the uses for querying the function attributes.
llvm-svn: 172844
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 5024a63c394..173782e5a25 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -255,9 +255,19 @@ AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx) assert(AWI && "Cannot find index in attribute set!"); - /// FIXME: This will be modified in the future. Basically, the - /// AttributeWithIndex class will contain the + uint64_t Mask = AWI->Attrs.Raw(); + for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds; + I = Attribute::AttrKind(I + 1)) { + if (uint64_t A = (Mask & AttributeImpl::getAttrMask(I))) { + Attrs.insert(I); + + if (I == Attribute::Alignment) + Alignment = 1ULL << ((A >> 16) - 1); + else if (I == Attribute::StackAlignment) + StackAlignment = 1ULL << ((A >> 26)-1); + } + } } void AttrBuilder::clear() { @@ -610,6 +620,10 @@ std::string AttributeSet::getAsString(unsigned Index) const { return getAttributes(Index).getAsString(); } +unsigned AttributeSet::getParamAlignment(unsigned Idx) const { + return getAttributes(Idx).getAlignment(); +} + unsigned AttributeSet::getStackAlignment(unsigned Index) const { return getAttributes(Index).getStackAlignment(); } @@ -646,6 +660,11 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { return false; } +AttributeSet AttributeSet::addFnAttributes(LLVMContext &C, + AttributeSet Attrs) const { + return addAttr(C, FunctionIndex, getAttributes(FunctionIndex)); +} + AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx, Attribute Attrs) const { Attribute OldAttrs = getAttributes(Idx); |