[llvm-commits] [llvm-gcc-4.2] r71351 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp llvm-abi.h llvm-convert.cpp llvm-types.cpp

Duncan Sands baldrick at free.fr
Sat May 9 00:36:01 PDT 2009


Author: baldrick
Date: Sat May  9 02:36:00 2009
New Revision: 71351

URL: http://llvm.org/viewvc/llvm-project?rev=71351&view=rev
Log:
Correct for renaming PaddedSize -> AllocSize in LLVM.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-abi.h
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=71351&r1=71350&r2=71351&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sat May  9 02:36:00 2009
@@ -1074,7 +1074,7 @@
 const Type *llvm_x86_scalar_type_for_struct_return(tree type, unsigned *Offset) {
   *Offset = 0;
   const Type *Ty = ConvertType(type);
-  unsigned Size = getTargetData().getTypePaddedSize(Ty);
+  unsigned Size = getTargetData().getTypeAllocSize(Ty);
   if (Size == 0)
     return Type::VoidTy;
   else if (Size == 1)

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=71351&r1=71350&r2=71351&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sat May  9 02:36:00 2009
@@ -205,7 +205,7 @@
 // target independent implementation.
 static const Type* getLLVMScalarTypeForStructReturn(tree type, unsigned *Offset) {
   const Type *Ty = ConvertType(type);
-  unsigned Size = getTargetData().getTypePaddedSize(Ty);
+  unsigned Size = getTargetData().getTypeAllocSize(Ty);
   *Offset = 0;
   if (Size == 0)
     return Type::VoidTy;
@@ -653,20 +653,20 @@
 
     const StructType *STy = StructType::get(Elts, false);
 
-    unsigned Size = getTargetData().getTypePaddedSize(STy);
+    unsigned Size = getTargetData().getTypeAllocSize(STy);
     const StructType *InSTy = dyn_cast<StructType>(Ty);
     unsigned InSize = 0;
     // If Ty and STy size does not match then last element is accessing
     // extra bits.
     unsigned LastEltSizeDiff = 0;
     if (InSTy) {
-      InSize = getTargetData().getTypePaddedSize(InSTy);
+      InSize = getTargetData().getTypeAllocSize(InSTy);
       if (InSize < Size) {
         unsigned N = STy->getNumElements();
         const llvm::Type *LastEltTy = STy->getElementType(N-1);
         if (LastEltTy->isInteger())
           LastEltSizeDiff = 
-            getTargetData().getTypePaddedSize(LastEltTy) - (Size - InSize);
+            getTargetData().getTypeAllocSize(LastEltTy) - (Size - InSize);
       }
     }
     for (unsigned i = 0, e = Elts.size(); i != e; ++i) {

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=71351&r1=71350&r2=71351&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat May  9 02:36:00 2009
@@ -1154,7 +1154,7 @@
     }
   } else {
     const ArrayType *ATy = cast<ArrayType>(ElTy);
-    unsigned EltSize = getTargetData().getTypePaddedSize(ATy->getElementType());
+    unsigned EltSize = getTargetData().getTypeAllocSize(ATy->getElementType());
     for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
       Value *DElPtr = Builder.CreateStructGEP(DestLoc.Ptr, i);
       Value *SElPtr = Builder.CreateStructGEP(SrcLoc.Ptr, i);
@@ -1265,7 +1265,7 @@
     }
   } else {
     const ArrayType *ATy = cast<ArrayType>(ElTy);
-    unsigned EltSize = getTargetData().getTypePaddedSize(ATy->getElementType());
+    unsigned EltSize = getTargetData().getTypeAllocSize(ATy->getElementType());
     for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
       Value *Ptr = Builder.CreateStructGEP(DestLoc.Ptr, i);
       unsigned Alignment = MinAlign(DestLoc.Alignment, i * EltSize);
@@ -3269,7 +3269,7 @@
     // We can't get the type size (and thus convert to using a GEP instr) from
     // pointers to opaque structs if the type isn't abstract.
     if (ElTy->isSized()) {
-      int64_t EltSize = TD.getTypePaddedSize(ElTy);
+      int64_t EltSize = TD.getTypeAllocSize(ElTy);
       
       // If EltSize exactly divides Offset, then we know that we can turn this
       // into a getelementptr instruction.
@@ -5681,7 +5681,7 @@
   Value *ImagPtr = Builder.CreateStructGEP(SrcComplex.Ptr, 1, "imag");
   Imag = Builder.CreateLoad(ImagPtr, SrcComplex.Volatile, "imag");
   cast<LoadInst>(Imag)->setAlignment(
-    MinAlign(SrcComplex.Alignment, TD.getTypePaddedSize(Real->getType()))
+    MinAlign(SrcComplex.Alignment, TD.getTypeAllocSize(Real->getType()))
   );
 }
 
@@ -5696,7 +5696,7 @@
   Value *ImagPtr = Builder.CreateStructGEP(DestComplex.Ptr, 1, "imag");
   St = Builder.CreateStore(Imag, ImagPtr, DestComplex.Volatile);
   St->setAlignment(
-    MinAlign(DestComplex.Alignment, TD.getTypePaddedSize(Real->getType()))
+    MinAlign(DestComplex.Alignment, TD.getTypeAllocSize(Real->getType()))
   );
 }
 
@@ -6168,7 +6168,7 @@
     if (LLVMFieldTy->isInteger() &&
         LLVMFieldTy->getPrimitiveSizeInBits() >= BitStart + BitfieldSize &&
         LLVMFieldTy->getPrimitiveSizeInBits() ==
-        TD.getTypePaddedSizeInBits(LLVMFieldTy))
+        TD.getTypeAllocSizeInBits(LLVMFieldTy))
       FieldTy = LLVMFieldTy;
     else
       // If the field result type T is a bool or some other curiously sized
