[llvm-commits] [poolalloc] r62234 - in /poolalloc/trunk/lib: DSA/DataStructure.cpp DSA/Local.cpp PoolAllocate/Heuristic.cpp PoolAllocate/PASimple.cpp PoolAllocate/PointerCompress.cpp PoolAllocate/TransformFunctionBody.cpp

John Criswell criswell at uiuc.edu
Wed Jan 14 09:29:16 PST 2009


Author: criswell
Date: Wed Jan 14 11:29:15 2009
New Revision: 62234

URL: http://llvm.org/viewvc/llvm-project?rev=62234&view=rev
Log:
Updated to new LLVM API.
This API replaced getABITypeSize() with getTypePaddedSize().

Modified:
    poolalloc/trunk/lib/DSA/DataStructure.cpp
    poolalloc/trunk/lib/DSA/Local.cpp
    poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
    poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
    poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Wed Jan 14 11:29:15 2009
@@ -399,7 +399,7 @@
           const ArrayType *AT = cast<ArrayType>(SS.Ty);
           ++SS.Idx;
           if (SS.Idx != AT->getNumElements()) {
-            SS.Offset += unsigned(TD.getABITypeSize(AT->getElementType()));
+            SS.Offset += unsigned(TD.getTypePaddedSize(AT->getElementType()));
             return;
           }
           Stack.pop_back();  // At the end of the array
@@ -434,7 +434,7 @@
             assert(SS.Idx < AT->getNumElements());
             Stack.push_back(StackState(AT->getElementType(),
                                        SS.Offset+SS.Idx*
-                             unsigned(TD.getABITypeSize(AT->getElementType()))));
+                             unsigned(TD.getTypePaddedSize(AT->getElementType()))));
           }
         }
       }
@@ -491,7 +491,7 @@
           (Size == 0 && !Ty->isSized() && !isArray()) ||
           (Size == 1 && Ty == Type::VoidTy && isArray()) ||
           (Size == 0 && !Ty->isSized() && !isArray()) ||
-          (TD.getABITypeSize(Ty) == Size)) &&
+          (TD.getTypePaddedSize(Ty) == Size)) &&
          "Size member of DSNode doesn't match the type structure!");
   assert(NewTy != Type::VoidTy && "Cannot merge void type into DSNode!");
 
@@ -514,7 +514,7 @@
   }
 
   // Figure out how big the new type we're merging in is...
-  unsigned NewTySize = NewTy->isSized() ? (unsigned)TD.getABITypeSize(NewTy) : 0;
+  unsigned NewTySize = NewTy->isSized() ? (unsigned)TD.getTypePaddedSize(NewTy) : 0;
 
   // Otherwise check to see if we can fold this type into the current node.  If
   // we can't, we fold the node completely, if we can, we potentially update our
