[cfe-commits] r130113 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Ken Dyck
kd at kendyck.com
Sun Apr 24 10:37:26 PDT 2011
Author: kjdyck
Date: Sun Apr 24 12:37:26 2011
New Revision: 130113
URL: http://llvm.org/viewvc/llvm-project?rev=130113&view=rev
Log:
Convert size and alignment variables to CharUnits in EmitAggregateCopy(). No
change in functionality intended.
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=130113&r1=130112&r2=130113&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sun Apr 24 12:37:26 2011
@@ -893,7 +893,8 @@
// safely handle this, we can add a target hook.
// Get size and alignment info for this aggregate.
- std::pair<uint64_t, unsigned> TypeInfo = getContext().getTypeInfo(Ty);
+ std::pair<CharUnits, CharUnits> TypeInfo =
+ getContext().getTypeInfoInChars(Ty);
// FIXME: Handle variable sized types.
@@ -923,9 +924,9 @@
if (const RecordType *RecordTy = Ty->getAs<RecordType>()) {
RecordDecl *Record = RecordTy->getDecl();
if (Record->hasObjectMember()) {
- unsigned long size = TypeInfo.first/8;
+ CharUnits size = TypeInfo.first;
const llvm::Type *SizeTy = ConvertType(getContext().getSizeType());
- llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size);
+ llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size.getQuantity());
CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
SizeVal);
return;
@@ -934,9 +935,10 @@
QualType BaseType = getContext().getBaseElementType(Ty);
if (const RecordType *RecordTy = BaseType->getAs<RecordType>()) {
if (RecordTy->getDecl()->hasObjectMember()) {
- unsigned long size = TypeInfo.first/8;
+ CharUnits size = TypeInfo.first;
const llvm::Type *SizeTy = ConvertType(getContext().getSizeType());
- llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size);
+ llvm::Value *SizeVal =
+ llvm::ConstantInt::get(SizeTy, size.getQuantity());
CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
SizeVal);
return;
@@ -945,6 +947,7 @@
}
Builder.CreateMemCpy(DestPtr, SrcPtr,
- llvm::ConstantInt::get(IntPtrTy, TypeInfo.first/8),
- TypeInfo.second/8, isVolatile);
+ llvm::ConstantInt::get(IntPtrTy,
+ TypeInfo.first.getQuantity()),
+ TypeInfo.second.getQuantity(), isVolatile);
}
More information about the cfe-commits
mailing list