P4C
The P4 Compiler
Loading...
Searching...
No Matches
dark.h
1
19
#ifndef BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_
20
#define BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_
21
22
#include "bf-p4c/common/field_defuse.h"
23
#include "bf-p4c/mau/mau_visitor.h"
24
#include "bf-p4c/phv/analysis/mocha.h"
25
#include "bf-p4c/phv/phv_fields.h"
26
#include "bf-p4c/phv/pragma/phv_pragmas.h"
27
#include "ir/ir.h"
28
33
class
CollectNonDarkUses
:
public
MauInspector
{
34
private
:
35
const
PhvInfo
&phv;
36
const
ReductionOrInfo
&red_info;
37
bitvec
nonDarkMauUses;
38
39
profile_t
init_apply(
const
IR::Node
*root)
override
;
40
bool
preorder(
const
IR::MAU::Table *)
override
;
41
bool
preorder(
const
IR::Expression *)
override
;
42
bool
preorder(
const
IR::MAU::Action *)
override
;
43
bool
contextNeedsIXBar();
44
45
public
:
46
CollectNonDarkUses
(
const
PhvInfo
&p,
const
ReductionOrInfo
&ri) : phv(p), red_info(ri) {}
47
48
bool
hasNonDarkUse(
const
PHV::Field
*f)
const
;
49
};
50
61
class
MarkDarkCandidates
:
public
Inspector
{
62
private
:
63
PhvInfo
&phv;
64
const
PhvUse
&uses;
65
const
CollectNonDarkUses
&nonDarkUses;
66
69
bitvec
nonDarkMauUses;
70
72
size_t
darkCount;
74
size_t
darkSize;
75
76
profile_t
init_apply(
const
IR::Node
*root)
override
;
77
void
end_apply()
override
;
78
79
public
:
80
explicit
MarkDarkCandidates
(
PhvInfo
&p,
const
PhvUse
&u,
const
CollectNonDarkUses
&d)
81
: phv(p), uses(u), nonDarkUses(d), darkCount(0), darkSize(0) {}
82
};
83
84
class
CollectDarkCandidates
:
public
PassManager
{
85
private
:
86
CollectNonDarkUses
nonDarkUses;
87
88
public
:
89
CollectDarkCandidates
(
PhvInfo
&p,
PhvUse
&u,
const
ReductionOrInfo
&ri) : nonDarkUses(p, ri) {
90
addPasses({&nonDarkUses,
new
MarkDarkCandidates
(p, u, nonDarkUses)});
91
}
92
};
93
94
#endif
/* BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_DARK_H_ */
CollectDarkCandidates
Definition
dark.h:84
CollectNonDarkUses
Definition
dark.h:33
MarkDarkCandidates
Definition
dark.h:61
MauInspector
Definition
mau_visitor.h:29
P4::IR::Node
Definition
node.h:95
P4::Inspector
Definition
visitor.h:400
P4::PassManager
Definition
ir/pass_manager.h:40
P4::Visitor::profile_t
Definition
visitor.h:78
P4::bitvec
Definition
bitvec.h:120
PHV::Field
Definition
phv_fields.h:154
PhvInfo
Definition
phv_fields.h:1095
PhvUse
Definition
phv_parde_mau_use.h:154
ReductionOrInfo
Definition
reduction_or.h:47
backends
tofino
bf-p4c
phv
analysis
dark.h
Generated by
1.12.0