forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ebpfOptions.cpp
26 lines (24 loc) · 1.19 KB
/
ebpfOptions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "ebpfOptions.h"
#include "midend.h"
EbpfOptions::EbpfOptions() {
langVersion = CompilerOptions::FrontendVersion::P4_16;
registerOption("-o", "outfile",
[this](const char* arg) { outputFile = arg; return true; },
"Write output to outfile");
registerOption("--listMidendPasses", nullptr,
[this](const char*) {
loadIRFromJson = false;
listMidendPasses = true;
EBPF::MidEnd midend;
midend.run(*this, nullptr, outStream);
exit(0);
return false; },
"[ebpf back-end] Lists exact name of all midend passes.\n");
registerOption("--fromJSON", "file",
[this](const char* arg) { loadIRFromJson = true; file = arg; return true; },
"Use IR representation from JsonFile dumped previously,"
"the compilation starts with reduced midEnd.");
registerOption("--emit-externs", nullptr,
[this](const char*) { emitExterns = true; return true; },
"[ebpf back-end] Allow for user-provided implementation of extern functions.");
}