add a helper method to get the byval alignment of an argument.
authorChris Lattner <sabre@nondot.org>
Sun, 22 May 2011 23:57:23 +0000 (23:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 May 2011 23:57:23 +0000 (23:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131883 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Argument.h
lib/VMCore/Function.cpp

index 71c001fbe18d7a04f8e07c546113f0df6dcb41b3..ff8637881eb786127e3c6f71e3c2cd11692ee39b 100644 (file)
@@ -51,6 +51,9 @@ public:
   /// hasByValAttr - Return true if this argument has the byval attribute on it
   /// in its containing function.
   bool hasByValAttr() const;
+  
+  /// getParamAlignment - If this is a byval argument, return its alignment.
+  unsigned getParamAlignment() const;
 
   /// hasNestAttr - Return true if this argument has the nest attribute on
   /// it in its containing function.
index ce2186f5cd094ae7569651f3ec1f10ed7c0383d6..0ae0bdb8056afb43ed294b8d86291cf3fc19fac9 100644 (file)
@@ -79,6 +79,12 @@ bool Argument::hasByValAttr() const {
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::ByVal);
 }
 
+unsigned Argument::getParamAlignment() const {
+  assert(getType()->isPointerTy() && "Only pointers have alignments");
+  return getParent()->getParamAlignment(getArgNo()+1);
+  
+}
+
 /// hasNestAttr - Return true if this argument has the nest attribute on
 /// it in its containing function.
 bool Argument::hasNestAttr() const {