diff options
| author | Mon P Wang <wangmp@apple.com> | 2010-04-04 03:10:52 +0000 |
|---|---|---|
| committer | Mon P Wang <wangmp@apple.com> | 2010-04-04 03:10:52 +0000 |
| commit | cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be (patch) | |
| tree | 10aeaeb2236e621f0ca836a6519aab699ba0a228 /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | c576ee90405896eeaeba671917e2e88014aec252 (diff) | |
| download | llvm-cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be.zip llvm-cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be.tar.gz llvm-cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be.tar.bz2 | |
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100305
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index e2e2cd05..4d5160f 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -771,12 +771,27 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, // a = b; // } // - // we need to use a differnt call here. We use isVolatile to indicate when + // we need to use a different call here. We use isVolatile to indicate when // either the source or the destination is volatile. - Builder.CreateCall4(CGM.getMemCpyFn(), + const llvm::Type *I1Ty = llvm::Type::getInt1Ty(VMContext); + const llvm::Type *I8Ty = llvm::Type::getInt8Ty(VMContext); + const llvm::Type *I32Ty = llvm::Type::getInt32Ty(VMContext); + + const llvm::PointerType *DPT = cast<llvm::PointerType>(DestPtr->getType()); + const llvm::Type *DBP = llvm::PointerType::get(I8Ty, DPT->getAddressSpace()); + if (DestPtr->getType() != DBP) + DestPtr = Builder.CreateBitCast(DestPtr, DBP, "tmp"); + + const llvm::PointerType *SPT = cast<llvm::PointerType>(SrcPtr->getType()); + const llvm::Type *SBP = llvm::PointerType::get(I8Ty, SPT->getAddressSpace()); + if (SrcPtr->getType() != SBP) + SrcPtr = Builder.CreateBitCast(SrcPtr, SBP, "tmp"); + + Builder.CreateCall5(CGM.getMemCpyFn(DestPtr->getType(), SrcPtr->getType(), + IntPtr), DestPtr, SrcPtr, // TypeInfo.first describes size in bits. llvm::ConstantInt::get(IntPtr, TypeInfo.first/8), - llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), - TypeInfo.second/8)); + llvm::ConstantInt::get(I32Ty, TypeInfo.second/8), + llvm::ConstantInt::get(I1Ty, isVolatile)); } |
