[llvm] r220007 - [LLVM-C] Add LLVMInstructionClone.
Peter Zotov
whitequark at whitequark.org
Thu Oct 16 18:02:34 PDT 2014
Author: whitequark
Date: Thu Oct 16 20:02:34 2014
New Revision: 220007
URL: http://llvm.org/viewvc/llvm-project?rev=220007&view=rev
Log:
[LLVM-C] Add LLVMInstructionClone.
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=220007&r1=220006&r2=220007&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Thu Oct 16 20:02:34 2014
@@ -2409,6 +2409,16 @@ LLVMOpcode LLVMGetInstructionOpcode(LL
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
/**
+ * Create a copy of 'this' instruction that is identical in all ways
+ * except the following:
+ * * The instruction has no parent
+ * * The instruction has no name
+ *
+ * @see llvm::Instruction::clone()
+ */
+LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst);
+
+/**
* @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
*
* Functions in this group apply to instructions that refer to call
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=220007&r1=220006&r2=220007&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Thu Oct 16 20:02:34 2014
@@ -1888,6 +1888,12 @@ LLVMOpcode LLVMGetInstructionOpcode(LLVM
return (LLVMOpcode)0;
}
+LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst) {
+ if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
+ return wrap(C->clone());
+ return nullptr;
+}
+
/*--.. Call and invoke instructions ........................................--*/
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {
More information about the llvm-commits
mailing list