[llvm-commits] [llvm] r94468 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp

Chris Lattner sabre at nondot.org
Mon Jan 25 15:18:11 PST 2010


Author: lattner
Date: Mon Jan 25 17:18:11 2010
New Revision: 94468

URL: http://llvm.org/viewvc/llvm-project?rev=94468&view=rev
Log:
add a method to get the alignment of an integer type even 
when we don't have one laying around.  Useful if you don't
have an llvmcontext handy.

Modified:
    llvm/trunk/include/llvm/Target/TargetData.h
    llvm/trunk/lib/Target/TargetData.cpp

Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=94468&r1=94467&r2=94468&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Mon Jan 25 17:18:11 2010
@@ -224,6 +224,11 @@
   /// getABITypeAlignment - Return the minimum ABI-required alignment for the
   /// specified type.
   unsigned char getABITypeAlignment(const Type *Ty) const;
+  
+  /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
+  /// an integer type of the specified bitwidth.
+  unsigned char getABIIntegerTypeAlignment(unsigned BitWidth) const;
+  
 
   /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment
   /// for the specified type when it is part of a call frame.

Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=94468&r1=94467&r2=94468&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Mon Jan 25 17:18:11 2010
@@ -545,6 +545,13 @@
   return getAlignment(Ty, true);
 }
 
+/// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
+/// an integer type of the specified bitwidth.
+unsigned char TargetData::getABIIntegerTypeAlignment(unsigned BitWidth) const {
+  return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, 0);
+}
+
+
 unsigned char TargetData::getCallFrameTypeAlignment(const Type *Ty) const {
   for (unsigned i = 0, e = Alignments.size(); i != e; ++i)
     if (Alignments[i].AlignType == STACK_ALIGN)





More information about the llvm-commits mailing list