P4C
The P4 Compiler
Loading...
Searching...
No Matches
backends/dpdk/options.h
1/*
2 * Copyright 2020 Intel Corp.
3 * SPDX-FileCopyrightText: 2020 Intel Corp.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef BACKENDS_DPDK_OPTIONS_H_
9#define BACKENDS_DPDK_OPTIONS_H_
10
11#include "backends/dpdk/midend.h"
12
13namespace P4::DPDK {
14
15class DpdkOptions : public CompilerOptions {
16 public:
17 std::filesystem::path bfRtSchema;
19 std::filesystem::path outputFile;
21 std::filesystem::path tdiFile;
23 std::filesystem::path ctxtFile;
25 std::filesystem::path tdiBuilderConf;
27 bool loadIRFromJson = false;
29 bool enableEgress = false;
30
31 DpdkOptions() {
32 registerOption(
33 "--listMidendPasses", nullptr,
34 [this](const char *) {
35 listMidendPasses = true;
36 DPDK::DpdkMidEnd midEnd(*this, outStream);
37 exit(0);
38 return false;
39 },
40 "[Dpdk back-end] Lists exact name of all midend passes.\n");
41 registerOption(
42 "--enableEgress", nullptr,
43 [this](const char *) {
44 enableEgress = true;
45 return true;
46 },
47 "[Dpdk back-end] Enable egress pipeline's codegen\n", OptionFlags::Hide);
48
49 registerOption(
50 "--bf-rt-schema", "file",
51 [this](const char *arg) {
52 bfRtSchema = arg;
53 return true;
54 },
55 "Generate and write BF-RT JSON schema to the specified file");
56 registerOption(
57 "-o", "outfile",
58 [this](const char *arg) {
59 outputFile = arg;
60 return true;
61 },
62 "Write output to outfile");
63 registerOption(
64 "--tdi-builder-conf", "file",
65 [this](const char *arg) {
66 tdiBuilderConf = arg;
67 return true;
68 },
69 "Generate and write the TDI builder configuration to the specified file");
70 registerOption(
71 "--tdi", "file",
72 [this](const char *arg) {
73 tdiFile = arg;
74 return true;
75 },
76 "Generate and write TDI JSON to the specified file");
77 registerOption(
78 "--context", "file",
79 [this](const char *arg) {
80 ctxtFile = arg;
81 return true;
82 },
83 "Generate and write context JSON to the specified file");
84 registerOption(
85 "--fromJSON", "file",
86 [this](const char *arg) {
87 loadIRFromJson = true;
88 file = arg;
89 return true;
90 },
91 "Use IR representation from JsonFile dumped previously,"
92 "the compilation starts with reduced midEnd.");
93 }
94
96 std::vector<const char *> *process(int argc, char *const argv[]) override;
97
98 const char *getIncludePath() const override;
99};
100
101using DpdkContext = P4CContextWithOptions<DpdkOptions>;
102
103} // namespace P4::DPDK
104
105#endif /* BACKENDS_DPDK_OPTIONS_H_ */
Definition dpdk/midend.h:17
bool loadIRFromJson
Read from JSON.
Definition backends/dpdk/options.h:27
bool enableEgress
Enable/disable Egress pipeline in PSA.
Definition backends/dpdk/options.h:29
std::filesystem::path ctxtFile
File to output context JSON to.
Definition backends/dpdk/options.h:23
std::filesystem::path tdiFile
File to output TDI JSON to.
Definition backends/dpdk/options.h:21
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:14
std::filesystem::path outputFile
File to output to.
Definition backends/dpdk/options.h:19
std::filesystem::path tdiBuilderConf
File to output the TDI builder configuration to.
Definition backends/dpdk/options.h:25
Definition parser_options.h:170
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:26