8#ifndef FRONTENDS_P4_PARSERCONTROLFLOW_H_
9#define FRONTENDS_P4_PARSERCONTROLFLOW_H_
11#include "frontends/p4/moveDeclarations.h"
12#include "frontends/p4/simplify.h"
13#include "frontends/p4/uniqueNames.h"
73 DoRemoveParserControlFlow() { setName(
"DoRemoveParserControlFlow"); }
74 const IR::Node *postorder(IR::ParserState *state)
override;
80class RemoveParserControlFlow :
public PassRepeated {
82 explicit RemoveParserControlFlow(
TypeMap *typeMap) : PassRepeated({}) {
85 setName(
"RemoveParserControlFlow");
94 explicit IfInParser(
bool *found) : found(found) {
96 setName(
"IfInParser");
98 void postorder(
const IR::IfStatement *)
override {
99 if (isInContext<IR::P4Parser>()) *found =
true;
105class RemoveParserIfs :
public PassManager {
109 explicit RemoveParserIfs(
TypeMap *typeMap) {
112 new PassIf([
this] {
return found; },
Converts if statements in parsers into transitions.
Definition parserControlFlow.h:69
Detect whether the program contains an 'if' statement in a parser.
Definition parserControlFlow.h:90
Definition referenceMap.h:36
Definition moveDeclarations.h:25
Definition ir/pass_manager.h:173
Definition parserControlFlow.h:80
Definition uniqueNames.h:61
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13