P4C
The P4 Compiler
Loading...
Searching...
No Matches
control_flow_visitor.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_IR_CONTROL_FLOW_VISITOR_H_
20#define BACKENDS_TOFINO_BF_P4C_IR_CONTROL_FLOW_VISITOR_H_
21
22#include "frontends/common/resolveReferences/resolveReferences.h"
23#include "ir/ir.h"
24
25namespace BFN {
26
27class ControlFlowVisitor : public ::ControlFlowVisitor, virtual public P4::ResolutionContext {
28 protected:
48 bool filter_join_point(const IR::Node *n) override {
49 // FIXME -- we generally should NOT be filtering out Tables or TableSeqs, BUT currently
50 // the joinFlows stuff doesn't work properly, as Table::visit_children does not use
51 // a SplitFlowVisit to visit next fields, so it has trouble when a TableSeq is used in
52 // more than one place. It also depends on the visitor as to whether it makes more
53 // sense to always revisit tables/seqs that are referenced more than once, as that
54 // cam give a more accurate flow analysis (though it is more expensive)
55 return !n->is<IR::BFN::ParserState>() &&
56 // !n->is<IR::MAU::Table>() &&
57 !n->is<IR::MAU::TableSeq>();
58 }
59
60 // Helpers for visiting midend IR in control-flow order. These functions take a call
61 // or reference to a ParserState, an Action, or a Table and visit that object.
62 void visit_def(const IR::PathExpression *);
63 void visit_def(const IR::MethodCallExpression *);
64};
65
66} // end namespace BFN
67
68#endif /* BACKENDS_TOFINO_BF_P4C_IR_CONTROL_FLOW_VISITOR_H_ */
bool filter_join_point(const IR::Node *n) override
Definition control_flow_visitor.h:48
Definition visitor.h:463
Definition node.h:94
Visitor mixin for looking up names in enclosing scopes from the Visitor::Context.
Definition resolveReferences.h:35
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
bool is() const noexcept
Definition rtti.h:216