CIRCT 21.0.0git
Loading...
Searching...
No Matches
OpCountAnalysis.h
Go to the documentation of this file.
1//===- OpCountAnalysis.h - operation count analyses -----------------------===//
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// This header file defines prototypes for methods that perform analysis
10// involving the frequency of different kinds of operations found in a
11// builtin.module.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef CIRCT_ANALYSIS_OPCOUNT_ANALYSIS_H
16#define CIRCT_ANALYSIS_OPCOUNT_ANALYSIS_H
17
18#include "circt/Support/LLVM.h"
19#include "mlir/IR/Operation.h"
20#include "llvm/ADT/DenseMap.h"
21
22namespace mlir {
23class AnalysisManager;
24} // namespace mlir
25namespace circt {
26namespace analysis {
27
29public:
30 OpCountAnalysis(Operation *moduleOp, mlir::AnalysisManager &am);
31
32 /// Get the frequency of operations of a specific name
33 size_t getOpCount(OperationName opName);
34
35 /// Get the names of all distinct operations found by the analysis
36 SmallVector<OperationName> getFoundOpNames();
37
38 /// Get a map from number of operands to corresponding frequency for the given
39 /// operation
40 DenseMap<size_t, size_t> getOperandCountMap(OperationName opName);
41
42private:
43 DenseMap<OperationName, size_t> opCounts;
44 DenseMap<OperationName, DenseMap<size_t, size_t>> operandCounts;
45};
46
47} // namespace analysis
48} // namespace circt
49
50#endif // CIRCT_ANALYSIS_OPCOUNT_ANALYSIS_H
size_t getOpCount(OperationName opName)
Get the frequency of operations of a specific name.
DenseMap< size_t, size_t > getOperandCountMap(OperationName opName)
Get a map from number of operands to corresponding frequency for the given operation.
DenseMap< OperationName, DenseMap< size_t, size_t > > operandCounts
DenseMap< OperationName, size_t > opCounts
SmallVector< OperationName > getFoundOpNames()
Get the names of all distinct operations found by the analysis.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.