P4C
The P4 Compiler
Loading...
Searching...
No Matches
flattenHeader.h
1/*
2 * SPDX-FileCopyrightText: 2019 Barefoot Networks, Inc.
3 * Copyright 2019-present Barefoot Networks, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef CONTROL_PLANE_FLATTENHEADER_H_
9#define CONTROL_PLANE_FLATTENHEADER_H_
10
11#include <vector>
12
13#include "ir/ir.h"
14
15namespace P4 {
16
17class TypeMap;
18
19namespace ControlPlaneAPI {
20
22class FlattenHeader {
23 private:
24 P4::TypeMap *typeMap;
25 IR::Type_Header *flattenedHeader;
26 std::vector<cstring> nameSegments;
27 std::vector<const IR::Vector<IR::Annotation> *> allAnnotations;
28 bool needsFlattening{false};
29
30 FlattenHeader(P4::TypeMap *typeMap, IR::Type_Header *flattenedHeader);
31
32 void doFlatten(const IR::Type *type);
33
34 cstring makeName(std::string_view sep) const;
35 IR::Vector<IR::Annotation> mergeAnnotations() const;
36
37 public:
41 static const IR::Type_Header *flatten(P4::TypeMap *typeMap, const IR::Type_Header *headerType);
42};
43
44} // namespace ControlPlaneAPI
45
46} // namespace P4
47
48#endif // CONTROL_PLANE_FLATTENHEADER_H_
static const IR::Type_Header * flatten(P4::TypeMap *typeMap, const IR::Type_Header *headerType)
Definition flattenHeader.cpp:67
Definition ir/vector.h:59
Definition typeMap.h:32
Definition cstring.h:85
TODO(antonin): High level goals of the generator go here!!
Definition dpdk/control-plane/bfruntime_arch_handler.h:44
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13