P4C
The P4 Compiler
Loading...
Searching...
No Matches
bindVariables.h
1#ifndef FRONTENDS_P4_TYPECHECKING_BINDVARIABLES_H_
2#define FRONTENDS_P4_TYPECHECKING_BINDVARIABLES_H_
3
4#include "frontends/p4/typeChecking/typeChecker.h"
5#include "frontends/p4/typeMap.h"
6#include "ir/ir.h"
7
8namespace P4 {
9
10// Insert explicit type specializations where they are missing
12 TypeMap *typeMap;
13 const IR::Type *getVarValue(const IR::Type_Var *var, const IR::Node *errorPosition) const;
14 const IR::Node *insertTypes(const IR::Node *node);
15
16 public:
17 explicit DoBindTypeVariables(TypeMap *typeMap) : typeMap(typeMap) {
18 CHECK_NULL(typeMap);
19 setName("DoBindTypeVariables");
20 }
21
24 const IR::Node *preorder(IR::Annotation *annotation) override;
25
26 const IR::Node *postorder(IR::Expression *expression) override;
27 const IR::Node *postorder(IR::Declaration_Instance *decl) override;
28 const IR::Node *postorder(IR::MethodCallExpression *expression) override;
29 const IR::Node *postorder(IR::ConstructorCallExpression *expression) override;
30};
31
33 public:
34 explicit BindTypeVariables(TypeMap *typeMap) {
35 CHECK_NULL(typeMap);
36 passes.push_back(new ClearTypeMap(typeMap));
37 passes.push_back(new TypeInference(typeMap, false)); // may insert casts
38 passes.push_back(new DoBindTypeVariables(typeMap));
39 passes.push_back(new ClearTypeMap(typeMap, true));
40 setName("BindTypeVariables");
41 }
42};
43
44} // namespace P4
45
46#endif /* FRONTENDS_P4_TYPECHECKING_BINDVARIABLES_H_ */
Definition bindVariables.h:32
Definition typeChecker.h:32
Definition bindVariables.h:11
const IR::Node * preorder(IR::Annotation *annotation) override
Definition bindVariables.cpp:138
Definition node.h:94
Definition ir/pass_manager.h:40
Definition visitor.h:424
Definition typeChecker.h:483
Definition typeMap.h:41
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24