LLVM API Documentation

LoopUtils.h
Go to the documentation of this file.
00001 //===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -*- C++ -*-=========//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines some loop transformation utilities.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
00015 #define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
00016 
00017 namespace llvm {
00018 class AliasAnalysis;
00019 class AssumptionTracker;
00020 class BasicBlock;
00021 class DataLayout;
00022 class DominatorTree;
00023 class Loop;
00024 class LoopInfo;
00025 class Pass;
00026 class ScalarEvolution;
00027 
00028 BasicBlock *InsertPreheaderForLoop(Loop *L, Pass *P);
00029 
00030 /// \brief Simplify each loop in a loop nest recursively.
00031 ///
00032 /// This takes a potentially un-simplified loop L (and its children) and turns
00033 /// it into a simplified loop nest with preheaders and single backedges. It
00034 /// will optionally update \c AliasAnalysis and \c ScalarEvolution analyses if
00035 /// passed into it.
00036 bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, Pass *PP,
00037                   AliasAnalysis *AA = nullptr, ScalarEvolution *SE = nullptr,
00038                   const DataLayout *DL = nullptr,
00039                   AssumptionTracker *AT = nullptr);
00040 
00041 /// \brief Put loop into LCSSA form.
00042 ///
00043 /// Looks at all instructions in the loop which have uses outside of the
00044 /// current loop. For each, an LCSSA PHI node is inserted and the uses outside
00045 /// the loop are rewritten to use this node.
00046 ///
00047 /// LoopInfo and DominatorTree are required and preserved.
00048 ///
00049 /// If ScalarEvolution is passed in, it will be preserved.
00050 ///
00051 /// Returns true if any modifications are made to the loop.
00052 bool formLCSSA(Loop &L, DominatorTree &DT, ScalarEvolution *SE = nullptr);
00053 
00054 /// \brief Put a loop nest into LCSSA form.
00055 ///
00056 /// This recursively forms LCSSA for a loop nest.
00057 ///
00058 /// LoopInfo and DominatorTree are required and preserved.
00059 ///
00060 /// If ScalarEvolution is passed in, it will be preserved.
00061 ///
00062 /// Returns true if any modifications are made to the loop.
00063 bool formLCSSARecursively(Loop &L, DominatorTree &DT,
00064                           ScalarEvolution *SE = nullptr);
00065 }
00066 
00067 #endif