MLIR  16.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=llvm::None)
 Construct a new mutable range from the given operand, operand start index, and range length. More...
 
 MutableOperandRange (Operation *owner)
 
MutableOperandRange slice (unsigned subStart, unsigned subLen, Optional< OperandSegment > segment=llvm::None) 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...
 
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...
 
Value operator[] (unsigned index) const
 Returns the value at the given index. More...
 

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 114 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 119 of file ValueRange.h.

Constructor & Destructor Documentation

◆ MutableOperandRange() [1/2]

MutableOperandRange::MutableOperandRange ( Operation owner,
unsigned  start,
unsigned  length,
ArrayRef< OperandSegment operandSegments = llvm::None 
)

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

References mlir::Operation::getNumOperands().

◆ MutableOperandRange() [2/2]

MutableOperandRange::MutableOperandRange ( Operation owner)

Definition at line 418 of file OperationSupport.cpp.

Member Function Documentation

◆ append()

void MutableOperandRange::append ( ValueRange  values)

Append the given values to the range.

Definition at line 434 of file OperationSupport.cpp.

References mlir::Operation::insertOperands().

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

◆ assign() [1/2]

void MutableOperandRange::assign ( ValueRange  values)

Assign this range to the given values.

Definition at line 442 of file OperationSupport.cpp.

References mlir::Operation::setOperands().

◆ assign() [2/2]

void MutableOperandRange::assign ( Value  value)

Assign the range to the given value.

Definition at line 449 of file OperationSupport.cpp.

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

◆ clear()

void MutableOperandRange::clear ( )

Clear this range and erase all of the operands.

Definition at line 468 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 152 of file ValueRange.h.

◆ erase()

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

Erase the operands within the given sub-range.

Definition at line 459 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 158 of file ValueRange.h.

References mlir::OperandRange::split().

◆ operator OperandRange()

MutableOperandRange::operator OperandRange ( ) const

Allow implicit conversion to an OperandRange.

Definition at line 476 of file OperationSupport.cpp.

References mlir::Operation::getOperands().

◆ operator[]()

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

Returns the value at the given index.

Definition at line 165 of file ValueRange.h.

◆ size()

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

Returns the current size of the range.

Definition at line 149 of file ValueRange.h.

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

◆ slice()

MutableOperandRange MutableOperandRange::slice ( unsigned  subStart,
unsigned  subLen,
Optional< OperandSegment segment = llvm::None 
) const

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

Definition at line 423 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 481 of file OperationSupport.cpp.

References mlir::detail::DenseArrayAttrImpl< int32_t >::get(), and mlir::Operation::setAttr().


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