summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Core.cpp')
-rw-r--r--llvm/lib/IR/Core.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index cf23a28ccb6..ba27e5042f0 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2041,22 +2041,17 @@ LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst) {
/*--.. Call and invoke instructions ........................................--*/
+unsigned LLVMGetNumArgOperands(LLVMValueRef Instr) {
+ return CallSite(unwrap<Instruction>(Instr)).getNumArgOperands();
+}
+
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {
- Value *V = unwrap(Instr);
- if (CallInst *CI = dyn_cast<CallInst>(V))
- return CI->getCallingConv();
- if (InvokeInst *II = dyn_cast<InvokeInst>(V))
- return II->getCallingConv();
- llvm_unreachable("LLVMGetInstructionCallConv applies only to call and invoke!");
+ return CallSite(unwrap<Instruction>(Instr)).getCallingConv();
}
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) {
- Value *V = unwrap(Instr);
- if (CallInst *CI = dyn_cast<CallInst>(V))
- return CI->setCallingConv(static_cast<CallingConv::ID>(CC));
- else if (InvokeInst *II = dyn_cast<InvokeInst>(V))
- return II->setCallingConv(static_cast<CallingConv::ID>(CC));
- llvm_unreachable("LLVMSetInstructionCallConv applies only to call and invoke!");
+ return CallSite(unwrap<Instruction>(Instr))
+ .setCallingConv(static_cast<CallingConv::ID>(CC));
}
void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index,
@@ -2090,6 +2085,10 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
index, B)));
}
+LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr) {
+ return wrap(CallSite(unwrap<Instruction>(Instr)).getCalledValue());
+}
+
/*--.. Operations on call instructions (only) ..............................--*/
LLVMBool LLVMIsTailCall(LLVMValueRef Call) {
OpenPOWER on IntegriCloud