2013-05-20 20:46:30 +00:00
|
|
|
//===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -*- C++ -*-=========//
|
2013-05-20 16:47:07 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines some loop transformation utilities.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-05-20 20:46:30 +00:00
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
|
|
|
|
#define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
|
2013-05-20 16:47:07 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2014-01-23 11:23:19 +00:00
|
|
|
class AliasAnalysis;
|
|
|
|
class BasicBlock;
|
|
|
|
class DominatorTree;
|
2013-05-20 16:47:07 +00:00
|
|
|
class Loop;
|
2014-01-23 11:23:19 +00:00
|
|
|
class LoopInfo;
|
2013-05-20 16:47:07 +00:00
|
|
|
class Pass;
|
2014-01-23 11:23:19 +00:00
|
|
|
class ScalarEvolution;
|
2013-05-20 16:47:07 +00:00
|
|
|
|
|
|
|
BasicBlock *InsertPreheaderForLoop(Loop *L, Pass *P);
|
|
|
|
|
2014-01-23 11:23:19 +00:00
|
|
|
/// \brief Simplify each loop in a loop nest recursively.
|
|
|
|
///
|
|
|
|
/// This takes a potentially un-simplified loop L (and its children) and turns
|
|
|
|
/// it into a simplified loop nest with preheaders and single backedges. It
|
|
|
|
/// will optionally update \c AliasAnalysis and \c ScalarEvolution analyses if
|
|
|
|
/// passed into it.
|
|
|
|
bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, Pass *PP,
|
|
|
|
AliasAnalysis *AA = 0, ScalarEvolution *SE = 0);
|
|
|
|
|
2014-01-25 04:07:24 +00:00
|
|
|
/// \brief Put loop into LCSSA form.
|
|
|
|
///
|
|
|
|
/// Looks at all instructions in the loop which have uses outside of the
|
|
|
|
/// current loop. For each, an LCSSA PHI node is inserted and the uses outside
|
|
|
|
/// the loop are rewritten to use this node.
|
|
|
|
///
|
|
|
|
/// LoopInfo and DominatorTree are required and preserved.
|
|
|
|
///
|
|
|
|
/// If ScalarEvolution is passed in, it will be preserved.
|
|
|
|
///
|
|
|
|
/// Returns true if any modifications are made to the loop.
|
|
|
|
bool formLCSSA(Loop &L, DominatorTree &DT, ScalarEvolution *SE = 0);
|
|
|
|
|
2014-01-28 01:25:38 +00:00
|
|
|
/// \brief Put a loop nest into LCSSA form.
|
|
|
|
///
|
|
|
|
/// This recursively forms LCSSA for a loop nest.
|
|
|
|
///
|
|
|
|
/// LoopInfo and DominatorTree are required and preserved.
|
|
|
|
///
|
|
|
|
/// If ScalarEvolution is passed in, it will be preserved.
|
|
|
|
///
|
|
|
|
/// Returns true if any modifications are made to the loop.
|
|
|
|
bool formLCSSARecursively(Loop &L, DominatorTree &DT, ScalarEvolution *SE = 0);
|
|
|
|
|
2013-05-20 16:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|