P4C
The P4 Compiler
Loading...
Searching...
No Matches
compute_multi_write_containers.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_MULTI_WRITE_CONTAINERS_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_MULTI_WRITE_CONTAINERS_H_
21
22#include "bf-p4c/parde/allocate_parser_checksum.h"
23#include "bf-p4c/parde/clot/clot_info.h"
24#include "bf-p4c/parde/parde_visitor.h"
25
26namespace Parde::Lowered {
27
33 const PhvInfo &phv;
34 const CollectLoweredParserInfo &parser_info;
35
36 std::set<std::pair<const IR::BFN::LoweredParserMatch *, unsigned>> visited_matches;
37 unsigned stack_offset = 0;
38
39 public:
41 : phv(ph), parser_info(pi) {
42 visitDagOnce = false;
43 }
44
45 private:
46 bool preorder(IR::BFN::LoweredParserMatch *match) override;
47 void postorder(IR::BFN::LoweredParserMatch *match) override;
48
49 bool preorder(IR::BFN::LoweredParser *) override;
50
51 PHV::Container offset_container(const PHV::Container &container);
52
53 bool has_non_mutex_writes(const IR::BFN::LoweredParser *parser,
54 const std::set<const IR::BFN::LoweredParserMatch *> &matches);
55
56 void detect_multi_writes(
57 const IR::BFN::LoweredParser *parser,
58 const std::map<PHV::Container, std::set<const IR::BFN::LoweredParserMatch *>> &writes,
59 std::set<PHV::Container> &write_containers, const char *which);
60
61 void postorder(IR::BFN::LoweredParser *parser) override;
62
63 std::map<PHV::Container, std::set<const IR::BFN::LoweredParserMatch *>> bitwise_or,
64 clear_on_write;
65 std::set<PHV::Container> bitwise_or_containers, clear_on_write_containers;
66};
67
68} // namespace Parde::Lowered
69
70#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_MULTI_WRITE_CONTAINERS_H_ */
Definition phv.h:176
Definition phv_fields.h:1095
Collects all containers that are written more than once by the parser.
Definition compute_multi_write_containers.h:32
Definition parde_visitor.h:78
Definition lower_parser.cpp:72