[C++] Use 'nullptr'. Transforms edition.
[oota-llvm.git] / include / llvm / Transforms / Utils / LoopUtils.h
1 //===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -*- C++ -*-=========//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines some loop transformation utilities.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
15 #define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
16
17 namespace llvm {
18 class AliasAnalysis;
19 class BasicBlock;
20 class DominatorTree;
21 class Loop;
22 class LoopInfo;
23 class Pass;
24 class ScalarEvolution;
25
26 BasicBlock *InsertPreheaderForLoop(Loop *L, Pass *P);
27
28 /// \brief Simplify each loop in a loop nest recursively.
29 ///
30 /// This takes a potentially un-simplified loop L (and its children) and turns
31 /// it into a simplified loop nest with preheaders and single backedges. It
32 /// will optionally update \c AliasAnalysis and \c ScalarEvolution analyses if
33 /// passed into it.
34 bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, Pass *PP,
35                   AliasAnalysis *AA = nullptr, ScalarEvolution *SE = nullptr);
36
37 /// \brief Put loop into LCSSA form.
38 ///
39 /// Looks at all instructions in the loop which have uses outside of the
40 /// current loop. For each, an LCSSA PHI node is inserted and the uses outside
41 /// the loop are rewritten to use this node.
42 ///
43 /// LoopInfo and DominatorTree are required and preserved.
44 ///
45 /// If ScalarEvolution is passed in, it will be preserved.
46 ///
47 /// Returns true if any modifications are made to the loop.
48 bool formLCSSA(Loop &L, DominatorTree &DT, ScalarEvolution *SE = nullptr);
49
50 /// \brief Put a loop nest into LCSSA form.
51 ///
52 /// This recursively forms LCSSA for a loop nest.
53 ///
54 /// LoopInfo and DominatorTree are required and preserved.
55 ///
56 /// If ScalarEvolution is passed in, it will be preserved.
57 ///
58 /// Returns true if any modifications are made to the loop.
59 bool formLCSSARecursively(Loop &L, DominatorTree &DT,
60                           ScalarEvolution *SE = nullptr);
61
62 }
63
64 #endif