P4C
The P4 Compiler
Loading...
Searching...
No Matches
build_power_graph.h
1
19#ifndef BF_P4C_MAU_BUILD_POWER_GRAPH_H_
20#define BF_P4C_MAU_BUILD_POWER_GRAPH_H_
21
22#include "backends/tofino/bf-p4c/bf-p4c-options.h"
23#include "backends/tofino/bf-p4c/ir/control_flow_visitor.h"
24#include "backends/tofino/bf-p4c/mau/default_next.h"
25#include "backends/tofino/bf-p4c/mau/jbay_next_table.h"
26#include "backends/tofino/bf-p4c/mau/simple_power_graph.h"
27#include "lib/ordered_set.h"
28#include "mau_visitor.h"
29
30namespace MauPower {
31
32using namespace P4;
33
39 public:
40 profile_t init_apply(const IR::Node *root) override;
41 bool preorder(const IR::MAU::TableSeq *seq) override;
42 bool preorder(const IR::MAU::Table *tbl) override;
47 void end_apply(const IR::Node *root) override;
48
49 BuildPowerGraph *clone() const override;
50 void flow_merge(Visitor &v) override;
51 void flow_copy(::ControlFlowVisitor &v) override;
52
53 SimplePowerGraph *get_graph(gress_t g);
54 BuildPowerGraph(const NextTable *next_table_properties, const BFN_Options &options);
55 BuildPowerGraph(const BuildPowerGraph &other) = default;
56
57 private:
58 SimplePowerGraph *ingress_graph_;
59 SimplePowerGraph *egress_graph_;
60 SimplePowerGraph *ghost_graph_;
61
62 public:
63 const NextTable *next_table_properties_;
64 const BFN_Options &options_;
65 // Keep track of which logical tables are marked as always run.
66 std::vector<UniqueId> always_run_;
67 ordered_set<UniqueId> next_for(const IR::MAU::Table *tbl, cstring what) const;
68};
69
70} // end namespace MauPower
71
72#endif /* BF_P4C_MAU_BUILD_POWER_GRAPH_H_ */
Definition bf-p4c-options.h:28
Definition mau_visitor.h:29
Definition build_power_graph.h:38
void end_apply(const IR::Node *root) override
Definition build_power_graph.cpp:52
void flow_merge(Visitor &v) override
Definition build_power_graph.cpp:141
Definition simple_power_graph.h:126
Definition next_table.h:26
Definition visitor.h:463
Definition node.h:94
Definition visitor.h:78
Definition visitor.h:75
Definition cstring.h:85
Definition ordered_set.h:32
Definition mau/asm_output.h:39
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24