MLIR 23.0.0git
Mem2Reg.cpp File Reference
#include "mlir/Transforms/Mem2Reg.h"
#include "mlir/Analysis/DataLayoutAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Analysis/TopologicalSortUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/RegionKindInterface.h"
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/MemorySlotInterfaces.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/DebugLog.h"
#include "llvm/Support/GenericIteratedDominanceFrontier.h"
#include "mlir/Transforms/Passes.h.inc"

Go to the source code of this file.

Classes

class  mlir::impl::Mem2RegBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::impl
 Attribute collections provide a dictionary-like interface.

Macros

#define GEN_PASS_DEF_MEM2REG
#define DEBUG_TYPE   "mem2reg"

Typedefs

using IDFCalculator = llvm::IDFCalculatorBase<Block, false>

Functions

std::unique_ptr<::mlir::Passmlir::impl::createMem2Reg ()
std::unique_ptr<::mlir::Passmlir::impl::createMem2Reg (Mem2RegOptions options)
std::unique_ptr<::mlir::Passmlir::createMem2Reg ()
std::unique_ptr<::mlir::Passmlir::createMem2Reg (Mem2RegOptions options)
static const DenseMap< Block *, size_t > & getOrCreateBlockIndices (BlockIndexCache &blockIndexCache, Block *regionEntryBlock)
 Gets or creates a block index mapping for the region of which the entry block is regionEntryBlock.
static void dominanceSort (SmallVector< Operation * > &ops, Region &region, BlockIndexCache &blockIndexCache)
 Sorts ops according to dominance.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mem2reg"

Definition at line 31 of file Mem2Reg.cpp.

◆ GEN_PASS_DEF_MEM2REG

#define GEN_PASS_DEF_MEM2REG

Definition at line 27 of file Mem2Reg.cpp.

Typedef Documentation

◆ IDFCalculator

using IDFCalculator = llvm::IDFCalculatorBase<Block, false>

Definition at line 475 of file Mem2Reg.cpp.

Function Documentation

◆ dominanceSort()

void dominanceSort ( SmallVector< Operation * > & ops,
Region & region,
BlockIndexCache & blockIndexCache )
static

Sorts ops according to dominance.

Relies on the topological order of basic blocks to get a deterministic ordering. Uses blockIndexCache to avoid the potentially expensive recomputation of a block index map. This function assumes no blocks are ever deleted or entry block changed during the lifetime of the block index cache.

Definition at line 707 of file Mem2Reg.cpp.

References mlir::Region::empty(), mlir::Region::front(), getOrCreateBlockIndices(), lhs, and rhs.

◆ getOrCreateBlockIndices()

const DenseMap< Block *, size_t > & getOrCreateBlockIndices ( BlockIndexCache & blockIndexCache,
Block * regionEntryBlock )
static

Gets or creates a block index mapping for the region of which the entry block is regionEntryBlock.

Definition at line 688 of file Mem2Reg.cpp.

References mlir::getBlocksSortedByDominance(), mlir::Block::getParent(), and inserted().

Referenced by dominanceSort().