MLIR  19.0.0git
Functions
FoldUtils.cpp File Reference
#include "mlir/Transforms/FoldUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/Operation.h"

Go to the source code of this file.

Functions

static RegiongetInsertionRegion (DialectInterfaceCollection< DialectFoldInterface > &interfaces, Block *insertionBlock)
 Given an operation, find the parent region that folded constants should be inserted into. More...
 
static OperationmaterializeConstant (Dialect *dialect, OpBuilder &builder, Attribute value, Type type, Location loc)
 A utility function used to materialize a constant for a given attribute and type. More...
 

Function Documentation

◆ getInsertionRegion()

static Region* getInsertionRegion ( DialectInterfaceCollection< DialectFoldInterface > &  interfaces,
Block insertionBlock 
)
static

Given an operation, find the parent region that folded constants should be inserted into.

Definition at line 25 of file FoldUtils.cpp.

References mlir::Block::getParent(), and mlir::Region::getParentOp().

Referenced by mlir::OperationFolder::getOrCreateConstant().

◆ materializeConstant()

static Operation* materializeConstant ( Dialect dialect,
OpBuilder builder,
Attribute  value,
Type  type,
Location  loc 
)
static

A utility function used to materialize a constant for a given attribute and type.

On success, a valid constant value is returned. Otherwise, null is returned

Definition at line 50 of file FoldUtils.cpp.

References mlir::OpBuilder::getInsertionPoint(), mlir::m_Constant(), mlir::matchPattern(), and mlir::Dialect::materializeConstant().