LLVM  13.0.0git
Public Member Functions | Friends | List of all members
llvm::CanonicalLoopInfo Class Reference

Class to represented the control flow structure of an OpenMP canonical loop. More...

#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"

Public Member Functions

BasicBlockgetPreheader () const
 The preheader ensures that there is only a single edge entering the loop. More...
 
BasicBlockgetHeader () const
 The header is the entry for each iteration. More...
 
BasicBlockgetCond () const
 The condition block computes whether there is another loop iteration. More...
 
BasicBlockgetBody () const
 The body block is the single entry for a loop iteration and not controlled by CanonicalLoopInfo. More...
 
BasicBlockgetLatch () const
 Reaching the latch indicates the end of the loop body code. More...
 
BasicBlockgetExit () const
 Reaching the exit indicates no more iterations are being executed. More...
 
BasicBlockgetAfter () const
 The after block is intended for clean-up code such as lifetime end markers. More...
 
ValuegetTripCount () const
 Returns the llvm::Value containing the number of loop iterations. More...
 
InstructiongetIndVar () const
 Returns the instruction representing the current logical induction variable. More...
 
TypegetIndVarType () const
 Return the type of the induction variable (and the trip count). More...
 
OpenMPIRBuilder::InsertPointTy getPreheaderIP () const
 Return the insertion point for user code before the loop. More...
 
OpenMPIRBuilder::InsertPointTy getBodyIP () const
 Return the insertion point for user code in the body. More...
 
OpenMPIRBuilder::InsertPointTy getAfterIP () const
 Return the insertion point for user code after the loop. More...
 
FunctiongetFunction () const
 
void assertOK () const
 Consistency self-check. More...
 

Friends

class OpenMPIRBuilder
 

Detailed Description

Class to represented the control flow structure of an OpenMP canonical loop.

The control-flow structure is standardized for easy consumption by directives associated with loops. For instance, the worksharing-loop construct may change this control flow such that each loop iteration is executed on only one thread.

The control flow can be described as follows:

Preheader
   |

/-> Header | | | Cond—\ | | | | Body | | | | | | <...> | | | | | --Latch | | Exit | After

Code in the header, condition block, latch and exit block must not have any side-effect. The body block is the single entry point into the loop body, which may contain arbitrary control flow as long as all control paths eventually branch to the latch block.

Defined outside OpenMPIRBuilder because one cannot forward-declare nested classes.

Definition at line 1126 of file OMPIRBuilder.h.

Member Function Documentation

◆ assertOK()

void CanonicalLoopInfo::assertOK ( ) const

◆ getAfter()

BasicBlock* llvm::CanonicalLoopInfo::getAfter ( ) const
inline

The after block is intended for clean-up code such as lifetime end markers.

It is separate from the exit block to ensure, analogous to the preheader, it having just a single entry edge and being free from PHI nodes should there be multiple loop exits (such as from break statements/cancellations).

