P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
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 DPDK {
23
25 public:
26 cstring bfRtSchema = "";
27 // File to output to.
28 cstring outputFile = nullptr;
29 // File to output TDI JSON to.
30 cstring tdiFile = "";
31 // File to output context JSON to.
32 cstring ctxtFile = "";
33 // File to output the TDI builder configuration to.
34 cstring tdiBuilderConf = "";
35 // Read from JSON.
36 bool loadIRFromJson = false;
37 // Enable/disable Egress pipeline in PSA.
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() override;
108};
109
111
112} // namespace DPDK
113
114#endif /* BACKENDS_DPDK_OPTIONS_H_ */
Definition options.h:26
Definition midend.h:26
Definition options.h:24
std::vector< const char * > * process(int argc, char *const argv[]) override
Process the command line arguments and set options accordingly.
Definition options.cpp:8
Definition parser_options.h:167
@ Hide
Hide this option from –help message.
Definition options.h:40
Definition cstring.h:72
Definition backend.cpp:35