17#ifndef CIRCT_ANALYSIS_AIG_ANALYSIS_H
18#define CIRCT_ANALYSIS_AIG_ANALYSIS_H
23#include "mlir/IR/BuiltinOps.h"
24#include "mlir/IR/MLIRContext.h"
25#include "llvm/ADT/ArrayRef.h"
26#include "llvm/ADT/ImmutableList.h"
27#include "llvm/ADT/SmallVector.h"
28#include "llvm/Support/JSON.h"
52 void print(llvm::raw_ostream &os)
const;
70 void Profile(llvm::FoldingSetNodeID &ID)
const {
71 for (
auto &inst :
object.instancePath) {
72 ID.AddPointer(inst.getAsOpaquePointer());
74 ID.AddPointer(
object.value.getAsOpaquePointer());
75 ID.AddInteger(
object.bitPos);
70 void Profile(llvm::FoldingSetNodeID &ID)
const {
…}
79 void print(llvm::raw_ostream &os)
const;
90 int64_t
delay = 0, llvm::ImmutableList<DebugPoint>
history = {})
98 void print(llvm::raw_ostream &os)
const;
101 llvm::ImmutableListFactory<DebugPoint> *debugPointFactory,
137 return std::get<OutputPort>(
fanOut);
150 void print(llvm::raw_ostream &os);
157 llvm::ImmutableListFactory<DebugPoint> *debugPointFactory,
190 SmallVectorImpl<DataflowPath> &results)
const;
207 SmallVectorImpl<DataflowPath> &results,
208 bool elaboratePaths =
false)
const;
214 StringAttr moduleName, SmallVectorImpl<DataflowPath> &results)
const;
220 StringAttr moduleName, SmallVectorImpl<DataflowPath> &results)
const;
228 SmallVectorImpl<DataflowPath> &results,
229 bool elaboratePaths =
false)
const;
244 return "aig.longest-path-analysis-top";
271 llvm::SmallVector<DataflowPath, 64>
paths;
291 std::tuple<circt::igraph::InstancePath, mlir::Value, size_t>>;
294 auto [path, value, bitPos] = Info::getEmptyKey();
295 return Object(path, value, bitPos);
299 auto [path, value, bitPos] = Info::getTombstoneKey();
300 return Object(path, value, bitPos);
303 return Info::getHashValue(
304 {
object.instancePath,
object.value,
object.bitPos});
const OpenPath & getPath() const
const OutputPort & getFanOutAsPort() const
const llvm::ImmutableList< DebugPoint > & getHistory() const
const Object & getFanOutAsObject() const
std::variant< Object, OutputPort > FanOutType
const FanOutType & getFanOut() const
DataflowPath & prependPaths(circt::igraph::InstancePathCache &cache, llvm::ImmutableListFactory< DebugPoint > *debugPointFactory, circt::igraph::InstancePath path)
DataflowPath(OutputPort fanOut, OpenPath fanIn, hw::HWModuleOp root)
const Object & getFanIn() const
DataflowPath(Object fanOut, OpenPath fanIn, hw::HWModuleOp root)
void printFanOut(llvm::raw_ostream &os)
std::pair< size_t, size_t > OutputPort
void print(llvm::raw_ostream &os)
hw::HWModuleOp getRoot() const
void setDelay(int64_t delay)
LongestPathAnalysisWithTrace(Operation *moduleOp, mlir::AnalysisManager &am)
LogicalResult getResults(Value value, size_t bitPos, SmallVectorImpl< DataflowPath > &results) const
LogicalResult getClosedPaths(StringAttr moduleName, SmallVectorImpl< DataflowPath > &results, bool elaboratePaths=false) const
int64_t getMaxDelay(Value value) const
int64_t getAverageMaxDelay(Value value) const
LogicalResult getAllPaths(StringAttr moduleName, SmallVectorImpl< DataflowPath > &results, bool elaboratePaths=false) const
MLIRContext * getContext() const
LogicalResult getOpenPathsFromInternalToOutputPorts(StringAttr moduleName, SmallVectorImpl< DataflowPath > &results) const
static StringRef getTopModuleNameAttrName()
llvm::ArrayRef< hw::HWModuleOp > getTopModules() const
bool isAnalysisAvailable(StringAttr moduleName) const
LogicalResult getOpenPathsFromInputPortsToInternal(StringAttr moduleName, SmallVectorImpl< DataflowPath > &results) const
const DataflowPath & getPath(unsigned index) const
void sortAndDropNonCriticalPathsPerFanOut()
MLIRContext * getContext() const
void sortInDescendingOrder()
LongestPathCollection(MLIRContext *ctx)
llvm::SmallVector< DataflowPath, 64 > paths
This graph tracks modules and where they are instantiated.
An instance path composed of a series of instances.
llvm::json::Value toJSON(const circt::aig::DataflowPath &path)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
void Profile(llvm::FoldingSetNodeID &ID) const
DebugPoint(circt::igraph::InstancePath path, Value value, size_t bitPos, int64_t delay=0, StringRef comment="")
void print(llvm::raw_ostream &os) const
circt::igraph::InstancePath instancePath
Object & prependPaths(circt::igraph::InstancePathCache &cache, circt::igraph::InstancePath path)
bool operator==(const Object &other) const
void print(llvm::raw_ostream &os) const
Object(circt::igraph::InstancePath path, Value value, size_t bitPos)
const Object & getFanIn() const
void print(llvm::raw_ostream &os) const
OpenPath(circt::igraph::InstancePath path, Value value, size_t bitPos, int64_t delay=0, llvm::ImmutableList< DebugPoint > history={})
OpenPath & prependPaths(circt::igraph::InstancePathCache &cache, llvm::ImmutableListFactory< DebugPoint > *debugPointFactory, circt::igraph::InstancePath path)
llvm::ImmutableList< DebugPoint > history
const llvm::ImmutableList< DebugPoint > & getHistory() const
A data structure that caches and provides paths to module instances in the IR.
static Object getTombstoneKey()
static llvm::hash_code getHashValue(Object object)
static Object getEmptyKey()
static bool isEqual(const Object &a, const Object &b)