CIRCT  20.0.0git
Namespaces | Macros | Functions
AdvancedLayerSink.cpp File Reference
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Support/Debug.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/Iterators.h"
#include "mlir/IR/Threading.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/ControlFlowSinkUtils.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for AdvancedLayerSink.cpp:

Go to the source code of this file.

Namespaces

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

Macros

#define DEBUG_TYPE   "firrtl-layer-sink"
 
#define GEN_PASS_DEF_ADVANCEDLAYERSINK
 

Functions

static bool isAncestor (Block *block, Block *other)
 
static bool isValidDest (Operation *op)
 True if this operation is a good site to sink operations. More...
 
static bool isBarrier (Operation *op)
 True if we are prevented from sinking operations into the regions of the op. More...
 
static Demand clamp (Operation *op, Demand demand)
 Adjust the demand based on the location of the op being demanded. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-layer-sink"

Definition at line 25 of file AdvancedLayerSink.cpp.

◆ GEN_PASS_DEF_ADVANCEDLAYERSINK

#define GEN_PASS_DEF_ADVANCEDLAYERSINK

Definition at line 29 of file AdvancedLayerSink.cpp.

Function Documentation

◆ clamp()

static Demand clamp ( Operation *  op,
Demand  demand 
)
static

Adjust the demand based on the location of the op being demanded.

Ideally, we can sink an op directly to its site of use. However, there are two issues.

1) Typically, an op will dominate every demand, but for hardware declarations such as wires, the declaration will demand any connections driving it. In this case, the relationship is reversed: the demander dominates the demandee. This can cause us to pull connect-like ops up and and out of their enclosing block (ref-defines can be buried under layerblocks). To avoid this, we set an upper bound on the demand: the enclosing block of the demandee.

2) not all regions are valid sink targets. If there is a sink-barrier between the operation and its demand, we adjust the demand upwards so that there is no sink barrier between the demandee and the demand site.

Definition at line 207 of file AdvancedLayerSink.cpp.

References assert(), isAncestor(), and isBarrier().

◆ isAncestor()

static bool isAncestor ( Block *  block,
Block *  other 
)
static

Definition at line 61 of file AdvancedLayerSink.cpp.

Referenced by clamp().

◆ isBarrier()

static bool isBarrier ( Operation *  op)
static

True if we are prevented from sinking operations into the regions of the op.

Definition at line 190 of file AdvancedLayerSink.cpp.

References isValidDest().

Referenced by clamp().

◆ isValidDest()

static bool isValidDest ( Operation *  op)
static

True if this operation is a good site to sink operations.

Definition at line 185 of file AdvancedLayerSink.cpp.

Referenced by isBarrier().