P4C
The P4 Compiler
Loading...
Searching...
No Matches
tc/midend.h
1/*
2Copyright (C) 2023 Intel Corporation
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
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing,
11software distributed 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
14and limitations under the License.
15*/
16
17#ifndef BACKENDS_TC_MIDEND_H_
18#define BACKENDS_TC_MIDEND_H_
19
20#include "backends/ebpf/lower.h"
21#include "frontends/common/constantFolding.h"
22#include "frontends/common/options.h"
23#include "frontends/common/resolveReferences/referenceMap.h"
24#include "frontends/common/resolveReferences/resolveReferences.h"
25#include "frontends/p4/evaluator/evaluator.h"
26#include "frontends/p4/moveDeclarations.h"
27#include "frontends/p4/simplify.h"
28#include "frontends/p4/simplifyParsers.h"
29#include "frontends/p4/strengthReduction.h"
30#include "frontends/p4/toP4/toP4.h"
31#include "frontends/p4/typeChecking/typeChecker.h"
32#include "frontends/p4/typeMap.h"
33#include "frontends/p4/unusedDeclarations.h"
34#include "ir/ir.h"
35#include "midend/actionSynthesis.h"
36#include "midend/complexComparison.h"
37#include "midend/convertEnums.h"
38#include "midend/copyStructures.h"
39#include "midend/eliminateInvalidHeaders.h"
40#include "midend/eliminateNewtype.h"
41#include "midend/eliminateSerEnums.h"
42#include "midend/eliminateTuples.h"
43#include "midend/expandEmit.h"
44#include "midend/local_copyprop.h"
45#include "midend/midEndLast.h"
46#include "midend/noMatch.h"
47#include "midend/parserUnroll.h"
48#include "midend/removeExits.h"
49#include "midend/removeLeftSlices.h"
50#include "midend/removeMiss.h"
51#include "midend/removeSelectBooleans.h"
52#include "midend/simplifyKey.h"
53#include "midend/simplifySelectCases.h"
54#include "midend/simplifySelectList.h"
55#include "midend/singleArgumentSelect.h"
56#include "midend/tableHit.h"
57#include "midend/validateProperties.h"
58#include "options.h"
59
60namespace P4::TC {
61
62class MidEnd {
63 public:
64 std::vector<DebugHook> hooks;
65 P4::ReferenceMap refMap;
66 P4::TypeMap typeMap;
67
68 void addDebugHook(DebugHook hook) { hooks.push_back(hook); }
69 // If p4c is run with option '--listMidendPasses', outStream is used for printing passes names
70 const IR::ToplevelBlock *run(TCOptions &options, const IR::P4Program *program,
71 std::ostream *outStream = nullptr);
72};
73} // namespace P4::TC
74
75#endif /* BACKENDS_TC_MIDEND_H_ */
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition tc/midend.h:62
Definition backends/tc/options.h:25
Definition typeMap.h:41
This file defines functions for the pass to generate the introspection file.
Definition tc/backend.cpp:24
std::function< void(const char *manager, unsigned seqNo, const char *pass, const IR::Node *node)> DebugHook
Definition ir/pass_manager.h:38