62 const IR::Expression *val =
nullptr;
65 std::set<cstring> keyreads, actions;
67 std::map<cstring, const IR::Expression *> key_remap;
70 std::set<cstring> reads, writes;
77 bool is_first_write_insert =
false;
79 std::map<cstring, VarInfo> available;
80 std::shared_ptr<std::map<cstring, TableInfo>> tables;
81 std::shared_ptr<std::map<cstring, FuncInfo>> actions;
82 std::shared_ptr<std::map<cstring, FuncInfo>> methods;
83 std::shared_ptr<std::map<cstring, FuncInfo>> states;
84 TableInfo *inferForTable =
nullptr;
85 FuncInfo *inferForFunc =
nullptr;
86 bool need_key_rewrite =
false;
87 std::function<bool(
const Context *,
const IR::Expression *)> policy;
88 bool elimUnusedTables =
false;
95 LOG8(
"flow_clone(" << uid <<
") = " << rv->uid);
98 void flow_merge(
Visitor &)
override;
102 void forOverlapAvail(
cstring, std::function<
void(
cstring, VarInfo *)>);
107 bool isHeaderUnionIsValid(
const IR::Expression *e);
111 void postorder(
const IR::AssignmentStatement *)
override;
112 void postorder(
const IR::MethodCallExpression *)
override;
113 void apply_table(TableInfo *tbl);
114 void apply_function(FuncInfo *tbl);
120 void visit_local_decl(
const IR::Declaration_Variable *);
121 const IR::Node *postorder(IR::Declaration_Variable *)
override;
122 IR::Expression *preorder(IR::Expression *m)
override;
124 const IR::Expression *postorder(IR::PathExpression *)
override;
125 const IR::Expression *preorder(IR::Member *)
override;
126 const IR::Expression *preorder(IR::ArrayIndex *)
override;
127 IR::Statement *preorder(IR::Statement *)
override;
128 IR::AssignmentStatement *preorder(IR::AssignmentStatement *)
override;
129 IR::AssignmentStatement *postorder(IR::AssignmentStatement *)
override;
130 IR::IfStatement *postorder(IR::IfStatement *)
override;
131 IR::ForStatement *preorder(IR::ForStatement *)
override;
132 IR::ForInStatement *preorder(IR::ForInStatement *)
override;
133 IR::MethodCallExpression *postorder(IR::MethodCallExpression *)
override;
134 IR::P4Action *preorder(IR::P4Action *)
override;
135 IR::P4Action *postorder(IR::P4Action *)
override;
136 IR::Function *preorder(IR::Function *)
override;
137 IR::Function *postorder(IR::Function *)
override;
138 IR::P4Control *preorder(IR::P4Control *)
override;
139 void apply_table(TableInfo *tbl);
140 void apply_function(FuncInfo *tbl);
141 IR::P4Table *preorder(IR::P4Table *)
override;
142 IR::P4Table *postorder(IR::P4Table *)
override;
143 const IR::P4Parser *postorder(IR::P4Parser *)
override;
144 IR::ParserState *preorder(IR::ParserState *)
override;
145 IR::ParserState *postorder(IR::ParserState *)
override;
146 void end_apply(
const IR::Node *node)
override;
154 std::function<
bool(
const Context *,
const IR::Expression *)> policy,
157 tables(std::make_shared<std::map<cstring, TableInfo>>()),
158 actions(std::make_shared<std::map<cstring, FuncInfo>>()),
159 methods(std::make_shared<std::map<cstring, FuncInfo>>()),
160 states(std::make_shared<std::map<cstring, FuncInfo>>()),
162 elimUnusedTables(eut) {}
Visitor mixin for looking up names in enclosing scopes from the Visitor::Context.
Definition resolveReferences.h:35