summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2010-04-04 03:10:52 +0000
committerMon P Wang <wangmp@apple.com>2010-04-04 03:10:52 +0000
commitcc2ab0cdc97a72fd5efe0ada69d8094eabddf1be (patch)
tree10aeaeb2236e621f0ca836a6519aab699ba0a228 /clang/lib/CodeGen/CodeGenModule.cpp
parentc576ee90405896eeaeba671917e2e88014aec252 (diff)
downloadbcm5719-llvm-cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be.tar.gz
bcm5719-llvm-cc2ab0cdc97a72fd5efe0ada69d8094eabddf1be.zip
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/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 3c872c8560d..a2ad31e85a8 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -47,8 +47,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M),
TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags),
Types(C, M, TD, getTargetCodeGenInfo().getABIInfo()),
- MangleCtx(C), VTables(*this), Runtime(0),
- MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0),
+ MangleCtx(C), VTables(*this), Runtime(0), CFConstantStringClassRef(0),
VMContext(M.getContext()) {
if (!Features.ObjC1)
@@ -1414,22 +1413,25 @@ llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys,
(llvm::Intrinsic::ID)IID, Tys, NumTys);
}
-llvm::Function *CodeGenModule::getMemCpyFn() {
- if (MemCpyFn) return MemCpyFn;
- const llvm::Type *IntPtr = TheTargetData.getIntPtrType(VMContext);
- return MemCpyFn = getIntrinsic(llvm::Intrinsic::memcpy, &IntPtr, 1);
+
+llvm::Function *CodeGenModule::getMemCpyFn(const llvm::Type *DestType,
+ const llvm::Type *SrcType,
+ const llvm::Type *SizeType) {
+ const llvm::Type *ArgTypes[3] = {DestType, SrcType, SizeType };
+ return getIntrinsic(llvm::Intrinsic::memcpy, ArgTypes, 3);
}
-llvm::Function *CodeGenModule::getMemMoveFn() {
- if (MemMoveFn) return MemMoveFn;
- const llvm::Type *IntPtr = TheTargetData.getIntPtrType(VMContext);
- return MemMoveFn = getIntrinsic(llvm::Intrinsic::memmove, &IntPtr, 1);
+llvm::Function *CodeGenModule::getMemMoveFn(const llvm::Type *DestType,
+ const llvm::Type *SrcType,
+ const llvm::Type *SizeType) {
+ const llvm::Type *ArgTypes[3] = {DestType, SrcType, SizeType };
+ return getIntrinsic(llvm::Intrinsic::memmove, ArgTypes, 3);
}
-llvm::Function *CodeGenModule::getMemSetFn() {
- if (MemSetFn) return MemSetFn;
- const llvm::Type *IntPtr = TheTargetData.getIntPtrType(VMContext);
- return MemSetFn = getIntrinsic(llvm::Intrinsic::memset, &IntPtr, 1);
+llvm::Function *CodeGenModule::getMemSetFn(const llvm::Type *DestType,
+ const llvm::Type *SizeType) {
+ const llvm::Type *ArgTypes[2] = { DestType, SizeType };
+ return getIntrinsic(llvm::Intrinsic::memset, ArgTypes, 2);
}
static llvm::StringMapEntry<llvm::Constant*> &
OpenPOWER on IntegriCloud