MLIR 22.0.0git
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.

Public Member Functions

 MutableOperandRange (Operation *owner, unsigned start, unsigned length, ArrayRef< OperandSegment > operandSegments={})
 Construct a new mutable range from the given operand, operand start index, and range length.
 MutableOperandRange (Operation *owner)
 MutableOperandRange (OpOperand &opOperand)
 Construct a new mutable range for the given OpOperand.
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.
void append (ValueRange values)
 Append the given values to the range.
void assign (ValueRange values)
 Assign this range to the given values.
void assign (Value value)
 Assign the range to the given value.
void erase (unsigned subStart, unsigned subLen=1)
 Erase the operands within the given sub-range.
void clear ()
 Clear this range and erase all of the operands.
unsigned size () const
 Returns the current size of the range.
bool empty () const
 Returns if the current range is empty.
OperandRange getAsOperandRange () const
 Explicit conversion to an OperandRange.
 operator OperandRange () const
 Allow implicit conversion to an OperandRange.
 operator MutableArrayRef< OpOperand > () const
 Allow implicit conversion to a MutableArrayRef.
OperationgetOwner () const
 Returns the owning operation.
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.
OpOperandoperator[] (unsigned index) const
 Returns the OpOperand at the given index.
MutableArrayRef< OpOperand >::iterator begin () const
 Iterators enumerate OpOperands.
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 118 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 123 of file ValueRange.h.

Constructor & Destructor Documentation

◆ MutableOperandRange() [1/3]

MutableOperandRange::MutableOperandRange ( Operation * owner,
unsigned start,
unsigned length,
ArrayRef< OperandSegment > operandSegments = {} )

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 425 of file OperationSupport.cpp.

Referenced by MutableOperandRange(), MutableOperandRange(), and slice().

◆ MutableOperandRange() [2/3]

MutableOperandRange::MutableOperandRange ( Operation * owner)

Definition at line 432 of file OperationSupport.cpp.

References MutableOperandRange().

◆ MutableOperandRange() [3/3]

MutableOperandRange::MutableOperandRange ( OpOperand & opOperand)

Construct a new mutable range for the given OpOperand.

Definition at line 436 of file OperationSupport.cpp.

References getOwner(), and MutableOperandRange().

Member Function Documentation

◆ append()

void MutableOperandRange::append ( ValueRange values)

Append the given values to the range.

Definition at line 454 of file OperationSupport.cpp.

Referenced by transformToReduceLoop().

◆ assign() [1/2]

void MutableOperandRange::assign ( Value value)

Assign the range to the given value.

Definition at line 469 of file OperationSupport.cpp.

◆ assign() [2/2]

◆ begin()

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

Iterators enumerate OpOperands.

Definition at line 535 of file OperationSupport.cpp.

◆ clear()

void MutableOperandRange::clear ( )

Clear this range and erase all of the operands.

Definition at line 488 of file OperationSupport.cpp.

◆ empty()

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

Returns if the current range is empty.

Definition at line 159 of file ValueRange.h.

References size().

◆ end()

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

Definition at line 539 of file OperationSupport.cpp.

◆ erase()

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

Erase the operands within the given sub-range.

Definition at line 479 of file OperationSupport.cpp.

Referenced by foldCstValueToCstAttrBasis().

◆ getAsOperandRange()

OperandRange MutableOperandRange::getAsOperandRange ( ) const

◆ getOwner()

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

Returns the owning operation.

Definition at line 171 of file ValueRange.h.

Referenced by MutableOperandRange().

◆ operator MutableArrayRef< OpOperand >()

MutableOperandRange::operator MutableArrayRef< OpOperand > ( ) const

Allow implicit conversion to a MutableArrayRef.

Definition at line 505 of file OperationSupport.cpp.

◆ operator OperandRange()

MutableOperandRange::operator OperandRange ( ) const

Allow implicit conversion to an OperandRange.

Definition at line 501 of file OperationSupport.cpp.

References getAsOperandRange().

◆ operator[]()

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

Returns the OpOperand at the given index.

Definition at line 530 of file OperationSupport.cpp.

◆ size()

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

Returns the current size of the range.

Definition at line 156 of file ValueRange.h.

Referenced by empty(), and transformToReduceLoop().

◆ 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 443 of file OperationSupport.cpp.

References MutableOperandRange().

◆ 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: