19#ifndef BF_P4C_MIDEND_CHECK_HEADER_ALIGNMENT_H_
20#define BF_P4C_MIDEND_CHECK_HEADER_ALIGNMENT_H_
22#include "backends/tofino/bf-p4c/midend/type_checker.h"
23#include "frontends/common/resolveReferences/resolveReferences.h"
24#include "frontends/p4/methodInstance.h"
25#include "frontends/p4/typeMap.h"
44 bool preorder(
const IR::AssignmentStatement *statement)
override;
47 CheckPadAssignment() {}
67class CheckHeaderAlignment final :
public Inspector {
71 bool preorder(
const IR::Type_Header *header)
override;
78using HeaderToPad = std::unordered_set<cstring>;
79using ResubmitHeaders = std::unordered_set<cstring>;
84 HeaderToPad *headers_to_pad;
85 ResubmitHeaders *resubmit_headers;
86 HeaderTypeMap *all_header_types;
94 bool preorder(
const IR::MethodCallExpression *expr)
override;
95 bool preorder(
const IR::Type_Header *)
override;
97 HeaderToPad *headers_to_pad, ResubmitHeaders *resubmit_headers,
98 HeaderTypeMap *all_header_types)
101 headers_to_pad(headers_to_pad),
102 resubmit_headers(resubmit_headers),
103 all_header_types(all_header_types) {}
108 HeaderToPad *headers_to_pad;
109 ResubmitHeaders *resubmit_headers;
110 HeaderTypeMap *all_header_types;
114 ResubmitHeaders *resubmit_headers, HeaderTypeMap *all_header_types)
116 headers_to_pad(headers_to_pad),
117 resubmit_headers(resubmit_headers),
118 all_header_types(all_header_types) {}
120 const IR::Node *preorder(IR::Type_Header *st)
override;
121 const IR::Node *preorder(IR::StructExpression *)
override;
126 ResubmitHeaders *resubmit_headers;
129 explicit TransformResubmitHeaders(ResubmitHeaders *resubmit_headers)
130 : resubmit_headers(resubmit_headers) {}
134class PadFlexibleField :
public PassManager {
136 HeaderToPad headers_to_pad;
138 HeaderTypeMap all_header_types;
139 ResubmitHeaders resubmit_headers;
159 setName(
"PadFlexibleField");
Definition check_header_alignment.h:106
Definition check_header_alignment.h:42
Definition check_header_alignment.h:81
std::vector< cstring > find_headers_to_pad(P4::MethodInstance *mi)
Definition check_header_alignment.cpp:64
Definition typeChecker.h:32
Definition methodInstance.h:56
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition resolveReferences.h:123
Definition typeChecker.h:55
Definition typeChecker.h:483
Definition ordered_map.h:32
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24