P4C
The P4 Compiler
Loading...
Searching...
No Matches
mau_visitor.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_MAU_MAU_VISITOR_H_
20#define BACKENDS_TOFINO_BF_P4C_MAU_MAU_VISITOR_H_
21
22#include "ir/ir.h"
23
24using namespace P4;
25
26/* MAU-specific visitor subclasses that automatically prune off traversal of non-MAU
27 * parts of the tree */
28
29class MauInspector : public Inspector {
31 bool preorder(const IR::BFN::AbstractParser *) override { return false; }
32 bool preorder(const IR::BFN::AbstractDeparser *) override { return false; }
34 bool preorder(const IR::P4Parser *) override { return false; }
35 bool preorder(const IR::BFN::TnaParser *) override { return false; }
36 bool preorder(const IR::BFN::TnaDeparser *) override { return false; }
37};
38
40 // skip subtrees (of tables) that never contain tables
41 bool preorder(const IR::MAU::Action *) override { return false; }
42 bool preorder(const IR::Expression *) override { return false; }
43};
44
45class MauModifier : public Modifier {
47 bool preorder(IR::BFN::AbstractParser *) override { return false; }
48 bool preorder(IR::BFN::AbstractDeparser *) override { return false; }
50 bool preorder(IR::P4Parser *) override { return false; }
51 bool preorder(IR::BFN::TnaParser *) override { return false; }
52 bool preorder(IR::BFN::TnaDeparser *) override { return false; }
53};
54
55class MauTransform : public Transform {
57 IR::Node *preorder(IR::BFN::AbstractParser *p) override {
58 prune();
59 return p;
60 }
61 IR::Node *preorder(IR::BFN::AbstractDeparser *d) override {
62 prune();
63 return d;
64 }
66 IR::Node *preorder(IR::P4Parser *p) override {
67 prune();
68 return p;
69 }
70 IR::Node *preorder(IR::BFN::TnaParser *p) override {
71 prune();
72 return p;
73 }
74 IR::Node *preorder(IR::BFN::TnaDeparser *p) override {
75 prune();
76 return p;
77 }
78};
79
80#endif /* BACKENDS_TOFINO_BF_P4C_MAU_MAU_VISITOR_H_ */
Definition mau_visitor.h:29
Definition mau_visitor.h:45
Definition mau_visitor.h:39
Definition mau_visitor.h:55
Definition node.h:95
Definition visitor.h:400
Definition visitor.h:372
Definition visitor.h:424
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24