P4C
The P4 Compiler
Loading...
Searching...
No Matches
pa_container_type.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_CONTAINER_TYPE_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_CONTAINER_TYPE_H_
21
22#include <optional>
23
24#include "backends/tofino/bf-p4c/phv/phv.h"
25#include "backends/tofino/bf-p4c/phv/phv_fields.h"
26#include "ir/ir.h"
27
28using namespace P4;
29
36 PhvInfo &phv_i;
37
42
43 profile_t init_apply(const IR::Node *root) override {
44 profile_t rv = Inspector::init_apply(root);
45 fields.clear();
46 return rv;
47 }
48
50 bool add_constraint(const IR::BFN::Pipe *pipe, const IR::Expression *expr, cstring field_name,
51 PHV::Kind kind);
52
53 bool preorder(const IR::BFN::Pipe *pipe) override;
54
55 public:
56 explicit PragmaContainerType(PhvInfo &phv) : phv_i(phv) {}
57
60 const ordered_map<const PHV::Field *, PHV::Kind> &getFields() const { return fields; }
61
62 std::optional<PHV::Kind> required_kind(const PHV::Field *f) const;
63
65 static const char *name;
66 static const char *description;
67 static const char *help;
68};
69
70std::ostream &operator<<(std::ostream &out, const PragmaContainerType &pa_ct);
71
72#endif /* BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_CONTAINER_TYPE_H_ */
Definition node.h:94
Definition visitor.h:400
Definition visitor.h:78
Definition cstring.h:85
Definition ordered_map.h:32
Definition phv_fields.h:154
Definition phv_fields.h:1095
Definition pa_container_type.h:35
const ordered_map< const PHV::Field *, PHV::Kind > & getFields() const
Definition pa_container_type.h:60
static const char * name
BFN::Pragma interface.
Definition pa_container_type.h:65
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Kind
Definition phv.h:44