17#ifndef FRONTENDS_P4_PARSERCONTROLFLOW_H_
18#define FRONTENDS_P4_PARSERCONTROLFLOW_H_
20#include "frontends/common/resolveReferences/referenceMap.h"
21#include "frontends/p4/moveDeclarations.h"
22#include "frontends/p4/simplify.h"
23#include "frontends/p4/uniqueNames.h"
83 DoRemoveParserControlFlow() { setName(
"DoRemoveParserControlFlow"); }
84 const IR::Node *postorder(IR::ParserState *state)
override;
90class RemoveParserControlFlow :
public PassRepeated {
92 explicit RemoveParserControlFlow(
TypeMap *typeMap) : PassRepeated({}) {
95 setName(
"RemoveParserControlFlow");
104 explicit IfInParser(
bool *found) : found(found) {
106 setName(
"IfInParser");
108 void postorder(
const IR::IfStatement *)
override {
109 if (findContext<IR::P4Parser>()) *found =
true;
115class RemoveParserIfs :
public PassManager {
119 explicit RemoveParserIfs(
TypeMap *typeMap) {
122 new PassIf([
this] {
return found; },
Converts if statements in parsers into transitions.
Definition parserControlFlow.h:79
Detect whether the program contains an 'if' statement in a parser.
Definition parserControlFlow.h:100
Definition referenceMap.h:36
Definition moveDeclarations.h:34
Definition pass_manager.h:172
Definition parserControlFlow.h:90
Definition uniqueNames.h:70
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24