aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/IntrinsicLowering.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-12 18:11:20 +0000
committerChris Lattner <sabre@nondot.org>2004-02-12 18:11:20 +0000
commit2751e76a709738590242adce47a3b55bc77fd36d (patch)
treee575b5b0e3108e16ea50316249639c21425b236f /lib/CodeGen/IntrinsicLowering.cpp
parent0eb51b440c4ea7eba82964047221e17758de2057 (diff)
Add support for the llvm.memmove intrinsic
Patch graciously contributed by Reid Spencer! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IntrinsicLowering.cpp')
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index 48ae01540b..6eaaafa2e2 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -71,6 +71,19 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
CI->getName(), CI);
break;
}
+ case Intrinsic::memmove: {
+ // The memmove intrinsic take an extra alignment argument that the memcpy
+ // libc function does not.
+ const FunctionType *CFT = Callee->getFunctionType();
+ FunctionType *FT =
+ FunctionType::get(*CFT->param_begin(),
+ std::vector<const Type*>(CFT->param_begin(), CFT->param_end()-1),
+ false);
+ Function *MemMove = M->getOrInsertFunction("memmove", FT);
+ new CallInst(MemMove, std::vector<Value*>(CI->op_begin()+1, CI->op_end()-1),
+ CI->getName(), CI);
+ break;
+ }
}
assert(CI->use_empty() &&