[LLVM-C] Add LLVMInstructionClone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220007 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Zotov 2014-10-17 01:02:34 +00:00
parent 0fea775e5c
commit cb76f395d7
2 changed files with 16 additions and 0 deletions

View File

@ -2408,6 +2408,16 @@ LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
*/ */
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst); 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 * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
* *

View File

@ -1888,6 +1888,12 @@ LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst) {
return (LLVMOpcode)0; 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 ........................................--*/ /*--.. Call and invoke instructions ........................................--*/
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) { unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {