P4C
The P4 Compiler
Loading...
Searching...
No Matches
backends/dpdk/options.h
1/*
2Copyright 2020 Intel Corp.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef BACKENDS_DPDK_OPTIONS_H_
18#define BACKENDS_DPDK_OPTIONS_H_
19
20#include "backends/dpdk/midend.h"
21
22namespace P4::DPDK {
23
25 public:
26 std::filesystem::path bfRtSchema;
28 std::filesystem::path outputFile;
30 std::filesystem::path tdiFile;
32 std::filesystem::path ctxtFile;
34 std::filesystem::path tdiBuilderConf;
36 bool loadIRFromJson = false;
38 bool enableEgress = false;
39
40 DpdkOptions() {
41 registerOption(
42 "--listMidendPasses", nullptr,
43 [this](const char *) {
44 listMidendPasses = true;
45 DPDK::DpdkMidEnd midEnd(*this, outStream);
46 exit(0);
47 return false;
48 },
49 "[Dpdk back-end] Lists exact name of all midend passes.\n");
50 registerOption(
51 "--enableEgress", nullptr,
52 [this](const char *) {
53 enableEgress = true;
54 return true;
55 },
56 "[Dpdk back-end] Enable egress pipeline's codegen\n", OptionFlags::Hide);
57
58 registerOption(
59 "--bf-rt-schema", "file",
60 [this](const char *arg) {
61 bfRtSchema = arg;
62 return true;
63 },
64 "Generate and write BF-RT JSON schema to the specified file");
65 registerOption(
66 "-o", "outfile",
67 [this](const char *arg) {
68 outputFile = arg;
69 return true;
70 },
71 "Write output to outfile");
72 registerOption(
73 "--tdi-builder-conf", "file",
74 [this](const char *arg) {
75 tdiBuilderConf = arg;
76 return true;
77 },
78 "Generate and write the TDI builder configuration to the specified file");
79 registerOption(
80 "--tdi", "file",
81 [this](const char *arg) {
82 tdiFile = arg;
83 return true;
84 },
85 "Generate and write TDI JSON to the specified file");
86 registerOption(
87 "--context", "file",
88 [this](const char *arg) {
89 ctxtFile = arg;
90 return true;
91 },
92 "Generate and write context JSON to the specified file");
93 registerOption(
94 "--fromJSON", "file",
95 [this](const char *arg) {
96 loadIRFromJson = true;
97 file = arg;
98 return true;
99 },
100 "Use IR representation from JsonFile dumped previously,"
101 "the compilation starts with reduced midEnd.");
102 }
103
105 std::vector<const char *> *process(int argc, char *const argv[]) override;
106
107 const char *getIncludePath() const override;
108};
109
110using DpdkContext = P4CContextWithOptions<DpdkOptions>;
111
112} // namespace P4::DPDK
113
114#endif /* BACKENDS_DPDK_OPTIONS_H_ */
Definition frontends/common/options.h:30
Definition dpdk/midend.h:26
Definition backends/dpdk/options.h:24
bool loadIRFromJson
Read from JSON.
Definition backends/dpdk/options.h:36
bool enableEgress
Enable/disable Egress pipeline in PSA.
Definition backends/dpdk/options.h:38
std::filesystem::path ctxtFile
File to output context JSON to.
Definition backends/dpdk/options.h:32
std::filesystem::path tdiFile
File to output TDI JSON to.
Definition backends/dpdk/options.h:30
std::vector< const char * > * process(int argc, char *const argv[]) override
Process the command line arguments and set options accordingly.
Definition backends/dpdk/options.cpp:10
std::filesystem::path outputFile
File to output to.
Definition backends/dpdk/options.h:28
std::filesystem::path tdiBuilderConf
File to output the TDI builder configuration to.
Definition backends/dpdk/options.h:34
Definition parser_options.h:167
std::filesystem::path file
file to compile (- for stdin)
Definition parser_options.h:74
@ Hide
Hide this option from –help message.
Definition lib/options.h:41
Definition dpdk/backend.cpp:36