P4C
The P4 Compiler
Loading...
Searching...
No Matches
check_design_pattern.h
1
47#ifndef BACKENDS_TOFINO_BF_P4C_MIDEND_CHECK_DESIGN_PATTERN_H_
48#define BACKENDS_TOFINO_BF_P4C_MIDEND_CHECK_DESIGN_PATTERN_H_
49
50#include "bf-p4c-options.h"
51#include "frontends/common/resolveReferences/referenceMap.h"
52#include "frontends/p4/methodInstance.h"
53#include "frontends/p4/typeMap.h"
54#include "ir/ir.h"
55
56namespace BFN {
72 P4::ReferenceMap *refMap;
73 P4::TypeMap *typeMap;
74
75 public:
77 : refMap(refMap), typeMap(typeMap) {}
78 bool preorder(const IR::MethodCallExpression *) override;
79};
80
85typedef std::map<const IR::P4Action *, std::vector<const P4::ExternMethod *>> ActionExterns;
90 P4::ReferenceMap *refMap;
91 P4::TypeMap *typeMap;
92 ActionExterns &directExterns;
93
94 public:
95 FindDirectExterns(P4::ReferenceMap *refMap, P4::TypeMap *typeMap, ActionExterns &directExterns)
96 : refMap(refMap), typeMap(typeMap), directExterns(directExterns) {}
97 bool preorder(const IR::MethodCallExpression *) override;
98 profile_t init_apply(const IR::Node *root) override;
99};
100
105 P4::ReferenceMap *refMap;
106 ActionExterns &directExterns;
107
108 public:
110 ActionExterns &directExterns)
111 : refMap(refMap), directExterns(directExterns) {}
112 bool preorder(IR::P4Table *) override;
113};
114
124 ActionExterns directExterns;
125
126 public:
127 static const std::map<cstring, cstring> externsToProperties;
129 passes.push_back(new FindDirectExterns(refMap, typeMap, directExterns));
130 passes.push_back(new CheckDirectExternsOnTables(refMap, typeMap, directExterns));
131 }
132};
133
144 public:
146 bool preorder(const IR::P4Table *) override;
147};
148
154 public:
156 passes.push_back(new CheckExternValidity(refMap, typeMap));
157 if (BackendOptions().arch != "v1model")
158 passes.push_back(new CheckDirectResourceInvocation(refMap, typeMap));
159 }
160};
161
162} // namespace BFN
163
164#endif // BACKENDS_TOFINO_BF_P4C_MIDEND_CHECK_DESIGN_PATTERN_H_
Definition check_design_pattern.h:143
Definition node.h:94
Definition visitor.h:400
Definition visitor.h:372
Definition ir/pass_manager.h:40
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition typeMap.h:41
Definition visitor.h:78
bool preorder(const IR::MethodCallExpression *) override
Definition check_design_pattern.cpp:23
Top level PassManager that governs checking for design patterns.
Definition check_design_pattern.h:153
Definition check_design_pattern.h:104
Definition check_design_pattern.h:123
Checks if the emit function call is valid with the TNA constraints.
Definition check_design_pattern.h:71
Definition check_design_pattern.h:89
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21