17#ifndef FRONTENDS_P4_PARSERCONTROLFLOW_H_
18#define FRONTENDS_P4_PARSERCONTROLFLOW_H_
20#include "frontends/p4/moveDeclarations.h"
21#include "frontends/p4/simplify.h"
22#include "frontends/p4/uniqueNames.h"
82 DoRemoveParserControlFlow() { setName(
"DoRemoveParserControlFlow"); }
83 const IR::Node *postorder(IR::ParserState *state)
override;
89class RemoveParserControlFlow :
public PassRepeated {
91 explicit RemoveParserControlFlow(
TypeMap *typeMap) : PassRepeated({}) {
94 setName(
"RemoveParserControlFlow");
103 explicit IfInParser(
bool *found) : found(found) {
105 setName(
"IfInParser");
107 void postorder(
const IR::IfStatement *)
override {
108 if (isInContext<IR::P4Parser>()) *found =
true;
114class RemoveParserIfs :
public PassManager {
118 explicit RemoveParserIfs(
TypeMap *typeMap) {
121 new PassIf([
this] {
return found; },
Converts if statements in parsers into transitions.
Definition parserControlFlow.h:78
Detect whether the program contains an 'if' statement in a parser.
Definition parserControlFlow.h:99
Definition referenceMap.h:36
Definition moveDeclarations.h:34
Definition ir/pass_manager.h:172
Definition parserControlFlow.h:89
Definition uniqueNames.h:70
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24