77 bool hasJumped =
false;
81 bool movedToIfBranch =
false;
83 bool preorder(IR::BlockStatement *)
override;
84 bool moveFromParentTo(
const IR::Statement *&child);
85 bool preorder(IR::IfStatement *)
override;
86 bool preorder(IR::SwitchStatement *)
override;
87 void postorder(IR::LoopStatement *)
override;
93 bool preorder(IR::BreakStatement *)
override {
return branch(); }
94 bool preorder(IR::ContinueStatement *)
override {
return branch(); }
95 bool preorder(IR::ExitStatement *)
override {
return branch(); }
96 bool preorder(IR::ReturnStatement *)
override {
return branch(); }
98 bool preorder(IR::Expression *)
override {
return false; }
129 std::vector<TernaryBool> stack;
130 void push() { stack.push_back(TernaryBool::No); }
131 void pop() { stack.pop_back(); }
132 void set(TernaryBool r) {
133 BUG_CHECK(!stack.empty(),
"Empty stack");
136 TernaryBool hasReturned() {
137 BUG_CHECK(!stack.empty(),
"Empty stack");
143 : variableName(varName), retValName(retValName) {
144 visitDagOnce =
false;
145 setName(
"DoRemoveReturns");
148 const IR::Node *preorder(IR::Function *function)
override;
149 const IR::Node *preorder(IR::BlockStatement *statement)
override;
150 const IR::Node *preorder(IR::ReturnStatement *statement)
override;
151 const IR::Node *preorder(IR::ExitStatement *statement)
override;
152 const IR::Node *preorder(IR::IfStatement *statement)
override;
153 const IR::Node *preorder(IR::SwitchStatement *statement)
override;
155 const IR::Node *preorder(IR::P4Action *action)
override;
156 const IR::Node *preorder(IR::P4Control *control)
override;
157 const IR::Node *preorder(IR::P4Parser *parser)
override {
162 const IR::Node *postorder(IR::LoopStatement *loop)
override;
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24