CIRCT 21.0.0git
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
LayerSink.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/Threading.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/ControlFlowSinkUtils.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for LayerSink.cpp:

Go to the source code of this file.

Namespaces

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

Macros

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

Functions

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

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-layer-sink"

Definition at line 24 of file LayerSink.cpp.

◆ GEN_PASS_DEF_LAYERSINK

#define GEN_PASS_DEF_LAYERSINK

Definition at line 28 of file LayerSink.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 231 of file LayerSink.cpp.

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

◆ cloneable()

static bool cloneable ( Operation *  op)
static

Definition at line 70 of file LayerSink.cpp.

◆ isAncestor()

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

Definition at line 60 of file LayerSink.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 214 of file LayerSink.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 209 of file LayerSink.cpp.

Referenced by isBarrier().