P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
directCalls.h
1/*
2Copyright 2017 VMware, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef FRONTENDS_P4_DIRECTCALLS_H_
18#define FRONTENDS_P4_DIRECTCALLS_H_
19
20#include "frontends/common/resolveReferences/resolveReferences.h"
21#include "ir/ir.h"
22#include "ir/pass_manager.h"
23
24namespace P4 {
25
38class DoInstantiateCalls : public Transform {
39 ReferenceMap *refMap;
40
41 IR::IndexedVector<IR::Declaration> insert;
42
43 public:
44 explicit DoInstantiateCalls(ReferenceMap *refMap) : refMap(refMap) {
45 CHECK_NULL(refMap);
46 setName("DoInstantiateCalls");
47 }
48 const IR::Node *postorder(IR::P4Parser *parser) override;
49 const IR::Node *postorder(IR::P4Control *control) override;
50 const IR::Node *postorder(IR::MethodCallExpression *expression) override;
51};
52
53class InstantiateDirectCalls : public PassManager {
54 public:
55 explicit InstantiateDirectCalls(ReferenceMap *refMap) {
56 passes.push_back(new ResolveReferences(refMap));
57 passes.push_back(new DoInstantiateCalls(refMap));
58 setName("InstantiateDirectCalls");
59 }
60};
61
62} // namespace P4
63
64#endif /* FRONTENDS_P4_DIRECTCALLS_H_ */
Definition directCalls.h:38
Definition directCalls.h:53
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition resolveReferences.h:119
Definition applyOptionsPragmas.cpp:24