@@ -654,7 +654,7 @@
   unsigned O = 0;
   const Type *SubType = Ty;
   while (O < Offset) {
-    assert(Offset-O < TD.getABITypeSize(SubType) && "Offset out of range!");
+    assert(Offset-O < TD.getTypePaddedSize(SubType) && "Offset out of range!");
 
     switch (SubType->getTypeID()) {
     case Type::StructTyID: {
@@ -669,7 +669,7 @@
     }
     case Type::ArrayTyID: {
       SubType = cast<ArrayType>(SubType)->getElementType();
-      unsigned ElSize = (unsigned)TD.getABITypeSize(SubType);
+      unsigned ElSize = (unsigned)TD.getTypePaddedSize(SubType);
       unsigned Remainder = (Offset-O) % ElSize;
       O = Offset-Remainder;
       break;
@@ -691,7 +691,7 @@
       isa<FunctionType>(NewTy)) return false;
 
   unsigned SubTypeSize = SubType->isSized() ?
-       (unsigned)TD.getABITypeSize(SubType) : 0;
+       (unsigned)TD.getTypePaddedSize(SubType) : 0;
 
   // Ok, we are getting desperate now.  Check for physical subtyping, where we
   // just require each element in the node to be compatible.
@@ -719,12 +719,12 @@
       else
         NextPadSize = SubTypeSize;
       NextSubType = STy->getElementType(0);
-      NextSubTypeSize = (unsigned)TD.getABITypeSize(NextSubType);
+      NextSubTypeSize = (unsigned)TD.getTypePaddedSize(NextSubType);
       break;
     }
     case Type::ArrayTyID:
       NextSubType = cast<ArrayType>(SubType)->getElementType();
-      NextSubTypeSize = (unsigned)TD.getABITypeSize(NextSubType);
+      NextSubTypeSize = (unsigned)TD.getTypePaddedSize(NextSubType);
       NextPadSize = NextSubTypeSize;
       break;
     default: ;

Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Wed Jan 14 11:29:15 2009
@@ -447,7 +447,7 @@
       if (ConstantInt *CS = dyn_cast<ConstantInt>(GEP.getOperand(i))) {
         Offset += 
           (CS->getType()->isSigned() ? CS->getSExtValue() : CS->getZExtValue())
-          * TD.getABITypeSize(CurTy);
+          * TD.getTypePaddedSize(CurTy);
       } else {
         // Variable index into a node.  We must merge all of the elements of the
         // sequential type here.
@@ -455,7 +455,7 @@
           cerr << "Pointer indexing not handled yet!\n";
         else {
           const ArrayType *ATy = cast<ArrayType>(STy);
-          unsigned ElSize = TD.getABITypeSize(CurTy);
+          unsigned ElSize = TD.getTypePaddedSize(CurTy);
           DSNode *N = Value.getNode();
           assert(N && "Value must have a node!");
           unsigned RawOffset = Offset+Value.getOffset();

Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Wed Jan 14 11:29:15 2009
@@ -57,7 +57,7 @@
 unsigned Heuristic::getRecommendedSize(const DSNode *N) {
   unsigned PoolSize = 0;
   if (!N->isArray() && N->getType()->isSized()) {
-    PoolSize = N->getParentGraph()->getTargetData().getABITypeSize(N->getType());
+    PoolSize = N->getParentGraph()->getTargetData().getTypePaddedSize(N->getType());
   }
   if (PoolSize == 1) PoolSize = 0;
   return PoolSize;

Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Wed Jan 14 11:29:15 2009
@@ -178,7 +178,7 @@
         if (MI->isArrayAllocation()) {
           Value * NumElements = MI->getArraySize();
           Value * ElementSize = ConstantInt::get (Type::Int32Ty,
-                                                  TD.getABITypeSize(MI->getAllocatedType()));
+                                                  TD.getTypePaddedSize(MI->getAllocatedType()));
           AllocSize = BinaryOperator::Create (Instruction::Mul,
                                               ElementSize,
                                               NumElements,
@@ -186,7 +186,7 @@
                                               MI);
         } else {
           AllocSize = ConstantInt::get (Type::Int32Ty,
-                                        TD.getABITypeSize(MI->getAllocatedType()));
+                                        TD.getTypePaddedSize(MI->getAllocatedType()));
         }
 
         Value* args[] = {TheGlobalPool, AllocSize};

Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Wed Jan 14 11:29:15 2009
@@ -226,7 +226,7 @@
   NewTy = ComputeCompressedType(Pool->getType(), 0, Nodes);
 
   // Get the compressed type size.
-  NewSize = NewTy->isSized() ? TD.getABITypeSize(NewTy) : 0;
+  NewSize = NewTy->isSized() ? TD.getTypePaddedSize(NewTy) : 0;
 }
 
 
@@ -318,9 +318,9 @@
   const TargetData &TD = getNode()->getParentGraph()->getTargetData();
   std::cerr << "  From size: "
             << (getNode()->getType()->isSized() ? 
-                        TD.getABITypeSize(getNode()->getType()) : 0)
+                        TD.getTypePaddedSize(getNode()->getType()) : 0)
             << "  To size: "
-            << (NewTy->isSized() ? TD.getABITypeSize(NewTy) : 0) << "\n";
+            << (NewTy->isSized() ? TD.getTypePaddedSize(NewTy) : 0) << "\n";
   std::cerr << "Node: "; getNode()->dump();
   std::cerr << "New Type: " << *NewTy << "\n";
 }
@@ -733,7 +733,7 @@
           Idx = CastInst::CreateSExtOrBitCast(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI);
 
         Constant *Scale = ConstantInt::get(SCALARUINTTYPE,
-                                            TD.getABITypeSize(ElTy));
+                                            TD.getTypePaddedSize(ElTy));
         Idx = BinaryOperator::CreateMul(Idx, Scale, "fieldidx", &GEPI);
         Val = BinaryOperator::CreateAdd(Val, Idx, GEPI.getName(), &GEPI);
       }

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=62234&r1=62233&r2=62234&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Wed Jan 14 11:29:15 2009
@@ -216,7 +216,7 @@
 
   TargetData &TD = PAInfo.getAnalysis<TargetData>();
   Value *AllocSize =
-    ConstantInt::get(Type::Int32Ty, TD.getABITypeSize(MI.getAllocatedType()));
+    ConstantInt::get(Type::Int32Ty, TD.getTypePaddedSize(MI.getAllocatedType()));
 
   if (MI.isArrayAllocation())
     AllocSize = BinaryOperator::Create(Instruction::Mul, AllocSize,
@@ -274,7 +274,7 @@
     if (PH == 0 || isa<ConstantPointerNull>(PH)) return;
     TargetData &TD = PAInfo.getAnalysis<TargetData>();
     Value *AllocSize =
-      ConstantInt::get(Type::Int32Ty, TD.getABITypeSize(MI.getAllocatedType()));
+      ConstantInt::get(Type::Int32Ty, TD.getTypePaddedSize(MI.getAllocatedType()));
     
     if (MI.isArrayAllocation())
       AllocSize = BinaryOperator::Create(Instruction::Mul, AllocSize,
@@ -335,7 +335,7 @@
 
 void FuncTransform::visitCallocCall(CallSite CS) {
   TargetData& TD = PAInfo.getAnalysis<TargetData>();
-  bool useLong = TD.getABITypeSize(PointerType::getUnqual(Type::Int8Ty)) != 4;
+  bool useLong = TD.getTypePaddedSize(PointerType::getUnqual(Type::Int8Ty)) != 4;
   
   Module *M = CS.getInstruction()->getParent()->getParent()->getParent();
   assert(CS.arg_end()-CS.arg_begin() == 2 && "calloc takes two arguments!");





More information about the llvm-commits mailing list