summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-08-06 02:43:45 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-08-06 02:43:45 +0000
commit01d7203ef8316fdd71c3cec59f8e68fb869e0dbf (patch)
tree51efd9e28de5addbea893b2742c5bca28f8e9445 /include
parent99c22aaeed3d519c0ec958c77aa35aad2e3b0ae9 (diff)
downloadllvm-01d7203ef8316fdd71c3cec59f8e68fb869e0dbf.tar.gz
llvm-01d7203ef8316fdd71c3cec59f8e68fb869e0dbf.tar.bz2
llvm-01d7203ef8316fdd71c3cec59f8e68fb869e0dbf.tar.xz
Factor FlattenCFG out from SimplifyCFG
Patch by: Mei Ye git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/InitializePasses.h4
-rw-r--r--include/llvm/Transforms/Scalar.h9
-rw-r--r--include/llvm/Transforms/Utils/BasicBlockUtils.h9
-rw-r--r--include/llvm/Transforms/Utils/Local.h8
4 files changed, 26 insertions, 4 deletions
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h
index d49636dde3..d7d18d061b 100644
--- a/include/llvm/InitializePasses.h
+++ b/include/llvm/InitializePasses.h
@@ -86,8 +86,8 @@ void initializeCallGraphViewerPass(PassRegistry&);
void initializeCFGOnlyPrinterPass(PassRegistry&);
void initializeCFGOnlyViewerPass(PassRegistry&);
void initializeCFGPrinterPass(PassRegistry&);
-void initializeCFGOptimizePass(PassRegistry&);
-void initializeCFGCanonicalizePass(PassRegistry&);
+void initializeCFGSimplifyPassPass(PassRegistry&);
+void initializeFlattenCFGPassPass(PassRegistry&);
void initializeStructurizeCFGPass(PassRegistry&);
void initializeCFGViewerPass(PassRegistry&);
void initializeCalculateSpillWeightsPass(PassRegistry&);
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index b52c327e4e..037ab6bea6 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -196,7 +196,14 @@ FunctionPass *createJumpThreadingPass();
// CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
// simplify terminator instructions, etc...
//
-FunctionPass *createCFGSimplificationPass(bool IsTargetAware = false);
+FunctionPass *createCFGSimplificationPass();
+
+//===----------------------------------------------------------------------===//
+//
+// FlattenCFG - flatten CFG, reduce number of conditional branches by using
+// parallel-and and parallel-or mode, etc...
+//
+FunctionPass *createFlattenCFGPass();
//===----------------------------------------------------------------------===//
//
diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h
index b5478cb669..65cafe2ec2 100644
--- a/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -205,6 +205,15 @@ ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
TerminatorInst *SplitBlockAndInsertIfThen(Instruction *Cmp,
bool Unreachable, MDNode *BranchWeights = 0);
+///
+/// GetIfCondition - Check whether BB is the merge point of a if-region.
+/// If so, return the boolean condition that determines which entry into
+/// BB will be taken. Also, return by references the block that will be
+/// entered from if the condition is true, and the block that will be
+/// entered if the condition is false.
+
+Value *GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue,
+ BasicBlock *&IfFalse);
} // End llvm namespace
#endif
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index 5e60286ba7..65755d076e 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -137,7 +137,13 @@ bool EliminateDuplicatePHINodes(BasicBlock *BB);
/// the basic block that was pointed to.
///
bool SimplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI,
- const DataLayout *TD = 0, AliasAnalysis *AA = 0);
+ const DataLayout *TD = 0);
+
+/// FlatternCFG - This function is used to flatten a CFG. For
+/// example, it uses parallel-and and parallel-or mode to collapse
+// if-conditions and merge if-regions with identical statements.
+///
+bool FlattenCFG(BasicBlock *BB, AliasAnalysis *AA = 0);
/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch,
/// and if a predecessor branches to us and one of our successors, fold the