Implement findOptimalStorageSize a bit more generally

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-10-29 21:47:50 +00:00
parent 6334205cb5
commit 62eaf7ef60

View File

@ -25,21 +25,13 @@
// space equal to optSizeForSubWordData, and all other primitive data
// items use space according to the type.
//
unsigned int
TargetMachine::findOptimalStorageSize(const Type* ty) const
{
switch(ty->getPrimitiveID())
{
case Type::BoolTyID:
case Type::UByteTyID:
case Type::SByteTyID:
case Type::UShortTyID:
case Type::ShortTyID:
return optSizeForSubWordData;
unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
// Round integral values smaller than SubWordDataSize up to SubWordDataSize
if (Ty->isIntegral() &&
Ty->getPrimitiveSize() < DataLayout.getSubWordDataSize())
return DataLayout.getSubWordDataSize();
default:
return DataLayout.getTypeSize(ty);
}
return DataLayout.getTypeSize(Ty);
}