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 "backends/tofino/bf-p4c/phv/phv_fields.h"
26
#include "backends/tofino/bf-p4c/phv/utils/utils.h"
27
#include "ir/ir.h"
28
29
using namespace
P4
;
30
37
class
PragmaMutuallyExclusive
:
public
Inspector
{
38
const
PhvInfo
&phv_i;
39
ordered_map<const PHV::Field *, ordered_set<const PHV::Field *>
> pa_mutually_exclusive_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
61
const
ordered_map<const PHV::Field *, ordered_set<const PHV::Field *>
> &mutex_fields()
const
{
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
69
std::ostream &operator<<(std::ostream &out,
const
PragmaMutuallyExclusive
&pa_me);
70
71
#endif
/* BACKENDS_TOFINO_BF_P4C_PHV_PRAGMA_PA_MUTUALLY_EXCLUSIVE_H_ */
P4::IR::Node
Definition
node.h:94
P4::Inspector
Definition
visitor.h:400
P4::Visitor::profile_t
Definition
visitor.h:78
P4::ordered_map
Definition
ordered_map.h:32
PhvInfo
Definition
phv_fields.h:1095
PragmaMutuallyExclusive
Definition
pa_mutually_exclusive.h:37
PragmaMutuallyExclusive::name
static const char * name
BFN::Pragma interface.
Definition
pa_mutually_exclusive.h:57
P4
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition
applyOptionsPragmas.cpp:24
backends
tofino
bf-p4c
phv
pragma
pa_mutually_exclusive.h
Generated by
1.12.0