From f6508617609f108c69c4e96038bbd0d5f97ae105 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 10 Nov 2003 04:10:27 +0000 Subject: [PATCH] Move isCriticalEdge & SplitCritical into this file. While we're at it, change the interface to SplitCriticalEdge so that it splits an edge if it is critical, otherwise just returns false and noops if not. llvm-svn: 9852 --- .../llvm/Transforms/Utils/BasicBlockUtils.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h index 53452eb1cd78..78e5592f44b4 100644 --- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -19,6 +19,7 @@ #include "llvm/BasicBlock.h" class Instruction; +class Pass; // ReplaceInstWithValue - Replace all uses of an instruction (specified by BI) // with a value, then remove and delete the original instruction. @@ -48,4 +49,19 @@ void ReplaceInstWithInst(Instruction *From, Instruction *To); // void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum); + +/// isCriticalEdge - Return true if the specified edge is a critical edge. +/// Critical edges are edges from a block with multiple successors to a block +/// with multiple predecessors. +/// +bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum); + +/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to +/// split the critical edge. This will update DominatorSet, ImmediateDominator, +/// DominatorTree, and DominatorFrontier information if it is available, thus +/// calling this pass will not invalidate either of them. This returns true if +/// the edge was split, false otherwise. +/// +bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0); + #endif