P4C
The P4 Compiler
Loading...
Searching...
No Matches
tofino/bf-p4c/parde/lowered/helpers.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HELPERS_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HELPERS_H_
21
22#include "bf-p4c/ir/bitrange.h"
23#include "bf-p4c/parde/clot/clot_info.h"
24#include "bf-p4c/phv/utils/slice_alloc.h"
25#include "ir/ir.h"
26#include "lib/cstring.h"
27#include "lib/stringref.h"
28
29namespace Parde::Lowered {
30
34
47cstring debugInfoFor(const cstring fieldName, const PHV::AllocSlice &slice,
48 bool includeContainerInfo = true);
49
62cstring debugInfoFor(const IR::BFN::ParserLVal *lval, const PHV::AllocSlice &slice,
63 bool includeContainerInfo = true);
64
83cstring debugInfoFor(const IR::BFN::Extract *extract, const PHV::AllocSlice &slice,
84 const nw_bitrange &bufferRange = nw_bitrange(), bool includeRangeInfo = false);
85
99cstring debugInfoFor(const IR::BFN::Extract *extract, const PHV::AllocSlice &slice,
100 const le_bitrange &pov_range, const cstring pov_type_string = ""_cs);
101
104const IR::BFN::ContainerBitRef *lowerSingleBit(const PhvInfo &phv,
105 const IR::BFN::FieldLVal *fieldRef,
106 const PHV::AllocContext *ctxt);
107
111std::pair<IR::Vector<IR::BFN::ContainerRef>, std::vector<Clot *>> lowerFields(
112 const PhvInfo &phv, const ClotInfo &clotInfo, const IR::Vector<IR::BFN::FieldLVal> &fields,
113 bool is_checksum = false);
114
118const IR::BFN::ContainerRef *lowerUnsplittableField(const PhvInfo &phv, const ClotInfo &clotInfo,
119 const IR::BFN::FieldLVal *fieldRef,
120 const char *unsplittableReason);
121
122// Deparser checksum engine exposes input entries as 16-bit.
123// PHV container entry needs a swap if the field's 2-byte alignment
124// in the container is not same as the alignment in the packet layout
125// i.e. off by 1 byte. For example, this could happen if "ipv4.ttl" is
126// allocated to a 8-bit container.
127std::map<PHV::Container, unsigned> getChecksumPhvSwap(const PhvInfo &phv,
128 const IR::BFN::EmitChecksum *emitChecksum);
129
133 const PhvInfo &phv, const IR::Vector<IR::BFN::FieldLVal> &fields);
134
135} // namespace Parde::Lowered
136
137#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_HELPERS_H_ */
Definition clot_info.h:41
Definition cstring.h:85
Definition safe_vector.h:27
Represents a PHV-allocation context: a parser, a table, or a deparser.
Definition phv_fields.h:83
Definition slice_alloc.h:136
Definition phv_fields.h:1095
ClosedRange< RangeUnit::Bit, Endian::Network > nw_bitrange
Convenience typedefs for closed ranges in bits.
Definition lib/bitrange.h:755
Definition lower_parser.cpp:72
cstring debugInfoFor(const cstring fieldName, const PHV::AllocSlice &slice, bool includeContainerInfo)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:35
cstring sanitizeName(StringRef name)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:29
std::pair< IR::Vector< IR::BFN::ContainerRef >, std::vector< Clot * > > lowerFields(const PhvInfo &phv, const ClotInfo &clotInfo, const IR::Vector< IR::BFN::FieldLVal > &fields, bool is_checksum)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:179
const IR::BFN::ContainerRef * lowerUnsplittableField(const PhvInfo &phv, const ClotInfo &clotInfo, const IR::BFN::FieldLVal *fieldRef, const char *unsplittableReason)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:257
const IR::BFN::ContainerBitRef * lowerSingleBit(const PhvInfo &phv, const IR::BFN::FieldLVal *fieldRef, const PHV::AllocContext *ctxt)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:152
const safe_vector< IR::BFN::DigestField > * computeControlPlaneFormat(const PhvInfo &phv, const IR::Vector< IR::BFN::FieldLVal > &fields)
Definition tofino/bf-p4c/parde/lowered/helpers.cpp:304
Definition stringref.h:43