P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
target.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_
3
4#include <filesystem>
5#include <string>
6
7#include "backends/p4tools/common/compiler/compiler_target.h"
8#include "backends/p4tools/common/core/target.h"
9#include "backends/p4tools/common/lib/arch_spec.h"
10#include "ir/ir.h"
11#include "ir/solver.h"
12
13#include "backends/p4tools/modules/testgen/core/program_info.h"
14#include "backends/p4tools/modules/testgen/core/small_step/cmd_stepper.h"
15#include "backends/p4tools/modules/testgen/core/small_step/expr_stepper.h"
16#include "backends/p4tools/modules/testgen/core/symbolic_executor/symbolic_executor.h"
17#include "backends/p4tools/modules/testgen/lib/execution_state.h"
18#include "backends/p4tools/modules/testgen/lib/test_backend.h"
19
20namespace P4Tools::P4Testgen {
21
22class TestgenTarget : public Target {
23 public:
25 static const TestgenTarget &get();
26
30 static const ProgramInfo *produceProgramInfo(const CompilerResult &compilerResult);
31
33 static TestBackEnd *getTestBackend(const ProgramInfo &programInfo,
34 const TestBackendConfiguration &testBackendConfiguration,
35 SymbolicExecutor &symbex);
36
38 static CmdStepper *getCmdStepper(ExecutionState &state, AbstractSolver &solver,
39 const ProgramInfo &programInfo);
40
42 static ExprStepper *getExprStepper(ExecutionState &state, AbstractSolver &solver,
43 const ProgramInfo &programInfo);
44
45 protected:
47 [[nodiscard]] const ProgramInfo *produceProgramInfoImpl(
48 const CompilerResult &compilerResult) const;
49
52 const CompilerResult &compilerResult, const IR::Declaration_Instance *mainDecl) const = 0;
53
56 const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration,
57 SymbolicExecutor &symbex) const = 0;
58
60 virtual CmdStepper *getCmdStepperImpl(ExecutionState &state, AbstractSolver &solver,
61 const ProgramInfo &programInfo) const = 0;
62
64 virtual ExprStepper *getExprStepperImpl(ExecutionState &state, AbstractSolver &solver,
65 const ProgramInfo &programInfo) const = 0;
66
67 explicit TestgenTarget(std::string deviceName, std::string archName);
68};
69
70} // namespace P4Tools::P4Testgen
71
72#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_ */
Definition compiler_target.h:21
Implements small-step operational semantics for commands.
Definition cmd_stepper.h:20
Represents state of execution after having reached a program point.
Definition execution_state.h:34
Implements small-step operational semantics for expressions.
Definition expr_stepper.h:20
Stores target-specific information about a P4 program.
Definition program_info.h:22
Definition symbolic_executor.h:21
Definition test_backend.h:23
Definition target.h:22
virtual CmdStepper * getCmdStepperImpl(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo) const =0
static TestBackEnd * getTestBackend(const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration, SymbolicExecutor &symbex)
Returns the test back end associated with this P4Testgen target.
Definition target.cpp:43
static ExprStepper * getExprStepper(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo)
Provides a ExprStepper implementation for this target.
Definition target.cpp:53
static const TestgenTarget & get()
Definition target.cpp:41
static const ProgramInfo * produceProgramInfo(const CompilerResult &compilerResult)
Definition target.cpp:49
const ProgramInfo * produceProgramInfoImpl(const CompilerResult &compilerResult) const
Definition target.cpp:21
virtual const ProgramInfo * produceProgramInfoImpl(const CompilerResult &compilerResult, const IR::Declaration_Instance *mainDecl) const =0
static CmdStepper * getCmdStepper(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo)
Provides a CmdStepper implementation for this target.
Definition target.cpp:58
virtual ExprStepper * getExprStepperImpl(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo) const =0
virtual TestBackEnd * getTestBackendImpl(const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration, SymbolicExecutor &symbex) const =0
Definition target.h:17
Definition test_backend_configuration.h:16