MLIR  19.0.0git
Macros | Functions
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 "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.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_TYPE_FULL   "transform-dialect-full"
 
#define DEBUG_PRINT_AFTER_ALL   "transform-dialect-print-top-level-after-all"
 
#define DBGS()   (llvm::dbgs() << "[" DEBUG_TYPE "] ")
 
#define LDBG(X)   LLVM_DEBUG(DBGS() << (X))
 
#define FULL_LDBG(X)   DEBUG_WITH_TYPE(DEBUG_TYPE_FULL, (DBGS() << (X)))
 

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. More...
 
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. More...
 
template<typename Mapping , typename Key , typename Mapped >
void dropMappingEntry (Mapping &mapping, Key key, Mapped mapped)
 
template<typename T >
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, Value 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. More...
 
static void remapArgumentEffects (Block &block, ValueRange operands, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Appends to effects the same effects as the operations of block have on block arguments but associated with operands. More...
 
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. More...
 

Macro Definition Documentation

◆ DBGS

#define DBGS ( )    (llvm::dbgs() << "[" DEBUG_TYPE "] ")

Definition at line 25 of file TransformInterfaces.cpp.

◆ 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 22 of file TransformInterfaces.cpp.

◆ DEBUG_TYPE_FULL

#define DEBUG_TYPE_FULL   "transform-dialect-full"

Definition at line 23 of file TransformInterfaces.cpp.

◆ FULL_LDBG

#define FULL_LDBG (   X)    DEBUG_WITH_TYPE(DEBUG_TYPE_FULL, (DBGS() << (X)))

Definition at line 27 of file TransformInterfaces.cpp.

◆ LDBG

#define LDBG (   X)    LLVM_DEBUG(DBGS() << (X))

Definition at line 26 of file TransformInterfaces.cpp.

Function Documentation

◆ castVector()

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

Definition at line 1494 of file TransformInterfaces.cpp.

◆ checkRepeatedConsumptionInOperand()

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

◆ dispatchMappedValues()

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 
)
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 137 of file TransformInterfaces.cpp.

References mlir::Value::getType().

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 
)

Definition at line 308 of file TransformInterfaces.cpp.

◆ happensBefore()

static 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 37 of file TransformInterfaces.cpp.

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

◆ hasEffect()

template<typename EffectTy , typename ResourceTy , typename Range >
static 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 1788 of file TransformInterfaces.cpp.

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

◆ remapArgumentEffects()

static void remapArgumentEffects ( Block block,
ValueRange  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 1593 of file TransformInterfaces.cpp.

◆ remapEffects()

static void remapEffects ( MemoryEffectOpInterface  iface,
BlockArgument  source,
Value  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 1582 of file TransformInterfaces.cpp.