MLIR  19.0.0git
Public Types | Public Member Functions | List of all members
mlir::MutableOperandRange Class Reference

This class provides a mutable adaptor for a range of operands. More...

#include "mlir/IR/ValueRange.h"

Public Types

using OperandSegment = std::pair< unsigned, NamedAttribute >
 A pair of a named attribute corresponding to an operand segment attribute, and the index within that attribute. More...
 

Public Member Functions

 MutableOperandRange (Operation *owner, unsigned start, unsigned length, ArrayRef< OperandSegment > operandSegments=std::nullopt)
 Construct a new mutable range from the given operand, operand start index, and range length. More...
 
 MutableOperandRange (Operation *owner)
 
 MutableOperandRange (OpOperand &opOperand)
 Construct a new mutable range for the given OpOperand. More...
 
MutableOperandRange slice (unsigned subStart, unsigned subLen, std::optional< OperandSegment > segment=std::nullopt) const
 Slice this range into a sub range, with the additional operand segment. More...
 
void append (ValueRange values)
 Append the given values to the range. More...
 
void assign (ValueRange values)
 Assign this range to the given values. More...
 
void assign (Value value)
 Assign the range to the given value. More...
 
void erase (unsigned subStart, unsigned subLen=1)
 Erase the operands within the given sub-range. More...
 
void clear ()
 Clear this range and erase all of the operands. More...
 
unsigned size () const
 Returns the current size of the range. More...
 
bool empty () const
 Returns if the current range is empty. More...
 
 operator OperandRange () const
 Allow implicit conversion to an OperandRange. More...
 
 operator MutableArrayRef< OpOperand > () const
 Allow implicit conversion to a MutableArrayRef. More...
 
OperationgetOwner () const
 Returns the owning operation. More...
 
MutableOperandRangeRange split (NamedAttribute segmentSizes) const
 Split this range into a set of contiguous subranges using the given elements attribute, which contains the sizes of the sub ranges. More...
 
OpOperandoperator[] (unsigned index) const
 Returns the OpOperand at the given index. More...
 
MutableArrayRef< OpOperand >::iterator begin () const
 Iterators enumerate OpOperands. More...
 
MutableArrayRef< OpOperand >::iterator end () const
 

Detailed Description

This class provides a mutable adaptor for a range of operands.

It allows for setting, inserting, and erasing operands from the given range.

Definition at line 115 of file ValueRange.h.

Member Typedef Documentation

◆ OperandSegment

A pair of a named attribute corresponding to an operand segment attribute, and the index within that attribute.

The attribute should correspond to a dense i32 array attr.

Definition at line 120 of file ValueRange.h.

Constructor & Destructor Documentation

◆ MutableOperandRange() [1/3]

MutableOperandRange::MutableOperandRange ( Operation owner,
unsigned  start,
unsigned  length,
ArrayRef< OperandSegment operandSegments = std::nullopt 
)

Construct a new mutable range from the given operand, operand start index, and range length.

operandSegments is an optional set of operand segments to be updated when mutating the operand list.

Definition at line 430 of file OperationSupport.cpp.

References mlir::Operation::getNumOperands().

◆ MutableOperandRange() [2/3]

MutableOperandRange::MutableOperandRange ( Operation owner)

Definition at line 437 of file OperationSupport.cpp.

◆ MutableOperandRange() [3/3]

MutableOperandRange::MutableOperandRange ( OpOperand opOperand)

Construct a new mutable range for the given OpOperand.

Definition at line 441 of file OperationSupport.cpp.

Member Function Documentation

◆ append()

void MutableOperandRange::append ( ValueRange  values)

Append the given values to the range.

Definition at line 459 of file OperationSupport.cpp.

References mlir::Operation::insertOperands().

Referenced by mlir::SuccessorOperands::append(), and transformToReduceLoop().

◆ assign() [1/2]

void MutableOperandRange::assign ( Value  value)

Assign the range to the given value.

Definition at line 474 of file OperationSupport.cpp.

References mlir::Operation::setOperand(), and mlir::Operation::setOperands().

◆ assign() [2/2]

void MutableOperandRange::assign ( ValueRange  values)

Assign this range to the given values.

Definition at line 467 of file OperationSupport.cpp.

References mlir::Operation::setOperands().

◆ begin()

MutableArrayRef< OpOperand >::iterator MutableOperandRange::begin ( ) const

Iterators enumerate OpOperands.

Definition at line 535 of file OperationSupport.cpp.

References mlir::Operation::getOpOperands().

◆ clear()

void MutableOperandRange::clear ( )

Clear this range and erase all of the operands.

Definition at line 493 of file OperationSupport.cpp.

References mlir::Operation::eraseOperands().

◆ empty()

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

Returns if the current range is empty.

Definition at line 156 of file ValueRange.h.

References size().

◆ end()

MutableArrayRef< OpOperand >::iterator MutableOperandRange::end ( ) const

Definition at line 539 of file OperationSupport.cpp.

References mlir::Operation::getOpOperands().

◆ erase()

void MutableOperandRange::erase ( unsigned  subStart,
unsigned  subLen = 1 
)

Erase the operands within the given sub-range.

Definition at line 484 of file OperationSupport.cpp.

References mlir::Operation::eraseOperands().

Referenced by mlir::SuccessorOperands::erase().

◆ getOwner()

Operation* mlir::MutableOperandRange::getOwner ( ) const
inline

Returns the owning operation.

Definition at line 165 of file ValueRange.h.

◆ operator MutableArrayRef< OpOperand >()

MutableOperandRange::operator MutableArrayRef< OpOperand > ( ) const

Allow implicit conversion to a MutableArrayRef.

Definition at line 505 of file OperationSupport.cpp.

References mlir::Operation::getOpOperands().

◆ operator OperandRange()

MutableOperandRange::operator OperandRange ( ) const

Allow implicit conversion to an OperandRange.

Definition at line 501 of file OperationSupport.cpp.

References mlir::Operation::getOperands().

◆ operator[]()

OpOperand & MutableOperandRange::operator[] ( unsigned  index) const

Returns the OpOperand at the given index.

Definition at line 530 of file OperationSupport.cpp.

References mlir::Operation::getOpOperand().

◆ size()

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

Returns the current size of the range.

Definition at line 153 of file ValueRange.h.

Referenced by empty(), and mlir::SuccessorOperands::size().

◆ slice()

MutableOperandRange MutableOperandRange::slice ( unsigned  subStart,
unsigned  subLen,
std::optional< OperandSegment segment = std::nullopt 
) const

Slice this range into a sub range, with the additional operand segment.

Definition at line 448 of file OperationSupport.cpp.

Referenced by mlir::SuccessorOperands::slice().

◆ split()

MutableOperandRangeRange MutableOperandRange::split ( NamedAttribute  segmentSizes) const

Split this range into a set of contiguous subranges using the given elements attribute, which contains the sizes of the sub ranges.

Definition at line 510 of file OperationSupport.cpp.


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