P4C
The P4 Compiler
Loading...
Searching...
No Matches
pa_no_pack.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_PACK_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_PACK_H_
21
22#include "backends/tofino/bf-p4c/phv/phv_fields.h"
23#include "backends/tofino/bf-p4c/phv/utils/utils.h"
24#include "ir/ir.h"
25
26using namespace P4;
27
28class PragmaNoPack : public Inspector {
29 const PhvInfo &phv_i;
30 std::vector<std::pair<const PHV::Field *, const PHV::Field *>> no_packs_i;
31 const ordered_map<cstring, ordered_set<cstring>> &no_pack_constr;
32 profile_t init_apply(const IR::Node *root) override {
33 profile_t rv = Inspector::init_apply(root);
34 no_packs_i.clear();
35 return rv;
36 }
37
38 bool preorder(const IR::BFN::Pipe *pipe) override;
39
40 public:
41 explicit PragmaNoPack(const PhvInfo &phv)
42 : phv_i(phv), no_pack_constr(*(new ordered_map<cstring, ordered_set<cstring>>)) {}
43 PragmaNoPack(const PhvInfo &phv,
44 const ordered_map<cstring, ordered_set<cstring>> &no_pack_constr)
45 : phv_i(phv), no_pack_constr(no_pack_constr) {}
46 const std::vector<std::pair<const PHV::Field *, const PHV::Field *>> &no_packs() const {
47 return no_packs_i;
48 }
49
51 static const char *name;
52 static const char *description;
53 static const char *help;
54};
55
56#endif /* BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_PACK_H_ */
Definition node.h:94
Definition visitor.h:400
Definition visitor.h:78
Definition cstring.h:85
Definition ordered_map.h:32
Definition ordered_set.h:32
Definition phv_fields.h:1095
Definition pa_no_pack.h:28
static const char * name
BFN::Pragma interface.
Definition pa_no_pack.h:51
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24