P4C
The P4 Compiler
Loading...
Searching...
No Matches
collect_coverable_nodes.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_COLLECT_COVERABLE_NODES_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_COLLECT_COVERABLE_NODES_H_
3
4#include <set>
5
6#include "ir/ir.h"
7#include "ir/visitor.h"
8#include "midend/coverage.h"
9
10#include "backends/p4tools/modules/testgen/lib/execution_state.h"
11
12namespace P4::P4Tools::P4Testgen {
13
15using NodeCache = std::map<const IR::Node *, P4::Coverage::CoverageSet>;
16
24 P4::Coverage::CoverageSet coverableNodes;
25
27 std::reference_wrapper<const ExecutionState> state;
28
30 std::set<int> seenParserIds;
31
33 P4::Coverage::CoverageOptions coverageOptions;
34
36 bool preorder(const IR::ParserState *parserState) override;
37 bool preorder(const IR::AssignmentStatement *stmt) override;
38 bool preorder(const IR::MethodCallStatement *stmt) override;
39 bool preorder(const IR::ExitStatement *stmt) override;
40 bool preorder(const IR::MethodCallExpression *call) override;
41
43 bool preorder(const IR::P4Action *act) override;
44
45 public:
46 explicit CoverableNodesScanner(const ExecutionState &state);
47
51
54};
55
56} // namespace P4::P4Tools::P4Testgen
57
58#endif /*BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_COLLECT_COVERABLE_NODES_H_*/
Definition node.h:94
Definition visitor.h:400
Definition collect_coverable_nodes.h:22
void updateNodeCoverage(const IR::Node *node, P4::Coverage::CoverageSet &nodes)
Definition collect_coverable_nodes.cpp:139
const P4::Coverage::CoverageSet & getCoverableNodes()
Definition collect_coverable_nodes.cpp:135
Represents state of execution after having reached a program point.
Definition execution_state.h:34
std::set< const IR::Node *, SourceIdCmp > CoverageSet
Definition coverage.h:39
Specifies general options and which IR nodes to track with this particular visitor.
Definition coverage.h:25