diff options
author | Mon P Wang <wangmp@apple.com> | 2010-03-30 21:02:45 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2010-03-30 21:02:45 +0000 |
commit | 3b5caa20652c43d00229bac972b78bee44a0ee9f (patch) | |
tree | bdb5adfac848bf3670b3e3630eb7b421d098fb49 /lib/CodeGen/CGDecl.cpp | |
parent | 5e40291d13ed2d7711235df947a2a18a925c7536 (diff) |
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 4eb95af8ff..07d219f1fb 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -564,11 +564,15 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { if (Loc->getType() != BP) Loc = Builder.CreateBitCast(Loc, BP, "tmp"); + llvm::Value *NotVolatile = + llvm::ConstantInt::get(llvm::Type::getInt1Ty(VMContext), 0); + // If the initializer is all zeros, codegen with memset. if (isa<llvm::ConstantAggregateZero>(Init)) { llvm::Value *Zero = - llvm::ConstantInt::get(llvm::Type::getInt8Ty(VMContext), 0); - Builder.CreateCall4(CGM.getMemSetFn(), Loc, Zero, SizeVal, AlignVal); + llvm::ConstantInt::get(llvm::Type::getInt8Ty(VMContext), 0); + Builder.CreateCall5(CGM.getMemSetFn(Loc->getType(), SizeVal->getType()), + Loc, Zero, SizeVal, AlignVal, NotVolatile); } else { // Otherwise, create a temporary global with the initializer then // memcpy from the global to the alloca. @@ -582,8 +586,10 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { llvm::Value *SrcPtr = GV; if (SrcPtr->getType() != BP) SrcPtr = Builder.CreateBitCast(SrcPtr, BP, "tmp"); - - Builder.CreateCall4(CGM.getMemCpyFn(), Loc, SrcPtr, SizeVal, AlignVal); + + Builder.CreateCall5(CGM.getMemCpyFn(Loc->getType(), SrcPtr->getType(), + SizeVal->getType()), + Loc, SrcPtr, SizeVal, AlignVal, NotVolatile); } } else if (Ty->isReferenceType()) { RValue RV = EmitReferenceBindingToExpr(Init, /*IsInitializer=*/true); |