LLVM: llvm::MachineLoop Class Reference (original) (raw)

Public Member Functions

LLVM_ABI MachineBasicBlock *

getTopBlock ()

Return the "top" block in the loop, which is the first block in the linear layout, ignoring any parts of the loop not contiguous with the part that contains the header.

LLVM_ABI MachineBasicBlock *

getBottomBlock ()

Return the "bottom" block in the loop, which is the last block in the linear layout, ignoring any parts of the loop not contiguous with the part that contains the header.

LLVM_ABI MachineBasicBlock *

findLoopControlBlock () const

Find the block that contains the loop control variable and the loop test.

LLVM_ABI DebugLoc

getStartLoc () const

Return the debug location of the start of this loop.

LLVM_ABI MDNode *

getLoopID () const

Find the llvm.loop metadata for this loop.

LLVM_ABI bool

isLoopInvariant (MachineInstr &I, const Register ExcludeReg=0) const

Returns true if the instruction is loop invariant.

LLVM_ABI void

dump () const

Public Member Functions inherited from llvm::LoopBase< MachineBasicBlock, MachineLoop >

unsigned

getLoopDepth () const

Return the nesting level of this loop.

MachineBasicBlock *

getHeader () const

MachineLoop *

getParentLoop () const

Return the parent loop if it exists or nullptr for top level loops.

const MachineLoop *

getOutermostLoop () const

Get the outermost loop in which this loop is contained.

void

setParentLoop (MachineLoop *L)

This is a raw interface for bypassing addChildLoop.

bool

contains (const MachineLoop *L) const

Return true if the specified loop is contained within in this loop.

const std::vector< MachineLoop * > &

getSubLoops () const

Return the loops contained entirely within this loop.

std::vector< MachineLoop * > &

getSubLoopsVector ()

iterator

begin () const

iterator

end () const

reverse_iterator

rbegin () const

reverse_iterator

rend () const

bool

isInnermost () const

Return true if the loop does not contain any (natural) loops.

bool

isOutermost () const

Return true if the loop does not have a parent (natural) loop.

ArrayRef< MachineBasicBlock * >

getBlocks () const

Get a list of the basic blocks which make up this loop.

block_iterator

block_begin () const

block_iterator

block_end () const

iterator_range< block_iterator >

blocks () const

unsigned

getNumBlocks () const

Get the number of blocks in this loop in constant time.

std::vector< MachineBasicBlock * > &

getBlocksVector ()

Return a direct, mutable handle to the blocks vector so that we can mutate it efficiently with techniques like std::remove.

SmallPtrSetImpl< const MachineBasicBlock * > &

getBlocksSet ()

Return a direct, mutable handle to the blocks set so that we can mutate it efficiently.

bool

isInvalid () const

Return true if this loop is no longer valid.

bool

isLoopExiting (const MachineBasicBlock *BB) const

True if terminator in the block can branch to another block that is outside of the current loop.

bool

isLoopLatch (const MachineBasicBlock *BB) const

unsigned

getNumBackEdges () const

Calculate the number of back edges to the loop header.

void

getExitingBlocks (SmallVectorImpl< MachineBasicBlock * > &ExitingBlocks) const

Return all blocks inside the loop that have successors outside of the loop.

MachineBasicBlock *

getExitingBlock () const

If getExitingBlocks would return exactly one block, return that block.

void

getExitBlocks (SmallVectorImpl< MachineBasicBlock * > &ExitBlocks) const

Return all of the successor blocks of this loop.

MachineBasicBlock *

getExitBlock () const

If getExitBlocks would return exactly one block, return that block.

bool

hasDedicatedExits () const

Return true if no exit block for the loop has a predecessor that is outside the loop.

void

getUniqueExitBlocks (SmallVectorImpl< MachineBasicBlock * > &ExitBlocks) const

Return all unique successor blocks of this loop.

void

getUniqueNonLatchExitBlocks (SmallVectorImpl< MachineBasicBlock * > &ExitBlocks) const

Return all unique successor blocks of this loop except successors from Latch block are not considered.

MachineBasicBlock *

getUniqueExitBlock () const

If getUniqueExitBlocks would return exactly one block, return that block.

MachineBasicBlock *

getUniqueLatchExitBlock () const

Return the unique exit block for the latch, or null if there are multiple different exit blocks or the latch is not exiting.

bool

hasNoExitBlocks () const

Return true if this loop does not have any exit blocks.

void

getExitEdges (SmallVectorImpl< Edge > &ExitEdges) const

Return all pairs of (inside_block,outside_block).

MachineBasicBlock *

getLoopPreheader () const

If there is a preheader for this loop, return it.

MachineBasicBlock *

getLoopPredecessor () const

If the given loop's header has exactly one unique predecessor outside the loop, return it.

MachineBasicBlock *

getLoopLatch () const

If there is a single latch block for this loop, return it.

void

getLoopLatches (SmallVectorImpl< MachineBasicBlock * > &LoopLatches) const

Return all loop latch blocks of this loop.

SmallVector< const MachineLoop *, 4 >

getLoopsInPreorder () const

Return all loops in the loop nest rooted by the loop in preorder, with siblings in forward program order.

void

addBasicBlockToLoop (MachineBasicBlock *NewBB, LoopInfoBase< MachineBasicBlock, MachineLoop > &LI)

This method is used by other analyses to update loop information.

void

replaceChildLoopWith (MachineLoop *OldChild, MachineLoop *NewChild)

This is used when splitting loops up.

void

addChildLoop (MachineLoop *NewChild)

Add the specified loop to be a child of this loop.

MachineLoop *

removeChildLoop (iterator I)

This removes the specified child from being a subloop of this loop.

void

addBlockEntry (MachineBasicBlock *BB)

This adds a basic block directly to the basic block list.

void

reverseBlock (unsigned from)

interface to reverse Blocks[from, end of loop] in this loop

void

reserveBlocks (unsigned size)

interface to do reserve() for Blocks

void

moveToHeader (MachineBasicBlock *BB)

This method is used to move BB (which must be part of this loop) to be the loop header of the loop (the block that dominates all others).

void

removeBlockFromLoop (MachineBasicBlock *BB)

This removes the specified basic block from the current loop, updating the Blocks as appropriate.

void

verifyLoop () const

Verify loop structure.

void

verifyLoopNest (DenseSet< const MachineLoop * > *Loops) const

Verify loop structure of this loop and all nested loops.

bool

isAnnotatedParallel () const

Returns true if the loop is annotated parallel.

void

print (raw_ostream &OS, bool Verbose=false, bool PrintNested=true, unsigned Depth=0) const

Print loop with all the BBs inside it.

Definition at line 48 of file MachineLoopInfo.h.

MDNode * MachineLoop::getLoopID ( ) const

Returns true if the instruction is loop invariant.

I.e., all virtual register operands are defined outside of the loop, physical registers aren't accessed explicitly, and there are no side effects that aren't captured by the operands or other flags. ExcludeReg can be used to exclude the given register from the check i.e. when we're considering hoisting it's definition but not hoisted it yet

Definition at line 233 of file MachineLoopInfo.cpp.

References assert(), llvm::LoopBase< MachineBasicBlock, MachineLoop >::contains(), llvm::LoopBase< MachineBasicBlock, MachineLoop >::getHeader(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), I, MRI, TII, and TRI.