8#ifndef CONTROL_PLANE_TYPESPECCONVERTER_H_
9#define CONTROL_PLANE_TYPESPECCONVERTER_H_
16#include "ir/visitor.h"
17#pragma GCC diagnostic push
18#pragma GCC diagnostic ignored "-Wunused-parameter"
19#pragma GCC diagnostic ignored "-Wpedantic"
20#include "p4/config/v1/p4info.pb.h"
21#pragma GCC diagnostic pop
38class TypeSpecConverter :
public Inspector {
44 ::p4::config::v1::P4TypeInfo *p4RtTypeInfo;
47 std::map<const IR::Type *, std::shared_ptr<::p4::config::v1::P4DataTypeSpec>> map;
50 ::p4::config::v1::P4TypeInfo *p4RtTypeInfo);
53 bool preorder(
const IR::Type *type)
override;
56 bool preorder(
const IR::Type_Bits *type)
override;
57 bool preorder(
const IR::Type_Varbits *type)
override;
58 bool preorder(
const IR::Type_Boolean *type)
override;
59 bool preorder(
const IR::Type_BaseList *type)
override;
60 bool preorder(
const IR::Type_Array *type)
override;
62 bool preorder(
const IR::Type_Name *type)
override;
63 bool preorder(
const IR::Type_Newtype *type)
override;
67 bool preorder(
const IR::Type_Struct *type)
override;
68 bool preorder(
const IR::Type_Header *type)
override;
69 bool preorder(
const IR::Type_HeaderUnion *type)
override;
70 bool preorder(
const IR::Type_Enum *type)
override;
71 bool preorder(
const IR::Type_SerEnum *type)
override;
72 bool preorder(
const IR::Type_Error *type)
override;
78 static std::shared_ptr<const ::p4::config::v1::P4DataTypeSpec>
convert(
80 ::p4::config::v1::P4TypeInfo *typeInfo);
85 enum Type { kBit, kString };
92 std::string original_type_uri;
static std::shared_ptr< 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:382
Class used to encode maps from paths to declarations.
Definition referenceMap.h:58
TODO(antonin): High level goals of the generator go here!!
Definition dpdk/control-plane/bfruntime_arch_handler.h:44
cstring getTypeName(const IR::Type *type, TypeMap *typeMap)
Definition typeSpecConverter.cpp:68
bool hasTranslationAnnotation(const IR::Type *type, TranslationAnnotation *payload)
Definition typeSpecConverter.cpp:32
Payload of @p4runtime_translation annotation.
Definition typeSpecConverter.h:91
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13
See section "User-defined types" in P4RT specification.
Definition typeSpecConverter.h:84