P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4tools/modules/testgen/core/target.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_
3
4#include <string>
5
6#include "backends/p4tools/common/compiler/compiler_target.h"
7#include "ir/ir.h"
8#include "ir/solver.h"
9
10#include "backends/p4tools/modules/testgen/core/program_info.h"
11#include "backends/p4tools/modules/testgen/core/small_step/cmd_stepper.h"
12#include "backends/p4tools/modules/testgen/core/small_step/expr_stepper.h"
13#include "backends/p4tools/modules/testgen/core/symbolic_executor/symbolic_executor.h"
14#include "backends/p4tools/modules/testgen/lib/execution_state.h"
15#include "backends/p4tools/modules/testgen/lib/test_backend.h"
16
17namespace P4::P4Tools::P4Testgen {
18
20 public:
22 static const TestgenTarget &get();
23
27 static const ProgramInfo *produceProgramInfo(const CompilerResult &compilerResult);
28
30 static TestBackEnd *getTestBackend(const ProgramInfo &programInfo,
31 const TestBackendConfiguration &testBackendConfiguration,
32 SymbolicExecutor &symbex);
33
36 const ProgramInfo &programInfo);
37
40 const ProgramInfo &programInfo);
41
42 protected:
44 [[nodiscard]] const ProgramInfo *produceProgramInfoImpl(
45 const CompilerResult &compilerResult) const;
46
49 const CompilerResult &compilerResult, const IR::Declaration_Instance *mainDecl) const = 0;
50
53 const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration,
54 SymbolicExecutor &symbex) const = 0;
55
58 const ProgramInfo &programInfo) const = 0;
59
62 const ProgramInfo &programInfo) const = 0;
63
64 explicit TestgenTarget(const std::string &deviceName, const std::string &archName);
65
67 const IR::P4Program *program) const override;
68};
69
70} // namespace P4::P4Tools::P4Testgen
71
72#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_TARGET_H_ */
Provides a higher-level interface for an SMT solver.
Definition solver.h:24
Definition frontends/common/options.h:30
Definition common/compiler/compiler_result.h:14
Encapsulates the details of invoking the P4 compiler for a target device and architecture.
Definition compiler_target.h:20
Implements small-step operational semantics for commands.
Definition core/small_step/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 core/small_step/expr_stepper.h:20
Stores target-specific information about a P4 program.
Definition core/program_info.h:21
Definition symbolic_executor.h:21
Definition lib/test_backend.h:23
Definition p4tools/modules/testgen/core/target.h:19
CompilerResultOrError runCompilerImpl(const CompilerOptions &options, const IR::P4Program *program) const override
Definition p4tools/modules/testgen/core/target.cpp:63
virtual ExprStepper * getExprStepperImpl(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo) const =0
static const ProgramInfo * produceProgramInfo(const CompilerResult &compilerResult)
Definition p4tools/modules/testgen/core/target.cpp:49
virtual TestBackEnd * getTestBackendImpl(const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration, SymbolicExecutor &symbex) const =0
virtual CmdStepper * getCmdStepperImpl(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo) const =0
static CmdStepper * getCmdStepper(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo)
Provides a CmdStepper implementation for this target.
Definition p4tools/modules/testgen/core/target.cpp:58
static ExprStepper * getExprStepper(ExecutionState &state, AbstractSolver &solver, const ProgramInfo &programInfo)
Provides a ExprStepper implementation for this target.
Definition p4tools/modules/testgen/core/target.cpp:53
virtual const ProgramInfo * produceProgramInfoImpl(const CompilerResult &compilerResult, const IR::Declaration_Instance *mainDecl) const =0
static const TestgenTarget & get()
Definition p4tools/modules/testgen/core/target.cpp:41
static TestBackEnd * getTestBackend(const ProgramInfo &programInfo, const TestBackendConfiguration &testBackendConfiguration, SymbolicExecutor &symbex)
Returns the test back end associated with this P4Testgen target.
Definition p4tools/modules/testgen/core/target.cpp:43
const ProgramInfo * produceProgramInfoImpl(const CompilerResult &compilerResult) const
Definition p4tools/modules/testgen/core/target.cpp:21
std::optional< std::reference_wrapper< const CompilerResult > > CompilerResultOrError
Definition common/compiler/compiler_result.h:31
Definition test_backend_configuration.h:16