mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 22:32:47 +00:00
5a9cd4d44e
a cache of assumptions for a single function, and an immutable pass that manages those caches. The motivation for this change is two fold. Immutable analyses are really hacks around the current pass manager design and don't exist in the new design. This is usually OK, but it requires that the core logic of an immutable pass be reasonably partitioned off from the pass logic. This change does precisely that. As a consequence it also paves the way for the *many* utility functions that deal in the assumptions to live in both pass manager worlds by creating an separate non-pass object with its own independent API that they all rely on. Now, the only bits of the system that deal with the actual pass mechanics are those that actually need to deal with the pass mechanics. Once this separation is made, several simplifications become pretty obvious in the assumption cache itself. Rather than using a set and callback value handles, it can just be a vector of weak value handles. The callers can easily skip the handles that are null, and eventually we can wrap all of this up behind a filter iterator. For now, this adds boiler plate to the various passes, but this kind of boiler plate will end up making it possible to port these passes to the new pass manager, and so it will end up factored away pretty reasonably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225131 91177308-0d34-0410-b5e6-96231b3b80d8
69 lines
2.3 KiB
C++
69 lines
2.3 KiB
C++
//===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -*- C++ -*-=========//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
|
|
#define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
|
|
|
|
namespace llvm {
|
|
class AliasAnalysis;
|
|
class AssumptionCache;
|
|
class BasicBlock;
|
|
class DataLayout;
|
|
class DominatorTree;
|
|
class Loop;
|
|
class LoopInfo;
|
|
class Pass;
|
|
class ScalarEvolution;
|
|
|
|
BasicBlock *InsertPreheaderForLoop(Loop *L, Pass *P);
|
|
|
|
/// \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 = nullptr, ScalarEvolution *SE = nullptr,
|
|
const DataLayout *DL = nullptr,
|
|
AssumptionCache *AC = nullptr);
|
|
|
|
/// \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, LoopInfo *LI,
|
|
ScalarEvolution *SE = nullptr);
|
|
|
|
/// \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, LoopInfo *LI,
|
|
ScalarEvolution *SE = nullptr);
|
|
}
|
|
|
|
#endif
|