19#ifndef BACKENDS_TOFINO_BF_P4C_BF_P4C_OPTIONS_H_
20#define BACKENDS_TOFINO_BF_P4C_BF_P4C_OPTIONS_H_
22#include "frontends/common/applyOptionsPragmas.h"
23#include "frontends/common/options.h"
24#include "lib/cstring.h"
25#include "logging/bf_error_reporter.h"
27class BFN_Options :
public CompilerOptions {
29 bool allowUnimplemented =
false;
30 bool debugInfo =
false;
31 bool no_deadcode_elimination =
false;
32 bool forced_placement =
false;
34 bool no_tagalong =
false;
35 float phv_scale_factor = 1;
36 float max_power = 0.0;
37 bool create_graphs =
false;
39 bool auto_init_metadata =
false;
40 bool disable_parser_state_merging =
false;
41 bool backward_compatible =
false;
42 bool display_power_budget =
false;
43 bool disable_power_check =
false;
44 bool disable_mpr_config =
false;
45 bool force_match_dependency =
false;
46 bool infer_payload_offset =
false;
47 bool parser_timing_reports =
false;
48 bool parser_bandwidth_opt =
false;
49 bool egress_intr_md_opt =
false;
50 bool disable_direct_exit =
false;
51 bool disable_long_branch =
false;
52 bool disable_dark_allocation =
false;
53 bool disable_split_attached =
false;
54 bool disable_table_placement_backfill =
false;
55 bool disable_egress_latency_padding =
false;
56 bool table_placement_in_order =
false;
57 bool table_placement_long_branch_backtrack =
false;
58 bool disable_gfm_parity =
true;
59 int relax_phv_init = 0;
60 bool quick_phv_alloc =
false;
61#ifdef ALT_PHV_ALLOC_DEFAULT
62 bool alt_phv_alloc = ALT_PHV_ALLOC_DEFAULT;
64 bool alt_phv_alloc =
false;
66 int traffic_limit = 100;
67 int num_stages_override = 0;
68 bool enable_event_logger =
false;
69 bool disable_parse_min_depth_limit =
false;
70 bool disable_parse_max_depth_limit =
false;
71 bool alt_phv_alloc_meta_init =
false;
72#if BAREFOOT_INTERNAL || 1
79 std::set<cstring> skipped_pipes;
80 bool no_power_check =
false;
81 bool stage_allocation =
false;
82 bool tof2lab44_workaround =
false;
90 bool allow_pov_aliasing =
false;
92 cstring bfRtSchema =
""_cs;
93 bool p4RuntimeForceStdExterns =
false;
95 cstring outputDir =
nullptr;
100 int v1ModelVersion = 20200408;
105 std::vector<const char *> *
process(
int argc,
char *
const argv[])
override;
113 bool processed =
false;
122 unsigned ghost_pipes = 0;
123 unsigned int inclusive_max_errors_before_enforcing_silence_other_than_the_summary = INT_MAX;
27class BFN_Options :
public CompilerOptions {
…};
174 void discoverPipes(
const IR::P4Program *,
const IR::ToplevelBlock *);
178 static cstring empty(
"");
179 if (_pipes.count(pipe_id))
return _pipes.at(pipe_id);
184 bool isPipeName(
const cstring &name) {
185 for (
auto pipe : _pipes) {
186 if (pipe.second == name)
return true;
191 BfErrorReporter &errorReporter()
override;
194 bool isRecognizedDiagnostic(cstring diagnostic)
final;
198 BFN_Options primaryOptions;
201 thread_local static BFN_Options *optionsInstance;
205 std::map<int, cstring> _pipes;
207 BfErrorReporter bfErrorReporter;
223 std::optional<CommandLineOptions> tryToParse(
const IR::Annotation *annotation)
override;
229 std::optional<CommandLineOptions> parseCompilerOption(
const IR::Annotation *annotation);
Definition bf-p4c-options.h:27
std::vector< const char * > * process(int argc, char *const argv[]) override
Process the command line arguments and set options accordingly.
Definition bf-p4c-options.cpp:674
A CompileContext for bf-p4c.
Definition bf-p4c-options.h:135
static BFNContext & get()
Definition bf-p4c-options.cpp:785
BFN_Options & options() override
Definition bf-p4c-options.cpp:789
void setBackendOptions(BFN_Options *options)
Record options created in the Backend.
Definition bf-p4c-options.cpp:791
void clearBackendOptions()
Clear the backend options.
Definition bf-p4c-options.cpp:797
cstring getOutputDirectory(const cstring &suffix=cstring(), int pipe_id=-1)
Definition bf-p4c-options.cpp:803
void discoverPipes(const IR::P4Program *, const IR::ToplevelBlock *)
identify the pipelines in the program and setup the _pipes map
Definition bf-p4c-options.cpp:837
cstring & getPipeName(int pipe_id)
Return the pipeline name or empty if the program has not been parsed.
Definition bf-p4c-options.h:177
Definition applyOptionsPragmas.h:78
The namespace encapsulating IR node classes.
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24