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