CIRCT 24.0.0git
Loading...
Searching...
No Matches
InsertMergeBlocks.cpp File Reference
#include "circt/Transforms/Passes.h"
#include "mlir/Analysis/CFGLoopInfo.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
#include "circt/Transforms/Passes.h.inc"
Include dependency graph for InsertMergeBlocks.cpp:

Go to the source code of this file.

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.

Macros

#define GEN_PASS_DEF_INSERTMERGEBLOCKS

Functions

static LogicalResult changeBranchTarget (Block *block, Block *oldDest, Block *newDest, ConversionPatternRewriter &rewriter)
 Replaces the branching to oldDest of with an equivalent operation that instead branches to newDest.
static FailureOr< Block * > buildMergeBlock (Block *b1, Block *b2, Block *oldSucc, ConversionPatternRewriter &rewriter)
 Creates a new intermediate block that b1 and b2 branch to.
static LogicalResult buildMergeBlocks (Block *currBlock, SplitInfo &splitInfo, Block *predDom, ConversionPatternRewriter &rewriter, DualGraph &graph)
 Builds a binary merge block tree for the predecessors of currBlock.
static LogicalResult preconditionCheck (Region &r, CFGLoopInfo &loopInfo)
 Checks preconditions of this transformation.
std::unique_ptr< mlir::Pass > circt::createInsertMergeBlocksPass ()

Macro Definition Documentation

◆ GEN_PASS_DEF_INSERTMERGEBLOCKS

#define GEN_PASS_DEF_INSERTMERGEBLOCKS

Definition at line 22 of file InsertMergeBlocks.cpp.

Function Documentation

◆ buildMergeBlock()

FailureOr< Block * > buildMergeBlock ( Block * b1,
Block * b2,
Block * oldSucc,
ConversionPatternRewriter & rewriter )
static

Creates a new intermediate block that b1 and b2 branch to.

The new block branches to their common successor oldSucc.

Definition at line 67 of file InsertMergeBlocks.cpp.

References changeBranchTarget(), and failure().

Referenced by buildMergeBlocks().

◆ buildMergeBlocks()

LogicalResult buildMergeBlocks ( Block * currBlock,
SplitInfo & splitInfo,
Block * predDom,
ConversionPatternRewriter & rewriter,
DualGraph & graph )
static

Builds a binary merge block tree for the predecessors of currBlock.

Definition at line 179 of file InsertMergeBlocks.cpp.

References buildMergeBlock(), failure(), mergeBlock(), and success().

◆ changeBranchTarget()

LogicalResult changeBranchTarget ( Block * block,
Block * oldDest,
Block * newDest,
ConversionPatternRewriter & rewriter )
static

Replaces the branching to oldDest of with an equivalent operation that instead branches to newDest.

Definition at line 31 of file InsertMergeBlocks.cpp.

References success().

Referenced by buildMergeBlock().

◆ preconditionCheck()

LogicalResult preconditionCheck ( Region & r,
CFGLoopInfo & loopInfo )
static

Checks preconditions of this transformation.

Definition at line 228 of file InsertMergeBlocks.cpp.

References success().