MLIR
20.0.0git
|
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Config/mlir-config.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Iterators.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Rewrite/PatternApplicator.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/ScopedPrinter.h"
#include <optional>
Go to the source code of this file.
Classes | |
struct | mlir::detail::ConversionPatternRewriterImpl |
struct | mlir::detail::ConversionPatternRewriterImpl::SingleEraseRewriter |
A rewriter that keeps track of erased ops and blocks. More... | |
struct | mlir::OperationConverter |
Namespaces | |
mlir | |
Include the generated interface declarations. | |
mlir::detail | |
AttrTypeReplacer. | |
Macros | |
#define | DEBUG_TYPE "dialect-conversion" |
Typedefs | |
using | ReplacementValues = SmallVector< Value, 1 > |
A list of replacement SSA values. More... | |
Functions | |
template<typename... Args> | |
static void | logSuccess (llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) |
A utility function to log a successful result for the given reason. More... | |
template<typename... Args> | |
static void | logFailure (llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) |
A utility function to log a failure result for the given reason. More... | |
static OpBuilder::InsertPoint | computeInsertPoint (Value value) |
Helper function that computes an insertion point where the given value is defined and can be used without a dominance violation. More... | |
template<typename RewriteTy , typename R > | |
static bool | hasRewrite (R &&rewrites, Operation *op) |
Return "true" if there is an operation rewrite that matches the specified rewrite type and operation among the given rewrites. More... | |
static LogicalResult | legalizeUnresolvedMaterialization (RewriterBase &rewriter, UnresolvedMaterializationRewrite *rewrite) |
static LogicalResult | convertFuncOpTypes (FunctionOpInterface funcOp, const TypeConverter &typeConverter, ConversionPatternRewriter &rewriter) |
static ConversionTarget::DynamicLegalityCallbackFn | composeLegalityCallbacks (ConversionTarget::DynamicLegalityCallbackFn oldCallback, ConversionTarget::DynamicLegalityCallbackFn newCallback) |
static FailureOr< SmallVector< Value > > | pdllConvertValues (ConversionPatternRewriter &rewriter, ValueRange values) |
Remap the given value using the rewriter and the type converter in the provided config. More... | |
static Operation * | findCommonAncestor (ArrayRef< Operation * > ops) |
Find a common IsolatedFromAbove ancestor of the given ops. More... | |
#define DEBUG_TYPE "dialect-conversion" |
Definition at line 30 of file DialectConversion.cpp.
using ReplacementValues = SmallVector<Value, 1> |
A list of replacement SSA values.
Optimized for the common case of a single SSA value.
Definition at line 72 of file DialectConversion.cpp.
|
static |
Definition at line 3102 of file DialectConversion.cpp.
Referenced by mlir::ConversionTarget::markOpRecursivelyLegal().
|
static |
Helper function that computes an insertion point where the given value is defined and can be used without a dominance violation.
Definition at line 58 of file DialectConversion.cpp.
References mlir::Block::begin(), and mlir::Value::getParentBlock().
Referenced by mlir::detail::ConversionPatternRewriterImpl::findOrBuildReplacementValue(), mlir::detail::ConversionPatternRewriterImpl::insertNTo1Materialization(), mlir::detail::ConversionPatternRewriterImpl::notifyOpReplaced(), and mlir::detail::ConversionPatternRewriterImpl::remapValues().
|
static |
Definition at line 2941 of file DialectConversion.cpp.
References mlir::ConversionPatternRewriter::convertRegionTypes(), mlir::TypeConverter::convertSignatureArgs(), mlir::TypeConverter::convertTypes(), mlir::get(), mlir::Builder::getContext(), mlir::TypeConverter::SignatureConversion::getConvertedTypes(), and mlir::RewriterBase::modifyOpInPlace().
Find a common IsolatedFromAbove ancestor of the given ops.
If at least one op is a top-level module op (which is expected to be isolated from above), return that op.
Definition at line 3298 of file DialectConversion.cpp.
References mlir::Operation::getParentOp(), mlir::Operation::getParentWithTrait(), mlir::Operation::hasTrait(), mlir::Operation::isAncestor(), and mlir::Operation::isProperAncestor().
Referenced by mlir::applyAnalysisConversion().
|
static |
Return "true" if there is an operation rewrite that matches the specified rewrite type and operation among the given rewrites.
Definition at line 717 of file DialectConversion.cpp.
References rewrite().
|
static |
Definition at line 2506 of file DialectConversion.cpp.
References diag(), mlir::Value::getType(), mlir::OperandRange::getTypes(), mlir::TypeConverter::materializeArgumentConversion(), mlir::TypeConverter::materializeSourceConversion(), mlir::TypeConverter::materializeTargetConversion(), mlir::RewriterBase::replaceOp(), rewrite(), and mlir::OpBuilder::setInsertionPoint().
Referenced by mlir::OperationConverter::convertOperations().
|
static |
A utility function to log a failure result for the given reason.
Definition at line 47 of file DialectConversion.cpp.
|
static |
A utility function to log a successful result for the given reason.
Definition at line 34 of file DialectConversion.cpp.
|
static |
Remap the given value using the rewriter and the type converter in the provided config.
Definition at line 3200 of file DialectConversion.cpp.
References mlir::ConversionPatternRewriter::getRemappedValues().
Referenced by mlir::registerConversionPDLFunctions().