P4C
The P4 Compiler
Loading...
Searching...
No Matches
final_state.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_FINAL_STATE_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_FINAL_STATE_H_
3
4#include <functional>
5#include <optional>
6#include <vector>
7
8#include "backends/p4tools/common/lib/model.h"
9#include "backends/p4tools/common/lib/trace_event.h"
10#include "ir/solver.h"
11#include "midend/coverage.h"
12
13#include "backends/p4tools/modules/testgen/lib/concolic.h"
14#include "backends/p4tools/modules/testgen/lib/execution_state.h"
15
16namespace P4::P4Tools::P4Testgen {
17
20 private:
23 std::reference_wrapper<AbstractSolver> solver;
24
26 std::reference_wrapper<const ExecutionState> state;
27
29 std::reference_wrapper<const Model> finalModel;
30
32 std::vector<std::reference_wrapper<const TraceEvent>> trace;
33
37 static void calculatePayload(const ExecutionState &executionState, Model &evaluatedModel);
38
42 static Model &processModel(const ExecutionState &finalState, Model &model,
43 bool postProcess = true);
44
45 public:
49
51 FinalState(AbstractSolver &solver, const ExecutionState &finalState, const Model &finalModel);
52
59 [[nodiscard]] std::optional<std::reference_wrapper<const FinalState>> computeConcolicState(
60 const ConcolicVariableMap &resolvedConcolicVariables) const;
61
63 [[nodiscard]] const Model &getFinalModel() const;
64
66 [[nodiscard]] AbstractSolver &getSolver() const;
67
69 [[nodiscard]] const ExecutionState *getExecutionState() const;
70
72 [[nodiscard]] const std::vector<std::reference_wrapper<const TraceEvent>> *getTraces() const;
73
75 [[nodiscard]] const P4::Coverage::CoverageSet &getVisited() const;
76};
77
78} // namespace P4::P4Tools::P4Testgen
79
80#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_LIB_FINAL_STATE_H_ */
Provides a higher-level interface for an SMT solver.
Definition solver.h:24
Definition backends/p4tools/common/lib/model.h:19
Represents state of execution after having reached a program point.
Definition execution_state.h:34
Represents the final state after execution.
Definition final_state.h:19
const std::vector< std::reference_wrapper< const TraceEvent > > * getTraces() const
Definition final_state.cpp:114
std::optional< std::reference_wrapper< const FinalState > > computeConcolicState(const ConcolicVariableMap &resolvedConcolicVariables) const
Definition final_state.cpp:66
FinalState(AbstractSolver &solver, const ExecutionState &finalState)
Definition final_state.cpp:24
const Model & getFinalModel() const
Definition final_state.cpp:108
const ExecutionState * getExecutionState() const
Definition final_state.cpp:112
AbstractSolver & getSolver() const
Definition final_state.cpp:110
const P4::Coverage::CoverageSet & getVisited() const
Definition final_state.cpp:118
std::set< const IR::Node *, SourceIdCmp > CoverageSet
Definition coverage.h:39
Definition phv/solver/action_constraint_solver.cpp:33