P4C
The P4 Compiler
Loading...
Searching...
No Matches
extract_simplifier.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_EXTRACT_SIMPLIFIER_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_EXTRACT_SIMPLIFIER_H_
21
22#include <boost/range/adaptor/reversed.hpp>
23
24#include "bf-p4c/parde/clot/clot_info.h"
25#include "bf-p4c/parde/lowered/helpers.h"
26#include "bf-p4c/phv/phv_fields.h"
27
28namespace Parde::Lowered {
29
36 const PhvInfo &phv;
37 const ClotInfo &clot;
38
39 ExtractSimplifier(const PhvInfo &phv, const ClotInfo &clot) : phv(phv), clot(clot) {}
40
41 using ExtractSequence = std::vector<const IR::BFN::LoweredExtractPhv *>;
42
44 void add(const IR::BFN::Extract *extract);
45 void add(const IR::BFN::ExtractClot *extract);
46 void add(const IR::BFN::ExtractPhv *extract);
47
55 template <typename InputBufferRValType>
56 static const IR::BFN::LoweredExtractPhv *createMergedExtract(PHV::Container container,
57 const ExtractSequence &extracts,
58 nw_byteinterval bufferRange);
59 template <typename InputBufferRValType>
60 static const ExtractSequence mergeExtractsFor(PHV::Container container,
61 const ExtractSequence &extracts);
62
63 void sortExtractPhvs(IR::Vector<IR::BFN::LoweredParserPrimitive> &loweredExtracts);
64
65 const IR::BFN::LoweredExtractPhv *mergeExtractsForConstants(PHV::Container container,
66 const ExtractSequence &extracts);
67
72 std::map<gress_t, std::map<unsigned, unsigned>> clotTagToCsumUnit);
73
78 ordered_map<PHV::Container, ExtractSequence> extractFromBufferByContainer;
79 ordered_map<PHV::Container, ExtractSequence> extractConstantByContainer;
80
82};
83
84} // namespace Parde::Lowered
85
86#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_EXTRACT_SIMPLIFIER_H_ */
Definition clot_info.h:41
Definition vector.h:59
Definition ordered_map.h:32
Definition phv.h:176
Definition phv_fields.h:1095
ordered_map< PHV::Container, ExtractSequence > extractFromPacketByContainer
Definition extract_simplifier.h:77
static const IR::BFN::LoweredExtractPhv * createMergedExtract(PHV::Container container, const ExtractSequence &extracts, nw_byteinterval bufferRange)
Definition extract_simplifier.cpp:161
IR::Vector< IR::BFN::LoweredParserPrimitive > lowerExtracts(std::map< gress_t, std::map< unsigned, unsigned > > clotTagToCsumUnit)
Definition extract_simplifier.cpp:328
void add(const IR::BFN::Extract *extract)
Add a new extract operation to the sequence.
Definition extract_simplifier.cpp:25
Helper class that splits extract operations into multiple smaller extracts, such that each extract wr...
Definition extract_simplifier.h:35
Definition lower_parser.cpp:72
Definition lib/bitrange.h:253