P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4tools/modules/smith/core/target.h
1
/*
2
* SPDX-FileCopyrightText: 2024 The P4 Language Consortium
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_
8
#define BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_
9
10
#include <ostream>
11
#include <string>
12
13
#include "backends/p4tools/common/compiler/compiler_target.h"
14
#include "backends/p4tools/modules/smith/common/declarations.h"
15
#include "backends/p4tools/modules/smith/common/expressions.h"
16
#include "backends/p4tools/modules/smith/common/parser.h"
17
#include "backends/p4tools/modules/smith/common/statements.h"
18
#include "backends/p4tools/modules/smith/common/table.h"
19
#include "ir/ir.h"
20
21
namespace
P4::P4Tools::P4Smith {
22
23
class
SmithTarget :
public
CompilerTarget {
24
public
:
26
static
const
SmithTarget &
get
();
27
30
[[nodiscard]]
virtual
int
writeTargetPreamble
(std::ostream *ostream)
const
= 0;
31
32
[[nodiscard]]
virtual
const
IR::P4Program *generateP4Program()
const
= 0;
33
34
[[nodiscard]]
virtual
DeclarationGenerator
&declarationGenerator()
const
= 0;
35
[[nodiscard]]
virtual
ExpressionGenerator
&expressionGenerator()
const
= 0;
36
[[nodiscard]]
virtual
StatementGenerator
&statementGenerator()
const
= 0;
37
[[nodiscard]]
virtual
ParserGenerator
&parserGenerator()
const
= 0;
38
[[nodiscard]]
virtual
TableGenerator
&tableGenerator()
const
= 0;
39
40
[[nodiscard]]
ICompileContext
*
makeContext
()
const override
;
41
42
protected
:
43
explicit
SmithTarget(
const
std::string &deviceName,
const
std::string &archName);
44
45
private
:
46
};
47
48
}
// namespace P4::P4Tools::P4Smith
49
50
#endif
/* BACKENDS_P4TOOLS_MODULES_SMITH_CORE_TARGET_H_ */
P4::ICompileContext
Definition
compile_context.h:23
P4::P4Tools::P4Smith::DeclarationGenerator
Definition
declarations.h:19
P4::P4Tools::P4Smith::ExpressionGenerator
Definition
common/expressions.h:54
P4::P4Tools::P4Smith::ParserGenerator
Definition
p4tools/modules/smith/common/parser.h:18
P4::P4Tools::P4Smith::SmithTarget::writeTargetPreamble
virtual int writeTargetPreamble(std::ostream *ostream) const =0
P4::P4Tools::P4Smith::SmithTarget::makeContext
ICompileContext * makeContext() const override
Definition
p4tools/modules/smith/core/target.cpp:19
P4::P4Tools::P4Smith::SmithTarget::get
static const SmithTarget & get()
Definition
p4tools/modules/smith/core/target.cpp:23
P4::P4Tools::P4Smith::StatementGenerator
Definition
statements.h:16
P4::P4Tools::P4Smith::TableGenerator
Definition
table.h:17
backends
p4tools
modules
smith
core
target.h
Generated by
1.13.2