MLIR  20.0.0git
Classes | Macros | Functions
SCF.cpp File Reference
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Interfaces/ValueBoundsOpInterface.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/SCF/IR/SCFOpsDialect.cpp.inc"
#include "mlir/Dialect/SCF/IR/SCFOps.cpp.inc"

Go to the source code of this file.

Classes

struct  SingleBlockExecuteInliner
 
struct  MultiBlockExecuteInliner
 
struct  FoldConstantCase
 

Macros

#define GET_OP_LIST
 
#define GET_OP_CLASSES
 

Functions

template<typename TerminatorTy >
static TerminatorTy verifyAndGetTerminator (Operation *op, Region &region, StringRef errorMessage)
 Verifies that the first block of the given region is terminated by a TerminatorTy. More...
 
static void replaceOpWithRegion (PatternRewriter &rewriter, Operation *op, Region &region, ValueRange blockArgs={})
 Replaces the given op with the contents of the given single-block region, using the operands of the block terminator to replace operation results. More...
 
static void printInitializationList (OpAsmPrinter &p, Block::BlockArgListType blocksArgs, ValueRange initializers, StringRef prefix="")
 Prints the initialization list in the form of <prefix>(inner = outer, inner2 = outer2, <...>) where 'inner' values are assumed to be region arguments and 'outer' values are regular SSA values. More...
 
template<typename OpTy >
static LogicalResult verifyTypeRangesMatch (OpTy op, TypeRange left, TypeRange right, StringRef message)
 Verifies that two ranges of types match, i.e. More...
 
static ParseResult parseSwitchCases (OpAsmParser &p, DenseI64ArrayAttr &cases, SmallVectorImpl< std::unique_ptr< Region >> &caseRegions)
 Parse the case regions and values. More...
 
static void printSwitchCases (OpAsmPrinter &p, Operation *op, DenseI64ArrayAttr cases, RegionRange caseRegions)
 Print the case regions and values. More...
 

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 4364 of file SCF.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

Function Documentation

◆ parseSwitchCases()

static ParseResult parseSwitchCases ( OpAsmParser p,
DenseI64ArrayAttr cases,
SmallVectorImpl< std::unique_ptr< Region >> &  caseRegions 
)
static

◆ printInitializationList()

static void printInitializationList ( OpAsmPrinter p,
Block::BlockArgListType  blocksArgs,
ValueRange  initializers,
StringRef  prefix = "" 
)
static

Prints the initialization list in the form of <prefix>(inner = outer, inner2 = outer2, <...>) where 'inner' values are assumed to be region arguments and 'outer' values are regular SSA values.

Definition at line 431 of file SCF.cpp.

◆ printSwitchCases()

static void printSwitchCases ( OpAsmPrinter p,
Operation op,
DenseI64ArrayAttr  cases,
RegionRange  caseRegions 
)
static

Print the case regions and values.

Definition at line 4205 of file SCF.cpp.

References mlir::detail::DenseArrayAttrImpl< T >::asArrayRef(), mlir::OpAsmPrinter::printNewline(), and mlir::OpAsmPrinter::printRegion().

◆ replaceOpWithRegion()

static void replaceOpWithRegion ( PatternRewriter rewriter,
Operation op,
Region region,
ValueRange  blockArgs = {} 
)
static

Replaces the given op with the contents of the given single-block region, using the operands of the block terminator to replace operation results.

Definition at line 112 of file SCF.cpp.

Referenced by SingleBlockExecuteInliner::matchAndRewrite().

◆ verifyAndGetTerminator()

template<typename TerminatorTy >
static TerminatorTy verifyAndGetTerminator ( Operation op,
Region region,
StringRef  errorMessage 
)
static

Verifies that the first block of the given region is terminated by a TerminatorTy.

Reports errors on the given operation if it is not the case.

Definition at line 92 of file SCF.cpp.

References mlir::Block::back(), diag(), mlir::Operation::emitOpError(), mlir::Block::empty(), mlir::Region::empty(), mlir::Region::front(), and mlir::Operation::getLoc().

◆ verifyTypeRangesMatch()

template<typename OpTy >
static LogicalResult verifyTypeRangesMatch ( OpTy  op,
TypeRange  left,
TypeRange  right,
StringRef  message 
)
static

Verifies that two ranges of types match, i.e.

have the same number of entries and that types are pairwise equals. Reports errors on the given operation in case of mismatch.

Definition at line 3436 of file SCF.cpp.

References diag().