summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRobert Widmann <devteam.codafi@gmail.com>2019-04-05 20:32:43 +0000
committerRobert Widmann <devteam.codafi@gmail.com>2019-04-05 20:32:43 +0000
commitb4baa5602d15f59a11927832cfd4e6592fabd281 (patch)
treea209d3b29d5ade3e81565eb140567ffea2632e49 /llvm/lib
parent6e68a79110cbcac6211d5157079c961e889ef3fd (diff)
downloadbcm5719-llvm-b4baa5602d15f59a11927832cfd4e6592fabd281.tar.gz
bcm5719-llvm-b4baa5602d15f59a11927832cfd4e6592fabd281.zip
[LLVM-C] Add bindings to insert basic blocks
Summary: Now that we can create standalone basic blocks, it's useful to be able to append them. Add bindings to - Insert a basic block after the current insertion block - Append a basic block to the end of a function's list of basic blocks Reviewers: whitequark, deadalnix, harlanhaskins Reviewed By: whitequark, harlanhaskins Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59658 llvm-svn: 357812
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Core.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index aa6bc542b4e..997f5330dec 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2609,6 +2609,20 @@ LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C,
return wrap(llvm::BasicBlock::Create(*unwrap(C), Name));
}
+void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder,
+ LLVMBasicBlockRef BB) {
+ BasicBlock *ToInsert = unwrap(BB);
+ BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
+ assert(CurBB && "current insertion point is invalid!");
+ CurBB->getParent()->getBasicBlockList().insertAfter(CurBB->getIterator(),
+ ToInsert);
+}
+
+void LLVMAppendExistingBasicBlock(LLVMValueRef Fn,
+ LLVMBasicBlockRef BB) {
+ unwrap<Function>(Fn)->getBasicBlockList().push_back(unwrap(BB));
+}
+
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
LLVMValueRef FnRef,
const char *Name) {
OpenPOWER on IntegriCloud