MLIR 24.0.0git
MemRefTransformOps.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "memref-transforms"
#define DBGS()
#define GET_OP_LIST
#define GET_OP_CLASSES

Functions

template<typename AllocLikeOp>
static DiagnosedSilenceableFailure checkAllocToGlobalPreconditions (AllocLikeOp allocLikeOp)
 Checks whether an allocation operation can be converted to a memref.global.
template<typename AllocLikeOp>
static DiagnosedSilenceableFailure allocLikeToGlobal (transform::TransformRewriter &rewriter, AllocLikeOp allocLikeOp, StringRef globalName, memref::GlobalOp &globalOp, memref::GetGlobalOp &getGlobalOp)
 Converts an allocation operation (memref.alloca or memref.alloc) to a memref.global operation in the nearest symbol table, and replaces the allocation with a memref.get_global operation.

Macro Definition Documentation

◆ DBGS

#define DBGS ( )
Value:
(llvm::dbgs() << '[' << DEBUG_TYPE << "] ")
#define DEBUG_TYPE

Definition at line 32 of file MemRefTransformOps.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "memref-transforms"

Definition at line 31 of file MemRefTransformOps.cpp.

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 447 of file MemRefTransformOps.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

Function Documentation

◆ allocLikeToGlobal()

template<typename AllocLikeOp>
DiagnosedSilenceableFailure allocLikeToGlobal ( transform::TransformRewriter & rewriter,
AllocLikeOp allocLikeOp,
StringRef globalName,
memref::GlobalOp & globalOp,
memref::GetGlobalOp & getGlobalOp )
static

Converts an allocation operation (memref.alloca or memref.alloc) to a memref.global operation in the nearest symbol table, and replaces the allocation with a memref.get_global operation.

Any memref.dealloc operations referencing the allocation are erased.

Definition at line 175 of file MemRefTransformOps.cpp.

References checkAllocToGlobalPreconditions(), mlir::RewriterBase::eraseOp(), mlir::Builder::getContext(), mlir::SymbolTable::getNearestSymbolTable(), mlir::SymbolTable::insert(), mlir::RewriterBase::replaceOpWithNewOp(), mlir::OpBuilder::setInsertionPoint(), mlir::DiagnosedSilenceableFailure::succeeded(), and mlir::DiagnosedSilenceableFailure::success().

◆ checkAllocToGlobalPreconditions()

template<typename AllocLikeOp>
DiagnosedSilenceableFailure checkAllocToGlobalPreconditions ( AllocLikeOp allocLikeOp)
static

Checks whether an allocation operation can be converted to a memref.global.

Definition at line 136 of file MemRefTransformOps.cpp.

References mlir::emitSilenceableFailure(), and mlir::DiagnosedSilenceableFailure::success().

Referenced by allocLikeToGlobal().