[llvm-commits] [llvm] r131883 - in /llvm/trunk: include/llvm/Argument.h lib/VMCore/Function.cpp

Chris Lattner sabre at nondot.org
Sun May 22 16:57:24 PDT 2011


Author: lattner
Date: Sun May 22 18:57:23 2011
New Revision: 131883

URL: http://llvm.org/viewvc/llvm-project?rev=131883&view=rev
Log:
add a helper method to get the byval alignment of an argument.

Modified:
    llvm/trunk/include/llvm/Argument.h
    llvm/trunk/lib/VMCore/Function.cpp

Modified: llvm/trunk/include/llvm/Argument.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Argument.h?rev=131883&r1=131882&r2=131883&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Argument.h (original)
+++ llvm/trunk/include/llvm/Argument.h Sun May 22 18:57:23 2011
@@ -51,6 +51,9 @@
   /// 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.

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=131883&r1=131882&r2=131883&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Sun May 22 18:57:23 2011
@@ -79,6 +79,12 @@
   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 {





More information about the llvm-commits mailing list