P4C
The P4 Compiler
Loading...
Searching...
No Matches
pa_no_overlay.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_OVERLAY_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_OVERLAY_H_
21
22#include "backends/tofino/bf-p4c/phv/phv_fields.h"
23#include "ir/ir.h"
24
25using namespace P4;
26
33class PragmaNoOverlay : public Inspector {
34 PhvInfo &phv_i;
35
41 SymBitMatrix mutually_inclusive;
42
43 profile_t init_apply(const IR::Node *root) override {
44 profile_t rv = Inspector::init_apply(root);
45 no_overlay.clear();
46 mutually_inclusive.clear();
47 return rv;
48 }
49
50 bool preorder(const IR::BFN::Pipe *pipe) override;
51 bool preorder(const IR::MAU::Instruction *inst) override;
52
53 public:
54 explicit PragmaNoOverlay(PhvInfo &phv) : phv_i(phv) {}
55
56 friend std::ostream &operator<<(std::ostream &out, const PragmaNoOverlay &pa_no);
58 static const char *name;
59 static const char *description;
60 static const char *help;
61
64 const ordered_set<const PHV::Field *> &get_no_overlay_fields() const { return no_overlay; }
65
66 bool can_overlay(const PHV::Field *a, const PHV::Field *b) const {
67 return !no_overlay.count(a) && !no_overlay.count(b) && !mutually_inclusive(a->id, b->id);
68 }
69};
70
71std::ostream &operator<<(std::ostream &out, const PragmaNoOverlay &pa_no);
72
73#endif /* BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_NO_OVERLAY_H_ */
Definition node.h:94
Definition visitor.h:400
Definition symbitmatrix.h:27
Definition visitor.h:78
Definition ordered_set.h:32
Definition phv_fields.h:154
int id
Unique field ID.
Definition phv_fields.h:164
Definition phv_fields.h:1095
Definition pa_no_overlay.h:33
static const char * name
BFN::Pragma interface.
Definition pa_no_overlay.h:58
const ordered_set< const PHV::Field * > & get_no_overlay_fields() const
Definition pa_no_overlay.h:64
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24