P4C
The P4 Compiler
Loading...
Searching...
No Matches
pa_mutually_exclusive.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_MUTUALLY_EXCLUSIVE_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_MUTUALLY_EXCLUSIVE_H_
21
22#include <map>
23#include <optional>
24
25#include "bf-p4c/phv/phv_fields.h"
26#include "bf-p4c/phv/utils/utils.h"
27#include "ir/ir.h"
28
29using namespace P4;
30
38 const PhvInfo &phv_i;
40 ordered_map<cstring, ordered_set<cstring>> mutually_exclusive_headers;
41
42 profile_t init_apply(const IR::Node *root) override {
43 profile_t rv = Inspector::init_apply(root);
44 pa_mutually_exclusive_i.clear();
45 mutually_exclusive_headers.clear();
46 return rv;
47 }
48
51 bool preorder(const IR::BFN::Pipe *pipe) override;
52
53 public:
54 explicit PragmaMutuallyExclusive(const PhvInfo &phv) : phv_i(phv) {}
55
57 static const char *name;
58 static const char *description;
59 static const char *help;
60
62 return pa_mutually_exclusive_i;
63 }
64 const ordered_map<cstring, ordered_set<cstring>> &mutex_headers() const {
65 return mutually_exclusive_headers;
66 }
67};
68
69std::ostream &operator<<(std::ostream &out, const PragmaMutuallyExclusive &pa_me);
70
71#endif /* BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_MUTUALLY_EXCLUSIVE_H_ */
Definition node.h:95
Definition visitor.h:400
Definition visitor.h:78
Definition ordered_map.h:32
Definition phv_fields.h:1095
Definition pa_mutually_exclusive.h:37
static const char * name
BFN::Pragma interface.
Definition pa_mutually_exclusive.h:57
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24