P4C
The P4 Compiler
Loading...
Searching...
No Matches
portable.h
1/*
2Copyright 2024 Marvell Technology, 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 BACKENDS_BMV2_PORTABLE_COMMON_PORTABLE_H_
18#define BACKENDS_BMV2_PORTABLE_COMMON_PORTABLE_H_
19
20#include "backends/bmv2/common/action.h"
21#include "backends/bmv2/common/control.h"
22#include "backends/bmv2/common/deparser.h"
23#include "backends/bmv2/common/extern.h"
24#include "backends/bmv2/common/header.h"
25#include "backends/bmv2/common/helpers.h"
26#include "backends/bmv2/common/lower.h"
27#include "backends/bmv2/common/parser.h"
28#include "backends/common/portableProgramStructure.h"
29#include "backends/common/programStructure.h"
30#include "frontends/common/constantFolding.h"
31#include "frontends/common/resolveReferences/referenceMap.h"
32#include "frontends/p4/coreLibrary.h"
33#include "frontends/p4/enumInstance.h"
34#include "frontends/p4/evaluator/evaluator.h"
35#include "frontends/p4/methodInstance.h"
36#include "frontends/p4/simplify.h"
37#include "frontends/p4/strengthReduction.h"
38#include "frontends/p4/typeMap.h"
39#include "frontends/p4/unusedDeclarations.h"
40#include "ir/ir.h"
41#include "lib/big_int_util.h"
42#include "lib/json.h"
43
44namespace P4::BMV2 {
45
47 public:
48 unsigned error_width = 32;
49
50 void createStructLike(ConversionContext *ctxt, const IR::Type_StructLike *st,
52 void createTypes(ConversionContext *ctxt, P4::PortableProgramStructure *structure);
53 void createHeaders(ConversionContext *ctxt, P4::PortableProgramStructure *structure);
54 void createScalars(ConversionContext *ctxt, P4::PortableProgramStructure *structure);
55 void createExterns();
56 void createActions(ConversionContext *ctxt, P4::PortableProgramStructure *structure);
57 void createGlobals();
58 cstring convertHashAlgorithm(cstring algo);
59};
60
61EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(Checksum)
62EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(Counter)
63EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(DirectCounter)
64EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(Meter)
65EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(DirectMeter)
66EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(Random)
67EXTERN_CONVERTER_W_INSTANCE(ActionProfile)
68EXTERN_CONVERTER_W_INSTANCE(ActionSelector)
69EXTERN_CONVERTER_W_OBJECT_AND_INSTANCE(Digest)
70
71} // namespace P4::BMV2
72
73#endif /* BACKENDS_BMV2_PORTABLE_COMMON_PORTABLE_H_ */
Definition portable.h:46
Definition portableProgramStructure.h:29
Definition cstring.h:85
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition action.cpp:21
Definition bmv2/common/helpers.h:297