Implement findOptimalStorageSize a bit more generally

llvm-svn: 4416
This commit is contained in:
Chris Lattner 2002-10-29 21:47:50 +00:00
parent eec571dce8
commit 94fb0d4b03

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;
default:
return DataLayout.getTypeSize(ty);
}
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();
return DataLayout.getTypeSize(Ty);
}