78 bool hasJumped =
false;
82 bool movedToIfBranch =
false;
84 bool preorder(IR::BlockStatement *)
override;
85 bool moveFromParentTo(
const IR::Statement *&child);
86 bool preorder(IR::IfStatement *)
override;
87 bool preorder(IR::SwitchStatement *)
override;
88 void postorder(IR::LoopStatement *)
override;
94 bool preorder(IR::BreakStatement *)
override {
return branch(); }
95 bool preorder(IR::ContinueStatement *)
override {
return branch(); }
96 bool preorder(IR::ExitStatement *)
override {
return branch(); }
97 bool preorder(IR::ReturnStatement *)
override {
return branch(); }
99 bool preorder(IR::Expression *)
override {
return false; }
130 std::vector<TernaryBool> stack;
131 void push() { stack.push_back(TernaryBool::No); }
132 void pop() { stack.pop_back(); }
133 void set(TernaryBool r) {
134 BUG_CHECK(!stack.empty(),
"Empty stack");
137 TernaryBool hasReturned() {
138 BUG_CHECK(!stack.empty(),
"Empty stack");
144 : variableName(varName), retValName(retValName) {
145 visitDagOnce =
false;
146 setName(
"DoRemoveReturns");
149 const IR::Node *preorder(IR::Function *function)
override;
150 const IR::Node *preorder(IR::BlockStatement *statement)
override;
151 const IR::Node *preorder(IR::ReturnStatement *statement)
override;
152 const IR::Node *preorder(IR::ExitStatement *statement)
override;
153 const IR::Node *preorder(IR::IfStatement *statement)
override;
154 const IR::Node *preorder(IR::SwitchStatement *statement)
override;
156 const IR::Node *preorder(IR::P4Action *action)
override;
157 const IR::Node *preorder(IR::P4Control *control)
override;
158 const IR::Node *preorder(IR::P4Parser *parser)
override {
163 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