[llvm-commits] [llvm-gcc-4.0] r43622 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-types.cpp

Duncan Sands baldrick at free.fr
Thu Nov 1 13:57:39 PDT 2007


Author: baldrick
Date: Thu Nov  1 15:57:38 2007
New Revision: 43622

URL: http://llvm.org/viewvc/llvm-project?rev=43622&view=rev
Log:
Change most uses of getTypeSize to getTypeStoreSize or
getABITypeSize, hopefully correctly.

Modified:
    llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43622&r1=43621&r2=43622&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Nov  1 15:57:38 2007
@@ -3364,7 +3364,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.getTypeSize(ElTy);
+      int64_t EltSize = TD.getABITypeSize(ElTy);
       
       // If EltSize exactly divides Offset, then we know that we can turn this
       // into a getelementptr instruction.
@@ -6152,7 +6152,7 @@
 static Constant *ConvertStructFieldInitializerToType(Constant *Val, 
                                                      const Type *FieldTy) {
   const TargetData &TD = getTargetData();
-  assert(TD.getTypeSize(FieldTy) == TD.getTypeSize(Val->getType()) &&
+  assert(TD.getABITypeSize(FieldTy) == TD.getABITypeSize(Val->getType()) &&
          "Mismatched initializer type isn't same size as initializer!");
 
   // If this is an integer initializer for an array of ubytes, we are
@@ -6271,7 +6271,7 @@
   tree UnionType = TREE_TYPE(exp);
   if (TYPE_SIZE(UnionType) && TREE_CODE(TYPE_SIZE(UnionType)) == INTEGER_CST) {
     unsigned UnionSize = ((unsigned)TREE_INT_CST_LOW(TYPE_SIZE(UnionType))+7)/8;
-    unsigned InitSize = getTargetData().getTypeSize(Elts[0]->getType());
+    unsigned InitSize = getTargetData().getABITypeSize(Elts[0]->getType());
     if (UnionSize != InitSize) {
       const Type *FillTy;
       assert(UnionSize > InitSize && "Init shouldn't be larger than union!");

Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=43622&r1=43621&r2=43622&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Thu Nov  1 15:57:38 2007
@@ -1149,7 +1149,7 @@
   /// getTypeSize - Return the size of the specified type in bytes.
   ///
   unsigned getTypeSize(const Type *Ty) const {
-    return TD.getTypeSize(Ty);
+    return Packed ? TD.getTypeStoreSize(Ty) : TD.getABITypeSize(Ty);
   }
   
   /// getLLVMType - Return the LLVM type for the specified object.
@@ -1849,7 +1849,7 @@
     
     const Type *TheTy = ConvertType(TREE_TYPE(Field));
     bool isPacked = false;
-    unsigned Size     = TD.getTypeSize(TheTy);
+    unsigned Size  = TD.getABITypeSize(TheTy);
     unsigned Align = TD.getABITypeAlignment(TheTy);
     if (const StructType *STy = dyn_cast<StructType>(TheTy)) 
       if (STy->isPacked())
@@ -1882,7 +1882,7 @@
   std::vector<const Type*> UnionElts;
   unsigned UnionSize = 0;
   if (UnionTy) {            // Not an empty union.
-    UnionSize = TD.getTypeSize(UnionTy);
+    UnionSize = TD.getABITypeSize(UnionTy);
     UnionElts.push_back(UnionTy);
   }
   





More information about the llvm-commits mailing list