59 const IR::Expression *val =
nullptr;
62 std::set<cstring> keyreads, actions;
64 std::map<cstring, const IR::Expression *> key_remap;
67 std::set<cstring> reads, writes;
74 bool is_first_write_insert =
false;
76 std::map<cstring, VarInfo> available;
77 std::map<cstring, TableInfo> &tables;
78 std::map<cstring, FuncInfo> &actions;
79 std::map<cstring, FuncInfo> &methods;
80 std::map<cstring, FuncInfo> &states;
81 TableInfo *inferForTable =
nullptr;
82 FuncInfo *inferForFunc =
nullptr;
83 bool need_key_rewrite =
false;
84 std::function<bool(
const Context *,
const IR::Expression *)> policy;
85 bool elimUnusedTables =
false;
88 void flow_merge(Visitor &)
override;
89 void flow_copy(ControlFlowVisitor &)
override;
91 void forOverlapAvail(
cstring, std::function<
void(
cstring, VarInfo *)>);
96 bool isHeaderUnionIsValid(
const IR::Expression *e);
98 void visit_local_decl(
const IR::Declaration_Variable *);
99 const IR::Node *postorder(IR::Declaration_Variable *)
override;
100 IR::Expression *preorder(IR::Expression *m)
override;
102 const IR::Expression *postorder(IR::PathExpression *)
override;
103 const IR::Expression *preorder(IR::Member *)
override;
104 const IR::Expression *preorder(IR::ArrayIndex *)
override;
105 IR::Statement *preorder(IR::Statement *)
override;
106 IR::AssignmentStatement *preorder(IR::AssignmentStatement *)
override;
107 IR::AssignmentStatement *postorder(IR::AssignmentStatement *)
override;
108 IR::IfStatement *postorder(IR::IfStatement *)
override;
109 IR::MethodCallExpression *postorder(IR::MethodCallExpression *)
override;
110 IR::P4Action *preorder(IR::P4Action *)
override;
111 IR::P4Action *postorder(IR::P4Action *)
override;
112 IR::Function *preorder(IR::Function *)
override;
113 IR::Function *postorder(IR::Function *)
override;
114 IR::P4Control *preorder(IR::P4Control *)
override;
115 void apply_table(TableInfo *tbl);
116 void apply_function(FuncInfo *tbl);
117 IR::P4Table *preorder(IR::P4Table *)
override;
118 IR::P4Table *postorder(IR::P4Table *)
override;
119 const IR::P4Parser *postorder(IR::P4Parser *)
override;
120 IR::ParserState *preorder(IR::ParserState *)
override;
121 IR::ParserState *postorder(IR::ParserState *)
override;
122 Visitor::profile_t init_apply(
const IR::Node *node)
override;
130 std::function<
bool(
const Context *,
const IR::Expression *)> policy,
134 tables(*
new std::map<cstring, TableInfo>),
135 actions(*
new std::map<cstring, FuncInfo>),
136 methods(*
new std::map<cstring, FuncInfo>),
137 states(*
new std::map<cstring, FuncInfo>),
139 elimUnusedTables(eut) {}