MLIR 22.0.0git
TransformInterfaces.cpp File Reference
#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/CastInterfaces.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DebugLog.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InterleavedRange.h"
#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.cpp.inc"
#include "mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.cpp.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "transform-dialect"
#define DEBUG_PRINT_AFTER_ALL   "transform-dialect-print-top-level-after-all"
#define FULL_LDBG()

Functions

static bool happensBefore (Operation *a, Operation *b)
 Return true if a happens before b, i.e., a or one of its ancestors properly dominates b and b is not inside a.
static DiagnosedSilenceableFailure dispatchMappedValues (Value handle, ArrayRef< transform::MappedValue > values, function_ref< LogicalResult(ArrayRef< Operation * >)> operationsFn, function_ref< LogicalResult(ArrayRef< transform::Param >)> paramsFn, function_ref< LogicalResult(ValueRange)> valuesFn)
 Given a list of MappedValues, cast them to the value kind implied by the interface of the handle type, and dispatch to one of the callbacks.
template<typename Mapping, typename Key, typename Mapped>
static void dropMappingEntry (Mapping &mapping, Key key, Mapped mapped)
template<typename T>
static DiagnosedSilenceableFailure checkRepeatedConsumptionInOperand (ArrayRef< T > payload, transform::TransformOpInterface transform, unsigned operandNumber)
template<typename T>
static SmallVector< T > castVector (ArrayRef< transform::MappedValue > range)
static void remapEffects (MemoryEffectOpInterface iface, BlockArgument source, OpOperand *target, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Appends to effects the memory effect instances on target with the same resource and effect as the ones the operation iface having on source.
static void remapArgumentEffects (Block &block, MutableArrayRef< OpOperand > operands, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Appends to effects the same effects as the operations of block have on block arguments but associated with operands.
template<typename EffectTy, typename ResourceTy, typename Range>
static bool hasEffect (Range &&effects)
 Returns true if the given list of effects instances contains an instance with the effect type specified as template parameter.

Macro Definition Documentation

◆ DEBUG_PRINT_AFTER_ALL

#define DEBUG_PRINT_AFTER_ALL   "transform-dialect-print-top-level-after-all"

Definition at line 24 of file TransformInterfaces.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "transform-dialect"

Definition at line 23 of file TransformInterfaces.cpp.

◆ FULL_LDBG

#define FULL_LDBG ( )
Value:
LDBG(4)

Definition at line 25 of file TransformInterfaces.cpp.

Referenced by mlir::transform::TransformState::applyTransform().

Function Documentation

◆ castVector()

template<typename T>
SmallVector< T > castVector ( ArrayRef< transform::MappedValue > range)
static

◆ checkRepeatedConsumptionInOperand()

template<typename T>
DiagnosedSilenceableFailure checkRepeatedConsumptionInOperand ( ArrayRef< T > payload,
transform::TransformOpInterface transform,
unsigned operandNumber )
static

◆ dispatchMappedValues()

DiagnosedSilenceableFailure dispatchMappedValues ( Value handle,
ArrayRef< transform::MappedValue > values,
function_ref< LogicalResult(ArrayRef< Operation * >)> operationsFn,
function_ref< LogicalResult(ArrayRef< transform::Param >)> paramsFn,
function_ref< LogicalResult(ValueRange)> valuesFn )
static

Given a list of MappedValues, cast them to the value kind implied by the interface of the handle type, and dispatch to one of the callbacks.

Definition at line 133 of file TransformInterfaces.cpp.

References mlir::DiagnosedSilenceableFailure::definiteFailure(), mlir::emitSilenceableFailure(), and mlir::DiagnosedSilenceableFailure::success().

Referenced by mlir::transform::TransformState::mapBlockArgument(), and mlir::transform::TransformResults::setMappedValues().

◆ dropMappingEntry()

template<typename Mapping, typename Key, typename Mapped>
void dropMappingEntry ( Mapping & mapping,
Key key,
Mapped mapped )
static

Definition at line 313 of file TransformInterfaces.cpp.

◆ happensBefore()

bool happensBefore ( Operation * a,
Operation * b )
static

Return true if a happens before b, i.e., a or one of its ancestors properly dominates b and b is not inside a.

Definition at line 35 of file TransformInterfaces.cpp.

References b, mlir::Block::findAncestorOpInBlock(), mlir::Operation::getBlock(), mlir::Operation::getParentOp(), mlir::Operation::isBeforeInBlock(), and mlir::Operation::isProperAncestor().

◆ hasEffect()

template<typename EffectTy, typename ResourceTy, typename Range>
bool hasEffect ( Range && effects)
static

Returns true if the given list of effects instances contains an instance with the effect type specified as template parameter.

Definition at line 1806 of file TransformInterfaces.cpp.

References mlir::SideEffects::EffectInstance< EffectT >::getEffect(), and mlir::SideEffects::EffectInstance< EffectT >::getResource().

◆ remapArgumentEffects()

void remapArgumentEffects ( Block & block,
MutableArrayRef< OpOperand > operands,
SmallVectorImpl< MemoryEffects::EffectInstance > & effects )
static

Appends to effects the same effects as the operations of block have on block arguments but associated with operands.

Definition at line 1612 of file TransformInterfaces.cpp.

References mlir::SideEffects::Resource::Base< PayloadIRResource >::get(), mlir::Block::getArguments(), remapEffects(), and target.

Referenced by mlir::transform::detail::getPotentialTopLevelEffects().

◆ remapEffects()

void remapEffects ( MemoryEffectOpInterface iface,
BlockArgument source,
OpOperand * target,
SmallVectorImpl< MemoryEffects::EffectInstance > & effects )
static

Appends to effects the memory effect instances on target with the same resource and effect as the ones the operation iface having on source.

Definition at line 1600 of file TransformInterfaces.cpp.

References target.

Referenced by remapArgumentEffects().