aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-05-09 07:08:47 +0000
committerDuncan Sands <baldrick@free.fr>2009-05-09 07:08:47 +0000
commit9408c45009b417e758749b3d95cdfb87dcb68ea9 (patch)
treeeb079d5e63f79f1b2c05b950360ba014640eae2a
parent11888a251b682775aad8cd178c7f0620ea062419 (diff)
Correct for renaming PaddedSize -> AllocSize in
LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71350 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGCall.cpp8
-rw-r--r--lib/CodeGen/CGExprConstant.cpp12
-rw-r--r--lib/CodeGen/CGObjCMac.cpp40
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp6
4 files changed, 33 insertions, 33 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 265bb7893b..2223f65acf 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1569,8 +1569,8 @@ static llvm::Value *CreateCoercedLoad(llvm::Value *SrcPtr,
CodeGenFunction &CGF) {
const llvm::Type *SrcTy =
cast<llvm::PointerType>(SrcPtr->getType())->getElementType();
- uint64_t SrcSize = CGF.CGM.getTargetData().getTypePaddedSize(SrcTy);
- uint64_t DstSize = CGF.CGM.getTargetData().getTypePaddedSize(Ty);
+ uint64_t SrcSize = CGF.CGM.getTargetData().getTypeAllocSize(SrcTy);
+ uint64_t DstSize = CGF.CGM.getTargetData().getTypeAllocSize(Ty);
// If load is legal, just bitcast the src pointer.
if (SrcSize == DstSize) {
@@ -1608,8 +1608,8 @@ static void CreateCoercedStore(llvm::Value *Src,
const llvm::Type *DstTy =
cast<llvm::PointerType>(DstPtr->getType())->getElementType();
- uint64_t SrcSize = CGF.CGM.getTargetData().getTypePaddedSize(SrcTy);
- uint64_t DstSize = CGF.CGM.getTargetData().getTypePaddedSize(DstTy);
+ uint64_t SrcSize = CGF.CGM.getTargetData().getTypeAllocSize(SrcTy);
+ uint64_t DstSize = CGF.CGM.getTargetData().getTypeAllocSize(DstTy);
// If store is legal, just bitcast the src pointer.
if (SrcSize == DstSize) {
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 1639ac0939..36a9eabcb9 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -136,7 +136,7 @@ public:
// Calculate information about the relevant field
const llvm::Type* Ty = CI->getType();
const llvm::TargetData &TD = CGM.getTypes().getTargetData();
- unsigned size = TD.getTypePaddedSizeInBits(Ty);
+ unsigned size = TD.getTypeAllocSizeInBits(Ty);
unsigned fieldOffset = CGM.getTypes().getLLVMFieldNo(Field) * size;
CodeGenTypes::BitFieldInfo bitFieldInfo =
CGM.getTypes().getBitFieldInfo(Field);
@@ -147,11 +147,11 @@ public:
// FIXME: This won't work if the struct isn't completely packed!
unsigned offset = 0, i = 0;
while (offset < (fieldOffset & -8))
- offset += TD.getTypePaddedSizeInBits(Elts[i++]->getType());
+ offset += TD.getTypeAllocSizeInBits(Elts[i++]->getType());
// Advance over 0 sized elements (must terminate in bounds since
// the bitfield must have a size).
- while (TD.getTypePaddedSizeInBits(Elts[i]->getType()) == 0)
+ while (TD.getTypeAllocSizeInBits(Elts[i]->getType()) == 0)
++i;
// Promote the size of V if necessary
@@ -241,8 +241,8 @@ public:
std::vector<const llvm::Type*> Types;
Elts.push_back(C);
Types.push_back(C->getType());
- unsigned CurSize = CGM.getTargetData().getTypePaddedSize(C->getType());
- unsigned TotalSize = CGM.getTargetData().getTypePaddedSize(Ty);
+ unsigned CurSize = CGM.getTargetData().getTypeAllocSize(C->getType());
+ unsigned TotalSize = CGM.getTargetData().getTypeAllocSize(Ty);
while (CurSize < TotalSize) {
Elts.push_back(llvm::Constant::getNullValue(llvm::Type::Int8Ty));
Types.push_back(llvm::Type::Int8Ty);
@@ -275,7 +275,7 @@ public:
if (curField->isBitField()) {
// Create a dummy struct for bit-field insertion
- unsigned NumElts = CGM.getTargetData().getTypePaddedSize(Ty);
+ unsigned NumElts = CGM.getTargetData().getTypeAllocSize(Ty);
llvm::Constant* NV = llvm::Constant::getNullValue(llvm::Type::Int8Ty);
std::vector<llvm::Constant*> Elts(NumElts, NV);
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 8043f7652b..0088a3e22e 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1601,7 +1601,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD,
const ConstantVector &OptInstanceMethods,
const ConstantVector &OptClassMethods) {
uint64_t Size =
- CGM.getTargetData().getTypePaddedSize(ObjCTypes.ProtocolExtensionTy);
+ CGM.getTargetData().getTypeAllocSize(ObjCTypes.ProtocolExtensionTy);
std::vector<llvm::Constant*> Values(4);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[1] =
@@ -1702,7 +1702,7 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name,
return llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy);
unsigned PropertySize =
- CGM.getTargetData().getTypePaddedSize(ObjCTypes.PropertyTy);
+ CGM.getTargetData().getTypeAllocSize(ObjCTypes.PropertyTy);
std::vector<llvm::Constant*> Values(3);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize);
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size());
@@ -1767,7 +1767,7 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &Name,
};
*/
void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(ObjCTypes.CategoryTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.CategoryTy);
// FIXME: This is poor design, the OCD should have a pointer to the
// category decl. Additionally, note that Category can be null for
@@ -1956,7 +1956,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
llvm::Constant *Protocols,
const ConstantVector &Methods) {
unsigned Flags = eClassFlags_Meta;
- unsigned Size = CGM.getTargetData().getTypePaddedSize(ObjCTypes.ClassTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassTy);
if (CGM.getDeclVisibilityMode(ID->getClassInterface()) == LangOptions::Hidden)
Flags |= eClassFlags_Hidden;
@@ -2058,7 +2058,7 @@ llvm::Constant *CGObjCMac::EmitMetaClassRef(const ObjCInterfaceDecl *ID) {
llvm::Constant *
CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) {
uint64_t Size =
- CGM.getTargetData().getTypePaddedSize(ObjCTypes.ClassExtensionTy);
+ CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassExtensionTy);
std::vector<llvm::Constant*> Values(3);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
@@ -2602,7 +2602,7 @@ void CGObjCMac::EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4) ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongLongTy);
@@ -2623,7 +2623,7 @@ void CGObjCMac::EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4) ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongLongTy);
@@ -2644,7 +2644,7 @@ void CGObjCMac::EmitObjCIvarAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4) ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongLongTy);
@@ -2665,7 +2665,7 @@ void CGObjCMac::EmitObjCStrongCastAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4) ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongLongTy);
@@ -2767,7 +2767,7 @@ void CGObjCMac::EmitImageInfo() {
static const int ModuleVersion = 7;
void CGObjCMac::EmitModuleInfo() {
- uint64_t Size = CGM.getTargetData().getTypePaddedSize(ObjCTypes.ModuleTy);
+ uint64_t Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.ModuleTy);
std::vector<llvm::Constant*> Values(4);
Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, ModuleVersion);
@@ -3110,7 +3110,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
// Build the string of skip/scan nibbles
llvm::SmallVector<SKIP_SCAN, 32> SkipScanIvars;
unsigned int WordSize =
- CGM.getTypes().getTargetData().getTypePaddedSize(PtrTy);
+ CGM.getTypes().getTargetData().getTypeAllocSize(PtrTy);
if (IvarsInfo[0].ivar_bytepos == 0) {
WordsToSkip = 0;
WordsToScan = IvarsInfo[0].ivar_size;
@@ -4242,7 +4242,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) {
"CGObjCNonFragileABIMac::GenerateClass - class is 0");
// FIXME: Is this correct (that meta class size is never computed)?
uint32_t InstanceStart =
- CGM.getTargetData().getTypePaddedSize(ObjCTypes.ClassnfABITy);
+ CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassnfABITy);
uint32_t InstanceSize = InstanceStart;
uint32_t flags = CLS_META;
std::string ObjCMetaClassName(getMetaclassSymbolPrefix());
@@ -4473,7 +4473,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(
std::vector<llvm::Constant*> Values(3);
// sizeof(struct _objc_method)
- unsigned Size = CGM.getTargetData().getTypePaddedSize(ObjCTypes.MethodTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.MethodTy);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
// method_count
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
@@ -4599,7 +4599,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
Ivar[2] = GetMethodVarType(IVD);
const llvm::Type *FieldTy =
CGM.getTypes().ConvertTypeForMem(IVD->getType());
- unsigned Size = CGM.getTargetData().getTypePaddedSize(FieldTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(FieldTy);
unsigned Align = CGM.getContext().getPreferredTypeAlign(
IVD->getType().getTypePtr()) >> 3;
Align = llvm::Log2_32(Align);
@@ -4616,7 +4616,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
if (Ivars.empty())
return llvm::Constant::getNullValue(ObjCTypes.IvarListnfABIPtrTy);
std::vector<llvm::Constant*> Values(3);
- unsigned Size = CGM.getTargetData().getTypePaddedSize(ObjCTypes.IvarnfABITy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.IvarnfABITy);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
@@ -4744,7 +4744,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
Values[7] = EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + PD->getNameAsString(),
0, PD, ObjCTypes);
uint32_t Size =
- CGM.getTargetData().getTypePaddedSize(ObjCTypes.ProtocolnfABITy);
+ CGM.getTargetData().getTypeAllocSize(ObjCTypes.ProtocolnfABITy);
Values[8] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[9] = llvm::Constant::getNullValue(ObjCTypes.IntTy);
llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolnfABITy,
@@ -5181,7 +5181,7 @@ void CGObjCNonFragileABIMac::EmitObjCIvarAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4 ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongTy));
@@ -5203,7 +5203,7 @@ void CGObjCNonFragileABIMac::EmitObjCStrongCastAssign(
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4 ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongTy));
@@ -5240,7 +5240,7 @@ void CGObjCNonFragileABIMac::EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4 ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongTy));
@@ -5261,7 +5261,7 @@ void CGObjCNonFragileABIMac::EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF,
{
const llvm::Type * SrcTy = src->getType();
if (!isa<llvm::PointerType>(SrcTy)) {
- unsigned Size = CGM.getTargetData().getTypePaddedSize(SrcTy);
+ unsigned Size = CGM.getTargetData().getTypeAllocSize(SrcTy);
assert(Size <= 8 && "does not support size > 8");
src = (Size == 4 ? CGF.Builder.CreateBitCast(src, ObjCTypes.IntTy)
: CGF.Builder.CreateBitCast(src, ObjCTypes.LongTy));
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index a3f79d3d59..a9d4615d2a 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -530,7 +530,7 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) {
Field != FieldEnd; ++Field) {
uint64_t offset = RL.getFieldOffset(curField);
const llvm::Type *Ty = CGT.ConvertTypeForMemRecursive(Field->getType());
- uint64_t size = CGT.getTargetData().getTypePaddedSizeInBits(Ty);
+ uint64_t size = CGT.getTargetData().getTypeAllocSizeInBits(Ty);
if (Field->isBitField()) {
uint64_t BitFieldSize =
@@ -563,7 +563,7 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) {
}
STy = llvm::StructType::get(LLVMFields, true);
- assert(CGT.getTargetData().getTypePaddedSizeInBits(STy) == RL.getSize());
+ assert(CGT.getTargetData().getTypeAllocSizeInBits(STy) == RL.getSize());
}
/// layoutUnionFields - Do the actual work and lay out all fields. Create
@@ -603,5 +603,5 @@ void RecordOrganizer::layoutUnionFields(const ASTRecordLayout &RL) {
LLVMFields.push_back(llvm::ArrayType::get(llvm::Type::Int8Ty,
RL.getSize() / 8));
STy = llvm::StructType::get(LLVMFields, true);
- assert(CGT.getTargetData().getTypePaddedSizeInBits(STy) == RL.getSize());
+ assert(CGT.getTargetData().getTypeAllocSizeInBits(STy) == RL.getSize());
}