P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4tools/modules/smith/targets/nic/target.h
1#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_NIC_TARGET_H_
2#define BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_NIC_TARGET_H_
3
4#include <ostream>
5#include <string>
6
7#include "backends/p4tools/modules/smith/common/declarations.h"
8#include "backends/p4tools/modules/smith/common/expressions.h"
9#include "backends/p4tools/modules/smith/common/parser.h"
10#include "backends/p4tools/modules/smith/common/statements.h"
11#include "backends/p4tools/modules/smith/common/table.h"
12#include "backends/p4tools/modules/smith/core/target.h"
13#include "backends/p4tools/modules/smith/targets/nic/expressions.h"
14#include "ir/ir.h"
15
16namespace P4::P4Tools::P4Smith::Nic {
17
19 protected:
20 explicit AbstractNicSmithTarget(const std::string &deviceName, const std::string &archName);
21};
22
24 private:
25 DeclarationGenerator *_declarationGenerator = new DeclarationGenerator(*this);
26 ExpressionGenerator *_expressionGenerator = new NicExpressionGenerator(*this);
27 StatementGenerator *_statementGenerator = new StatementGenerator(*this);
28 ParserGenerator *_parserGenerator = new ParserGenerator(*this);
29 TableGenerator *_tableGenerator = new TableGenerator(*this);
30
31 [[nodiscard]] IR::P4Parser *generateMainParserBlock() const;
32 [[nodiscard]] IR::P4Control *generatePreControlBlock() const;
33 [[nodiscard]] IR::P4Control *generateMainControlBlock() const;
34 [[nodiscard]] IR::P4Control *generateMainDeparserBlock() const;
35
36 public:
38 static void make();
39
40 [[nodiscard]] int writeTargetPreamble(std::ostream *ostream) const override;
41
42 [[nodiscard]] const IR::P4Program *generateP4Program() const override;
43
44 [[nodiscard]] DeclarationGenerator &declarationGenerator() const override {
45 return *_declarationGenerator;
46 }
47
48 [[nodiscard]] ExpressionGenerator &expressionGenerator() const override {
49 return *_expressionGenerator;
50 }
51
52 [[nodiscard]] StatementGenerator &statementGenerator() const override {
53 return *_statementGenerator;
54 }
55
56 [[nodiscard]] ParserGenerator &parserGenerator() const override { return *_parserGenerator; }
57
58 [[nodiscard]] TableGenerator &tableGenerator() const override { return *_tableGenerator; }
59
60 private:
62};
63
64} // namespace P4::P4Tools::P4Smith::Nic
65
66#endif /* BACKENDS_P4TOOLS_MODULES_SMITH_TARGETS_NIC_TARGET_H_ */
Definition declarations.h:13
Definition common/expressions.h:48
Definition p4tools/modules/smith/targets/nic/target.h:18
Definition p4tools/modules/smith/targets/nic/target.h:23
static void make()
Registers this target.
Definition p4tools/modules/smith/targets/nic/target.cpp:39
int writeTargetPreamble(std::ostream *ostream) const override
Definition p4tools/modules/smith/targets/nic/target.cpp:383
Definition targets/nic/expressions.h:9
Definition p4tools/modules/smith/common/parser.h:12
Definition p4tools/modules/smith/core/target.h:17