MLIR 23.0.0git
mlir::Operation::CloneOptions Class Reference

Class encompassing various options related to cloning an operation. More...

#include "mlir/IR/Operation.h"

Public Member Functions

 CloneOptions ()
 Default constructs an option with all flags set to false.
 CloneOptions (bool cloneRegions, bool cloneOperands, std::optional< SmallVector< Type > > resultTypes)
 Constructs an instance with the options set accordingly.
CloneOptionscloneRegions (bool enable=true)
 Configures whether cloning should traverse into any of the regions of the operation.
bool shouldCloneRegions () const
 Returns whether regions of the operation should be cloned as well.
CloneOptionscloneOperands (bool enable=true)
 Configures whether operation' operands should be cloned.
bool shouldCloneOperands () const
 Returns whether operands should be cloned as well.
CloneOptionswithResultTypes (std::optional< SmallVector< Type > > resultTypes)
 Configures different result types to use for the cloned operation.
bool shouldCloneResults () const
 Returns true if the results are cloned from the operation.
TypeRange resultTypesOr (TypeRange defaultResultTypes) const
 Returns the result types that should be used for the created operation or defaultResultTypes if none were set.

Static Public Member Functions

static CloneOptions all ()
 Returns an instance such that all elements of the operation are cloned.

Detailed Description

Class encompassing various options related to cloning an operation.

Users of this class should pass it to Operation's 'clone' methods. Current options include:

  • Whether cloning should recursively traverse into the regions of the operation or not.
  • Whether cloning should also clone the operands of the operation.
  • Whether to use different result types or clone them.

Definition at line 144 of file Operation.h.

Constructor & Destructor Documentation

◆ CloneOptions() [1/2]

Operation::CloneOptions::CloneOptions ( )

Default constructs an option with all flags set to false.

That means all parts of an operation that may optionally not be cloned, are not cloned.

Definition at line 676 of file Operation.cpp.

References false.

Referenced by all().

◆ CloneOptions() [2/2]

Operation::CloneOptions::CloneOptions ( bool cloneRegions,
bool cloneOperands,
std::optional< SmallVector< Type > > resultTypes )

Constructs an instance with the options set accordingly.

Definition at line 680 of file Operation.cpp.

References cloneOperands(), and cloneRegions().

Member Function Documentation

◆ all()

Operation::CloneOptions Operation::CloneOptions::all ( )
static

Returns an instance such that all elements of the operation are cloned.

This is the default when using the clone method and clones all parts of the operation.

Definition at line 686 of file Operation.cpp.

References CloneOptions().

Referenced by mlir::Region::cloneInto(), and mlir::Operation::cloneWithoutRegions().

◆ cloneOperands()

Operation::CloneOptions & Operation::CloneOptions::cloneOperands ( bool enable = true)

Configures whether operation' operands should be cloned.

Otherwise the resulting clones will simply have zero operands.

Definition at line 696 of file Operation.cpp.

Referenced by mlir::Region::cloneInto(), and CloneOptions().

◆ cloneRegions()

Operation::CloneOptions & Operation::CloneOptions::cloneRegions ( bool enable = true)

Configures whether cloning should traverse into any of the regions of the operation.

If set to true, the operation's regions are recursively cloned. If set to false, cloned operations will have the same number of regions, but they will be empty. Cloning of nested operations in the operation's regions are currently unaffected by other flags.

Definition at line 691 of file Operation.cpp.

Referenced by mlir::Region::cloneInto(), and CloneOptions().

◆ resultTypesOr()

TypeRange mlir::Operation::CloneOptions::resultTypesOr ( TypeRange defaultResultTypes) const
inline

Returns the result types that should be used for the created operation or defaultResultTypes if none were set.

Definition at line 187 of file Operation.h.

◆ shouldCloneOperands()

bool mlir::Operation::CloneOptions::shouldCloneOperands ( ) const
inline

Returns whether operands should be cloned as well.

Definition at line 175 of file Operation.h.

◆ shouldCloneRegions()

bool mlir::Operation::CloneOptions::shouldCloneRegions ( ) const
inline

Returns whether regions of the operation should be cloned as well.

Definition at line 168 of file Operation.h.

◆ shouldCloneResults()

bool mlir::Operation::CloneOptions::shouldCloneResults ( ) const
inline

Returns true if the results are cloned from the operation.

Definition at line 183 of file Operation.h.

◆ withResultTypes()

Operation::CloneOptions & Operation::CloneOptions::withResultTypes ( std::optional< SmallVector< Type > > resultTypes)

Configures different result types to use for the cloned operation.

If an empty optional, the result types are cloned from the original operation.

Definition at line 701 of file Operation.cpp.


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