add a method to get the alignment of an integer type even
authorChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 23:18:11 +0000 (23:18 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 23:18:11 +0000 (23:18 +0000)
when we don't have one laying around.  Useful if you don't
have an llvmcontext handy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94468 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetData.h
lib/Target/TargetData.cpp

index 2e63188989abc53a35f3964351d12593454915f4..cc88dae9fa689c2b5b778def250e78680bc4d2c6 100644 (file)
@@ -224,6 +224,11 @@ public:
   /// 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.
index ba3cc9d946253fa288a5adf3f16f780a5569f638..295b30fc36a304bb7ffb5061c2a82a05bd00ad3c 100644 (file)
@@ -545,6 +545,13 @@ unsigned char TargetData::getABITypeAlignment(const Type *Ty) const {
   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)