summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-31 08:41:38 +0000
committerChris Lattner <sabre@nondot.org>2008-12-31 08:41:38 +0000
commit9dd5e9e4aef0909a2a4a21b7ca38adc4fed53c23 (patch)
tree30eaa9dd415ebd9a5cab94fa2ac0de7794e8e04d
parent80cb99575edf9a423f3f03425efb939f81269740 (diff)
downloadbcm5719-llvm-9dd5e9e4aef0909a2a4a21b7ca38adc4fed53c23.tar.gz
bcm5719-llvm-9dd5e9e4aef0909a2a4a21b7ca38adc4fed53c23.zip
Add a new Attribute::getAlignmentFromAttrs method.
llvm-svn: 61517
-rw-r--r--llvm/include/llvm/Attributes.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h
index ab093788f7a..972dbfa518d 100644
--- a/llvm/include/llvm/Attributes.h
+++ b/llvm/include/llvm/Attributes.h
@@ -88,6 +88,16 @@ inline Attributes constructAlignmentFromInt(unsigned i) {
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 @@ public:
/// 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
OpenPOWER on IntegriCloud