19#ifndef BF_P4C_MAU_TABLE_INJECTED_DEPS_H_
20#define BF_P4C_MAU_TABLE_INJECTED_DEPS_H_
25#include "bf-p4c/common/field_defuse.h"
26#include "bf-p4c/ir/control_flow_visitor.h"
27#include "bf-p4c/mau/table_flow_graph.h"
28#include "bf-p4c/mau/table_mutex.h"
29#include "bf-p4c/mau/table_summary.h"
30#include "bf-p4c/phv/phv_fields.h"
31#include "lib/ordered_map.h"
32#include "lib/ordered_set.h"
33#include "mau_visitor.h"
34#include "table_dependency_graph.h"
39 bool preorder(
const IR::MAU::TableSeq *seq)
override;
54 std::map<cstring, const IR::MAU::Table *> name_to_table;
56 bool edge(
const IR::MAU::Table *a,
const IR::MAU::Table *b)
const {
57 if (edges_to_add.count(a) == 0)
return false;
58 return edges_to_add.at(a).count(b);
62 : dg(d), ctrl_paths(cp) {}
66 auto rv = MauInspector::init_apply(node);
71 void postorder(
const IR::MAU::Table *tbl)
override;
72 void end_apply()
override;
78 bool tables_placed =
false;
83 auto rv = MauInspector::init_apply(node);
84 tables_placed =
false;
88 bool preorder(
const IR::MAU::Table *table)
override {
89 tables_placed |= table->is_placed();
95 : dg(dg), ctrl_paths(cp) {}
106 std::map<cstring, const IR::MAU::Table *> name_to_table;
109 auto rv = AbstractDependencyInjector::init_apply(node);
110 name_to_table.clear();
114 bool preorder(
const IR::MAU::Table *t)
override {
115 auto rv = AbstractDependencyInjector::preorder(t);
116 name_to_table[t->name] = t;
120 void end_apply()
override;
131 void postorder(
const IR::MAU::Table *table)
override;
140 std::map<gress_t, std::vector<const IR::MAU::Table *>> run_before_exit_tables;
143 LOG3(
"InjectControlExitDependencies begins");
144 auto rv = AbstractDependencyInjector::init_apply(node);
145 run_before_exit_tables.clear();
149 void end_apply(
const IR::Node *node)
override {
150 Visitor::end_apply(node);
151 link_run_before_exit_tables();
152 LOG3(
"InjectControlExitDependencies ends");
155 bool preorder(
const IR::MAU::Table *table)
override;
156 void postorder(
const IR::MAU::Table *table)
override;
158 void collect_run_before_exit_table(
const IR::MAU::Table *table);
159 void inject_dependencies_from_gress_root_tables_to_first_rbe_table(
160 const IR::MAU::Table *first_rbe_table);
161 bool is_first_run_before_exit_table_in_gress(
const IR::MAU::Table *rbe_table);
162 const IR::MAU::TableSeq *get_gress_root_table_seq(
const IR::MAU::Table *table);
163 void link_run_before_exit_tables();
164 void inject_control_exit_dependency(
const IR::MAU::Table *source,
165 const IR::MAU::Table *destination);
175 std::map<UniqueId, const IR::MAU::Table *> id_to_table;
178 auto rv = AbstractDependencyInjector::init_apply(node);
184 bool preorder(
const IR::MAU::Table *)
override;
185 void end_apply()
override;
188 const IR::MAU::Table *getTable(
UniqueId uid);
206 auto rv = PassManager::init_apply(root);
231 void end_apply()
override;
236 : phv(p), dg(g), defuse(du), mutex(mu) {}
Common functionality for injecting dependencies into a DependencyGraph.
Definition table_injected_deps.h:76
Definition bf-p4c-options.h:28
Definition table_dependency_graph.h:938
Definition table_dependency_graph.h:972
Definition table_injected_deps.h:128
Definition table_injected_deps.h:38
Definition table_injected_deps.h:139
Definition table_injected_deps.h:172
Definition table_injected_deps.h:225
Definition mau_visitor.h:29
Definition ir/pass_manager.h:40
Definition unique_id.h:168
Definition ordered_map.h:32
Definition phv_fields.h:1095
Definition table_injected_deps.h:48
Definition table_injected_deps.h:196
Definition table_summary.h:158
Definition mau/table_mutex.h:110
Definition field_defuse.h:77
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition table_dependency_graph.h:52
Definition table_flow_graph.h:45
void clear()
Clears the state in this FlowGraph.
Definition table_flow_graph.h:191