diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-08 16:25:52 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-08 16:25:52 +0000 |
commit | 25a6a84cf5067b32c271e3ba078676dee838798d (patch) | |
tree | 31a8d7b32cbc5d57322ecf8ca19951029fdb4172 /lib/CodeGen/CGRecordLayoutBuilder.cpp | |
parent | d3420c906e3605d94c084e8b8b1f3fa490093c86 (diff) |
Move TargetData to DataLayout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRecordLayoutBuilder.cpp')
-rw-r--r-- | lib/CodeGen/CGRecordLayoutBuilder.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index d642ef8533..2f33ba93c2 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -25,7 +25,7 @@ #include "llvm/Type.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Target/TargetData.h" +#include "llvm/DataLayout.h" using namespace clang; using namespace CodeGen; @@ -239,7 +239,7 @@ CGBitFieldInfo CGBitFieldInfo::MakeInfo(CodeGenTypes &Types, llvm::Type *Ty = Types.ConvertTypeForMem(FD->getType()); CharUnits TypeSizeInBytes = - CharUnits::fromQuantity(Types.getTargetData().getTypeAllocSize(Ty)); + CharUnits::fromQuantity(Types.getDataLayout().getTypeAllocSize(Ty)); uint64_t TypeSizeInBits = Types.getContext().toBits(TypeSizeInBytes); bool IsSigned = FD->getType()->isSignedIntegerOrEnumerationType(); @@ -259,7 +259,7 @@ CGBitFieldInfo CGBitFieldInfo::MakeInfo(CodeGenTypes &Types, // in big-endian machines the first fields are in higher bit positions, // so revert the offset. The byte offsets are reversed(back) later. - if (Types.getTargetData().isBigEndian()) { + if (Types.getDataLayout().isBigEndian()) { FieldOffset = ((ContainingTypeSizeInBits)-FieldOffset-FieldSize); } @@ -334,7 +334,7 @@ CGBitFieldInfo CGBitFieldInfo::MakeInfo(CodeGenTypes &Types, // on big-endian machines we reverted the bit offset because first fields are // in higher bits. But this also reverts the bytes, so fix this here by reverting // the byte offset on big-endian machines. - if (Types.getTargetData().isBigEndian()) { + if (Types.getDataLayout().isBigEndian()) { AI.FieldByteOffset = Types.getContext().toCharUnitsFromBits( ContainingTypeSizeInBits - AccessStart - AccessWidth); } else { @@ -553,9 +553,9 @@ void CGRecordLayoutBuilder::LayoutUnion(const RecordDecl *D) { hasOnlyZeroSizedBitFields = false; CharUnits fieldAlign = CharUnits::fromQuantity( - Types.getTargetData().getABITypeAlignment(fieldType)); + Types.getDataLayout().getABITypeAlignment(fieldType)); CharUnits fieldSize = CharUnits::fromQuantity( - Types.getTargetData().getTypeAllocSize(fieldType)); + Types.getDataLayout().getTypeAllocSize(fieldType)); if (fieldAlign < unionAlign) continue; @@ -884,7 +884,7 @@ void CGRecordLayoutBuilder::AppendTailPadding(CharUnits RecordSize) { void CGRecordLayoutBuilder::AppendField(CharUnits fieldOffset, llvm::Type *fieldType) { CharUnits fieldSize = - CharUnits::fromQuantity(Types.getTargetData().getTypeAllocSize(fieldType)); + CharUnits::fromQuantity(Types.getDataLayout().getTypeAllocSize(fieldType)); FieldTypes.push_back(fieldType); @@ -957,7 +957,7 @@ CharUnits CGRecordLayoutBuilder::getTypeAlignment(llvm::Type *Ty) const { if (Packed) return CharUnits::One(); - return CharUnits::fromQuantity(Types.getTargetData().getABITypeAlignment(Ty)); + return CharUnits::fromQuantity(Types.getDataLayout().getABITypeAlignment(Ty)); } CharUnits CGRecordLayoutBuilder::getAlignmentAsLLVMStruct() const { @@ -1036,7 +1036,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, const ASTRecordLayout &Layout = getContext().getASTRecordLayout(D); uint64_t TypeSizeInBits = getContext().toBits(Layout.getSize()); - assert(TypeSizeInBits == getTargetData().getTypeAllocSizeInBits(Ty) && + assert(TypeSizeInBits == getDataLayout().getTypeAllocSizeInBits(Ty) && "Type size mismatch!"); if (BaseTy) { @@ -1049,14 +1049,14 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, getContext().toBits(AlignedNonVirtualTypeSize); assert(AlignedNonVirtualTypeSizeInBits == - getTargetData().getTypeAllocSizeInBits(BaseTy) && + getDataLayout().getTypeAllocSizeInBits(BaseTy) && "Type size mismatch!"); } // Verify that the LLVM and AST field offsets agree. llvm::StructType *ST = dyn_cast<llvm::StructType>(RL->getLLVMType()); - const llvm::StructLayout *SL = getTargetData().getStructLayout(ST); + const llvm::StructLayout *SL = getDataLayout().getStructLayout(ST); const ASTRecordLayout &AST_RL = getContext().getASTRecordLayout(D); RecordDecl::field_iterator it = D->field_begin(); |