Definition at line 1180 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::collapseLoops(), llvm::OpenMPIRBuilder::createCanonicalLoop(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getAfterIP()

OpenMPIRBuilder::InsertPointTy llvm::CanonicalLoopInfo::getAfterIP ( ) const
inline

Return the insertion point for user code after the loop.

Definition at line 1213 of file OMPIRBuilder.h.

References llvm::BasicBlock::begin().

Referenced by llvm::OpenMPIRBuilder::createDynamicWorkshareLoop().

◆ getBody()

BasicBlock* llvm::CanonicalLoopInfo::getBody ( ) const
inline

The body block is the single entry for a loop iteration and not controlled by CanonicalLoopInfo.

It can contain arbitrary control flow but must eventually branch to the Latch block.

Definition at line 1165 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::collapseLoops(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getBodyIP()

OpenMPIRBuilder::InsertPointTy llvm::CanonicalLoopInfo::getBodyIP ( ) const
inline

Return the insertion point for user code in the body.

Definition at line 1208 of file OMPIRBuilder.h.

References llvm::BasicBlock::begin().

Referenced by llvm::OpenMPIRBuilder::createCanonicalLoop().

◆ getCond()

BasicBlock* llvm::CanonicalLoopInfo::getCond ( ) const
inline

The condition block computes whether there is another loop iteration.

If yes, branches to the body; otherwise to the exit block.

Definition at line 1160 of file OMPIRBuilder.h.

References Cond.

Referenced by llvm::OpenMPIRBuilder::createDynamicWorkshareLoop(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), and setCanonicalLoopTripCount().

◆ getExit()

BasicBlock* llvm::CanonicalLoopInfo::getExit ( ) const
inline

Reaching the exit indicates no more iterations are being executed.

Definition at line 1173 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::createDynamicWorkshareLoop(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getFunction()

Function* llvm::CanonicalLoopInfo::getFunction ( ) const
inline

Definition at line 1217 of file OMPIRBuilder.h.

References llvm::BasicBlock::getParent().

◆ getHeader()

BasicBlock* llvm::CanonicalLoopInfo::getHeader ( ) const
inline

The header is the entry for each iteration.

In the canonical control flow, it only contains the PHINode for the induction variable.

Definition at line 1156 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::createDynamicWorkshareLoop().

◆ getIndVar()

Instruction* llvm::CanonicalLoopInfo::getIndVar ( ) const
inline

Returns the instruction representing the current logical induction variable.

Always unsigned, always starting at 0 with an increment of one.

Definition at line 1193 of file OMPIRBuilder.h.

References assert(), and llvm::BasicBlock::front().

Referenced by llvm::OpenMPIRBuilder::createCanonicalLoop(), llvm::OpenMPIRBuilder::createDynamicWorkshareLoop(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), getIndVarType(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getIndVarType()

Type* llvm::CanonicalLoopInfo::getIndVarType ( ) const
inline

Return the type of the induction variable (and the trip count).

Definition at line 1200 of file OMPIRBuilder.h.

References getIndVar(), and llvm::Value::getType().

◆ getLatch()

BasicBlock* llvm::CanonicalLoopInfo::getLatch ( ) const
inline

Reaching the latch indicates the end of the loop body code.

In the canonical control flow, it only contains the increment of the induction variable.

Definition at line 1170 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::collapseLoops(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getPreheader()

BasicBlock* llvm::CanonicalLoopInfo::getPreheader ( ) const
inline

The preheader ensures that there is only a single edge entering the loop.

Code that must be execute before any loop iteration can be emitted here, such as computing the loop trip count and begin lifetime markers. Code in the preheader is not considered part of the canonical loop.

Definition at line 1152 of file OMPIRBuilder.h.

Referenced by llvm::OpenMPIRBuilder::collapseLoops(), llvm::OpenMPIRBuilder::createDynamicWorkshareLoop(), llvm::OpenMPIRBuilder::createStaticWorkshareLoop(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getPreheaderIP()

OpenMPIRBuilder::InsertPointTy llvm::CanonicalLoopInfo::getPreheaderIP ( ) const
inline

Return the insertion point for user code before the loop.

Definition at line 1203 of file OMPIRBuilder.h.

References llvm::BasicBlock::end().

Referenced by llvm::OpenMPIRBuilder::collapseLoops(), and llvm::OpenMPIRBuilder::tileLoops().

◆ getTripCount()

Value* llvm::CanonicalLoopInfo::getTripCount ( ) const
inline

Returns the llvm::Value containing the number of loop iterations.

It must be valid in the preheader and always interpreted as an unsigned integer of any bit-width.

Definition at line 1185 of file OMPIRBuilder.h.

References assert(), Cond, and llvm::User::getOperand().

Referenced by llvm::OpenMPIRBuilder::createDynamicWorkshareLoop(), and llvm::OpenMPIRBuilder::createStaticWorkshareLoop().

Friends And Related Function Documentation

◆ OpenMPIRBuilder

friend class OpenMPIRBuilder
friend

Definition at line 1127 of file OMPIRBuilder.h.


The documentation for this class was generated from the following files: