P4C
The P4 Compiler
Loading...
Searching...
No Matches
backends/p4tools/modules/smith/targets/bmv2/v1model.h
1#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_BMV2_V1MODEL_H_
2#define BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_BMV2_V1MODEL_H_
3
4#include <ostream>
5
6#include "backends/p4tools/modules/smith/common/declarations.h"
7#include "backends/p4tools/modules/smith/common/expressions.h"
8#include "backends/p4tools/modules/smith/common/parser.h"
9#include "backends/p4tools/modules/smith/common/statements.h"
10#include "backends/p4tools/modules/smith/common/table.h"
11#include "backends/p4tools/modules/smith/targets/bmv2/target.h"
12#include "ir/ir.h"
13
14namespace P4::P4Tools::P4Smith::BMv2 {
15
17 private:
18 DeclarationGenerator *_declarationGenerator = new DeclarationGenerator(*this);
19 ExpressionGenerator *_expressionGenerator = new ExpressionGenerator(*this);
20 StatementGenerator *_statementGenerator = new StatementGenerator(*this);
21 ParserGenerator *_parserGenerator = new ParserGenerator(*this);
22 TableGenerator *_tableGenerator = new TableGenerator(*this);
23
24 [[nodiscard]] IR::P4Parser *generateParserBlock() const;
25 [[nodiscard]] IR::P4Control *generateIngressBlock() const;
26 [[nodiscard]] IR::P4Control *generateUpdateBlock() const;
27 [[nodiscard]] IR::P4Control *generateVerifyBlock() const;
28 [[nodiscard]] IR::P4Control *generateEgressBlock() const;
29 [[nodiscard]] IR::P4Control *generateDeparserBlock() const;
30
31 public:
33 static void make();
34
35 [[nodiscard]] int writeTargetPreamble(std::ostream *ostream) const override;
36
37 [[nodiscard]] const IR::P4Program *generateP4Program() const override;
38
39 [[nodiscard]] DeclarationGenerator &declarationGenerator() const override {
40 return *_declarationGenerator;
41 }
42
43 [[nodiscard]] ExpressionGenerator &expressionGenerator() const override {
44 return *_expressionGenerator;
45 }
46
47 [[nodiscard]] StatementGenerator &statementGenerator() const override {
48 return *_statementGenerator;
49 }
50
51 [[nodiscard]] ParserGenerator &parserGenerator() const override { return *_parserGenerator; }
52
53 [[nodiscard]] TableGenerator &tableGenerator() const override { return *_tableGenerator; }
54
55 private:
57};
58
59} // namespace P4::P4Tools::P4Smith::BMv2
60
61#endif /* BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_BMV2_V1MODEL_H_ */
Definition p4tools/modules/smith/targets/bmv2/target.h:10
Definition backends/p4tools/modules/smith/targets/bmv2/v1model.h:16
int writeTargetPreamble(std::ostream *ostream) const override
Definition backends/p4tools/modules/smith/targets/bmv2/v1model.cpp:319
static void make()
Registers this target.
Definition backends/p4tools/modules/smith/targets/bmv2/v1model.cpp:32
Definition declarations.h:13
Definition common/expressions.h:48
Definition p4tools/modules/smith/common/parser.h:12