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

2007-11-30 Thread Duncan Sands
Hi John,

 Update use of TargetData-getTypeSize() to TargetData-getABITypeSize().
 I believe we want all of the sizes to including ABI padding.

you need to use getABITypeSize for GEP calculations, in particular for advancing
pointers or moving to the next array element (you shouldn't need this for moving
around in structs, because there is a special API for structs that does it all 
for
you).  Also, all memory allocations need to use getABITypeSize, including 
alloca's
and storage for globals.  You probably only want getTypeStoreSize if you are 
doing
alias analysis.

Ciao,

Duncan.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-11-29 Thread John Criswell
Author: criswell
Date: Thu Nov 29 14:37:55 2007
New Revision: 1

URL: http://llvm.org/viewvc/llvm-project?rev=1view=rev
Log:
Update use of TargetData-getTypeSize() to TargetData-getABITypeSize().
I believe we want all of the sizes to including ABI padding.

Modified:
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/Local.cpp
poolalloc/trunk/lib/PoolAllocate/Heuristic.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=1r1=0r2=1view=diff

==
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Thu Nov 29 14:37:55 2007
@@ -398,7 +398,7 @@
   const ArrayType *AT = castArrayType(SS.Ty);
   ++SS.Idx;
   if (SS.Idx != AT-getNumElements()) {
-SS.Offset += unsigned(TD.getTypeSize(AT-getElementType()));
+SS.Offset += unsigned(TD.getABITypeSize(AT-getElementType()));
 return;
   }
   Stack.pop_back();  // At the end of the array
@@ -433,7 +433,7 @@
 assert(SS.Idx  AT-getNumElements());
 Stack.push_back(StackState(AT-getElementType(),
SS.Offset+SS.Idx*
- unsigned(TD.getTypeSize(AT-getElementType();
+ 
unsigned(TD.getABITypeSize(AT-getElementType();
   }
 }
   }
@@ -490,7 +490,7 @@
   (Size == 0  !Ty-isSized()  !isArray()) ||
   (Size == 1  Ty == Type::VoidTy  isArray()) ||
   (Size == 0  !Ty-isSized()  !isArray()) ||
-  (TD.getTypeSize(Ty) == Size)) 
+  (TD.getABITypeSize(Ty) == Size)) 
  Size member of DSNode doesn't match the type structure!);
   assert(NewTy != Type::VoidTy  Cannot merge void type into DSNode!);
 
@@ -513,7 +513,7 @@
   }
 
   // Figure out how big the new type we're merging in is...
-  unsigned NewTySize = NewTy-isSized() ? (unsigned)TD.getTypeSize(NewTy) : 0;
+  unsigned NewTySize = NewTy-isSized() ? (unsigned)TD.getABITypeSize(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
@@ -653,7 +653,7 @@
   unsigned O = 0;
   const Type *SubType = Ty;
   while (O  Offset) {
-assert(Offset-O  TD.getTypeSize(SubType)  Offset out of range!);
+assert(Offset-O  TD.getABITypeSize(SubType)  Offset out of range!);
 
 switch (SubType-getTypeID()) {
 case Type::StructTyID: {
@@ -668,7 +668,7 @@
 }
 case Type::ArrayTyID: {
   SubType = castArrayType(SubType)-getElementType();
-  unsigned ElSize = (unsigned)TD.getTypeSize(SubType);
+  unsigned ElSize = (unsigned)TD.getABITypeSize(SubType);
   unsigned Remainder = (Offset-O) % ElSize;
   O = Offset-Remainder;
   break;
@@ -690,7 +690,7 @@
   isaFunctionType(NewTy)) return false;
 
   unsigned SubTypeSize = SubType-isSized() ?
-   (unsigned)TD.getTypeSize(SubType) : 0;
+   (unsigned)TD.getABITypeSize(SubType) : 0;
 
   // Ok, we are getting desperate now.  Check for physical subtyping, where we
   // just require each element in the node to be compatible.
@@ -718,12 +718,12 @@
   else
 NextPadSize = SubTypeSize;
   NextSubType = STy-getElementType(0);
-  NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType);
+  NextSubTypeSize = (unsigned)TD.getABITypeSize(NextSubType);
   break;
 }
 case Type::ArrayTyID:
   NextSubType = castArrayType(SubType)-getElementType();
-  NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType);
+  NextSubTypeSize = (unsigned)TD.getABITypeSize(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=1r1=0r2=1view=diff

==
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Thu Nov 29 14:37:55 2007
@@ -459,7 +459,7 @@
   if (ConstantInt *CS = dyn_castConstantInt(GEP.getOperand(i))) {
 Offset += 
   (CS-getType()-isSigned() ? CS-getSExtValue() : CS-getZExtValue())
-  * TD.getTypeSize(CurTy);
+  * TD.getABITypeSize(CurTy);
   } else {
 // Variable index into a node.  We must merge all of the elements of 
the
 // sequential type here.
@@ -467,7 +467,7 @@
   cerr  Pointer indexing not handled yet!\n;
 else {
   const ArrayType *ATy = castArrayType(STy);
-  unsigned ElSize = TD.getTypeSize(CurTy);
+