summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2014-10-28 19:46:56 +0000
committerPeter Zotov <whitequark@whitequark.org>2014-10-28 19:46:56 +0000
commit2481c75f8ba805e31776cfdb4cb29afea6e157a1 (patch)
tree7813f9c86de03909092b0041aa7dc8e536c4008f /llvm/lib/IR
parent6074c344de47f336e964728fbfa3d709c2ade57a (diff)
downloadbcm5719-llvm-2481c75f8ba805e31776cfdb4cb29afea6e157a1.tar.gz
bcm5719-llvm-2481c75f8ba805e31776cfdb4cb29afea6e157a1.zip
[C API] PR19859: Add functions to query and modify branches.
Patch by Gabriel Radanne <drupyog@zoho.com>. llvm-svn: 220817
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Core.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index e8cfc79679d..f6ab9197244 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1985,6 +1985,34 @@ void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall) {
unwrap<CallInst>(Call)->setTailCall(isTailCall);
}
+/*--.. Operations on terminators ...........................................--*/
+
+unsigned LLVMGetNumSuccessors(LLVMValueRef Term) {
+ return unwrap<TerminatorInst>(Term)->getNumSuccessors();
+}
+
+LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i) {
+ return wrap(unwrap<TerminatorInst>(Term)->getSuccessor(i));
+}
+
+void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block) {
+ return unwrap<TerminatorInst>(Term)->setSuccessor(i,unwrap(block));
+}
+
+/*--.. Operations on branch instructions (only) ............................--*/
+
+LLVMBool LLVMIsConditional(LLVMValueRef Branch) {
+ return unwrap<BranchInst>(Branch)->isConditional();
+}
+
+LLVMValueRef LLVMGetCondition(LLVMValueRef Branch) {
+ return wrap(unwrap<BranchInst>(Branch)->getCondition());
+}
+
+void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond) {
+ return unwrap<BranchInst>(Branch)->setCondition(unwrap(Cond));
+}
+
/*--.. Operations on switch instructions (only) ............................--*/
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch) {
OpenPOWER on IntegriCloud