P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4tools/modules/smith/core/target.h
1#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_
2#define BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_
3
4#include <ostream>
5#include <string>
6
7#include "backends/p4tools/common/compiler/compiler_target.h"
8#include "backends/p4tools/modules/smith/common/declarations.h"
9#include "backends/p4tools/modules/smith/common/expressions.h"
10#include "backends/p4tools/modules/smith/common/parser.h"
11#include "backends/p4tools/modules/smith/common/statements.h"
12#include "backends/p4tools/modules/smith/common/table.h"
13#include "ir/ir.h"
14
15namespace P4::P4Tools::P4Smith {
16
18 public:
20 static const SmithTarget &get();
21
24 [[nodiscard]] virtual int writeTargetPreamble(std::ostream *ostream) const = 0;
25
26 [[nodiscard]] virtual const IR::P4Program *generateP4Program() const = 0;
27
28 [[nodiscard]] virtual DeclarationGenerator &declarationGenerator() const = 0;
29 [[nodiscard]] virtual ExpressionGenerator &expressionGenerator() const = 0;
30 [[nodiscard]] virtual StatementGenerator &statementGenerator() const = 0;
31 [[nodiscard]] virtual ParserGenerator &parserGenerator() const = 0;
32 [[nodiscard]] virtual TableGenerator &tableGenerator() const = 0;
33
34 [[nodiscard]] ICompileContext *makeContext() const override;
35
36 protected:
37 explicit SmithTarget(const std::string &deviceName, const std::string &archName);
38
39 private:
40};
41
42} // namespace P4::P4Tools::P4Smith
43
44#endif /* BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_ */
Definition compile_context.h:32
Encapsulates the details of invoking the P4 compiler for a target device and architecture.
Definition compiler_target.h:19
Definition declarations.h:13
Definition common/expressions.h:48
Definition p4tools/modules/smith/common/parser.h:12
Definition p4tools/modules/smith/core/target.h:17
virtual int writeTargetPreamble(std::ostream *ostream) const =0
ICompileContext * makeContext() const override
Definition p4tools/modules/smith/core/target.cpp:15
static const SmithTarget & get()
Definition p4tools/modules/smith/core/target.cpp:19