P4C
The P4 Compiler
Loading...
Searching...
No Matches
collect_table_keys.h
1
19#ifndef BF_P4C_PHV_COLLECT_TABLE_KEYS_H_
20#define BF_P4C_PHV_COLLECT_TABLE_KEYS_H_
21
22#include "bf-p4c/mau/mau_visitor.h"
23#include "bf-p4c/phv/phv_fields.h"
24
25namespace PHV {
26
28 public:
29 struct TableProp {
31 int n_entries = -1;
32 bool is_tcam = false;
33 bool is_range = false;
34 };
35
36 private:
37 const PhvInfo &phv;
39
40 profile_t init_apply(const IR::Node *root) override {
41 profile_t rv = MauInspector::init_apply(root);
42 table_props.clear();
43 return rv;
44 }
45 void end_apply() override;
46 bool preorder(const IR::MAU::Table *tbl) override;
47 int get_n_entries(const IR::MAU::Table *tbl) const;
48
49 public:
50 explicit CollectTableKeys(const PhvInfo &p) : phv(p) {}
51 const TableProp &prop(const IR::MAU::Table *tbl) const { return table_props.at(tbl); }
52 const ordered_map<const IR::MAU::Table *, TableProp> &props() const { return table_props; }
53};
54
55} // namespace PHV
56
57#endif /* BF_P4C_PHV_COLLECT_TABLE_KEYS_H_ */
Definition mau_visitor.h:29
Definition node.h:95
Definition visitor.h:78
Definition ordered_map.h:32
Definition ordered_set.h:32
Definition collect_table_keys.h:27
Definition collect_table_keys.h:29
Definition phv_fields.h:1095
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32