P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
options.h
1/*
2Copyright 2013-present Barefoot Networks, Inc.
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/* -*-C++-*- */
18
19#ifndef FRONTENDS_COMMON_OPTIONS_H_
20#define FRONTENDS_COMMON_OPTIONS_H_
21
22#include "parser_options.h"
23// for p4::P4RuntimeFormat definition
24#include "control-plane/p4RuntimeTypes.h"
25
27 protected:
28 // Checks if parsed options make sense with respect to each-other.
29 void validateOptions() const override;
30
31 public:
33
34 // If true, skip frontend passes whose names are contained in
35 // passesToExcludeFrontend vector.
36 bool excludeFrontendPasses = false;
37 bool listFrontendPasses = false;
38 // If true, skip midend passes whose names are contained in
39 // passesToExcludeMidend vector.
40 bool excludeMidendPasses = false;
41 bool listMidendPasses = false;
42 // If true, skip backend passes whose names are contained in
43 // passesToExcludeBackend vector.
44 bool excludeBackendPasses = false;
45 // Strings matched against pass names that should be excluded from frontend
46 // passes.
47 std::vector<cstring> passesToExcludeFrontend;
48 // Strings matched against pass names that should be excluded from midend
49 // passes.
50 std::vector<cstring> passesToExcludeMidend;
51 // Strings matched against pass names that should be excluded from backend
52 // passes.
53 std::vector<cstring> passesToExcludeBackend;
54 // Dump a JSON representation of the IR in the file.
55 cstring dumpJsonFile = nullptr;
56 // Dump and undump the IR tree.
57 bool debugJson = false;
58 // if this flag is true, compile program in non-debug mode.
59 bool ndebug = false;
60 // Write a P4Runtime control plane API description to the specified file.
61 cstring p4RuntimeFile = nullptr;
62 // Write static table entries as a P4Runtime WriteRequest message to the
63 // specified file.
64 cstring p4RuntimeEntriesFile = nullptr;
65 // Write P4Runtime control plane API description to the specified files.
66 cstring p4RuntimeFiles = nullptr;
67 // Write static table entries as a P4Runtime WriteRequest message to the
68 // specified files.
69 cstring p4RuntimeEntriesFiles = nullptr;
70 // Choose format for P4Runtime API description.
71 P4::P4RuntimeFormat p4RuntimeFormat = P4::P4RuntimeFormat::BINARY;
72 // Pretty-print the program in the specified file.
73 cstring prettyPrintFile = nullptr;
74 // Target.
75 cstring target = nullptr;
76 // Architecture.
77 cstring arch = nullptr;
78 // If true, unroll all parser loops inside the midend.
79 bool loopsUnrolling = false;
80
81 // General optimization options -- can be interpreted by backends in various ways
82 int optimizationLevel = 1;
83 bool optimizeDebug = false; // optimize favoring debuggability
84 bool optimizeSize = false; // optimize favoring size
85
86 virtual bool enable_intrinsic_metadata_fix();
87};
88#endif /* FRONTENDS_COMMON_OPTIONS_H_ */
Definition options.h:26
Definition parser_options.h:39
Definition cstring.h:72
P4RuntimeFormat
P4Runtime serialization formats.
Definition p4RuntimeTypes.h:23