summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-14 03:58:29 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-14 03:58:29 +0000
commitda3f9d8edc5b3e0a3e0b94257c63e24215a85653 (patch)
tree876493920590f19f28baa2b43023c0dda88afe3b /include
parentdb55fc9dd8f6ede9b5337ba1f1d7cf0adfb1cc1a (diff)
downloadllvm-da3f9d8edc5b3e0a3e0b94257c63e24215a85653.tar.gz
llvm-da3f9d8edc5b3e0a3e0b94257c63e24215a85653.tar.bz2
llvm-da3f9d8edc5b3e0a3e0b94257c63e24215a85653.tar.xz
Use builder to create alignment attributes. Remove dead function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165890 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Core.h2
-rw-r--r--include/llvm/Attributes.h25
2 files changed, 10 insertions, 17 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 8cf03c268c..badc70ba22 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -1803,7 +1803,7 @@ LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg);
* Set the alignment for a function parameter.
*
* @see llvm::Argument::addAttr()
- * @see llvm::Attributes::constructAlignmentFromInt()
+ * @see llvm::Attributes::Builder::addAlignmentAttr()
*/
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index c757951a1f..eb1798fb5e 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -118,11 +118,13 @@ public:
Builder &addAttribute(Attributes::AttrVal Val);
Builder &removeAttribute(Attributes::AttrVal Val);
- void addAlignmentAttr(unsigned Align);
+ /// addAlignmentAttr - This turns an int alignment (which must be a power of
+ /// 2) into the form used internally in Attributes.
+ Builder &addAlignmentAttr(unsigned Align);
/// addStackAlignmentAttr - This turns an int stack alignment (which must be
/// a power of 2) into the form used internally in Attributes.
- void addStackAlignmentAttr(unsigned Align);
+ Builder &addStackAlignmentAttr(unsigned Align);
void removeAttributes(const Attributes &A);
@@ -229,18 +231,6 @@ public:
uint64_t Raw() const;
- /// constructAlignmentFromInt - This turns an int alignment (a power of 2,
- /// normally) into the form used internally in Attributes.
- static Attributes constructAlignmentFromInt(unsigned i) {
- // Default alignment, allow the target to define how to align it.
- if (i == 0)
- return Attributes();
-
- assert(isPowerOf2_32(i) && "Alignment must be a power of two.");
- assert(i <= 0x40000000 && "Alignment too large.");
- return Attributes((Log2_32(i)+1) << 16);
- }
-
/// @brief Which attributes cannot be applied to a type.
static Attributes typeIncompatible(Type *Ty);
@@ -277,8 +267,11 @@ public:
"Alignment must be a power of two.");
Attributes Attrs(EncodedAttrs & 0xffff);
- if (Alignment)
- Attrs |= Attributes::constructAlignmentFromInt(Alignment);
+ if (Alignment) {
+ Attributes::Builder B;
+ B.addAlignmentAttr(Alignment);
+ Attrs |= Attributes::get(B);
+ }
Attrs |= Attributes((EncodedAttrs & (0xfffULL << 32)) >> 11);
return Attrs;
}