MLIR  20.0.0git
Namespaces | Macros | Typedefs | Functions
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/Support/GenericIteratedDominanceFrontier.h"
#include "mlir/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define GEN_PASS_DEF_MEM2REG
 
#define DEBUG_TYPE   "mem2reg"
 

Typedefs

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

Functions

static const DenseMap< Block *, size_t > & getOrCreateBlockIndices (BlockIndexCache &blockIndexCache, Region *region)
 Gets or creates a block index mapping for region. More...
 
static void dominanceSort (SmallVector< Operation * > &ops, Region &region, BlockIndexCache &blockIndexCache)
 Sorts ops according to dominance. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mem2reg"

Definition at line 29 of file Mem2Reg.cpp.

◆ GEN_PASS_DEF_MEM2REG

#define GEN_PASS_DEF_MEM2REG

Definition at line 25 of file Mem2Reg.cpp.

Typedef Documentation

◆ IDFCalculator

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

Definition at line 389 of file Mem2Reg.cpp.

Function Documentation

◆ dominanceSort()

static 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.

Definition at line 542 of file Mem2Reg.cpp.

References mlir::Operation::getBlock(), getOrCreateBlockIndices(), and mlir::Operation::isBeforeInBlock().

◆ getOrCreateBlockIndices()

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

Gets or creates a block index mapping for region.

Definition at line 527 of file Mem2Reg.cpp.

References mlir::detail::enumerate(), and mlir::getBlocksSortedByDominance().

Referenced by dominanceSort().