P4C
The P4 Compiler
Loading...
Searching...
No Matches
simplifyIfStatement.h
1
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
32namespace P4 {
33
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
62};
63
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_ */
Definition node.h:52
Definition node.h:95
Definition ir/pass_manager.h:40
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition simplify.h:70
Definition visitor.h:424
Definition typeMap.h:41
Pass that eliminates call expressions in if statement’s condition.
Definition simplifyIfStatement.h:53
Top level PassManager that governs simplification of if statements.
Definition simplifyIfStatement.h:69
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24