P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
entryPriorities.h
1/*
2Copyright 2023 Mihai Budiu
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_ENTRYPRIORITIES_H_
18#define FRONTENDS_P4_ENTRYPRIORITIES_H_
19
20#include "coreLibrary.h"
21#include "frontends/common/resolveReferences/resolveReferences.h"
22#include "ir/ir.h"
23#include "ir/pass_manager.h"
24
25namespace P4 {
26
28class DoEntryPriorities : public Transform {
29 ReferenceMap *refMap;
30 P4::P4CoreLibrary &corelib;
31
32 bool requiresPriority(const IR::KeyElement *ke) const;
33
34 public:
35 explicit DoEntryPriorities(ReferenceMap *refMap)
36 : refMap(refMap), corelib(P4::P4CoreLibrary::instance()) {
37 setName("DoEntryPriorities");
38 CHECK_NULL(refMap);
39 }
40 const IR::Node *preorder(IR::EntriesList *entries) override;
41};
42
43class EntryPriorities : public PassManager {
44 public:
45 explicit EntryPriorities(ReferenceMap *refMap) {
46 setName("EntryPriorities");
47 passes.emplace_back(new ResolveReferences(refMap));
48 passes.emplace_back(new DoEntryPriorities(refMap));
49 }
50};
51
52} // namespace P4
53
54#endif /* FRONTENDS_P4_ENTRYPRIORITIES_H_ */
Assigns priorities to table entries if they are not 'const'.
Definition entryPriorities.h:28
Definition entryPriorities.h:43
Definition coreLibrary.h:100
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition resolveReferences.h:119
Definition applyOptionsPragmas.cpp:24