[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp IntrinsicLowering.cpp Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 12 12:12:03 PST 2004
Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.63 -> 1.64
IntrinsicLowering.cpp updated: 1.6 -> 1.7
Verifier.cpp updated: 1.79 -> 1.80
---
Log message:
Add support for the llvm.memmove intrinsic
Patch graciously contributed by Reid Spencer!
---
Diffs of the changes: (+15 -0)
Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.63 llvm/lib/VMCore/Function.cpp:1.64
--- llvm/lib/VMCore/Function.cpp:1.63 Thu Feb 12 11:01:08 2004
+++ llvm/lib/VMCore/Function.cpp Thu Feb 12 12:11:20 2004
@@ -219,6 +219,7 @@
break;
case 'm':
if (getName() == "llvm.memcpy") return Intrinsic::memcpy;
+ if (getName() == "llvm.memmove") return Intrinsic::memmove;
break;
case 's':
if (getName() == "llvm.setjmp") return Intrinsic::setjmp;
Index: llvm/lib/VMCore/IntrinsicLowering.cpp
diff -u llvm/lib/VMCore/IntrinsicLowering.cpp:1.6 llvm/lib/VMCore/IntrinsicLowering.cpp:1.7
--- llvm/lib/VMCore/IntrinsicLowering.cpp:1.6 Thu Feb 12 11:01:09 2004
+++ llvm/lib/VMCore/IntrinsicLowering.cpp Thu Feb 12 12:11:20 2004
@@ -71,6 +71,19 @@
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() &&
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.79 llvm/lib/VMCore/Verifier.cpp:1.80
--- llvm/lib/VMCore/Verifier.cpp:1.79 Thu Feb 12 11:01:09 2004
+++ llvm/lib/VMCore/Verifier.cpp Thu Feb 12 12:11:20 2004
@@ -563,6 +563,7 @@
case Intrinsic::dbg_declare: NumArgs = 1; break;
case Intrinsic::memcpy: NumArgs = 4; break;
+ case Intrinsic::memmove: NumArgs = 4; break;
case Intrinsic::alpha_ctlz: NumArgs = 1; break;
case Intrinsic::alpha_cttz: NumArgs = 1; break;
More information about the llvm-commits
mailing list