summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Utils/BasicBlockUtils.h
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-10-19 10:48:31 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-10-19 10:48:31 +0000
commit4a2dec05cef5882b745dd248d79e42a42cdbc87b (patch)
tree40e1fd90148efd33b681dfb9d22c1be626f561b2 /include/llvm/Transforms/Utils/BasicBlockUtils.h
parent17f68c52d2f3b6b2472b07492d76520df230afcd (diff)
downloadllvm-4a2dec05cef5882b745dd248d79e42a42cdbc87b.tar.gz
llvm-4a2dec05cef5882b745dd248d79e42a42cdbc87b.tar.bz2
llvm-4a2dec05cef5882b745dd248d79e42a42cdbc87b.tar.xz
Move SplitBlockAndInsertIfThen to BasicBlockUtils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/BasicBlockUtils.h')
-rw-r--r--include/llvm/Transforms/Utils/BasicBlockUtils.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 2510aecc69..b810f1a818 100644
--- a/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -25,9 +25,11 @@ namespace llvm {
class AliasAnalysis;
class Instruction;
+class MDNode;
class Pass;
class ReturnInst;
class TargetLibraryInfo;
+class TerminatorInst;
/// DeleteDeadBlock - Delete the specified block, which must have no
/// predecessors.
@@ -203,6 +205,29 @@ void SplitLandingPadPredecessors(BasicBlock *OrigBB,ArrayRef<BasicBlock*> Preds,
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
BasicBlock *Pred);
+/// SplitBlockAndInsertIfThen - Split the containing block at the
+/// specified instruction - everything before and including Cmp stays
+/// in the old basic block, and everything after Cmp is moved to a
+/// new block. The two blocks are connected by a conditional branch
+/// (with value of Cmp being the condition).
+/// Before:
+/// Head
+/// Cmp
+/// Tail
+/// After:
+/// Head
+/// Cmp
+/// if (Cmp)
+/// ThenBlock
+/// Tail
+///
+/// If Unreachable is true, then ThenBlock ends with
+/// UnreachableInst, otherwise it branches to Tail.
+/// Returns the NewBasicBlock's terminator.
+
+TerminatorInst *SplitBlockAndInsertIfThen(Instruction *Cmp,
+ bool Unreachable, MDNode *BranchWeights = 0);
+
} // End llvm namespace
#endif