Author: criswell Date: Thu Nov 29 14:37:55 2007 New Revision: 44441 URL: http://llvm.org/viewvc/llvm-project?rev=44441&view=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=44441&r1=44440&r2=44441&view=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 = cast<ArrayType>(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 = cast<ArrayType>(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 @@ isa<FunctionType>(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 = cast<ArrayType>(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=44441&r1=44440&r2=44441&view=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_cast<ConstantInt>(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 = cast<ArrayType>(STy); - unsigned ElSize = TD.getTypeSize(CurTy); + unsigned ElSize = TD.getABITypeSize(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=44441&r1=44440&r2=44441&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Thu Nov 29 14:37:55 2007 @@ -57,7 +57,7 @@ unsigned Heuristic::getRecommendedSize(const DSNode *N) { unsigned PoolSize = 0; if (!N->isArray() && N->getType()->isSized()) { - PoolSize = N->getParentGraph()->getTargetData().getTypeSize(N->getType()); + PoolSize = N->getParentGraph()->getTargetData().getABITypeSize(N->getType()); } if (PoolSize == 1) PoolSize = 0; return PoolSize; Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=44441&r1=44440&r2=44441&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Thu Nov 29 14:37:55 2007 @@ -226,7 +226,7 @@ NewTy = ComputeCompressedType(Pool->getType(), 0, Nodes); // Get the compressed type size. - NewSize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0; + NewSize = NewTy->isSized() ? TD.getABITypeSize(NewTy) : 0; } @@ -318,9 +318,9 @@ const TargetData &TD = getNode()->getParentGraph()->getTargetData(); std::cerr << " From size: " << (getNode()->getType()->isSized() ? - TD.getTypeSize(getNode()->getType()) : 0) + TD.getABITypeSize(getNode()->getType()) : 0) << " To size: " - << (NewTy->isSized() ? TD.getTypeSize(NewTy) : 0) << "\n"; + << (NewTy->isSized() ? TD.getABITypeSize(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.getTypeSize(ElTy)); + TD.getABITypeSize(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=44441&r1=44440&r2=44441&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Thu Nov 29 14:37:55 2007 @@ -198,7 +198,7 @@ TargetData &TD = PAInfo.getAnalysis<TargetData>(); Value *AllocSize = - ConstantInt::get(Type::Int32Ty, TD.getTypeSize(MI.getAllocatedType())); + ConstantInt::get(Type::Int32Ty, TD.getABITypeSize(MI.getAllocatedType())); if (MI.isArrayAllocation()) AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, @@ -240,7 +240,7 @@ if (PH == 0 || isa<ConstantPointerNull>(PH)) return; TargetData &TD = PAInfo.getAnalysis<TargetData>(); Value *AllocSize = - ConstantInt::get(Type::Int32Ty, TD.getTypeSize(MI.getAllocatedType())); + ConstantInt::get(Type::Int32Ty, TD.getABITypeSize(MI.getAllocatedType())); if (MI.isArrayAllocation()) AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, @@ -296,7 +296,7 @@ void FuncTransform::visitCallocCall(CallSite CS) { TargetData& TD = PAInfo.getAnalysis<TargetData>(); - bool useLong = TD.getTypeSize(PointerType::get(Type::Int8Ty)) != 4; + bool useLong = TD.getABITypeSize(PointerType::get(Type::Int8Ty)) != 4; Module *M = CS.getInstruction()->getParent()->getParent()->getParent(); assert(CS.arg_end()-CS.arg_begin() == 2 && "calloc takes two arguments!"); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits