CIRCT  20.0.0git
PipelineOps.h
Go to the documentation of this file.
1 //===- PipelineOps.h - Pipeline dialect operations ---------------- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef CIRCT_DIALECT_PIPELINE_PIPELINEOPS_H
10 #define CIRCT_DIALECT_PIPELINE_PIPELINEOPS_H
11 
12 #include "mlir/IR/OpImplementation.h"
13 #include "mlir/IR/RegionKindInterface.h"
14 #include "mlir/IR/SymbolTable.h"
15 #include "mlir/Interfaces/CallInterfaces.h"
16 #include "mlir/Interfaces/ControlFlowInterfaces.h"
17 #include "mlir/Interfaces/InferTypeOpInterface.h"
18 #include "mlir/Interfaces/SideEffectInterfaces.h"
19 
22 
23 namespace circt {
24 namespace pipeline {
25 class StageOp;
26 class ScheduledPipelineOp;
27 
28 // StageKind defines the control semantics of a pipeline stages.
29 enum class StageKind {
30  // All stages in a pipeline without a stall signal is a continuous stage.
31  Continuous,
32  // Stallable stages are any stages which appear **before** the first
33  // non-stallable stage in the pipeline.
34  Stallable,
35  // Non-stallable stages are the stages explicitly marked as non-stallable by
36  // the user.
38  // Runoff stages and stages that appear **after** (and by extension,
39  // **between** non-stallable stages). Runoff stages consider their own
40  // enablement wrt. the stall signal, as well as the enablement of the **last
41  // non-stallable register** (LNS) wrt. the runoff stage's position in the
42  // pipeline.
43  Runoff
44 };
45 
46 namespace detail {
47 
48 // Returns the set of values defined outside of the given region, and the
49 // operation that defines the region. This will walk the entire region so
50 // should be used with care (or cache the results).
51 llvm::SmallVector<Value> getValuesDefinedOutsideRegion(Region &region);
52 } // namespace detail
53 
54 // Determines the stage which 'op' resides in within the pipeline. This is
55 // useful for analysis of the pipeline, wherein ops may reside in nested
56 // regions within different stages of the pipeline.
57 Block *getParentStageInPipeline(ScheduledPipelineOp pipeline, Operation *op);
58 
59 // Determines the stage which 'block' resides in within the pipeline. This is
60 // useful for analysis of the pipeline, wherein blocks may reside in nested
61 // regions within different stages of the pipeline.
62 Block *getParentStageInPipeline(ScheduledPipelineOp pipeline, Block *block);
63 
64 // Determines the stage which 'v' resides in within the pipeline. This is
65 // useful for analysis of the pipeline, wherein values may reside in nested
66 // regions within different stages of the pipeline.
67 Block *getParentStageInPipeline(ScheduledPipelineOp pipeline, Value v);
68 
69 } // namespace pipeline
70 } // namespace circt
71 
72 #define GET_OP_CLASSES
73 #include "circt/Dialect/Pipeline/Pipeline.h.inc"
74 
75 #endif // CIRCT_DIALECT_PIPELINE_PIPELINEOPS_H
llvm::SmallVector< Value > getValuesDefinedOutsideRegion(Region &region)
Definition: PipelineOps.cpp:32
Block * getParentStageInPipeline(ScheduledPipelineOp pipeline, Operation *op)
Definition: PipelineOps.cpp:66
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21