[llvm-commits] [llvm] r61517 - /llvm/trunk/include/llvm/Attributes.h
Chris Lattner
sabre at nondot.org
Wed Dec 31 00:41:40 PST 2008
Author: lattner
Date: Wed Dec 31 02:41:38 2008
New Revision: 61517
URL: http://llvm.org/viewvc/llvm-project?rev=61517&view=rev
Log:
Add a new Attribute::getAlignmentFromAttrs method.
Modified:
llvm/trunk/include/llvm/Attributes.h
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=61517&r1=61516&r2=61517&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Wed Dec 31 02:41:38 2008
@@ -88,6 +88,16 @@
return (Log2_32(i)+1) << 16;
}
+/// This returns the alignment field of an attribute as a byte alignment value.
+inline unsigned getAlignmentFromAttrs(Attributes A) {
+ Attributes Align = A & Attribute::Alignment;
+ if (Align == 0)
+ return 0;
+
+ return 1U << ((Align >> 16) - 1);
+}
+
+
/// The set of Attributes set in Attributes is converted to a
/// string of equivalent mnemonics. This is, presumably, for writing out
/// the mnemonics for the assembly writer.
@@ -184,11 +194,7 @@
/// getParamAlignment - Return the alignment for the specified function
/// parameter.
unsigned getParamAlignment(unsigned Idx) const {
- Attributes Align = getAttributes(Idx) & Attribute::Alignment;
- if (Align == 0)
- return 0;
-
- return 1ull << ((Align >> 16) - 1);
+ return Attribute::getAlignmentFromAttrs(getAttributes(Idx));
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
More information about the llvm-commits
mailing list