@@ -6178,10 +6178,10 @@
       // sized like an i24 there may be trouble: incrementing a T* will move
       // the position by 32 bits not 24, leaving the upper 8 of those 32 bits
       // inaccessible.  Avoid this by rounding up the size appropriately.
-      FieldTy = IntegerType::get(TD.getTypePaddedSizeInBits(FieldTy));
+      FieldTy = IntegerType::get(TD.getTypeAllocSizeInBits(FieldTy));
 
     assert(FieldTy->getPrimitiveSizeInBits() ==
-           TD.getTypePaddedSizeInBits(FieldTy) && "Field type not sequential!");
+           TD.getTypeAllocSizeInBits(FieldTy) && "Field type not sequential!");
 
     // If this is a bitfield, the field may span multiple fields in the LLVM
     // type.  As such, cast the pointer to be a pointer to the declared type.
@@ -6258,7 +6258,7 @@
   assert(BitSize <= ValueSizeInBits &&
          "ValTy isn't large enough to hold the value loaded!");
 
-  assert(ValueSizeInBits == TD.getTypePaddedSizeInBits(ValTy) &&
+  assert(ValueSizeInBits == TD.getTypeAllocSizeInBits(ValTy) &&
          "FIXME: BIT_FIELD_REF logic is broken for non-round types");
 
   // BIT_FIELD_REF values can have BitStart values that are quite large.  We
@@ -6295,7 +6295,7 @@
   else
     // IMAGPART alignment = MinAlign(Ptr.Alignment, sizeof field);
     Alignment = MinAlign(Ptr.Alignment,
-                         TD.getTypePaddedSize(Ptr.Ptr->getType()));
+                         TD.getTypeAllocSize(Ptr.Ptr->getType()));
   return LValue(Builder.CreateStructGEP(Ptr.Ptr, Idx), Alignment);
 }
 
@@ -6847,7 +6847,7 @@
     // If the alignment doesn't affect the element offset, then the value is ok.
     // Accept the field and keep moving.
     if (AlignedEltOffs == EltOffs) {
-      EltOffs += TD.getTypePaddedSize(Val->getType());
+      EltOffs += TD.getTypeAllocSize(Val->getType());
       continue;
     }
 
@@ -6953,7 +6953,7 @@
   assert(LLVMNaturalByteOffset*8 == GCCFieldOffsetInBits);
   ResultElts.push_back(Val);
   NextFieldByteStart = LLVMNaturalByteOffset;
-  NextFieldByteStart += TD.getTypePaddedSize(Val->getType());
+  NextFieldByteStart += TD.getTypeAllocSize(Val->getType());
 }
 
 /// AddBitFieldToRecordConstant - Bitfields can span multiple LLVM fields and
@@ -7209,7 +7209,7 @@
   tree UnionType = TREE_TYPE(exp);
   if (TYPE_SIZE(UnionType) && TREE_CODE(TYPE_SIZE(UnionType)) == INTEGER_CST) {
     uint64_t UnionSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(UnionType))+7)/8;
-    uint64_t InitSize = getTargetData().getTypePaddedSize(Elts[0]->getType());
+    uint64_t InitSize = getTargetData().getTypeAllocSize(Elts[0]->getType());
     if (UnionSize != InitSize) {
       const Type *FillTy;
       assert(UnionSize > InitSize && "Init shouldn't be larger than union!");

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=71351&r1=71350&r2=71351&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat May  9 02:36:00 2009
@@ -72,11 +72,11 @@
 static const Type * llvm_set_type(tree Tr, const Type *Ty) {
 
   // For x86 long double, llvm records the size of the data (80) while
-  // gcc's TYPE_SIZE including alignment padding.  getTypePaddedSizeInBits
+  // gcc's TYPE_SIZE including alignment padding.  getTypeAllocSizeInBits
   // is used to compensate for this.
   assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
          getInt64(TYPE_SIZE(Tr), true) == 
-            getTargetData().getTypePaddedSizeInBits(Ty))
+            getTargetData().getTypeAllocSizeInBits(Ty))
          && "LLVM type size doesn't match GCC type size!");
 
   unsigned &TypeSlot = LTypesMap[Ty];
@@ -1334,7 +1334,7 @@
   /// getTypeSize - Return the size of the specified type in bytes.
   ///
   uint64_t getTypeSize(const Type *Ty) const {
-    return TD.getTypePaddedSize(Ty);
+    return TD.getTypeAllocSize(Ty);
   }
   
   /// getLLVMType - Return the LLVM type for the specified object.
@@ -2284,7 +2284,7 @@
     }
 #endif
     const Type *TheTy = ConvertType(TheGccTy);
-    unsigned Size  = TD.getTypePaddedSize(TheTy);
+    unsigned Size  = TD.getTypeAllocSize(TheTy);
     unsigned Align = TD.getABITypeAlignment(TheTy);
 
     adjustPaddingElement(GccUnionTy, TheGccTy);
@@ -2321,7 +2321,7 @@
   unsigned EltSize = 0;
   if (UnionTy) {            // Not an empty union.
     EltAlign = TD.getABITypeAlignment(UnionTy);
-    EltSize = TD.getTypePaddedSize(UnionTy);
+    EltSize = TD.getTypeAllocSize(UnionTy);
     UnionElts.push_back(UnionTy);
   }
 





More information about the llvm-commits mailing list