Initial support for packed types, contributed by Morten Ofstad
authorChris Lattner <sabre@nondot.org>
Wed, 1 Dec 2004 17:14:28 +0000 (17:14 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 1 Dec 2004 17:14:28 +0000 (17:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18406 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetData.cpp

index 594c33588efc7b7a077022458cbadbed8831e2bf..fc58f577497143d12d2ae23afcac08fb3cf72f6d 100644 (file)
@@ -175,6 +175,13 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
     Size = AlignedSize*ATy->getNumElements();
     return;
   }
+  case Type::PackedTyID: {
+    const PackedType *PTy = cast<PackedType>(Ty);
+    getTypeInfo(PTy->getElementType(), TD, Size, Alignment);
+    unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
+    Size = AlignedSize*PTy->getNumElements();
+    return;
+  }
   case Type::StructTyID: {
     // Get the layout annotation... which is lazily created on demand.
     const StructLayout *Layout = TD->getStructLayout(cast<StructType>(Ty));