P4C
The P4 Compiler
Loading...
Searching...
No Matches
auto_init_metadata.h
1
19#ifndef BF_P4C_PHV_AUTO_INIT_METADATA_H_
20#define BF_P4C_PHV_AUTO_INIT_METADATA_H_
21
22#include <set>
23#include <utility>
24
25#include "bf-p4c/common/elim_unused.h"
26#include "bf-p4c/common/field_defuse.h"
27#include "ir/ir.h"
28#include "ir/visitor.h"
29#include "lib/cstring.h"
30
35 const FieldDefUse &defuse;
36 const PhvInfo &phv;
37
38 public:
39 explicit DisableAutoInitMetadata(const FieldDefUse &defuse, const PhvInfo &phv)
40 : defuse(defuse), phv(phv) {}
41
42 const IR::Node *preorder(IR::BFN::Pipe *pipe) override;
43
44 private:
46 bool auto_init_metadata(const IR::BFN::Pipe *pipe) const;
47};
48
57 const PhvInfo &phv;
58 const FieldDefUse &defuse;
59 std::set<cstring> &zeroInitFields;
60
63 std::set<cstring> pa_no_inits;
64
67 bool elim_assign(const IR::BFN::Unit *unit, const IR::Expression *left,
68 const IR::Expression *right);
69
70 profile_t init_apply(const IR::Node *root) override;
71 void end_apply() override;
72
73 public:
74 bool elim_extract(const IR::BFN::Unit *unit, const IR::BFN::Extract *extract) override;
75
76 const IR::BFN::Pipe *preorder(IR::BFN::Pipe *pipe) override;
77 const IR::MAU::Instruction *preorder(IR::MAU::Instruction *instr) override;
78
79 explicit RemoveMetadataInits(const PhvInfo &phv, const FieldDefUse &defuse,
80 std::set<cstring> &zeroInitFields)
82 phv(phv),
83 defuse(defuse),
84 zeroInitFields(zeroInitFields) {}
85};
86
87#endif /* BF_P4C_PHV_AUTO_INIT_METADATA_H_ */
Definition elim_unused.h:45
Definition auto_init_metadata.h:34
Definition node.h:95
Definition visitor.h:424
Definition visitor.h:78
Definition phv_fields.h:1095
Definition auto_init_metadata.h:56
bool elim_extract(const IR::BFN::Unit *unit, const IR::BFN::Extract *extract) override
Determines whether the given extract, occurring in the given unit, should be eliminated.
Definition auto_init_metadata.cpp:161
Definition field_defuse.h:77