24#ifndef BF_P4C_MIDEND_REWRITE_FLEXIBLE_HEADER_H_
25#define BF_P4C_MIDEND_REWRITE_FLEXIBLE_HEADER_H_
27#include "frontends/p4/typeMap.h"
43 const IR::Node *postorder(IR::Type_Struct *st)
override {
44 if (st->getAnnotation(
"flexible"_cs) ==
nullptr)
return st;
47 for (
auto f : st->fields) {
48 auto *fieldAnnotations =
new IR::Annotations();
49 fieldAnnotations->annotations.push_back(
new IR::Annotation(
IR::ID(
"flexible"), {}));
50 fields.push_back(
new IR::StructField(f->name, fieldAnnotations, f->type));
53 return new IR::Type_Struct(st->name, st->annotations, fields);
Definition typeChecker.h:32
Definition ir/pass_manager.h:40
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition typeChecker.h:55
Top level PassManager that governs moving of flexible annotation from structure to its fields.
Definition rewrite_flexible_header.h:62
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