40 std::vector<IR::Vector<IR::Declaration>> toMove;
41 void push() { toMove.emplace_back(); }
43 BUG_CHECK(!toMove.empty(),
"Empty move stack");
47 BUG_CHECK(!toMove.empty(),
"Empty move stack");
51 BUG_CHECK(!toMove.empty(),
"Empty move stack");
54 void addMove(
const IR::Declaration *decl) { getMoves().push_back(decl); }
57 explicit MoveDeclarations(
bool parsersOnly =
false) : parsersOnly(parsersOnly) {
58 setName(
"MoveDeclarations");
61 void end_apply(
const IR::Node *)
override { BUG_CHECK(toMove.empty(),
"Non empty move stack"); }
62 const IR::Node *preorder(IR::P4Action *action)
override {
67 if (findContext<IR::P4Control>() ==
nullptr)
73 const IR::Node *preorder(IR::P4Control *control)
override {
81 const IR::Node *preorder(IR::P4Parser *parser)
override {
85 const IR::Node *preorder(IR::Function *function)
override {
93 const IR::Node *postorder(IR::P4Action *action)
override;
94 const IR::Node *postorder(IR::P4Control *control)
override;
95 const IR::Node *postorder(IR::P4Parser *parser)
override;
96 const IR::Node *postorder(IR::Function *function)
override;
97 const IR::Node *postorder(IR::Declaration_Variable *decl)
override;
98 const IR::Node *postorder(IR::Declaration_Constant *decl)
override;
Visitor mixin for looking up names in enclosing scopes from the Visitor::Context.
Definition resolveReferences.h:35
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24