P4C
The P4 Compiler
Loading...
Searching...
No Matches
hoist_common_match_operations.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HOIST_COMMON_MATCH_OPERATIONS_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HOIST_COMMON_MATCH_OPERATIONS_H_
21
22#include "bf-p4c/device.h"
23#include "bf-p4c/lib/assoc.h"
24#include "bf-p4c/parde/clot/clot_info.h"
25#include "bf-p4c/parde/parde_visitor.h"
26#include "compute_lowered_parser_ir.h"
27
28namespace Parde::Lowered {
29
37 CollectLoweredParserInfo &parser_info;
38 const ComputeLoweredParserIR &computed;
39 ClotInfo &clot_info;
40
42 original_to_modified;
43
44 profile_t init_apply(const IR::Node *root) override;
45
46 // Compares all fields in two LoweredParserMatch objects
47 // except for the match values. Essentially returns if both
48 // LoweredParserMatch do the same things when matching.
49 //
50 // Equivalent to IR::BFN::LoweredParserMatch::operator==(IR::BFN::LoweredParserMatch const & a)
51 // but considering the loop fields and with the value fields masked off.
52 bool compare_match_operations(const IR::BFN::LoweredParserMatch *a,
53 const IR::BFN::LoweredParserMatch *b);
54
55 const IR::BFN::LoweredParserMatch *get_unconditional_match(
56 const IR::BFN::LoweredParserState *state);
57
58 std::set<PHV::Container> get_extract_constant_dests(const IR::BFN::LoweredParserMatch *match);
59 std::set<PHV::Container> get_extract_inbuf_dests(const IR::BFN::LoweredParserMatch *match);
60
61 std::map<unsigned, unsigned> extractors_used(const IR::BFN::LoweredParserMatch *match);
62
63 bool can_hoist(const IR::BFN::LoweredParserMatch *a, const IR::BFN::LoweredParserMatch *b);
64
65 void do_hoist(IR::BFN::LoweredParserMatch *match, const IR::BFN::LoweredParserMatch *next);
66
67 // do not merge loopback state for now, need to maitain loopback pointer TODO
68 bool is_loopback_state(cstring state);
69
70 IR::Node *preorder(IR::BFN::LoweredParserMatch *match) override;
71
72 public:
74 const ComputeLoweredParserIR &computed, ClotInfo &clot_info)
75 : parser_info(parser_info), computed(computed), clot_info(clot_info) {}
76};
77
78} // namespace Parde::Lowered
79
80#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HOIST_COMMON_MATCH_OPERATIONS_H_ */
Definition clot_info.h:41
Definition node.h:95
Definition cstring.h:85
Definition assoc.h:300
After parser lowering, we have converted the parser IR from P4 semantic (action->match) to hardware s...
Definition hoist_common_match_operations.h:36
Combines the high-level parser IR and the results of PHV allocation to produce a low-level,...
Definition compute_lowered_parser_ir.h:37
Definition parde_visitor.h:90
Definition lower_parser.cpp:72