17#ifndef CONTROL_PLANE_TYPESPECCONVERTER_H_
18#define CONTROL_PLANE_TYPESPECCONVERTER_H_
24#include "ir/visitor.h"
25#pragma GCC diagnostic push
26#pragma GCC diagnostic ignored "-Wunused-parameter"
27#pragma GCC diagnostic ignored "-Wpedantic"
28#include "p4/config/v1/p4info.pb.h"
29#pragma GCC diagnostic pop
43namespace ControlPlaneAPI {
52 ::p4::config::v1::P4TypeInfo *p4RtTypeInfo;
55 std::map<const IR::Type *, ::p4::config::v1::P4DataTypeSpec *> map;
58 ::p4::config::v1::P4TypeInfo *p4RtTypeInfo);
61 bool preorder(
const IR::Type *type)
override;
64 bool preorder(
const IR::Type_Bits *type)
override;
65 bool preorder(
const IR::Type_Varbits *type)
override;
66 bool preorder(
const IR::Type_Boolean *type)
override;
67 bool preorder(
const IR::Type_BaseList *type)
override;
68 bool preorder(
const IR::Type_Stack *type)
override;
70 bool preorder(
const IR::Type_Name *type)
override;
71 bool preorder(
const IR::Type_Newtype *type)
override;
75 bool preorder(
const IR::Type_Struct *type)
override;
76 bool preorder(
const IR::Type_Header *type)
override;
77 bool preorder(
const IR::Type_HeaderUnion *type)
override;
78 bool preorder(
const IR::Type_Enum *type)
override;
79 bool preorder(
const IR::Type_SerEnum *type)
override;
80 bool preorder(
const IR::Type_Error *type)
override;
89 ::p4::config::v1::P4TypeInfo *typeInfo);
94 enum Type { kBit, kString };
101 std::string original_type_uri;
Generates the appropriate p4.P4DataTypeSpec for a given IR::Type node.
Definition typeSpecConverter.h:46
static const ::p4::config::v1::P4DataTypeSpec * convert(const P4::ReferenceMap *refMap, P4::TypeMap *typeMap, const IR::Type *type, ::p4::config::v1::P4TypeInfo *typeInfo)
Definition typeSpecConverter.cpp:390
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
cstring getTypeName(const IR::Type *type, TypeMap *typeMap)
Definition typeSpecConverter.cpp:81
bool hasTranslationAnnotation(const IR::Type *type, TranslationAnnotation *payload)
Definition typeSpecConverter.cpp:43
Payload of @p4runtime_translation annotation.
Definition typeSpecConverter.h:100
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
See section "User-defined types" in P4RT specification.
Definition typeSpecConverter.h:93