[llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 29 15:49:04 PST 2002
Changes in directory llvm/lib/Target:
TargetMachine.cpp updated: 1.15 -> 1.16
---
Log message:
Implement findOptimalStorageSize a bit more generally
---
Diffs of the changes:
Index: llvm/lib/Target/TargetMachine.cpp
diff -u llvm/lib/Target/TargetMachine.cpp:1.15 llvm/lib/Target/TargetMachine.cpp:1.16
--- llvm/lib/Target/TargetMachine.cpp:1.15 Mon Oct 28 17:55:33 2002
+++ llvm/lib/Target/TargetMachine.cpp Tue Oct 29 15:47:50 2002
@@ -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);
}
More information about the llvm-commits
mailing list