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