P4C
The P4 Compiler
Loading...
Searching...
No Matches
dpdkUtils.h
1/* Copyright 2022 Intel Corporation
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14*/
15
16#ifndef BACKENDS_DPDK_DPDKUTILS_H_
17#define BACKENDS_DPDK_DPDKUTILS_H_
18
19#include "frontends/common/resolveReferences/resolveReferences.h"
20#include "ir/ir.h"
21
22namespace P4::DPDK {
23bool isSimpleExpression(const IR::Expression *e);
24bool isNonConstantSimpleExpression(const IR::Expression *e);
25bool isCommutativeBinaryOperation(const IR::Operation_Binary *bin);
26bool isStandardMetadata(cstring name);
27bool isMetadataStruct(const IR::Type_Struct *st);
28bool isMetadataField(const IR::Expression *e);
29bool isEightBitAligned(const IR::Expression *e);
30bool isDirection(const IR::Member *m);
31bool isHeadersStruct(const IR::Type_Struct *st);
32bool isLargeFieldOperand(const IR::Expression *e);
33bool isInsideHeader(const IR::Expression *e);
34bool isValidCall(const IR::MethodCallExpression *m);
35bool isValidMemberField(const IR::Member *mem);
36int getMetadataFieldWidth(int width);
37const IR::Type_Bits *getEightBitAlignedType(const IR::Type_Bits *tb);
38
40bool reservedNames(P4::ReferenceMap *refMap, const std::vector<cstring> &names, cstring &resName);
42IR::Declaration_Instance *createRegDeclarationInstance(cstring instanceName, int regSize,
43 int indexBitWidth, int initValBitwidth);
44} // namespace P4::DPDK
45#endif /* BACKENDS_DPDK_DPDKUTILS_H_ */
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition dpdk/backend.cpp:37
IR::Declaration_Instance * createRegDeclarationInstance(cstring instanceName, int regSize, int indexBitWidth, int initValBitWidth)
Creates Register extern declaration for holding persistent information.
Definition dpdkUtils.cpp:126
int getMetadataFieldWidth(int width)
Update bitwidth of Metadata fields to 32 or 64 bits if it 8-bit aligned.
Definition dpdkUtils.cpp:155
bool reservedNames(P4::ReferenceMap *refMap, const std::vector< cstring > &names, cstring &resName)
Check for reserved names for DPDK target.
Definition dpdkUtils.cpp:143