mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Add some helpful methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a7f98c80d
commit
e725cb0d5a
@ -33,6 +33,8 @@ namespace llvm {
|
|||||||
|
|
||||||
class DominatorSet;
|
class DominatorSet;
|
||||||
class LoopInfo;
|
class LoopInfo;
|
||||||
|
class PHINode;
|
||||||
|
class Instruction;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// Loop class - Instances of this class are used to represent loops that are
|
/// Loop class - Instances of this class are used to represent loops that are
|
||||||
@ -94,18 +96,47 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===--------------------------------------------------------------------===//
|
||||||
|
// APIs for simple analysis of the loop.
|
||||||
|
//
|
||||||
|
// Note that all of these methods can fail on general loops (ie, there may not
|
||||||
|
// be a preheader, etc). For best success, the loop simplification and
|
||||||
|
// induction variable canonicalization pass should be used to normalize loops
|
||||||
|
// for easy analysis. These methods assume canonical loops.
|
||||||
|
|
||||||
/// getLoopPreheader - If there is a preheader for this loop, return it. A
|
/// getLoopPreheader - If there is a preheader for this loop, return it. A
|
||||||
/// loop has a preheader if there is only one edge to the header of the loop
|
/// loop has a preheader if there is only one edge to the header of the loop
|
||||||
/// from outside of the loop. If this is the case, the block branching to the
|
/// from outside of the loop. If this is the case, the block branching to the
|
||||||
/// header of the loop is the preheader node. The "preheaders" pass can be
|
/// header of the loop is the preheader node.
|
||||||
/// "Required" to ensure that there is always a preheader node for every loop.
|
|
||||||
///
|
///
|
||||||
/// This method returns null if there is no preheader for the loop (either
|
/// This method returns null if there is no preheader for the loop.
|
||||||
/// because the loop is dead or because multiple blocks branch to the header
|
|
||||||
/// node of this loop).
|
|
||||||
///
|
///
|
||||||
BasicBlock *getLoopPreheader() const;
|
BasicBlock *getLoopPreheader() const;
|
||||||
|
|
||||||
|
/// getCanonicalInductionVariable - Check to see if the loop has a canonical
|
||||||
|
/// induction variable: an integer recurrence that starts at 0 and increments
|
||||||
|
/// by one each time through the loop. If so, return the phi node that
|
||||||
|
/// corresponds to it.
|
||||||
|
///
|
||||||
|
PHINode *getCanonicalInductionVariable() const;
|
||||||
|
|
||||||
|
/// getCanonicalInductionVariableIncrement - Return the LLVM value that holds
|
||||||
|
/// the canonical induction variable value for the "next" iteration of the
|
||||||
|
/// loop. This always succeeds if getCanonicalInductionVariable succeeds.
|
||||||
|
///
|
||||||
|
Instruction *getCanonicalInductionVariableIncrement() const;
|
||||||
|
|
||||||
|
/// getTripCount - Return a loop-invariant LLVM value indicating the number of
|
||||||
|
/// times the loop will be executed. Note that this means that the backedge
|
||||||
|
/// of the loop executes N-1 times. If the trip-count cannot be determined,
|
||||||
|
/// this returns null.
|
||||||
|
///
|
||||||
|
Value *getTripCount() const;
|
||||||
|
|
||||||
|
//===--------------------------------------------------------------------===//
|
||||||
|
// APIs for updating loop information after changing the CFG
|
||||||
|
//
|
||||||
|
|
||||||
/// addBasicBlockToLoop - This method is used by other analyses to update loop
|
/// addBasicBlockToLoop - This method is used by other analyses to update loop
|
||||||
/// information. NewBB is set to be a new member of the current loop.
|
/// information. NewBB is set to be a new member of the current loop.
|
||||||
/// Because of this, it is added as a member of all parent loops, and is added
|
/// Because of this, it is added as a member of all parent loops, and is added
|
||||||
|
Loading…
x
Reference in New Issue
Block a user