MLIR
21.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/Dominance.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 | ValueVector = SmallVector< Value, 1 > |
A vector of SSA values, optimized for the most common case of a single value. 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... | |
static OpBuilder::InsertPoint | computeInsertPoint (ArrayRef< Value > vals) |
Helper function that computes an insertion point where the given values are defined and can be used without a dominance violation. 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 31 of file DialectConversion.cpp.
using ValueVector = SmallVector<Value, 1> |
A vector of SSA values, optimized for the most common case of a single value.
Definition at line 100 of file DialectConversion.cpp.
|
static |
Definition at line 3201 of file DialectConversion.cpp.
Referenced by mlir::ConversionTarget::markOpRecursivelyLegal().
|
static |
Helper function that computes an insertion point where the given values are defined and can be used without a dominance violation.
Definition at line 69 of file DialectConversion.cpp.
References computeInsertPoint(), mlir::DominanceInfo::dominates(), mlir::OpBuilder::InsertPoint::getBlock(), and mlir::OpBuilder::InsertPoint::getPoint().
|
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 59 of file DialectConversion.cpp.
References mlir::Block::begin(), and mlir::Value::getParentBlock().
Referenced by computeInsertPoint(), mlir::detail::ConversionPatternRewriterImpl::findOrBuildReplacementValue(), mlir::detail::ConversionPatternRewriterImpl::notifyOpReplaced(), and mlir::detail::ConversionPatternRewriterImpl::remapValues().
|
static |
Definition at line 3040 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 3397 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 |
Definition at line 2605 of file DialectConversion.cpp.
References diag(), mlir::OperandRange::getTypes(), 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 48 of file DialectConversion.cpp.
|
static |
A utility function to log a successful result for the given reason.
Definition at line 35 of file DialectConversion.cpp.
|
static |
Remap the given value using the rewriter and the type converter in the provided config.
Definition at line 3299 of file DialectConversion.cpp.
References mlir::ConversionPatternRewriter::getRemappedValues().
Referenced by mlir::registerConversionPDLFunctions().