P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
expr_stepper.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_EXPR_STEPPER_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_EXPR_STEPPER_H_
3
4#include <cstdint>
5#include <string>
6
7#include "ir/id.h"
8#include "ir/ir.h"
9#include "ir/solver.h"
10#include "ir/vector.h"
11
12#include "backends/p4tools/modules/testgen/core/program_info.h"
13#include "backends/p4tools/modules/testgen/core/small_step/expr_stepper.h"
14#include "backends/p4tools/modules/testgen/core/small_step/small_step.h"
15#include "backends/p4tools/modules/testgen/lib/execution_state.h"
16
18
20 protected:
21 std::string getClassName() override;
22
23 private:
24 // Helper function that checks whether the given structure filed has a 'field_list' annotation
25 // and the recirculate index matches. @returns true if that is the case.
26 static bool isPartOfFieldList(const IR::StructField *field, uint64_t recirculateIndex);
27
32 void resetPreservingFieldList(ExecutionState &nextState, const IR::PathExpression *ref,
33 uint64_t recirculateIndex) const;
34
36 void processClone(const ExecutionState &state, SmallStepEvaluator::Result &result);
37
40 void processRecirculate(const ExecutionState &state, SmallStepEvaluator::Result &result);
41
42 public:
45
46 void evalExternMethodCall(const IR::MethodCallExpression *call, const IR::Expression *receiver,
47 IR::ID name, const IR::Vector<IR::Argument> *args,
48 ExecutionState &state) override;
49
50 bool preorder(const IR::P4Table * /*table*/) override;
51};
52} // namespace P4Tools::P4Testgen::Bmv2
53
54#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_EXPR_STEPPER_H_ */
Definition externInstance.h:33
ExecutionState & state
The state being evaluated.
Definition abstract_stepper.h:49
const ProgramInfo & programInfo
Target-specific information about the P4 program being evaluated.
Definition abstract_stepper.h:46
AbstractSolver & solver
The solver backing the state being executed.
Definition abstract_stepper.h:52
Result result
The output of the evaluation.
Definition abstract_stepper.h:55
void evalExternMethodCall(const IR::MethodCallExpression *call, const IR::Expression *receiver, IR::ID name, const IR::Vector< IR::Argument > *args, ExecutionState &state) override
Definition expr_stepper.cpp:292
std::string getClassName() override
Definition expr_stepper.cpp:46
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
Inja.
Definition bmv2.cpp:25