MLIR  20.0.0git
Classes | Namespaces | Macros | Typedefs | Functions
DialectConversion.cpp File Reference
#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 OperationfindCommonAncestor (ArrayRef< Operation * > ops)
 Find a common IsolatedFromAbove ancestor of the given ops. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "dialect-conversion"

Definition at line 30 of file DialectConversion.cpp.

Typedef Documentation

◆ ReplacementValues

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.

Function Documentation

◆ composeLegalityCallbacks()

◆ computeInsertPoint()

static OpBuilder::InsertPoint computeInsertPoint ( Value  value)
static

◆ convertFuncOpTypes()

static LogicalResult convertFuncOpTypes ( FunctionOpInterface  funcOp,
const TypeConverter typeConverter,
ConversionPatternRewriter rewriter 
)
static

◆ findCommonAncestor()

static Operation* findCommonAncestor ( ArrayRef< Operation * >  ops)
static

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().

◆ hasRewrite()

template<typename RewriteTy , typename R >
static bool hasRewrite ( R &&  rewrites,
Operation op 
)
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().

◆ legalizeUnresolvedMaterialization()

static LogicalResult legalizeUnresolvedMaterialization ( RewriterBase rewriter,
UnresolvedMaterializationRewrite *  rewrite 
)
static

◆ logFailure()

template<typename... Args>
static void logFailure ( llvm::ScopedPrinter &  os,
StringRef  fmt,
Args &&...  args 
)
static

A utility function to log a failure result for the given reason.

Definition at line 47 of file DialectConversion.cpp.

◆ logSuccess()

template<typename... Args>
static void logSuccess ( llvm::ScopedPrinter &  os,
StringRef  fmt,
Args &&...  args 
)
static

A utility function to log a successful result for the given reason.

Definition at line 34 of file DialectConversion.cpp.

◆ pdllConvertValues()

static FailureOr<SmallVector<Value> > pdllConvertValues ( ConversionPatternRewriter rewriter,
ValueRange  values 
)
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().