MLIR  20.0.0git
Public Member Functions | List of all members
mlir::SuccessorOperands Class Reference

This class models how operands are forwarded to block arguments in control flow. More...

#include "mlir/Interfaces/ControlFlowInterfaces.h"

Public Member Functions

 SuccessorOperands (MutableOperandRange forwardedOperands)
 Constructs a SuccessorOperands with no produced operands that simply forwards operands to the successor. More...
 
 SuccessorOperands (unsigned producedOperandCount, MutableOperandRange forwardedOperands)
 Constructs a SuccessorOperands with the given amount of produced operands and forwarded operands. More...
 
unsigned size () const
 Returns the amount of operands passed to the successor. More...
 
bool empty () const
 Returns true if there are no successor operands. More...
 
unsigned getProducedOperandCount () const
 Returns the amount of operands that are produced internally by the operation. More...
 
bool isOperandProduced (unsigned index) const
 Returns true if the successor operand denoted by index is produced by the operation. More...
 
Value operator[] (unsigned index) const
 Returns the Value that is passed to the successors block argument denoted by index. More...
 
OperandRange getForwardedOperands () const
 Get the range of operands that are simply forwarded to the successor. More...
 
MutableOperandRange getMutableForwardedOperands () const
 Get the range of operands that are simply forwarded to the successor. More...
 
MutableOperandRange slice (unsigned subStart, unsigned subLen) const
 Get a slice of the operands forwarded to the successor. More...
 
void erase (unsigned subStart, unsigned subLen=1)
 Erase operands forwarded to the successor. More...
 
void append (ValueRange valueRange)
 Add new operands that are forwarded to the successor. More...
 
unsigned getOperandIndex (unsigned blockArgumentIndex) const
 Gets the index of the forwarded operand within the operation which maps to the block argument denoted by blockArgumentIndex. More...
 

Detailed Description

This class models how operands are forwarded to block arguments in control flow.

It consists of a number, denoting how many of the successors block arguments are produced by the operation, followed by a range of operands that are forwarded. The produced operands are passed to the first few block arguments of the successor, followed by the forwarded operands. It is unsupported to pass them in a different order.

An example operation with both of these concepts would be a branch-on-error operation, that internally produces an error object on the error path:

invoke function(%0) label ^success ^error(%1 : i32)

^error(e: !error, arg0 : i32): ...

This operation would return an instance of SuccessorOperands with a produced operand count of 1 (mapped to e in the successor) and a forwarded operands range consisting of %1 in the example above (mapped to arg0 in the successor).

Definition at line 43 of file ControlFlowInterfaces.h.

Constructor & Destructor Documentation

◆ SuccessorOperands() [1/2]

SuccessorOperands::SuccessorOperands ( MutableOperandRange  forwardedOperands)
explicit

Constructs a SuccessorOperands with no produced operands that simply forwards operands to the successor.

Definition at line 23 of file ControlFlowInterfaces.cpp.

◆ SuccessorOperands() [2/2]

mlir::SuccessorOperands::SuccessorOperands ( unsigned  producedOperandCount,
MutableOperandRange  forwardedOperands 
)

Constructs a SuccessorOperands with the given amount of produced operands and forwarded operands.

Member Function Documentation

◆ append()

void mlir::SuccessorOperands::append ( ValueRange  valueRange)
inline

Add new operands that are forwarded to the successor.

Definition at line 107 of file ControlFlowInterfaces.h.

References mlir::MutableOperandRange::append().

◆ empty()

bool mlir::SuccessorOperands::empty ( ) const
inline

Returns true if there are no successor operands.

Definition at line 61 of file ControlFlowInterfaces.h.

References size().

Referenced by getPHISourceValue().

◆ erase()

void mlir::SuccessorOperands::erase ( unsigned  subStart,
unsigned  subLen = 1 
)
inline

Erase operands forwarded to the successor.

The given range must not contain any operands produced by the operation.

Definition at line 100 of file ControlFlowInterfaces.h.

References mlir::MutableOperandRange::erase(), and isOperandProduced().

Referenced by dropRedundantArguments(), and eraseTerminatorSuccessorOperands().

◆ getForwardedOperands()

OperandRange mlir::SuccessorOperands::getForwardedOperands ( ) const
inline

Get the range of operands that are simply forwarded to the successor.

Definition at line 83 of file ControlFlowInterfaces.h.

Referenced by mlir::bufferization::bufferizeBlockSignature(), dropRedundantArguments(), mlir::detail::getBranchSuccessorArgument(), and mlir::bufferization::detail::getCallerOpOperands().

◆ getMutableForwardedOperands()

MutableOperandRange mlir::SuccessorOperands::getMutableForwardedOperands ( ) const
inline

Get the range of operands that are simply forwarded to the successor.

Definition at line 86 of file ControlFlowInterfaces.h.

Referenced by mlir::bufferization::bufferizeBlockSignature(), and getMutableSuccessorOperands().

◆ getOperandIndex()

unsigned mlir::SuccessorOperands::getOperandIndex ( unsigned  blockArgumentIndex) const
inline

Gets the index of the forwarded operand within the operation which maps to the block argument denoted by blockArgumentIndex.

The block argument must be mapped to a forwarded operand.

Definition at line 112 of file ControlFlowInterfaces.h.

References mlir::OperandRange::getBeginOperandIndex(), and isOperandProduced().

◆ getProducedOperandCount()

unsigned mlir::SuccessorOperands::getProducedOperandCount ( ) const
inline

Returns the amount of operands that are produced internally by the operation.

These are passed to the first few block arguments.

Definition at line 65 of file ControlFlowInterfaces.h.

Referenced by checkTransformationPreconditions(), mlir::detail::getBranchSuccessorArgument(), mlir::bufferization::detail::getCallerOpOperands(), propagateTerminatorLiveness(), and mlir::detail::verifyBranchSuccessorOperands().

◆ isOperandProduced()

bool mlir::SuccessorOperands::isOperandProduced ( unsigned  index) const
inline

Returns true if the successor operand denoted by index is produced by the operation.

Definition at line 69 of file ControlFlowInterfaces.h.

Referenced by erase(), getOperandIndex(), operator[](), and slice().

◆ operator[]()

Value mlir::SuccessorOperands::operator[] ( unsigned  index) const
inline

Returns the Value that is passed to the successors block argument denoted by index.

If it is produced by the operation, no such value exists and a null Value is returned.

Definition at line 76 of file ControlFlowInterfaces.h.

References isOperandProduced().

◆ size()

unsigned mlir::SuccessorOperands::size ( ) const
inline

Returns the amount of operands passed to the successor.

This consists both of produced operands by the operation as well as forwarded ones.

Definition at line 56 of file ControlFlowInterfaces.h.

References mlir::MutableOperandRange::size().

Referenced by empty(), eraseTerminatorSuccessorOperands(), and mlir::detail::verifyBranchSuccessorOperands().

◆ slice()

MutableOperandRange mlir::SuccessorOperands::slice ( unsigned  subStart,
unsigned  subLen 
) const
inline

Get a slice of the operands forwarded to the successor.

The given range must not contain any operands produced by the operation.

Definition at line 92 of file ControlFlowInterfaces.h.

References isOperandProduced(), and mlir::MutableOperandRange::slice().


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