P4C
The P4 Compiler
Loading...
Searching...
No Matches
simplifyIfStatement.h
1
18
24
#ifndef BACKENDS_TOFINO_BF_P4C_MIDEND_SIMPLIFYIFSTATEMENT_H_
25
#define BACKENDS_TOFINO_BF_P4C_MIDEND_SIMPLIFYIFSTATEMENT_H_
26
27
#include "frontends/common/resolveReferences/resolveReferences.h"
28
#include "frontends/p4/simplify.h"
29
#include "frontends/p4/typeMap.h"
30
#include "ir/ir.h"
31
32
namespace
P4
{
33
52
53
class
ElimCallExprInIfCond :
public
Transform
{
54
ReferenceMap
*refMap;
55
56
public
:
57
ElimCallExprInIfCond(
ReferenceMap
*refMap,
TypeMap
*) : refMap(refMap) {}
58
const
IR::Node
*preorder(IR::IfStatement *statement)
override
;
59
const
IR::Node
*postorder(IR::MethodCallExpression *methodCall)
override
;
60
61
IR::IndexedVector<IR::StatOrDecl>
stack;
62
};
63
69
class
SimplifyIfStatement :
public
PassManager {
70
public
:
71
SimplifyIfStatement(
ReferenceMap
*refMap,
TypeMap
*typeMap) {
72
passes.push_back(
new
ElimCallExprInIfCond
(refMap, typeMap));
73
passes.push_back(
new
SimplifyControlFlow
(typeMap));
74
}
75
};
76
77
}
// namespace P4
78
79
#endif
/* BACKENDS_TOFINO_BF_P4C_MIDEND_SIMPLIFYIFSTATEMENT_H_ */
P4::IR::IndexedVector
Definition
node.h:52
P4::IR::Node
Definition
node.h:94
P4::ReferenceMap
Class used to encode maps from paths to declarations.
Definition
referenceMap.h:66
P4::SimplifyControlFlow
Definition
simplify.h:70
P4::Transform
Definition
visitor.h:437
P4::TypeMap
Definition
typeMap.h:41
P4::ElimCallExprInIfCond
Pass that eliminates call expressions in if statement’s condition.
Definition
simplifyIfStatement.h:53
P4
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition
applyOptionsPragmas.cpp:24
backends
tofino
bf-p4c
midend
simplifyIfStatement.h
Generated by
1.13.0