1
1
#include " backends/p4tools/common/compiler/midend.h"
2
2
3
- #include " backends/p4tools/common/compiler/boolean_keys.h"
4
- #include " backends/p4tools/common/compiler/convert_errors.h"
5
3
#include " backends/p4tools/common/compiler/convert_varbits.h"
6
- #include " backends/p4tools/common/compiler/copy_headers.h"
7
4
#include " frontends/common/constantFolding.h"
8
5
#include " frontends/common/options.h"
9
6
#include " frontends/common/parser_options.h"
13
10
#include " frontends/p4/simplify.h"
14
11
#include " frontends/p4/typeChecking/typeChecker.h"
15
12
#include " frontends/p4/typeMap.h"
13
+ #include " midend/booleanKeys.h"
16
14
#include " midend/complexComparison.h"
17
15
#include " midend/convertEnums.h"
16
+ #include " midend/convertErrors.h"
17
+ #include " midend/copyHeaders.h"
18
18
#include " midend/eliminateNewtype.h"
19
19
#include " midend/eliminateSerEnums.h"
20
20
#include " midend/eliminateSwitch.h"
@@ -49,7 +49,7 @@ Visitor* MidEnd::mkConvertEnums() {
49
49
}
50
50
51
51
Visitor* MidEnd::mkConvertErrors () {
52
- return new ConvertErrors (&refMap, &typeMap, mkConvertErrorPolicy ());
52
+ return new P4:: ConvertErrors (&refMap, &typeMap, mkConvertErrorPolicy ());
53
53
}
54
54
55
55
Visitor* MidEnd::mkConvertKeys () {
@@ -67,9 +67,9 @@ P4::ChooseEnumRepresentation* MidEnd::mkConvertEnumsPolicy() {
67
67
return new EnumOn32Bits ();
68
68
}
69
69
70
- ChooseErrorRepresentation* MidEnd::mkConvertErrorPolicy () {
70
+ P4:: ChooseErrorRepresentation* MidEnd::mkConvertErrorPolicy () {
71
71
// / Implements the default enum-conversion policy, which converts all enums to bit<32>.
72
- class ErrorOn32Bits : public ChooseErrorRepresentation {
72
+ class ErrorOn32Bits : public P4 :: ChooseErrorRepresentation {
73
73
bool convert (const IR::Type_Error* /* type*/ ) const override { return true ; }
74
74
75
75
unsigned errorSize (unsigned ) const override { return 32 ; }
@@ -120,7 +120,7 @@ void MidEnd::addDefaultPasses() {
120
120
// Expand comparisons on structs and headers into comparisons on fields.
121
121
new P4::SimplifyComparisons (&refMap, &typeMap),
122
122
// Expand header and struct assignments into sequences of field assignments.
123
- new CopyHeaders (&refMap, &typeMap),
123
+ new P4:: CopyHeaders (&refMap, &typeMap),
124
124
// Flatten nested list expressions.
125
125
new P4::SimplifySelectList (&refMap, &typeMap),
126
126
// Convert booleans in selects into bit<1>.
@@ -158,7 +158,7 @@ void MidEnd::addDefaultPasses() {
158
158
// Convert Type_Varbits into a type that contains information about the assigned width.
159
159
new ConvertVarbits (&refMap, &typeMap),
160
160
// Cast all boolean table keys with a bit<1>.
161
- new CastBooleanTableKeys (),
161
+ new P4:: CastBooleanTableKeys (),
162
162
});
163
163
}
164
164
0 commit comments