P4C
The P4 Compiler
|
Public Member Functions | |
SliceExtracts (const PhvInfo &phv, const ClotInfo &clot, const CollectParserInfo &parser_info, const MapFieldToParserStates &field_to_states) | |
template<class Extract > | |
const Extract * | make_slice (const IR::BFN::Extract *extract, int le_low_idx, int width, int extract_base, std::optional< PHV::Container > cont=std::nullopt) |
bool | preorder (IR::BFN::ParserState *state) override |
std::vector< const IR::BFN::Extract * > | slice_extract (const IR::BFN::Extract *extract) |
Public Attributes | |
const ClotInfo & | clot |
const PhvInfo & | phv |
const ParserQuery | pq |
const IR::BFN::ParserState * | state = nullptr |
Slices each extract into multiple extracts that each write into a single PHV container or CLOT. This prepares for the subsequent state-splitting pass, where we may need to allocate the sliced extracts into different states (this is the case when field straddles the input-buffer boundary).
|
inline |
Rewrites an extract so that it extracts exactly the slice specified by le_low_idx
and width
, and marks the extract with the given extract type.
extract | extract to be rewritten. |
le_low_idx | the little-endian index for the low end of the slice. |
width | the width of the slice, in bits. |
extract_base | The low index of the extract destination ignoring slicing. For example, for extract inbuf bit[112..175] to ig_md.f[95:32], assume ig_md.f[95:64] and ig_md.f[63:32] are allocated to two 32-bit container. Two make_slice will be called. For the first make_slice, le_low_idx is 32, width is 32 and extract_base is 32. For the second make_slice, le_low_idx is 64, width is 32 and extract_base is 32. |
|
inline |
Breaks up an Extract into a series of Extracts according to the extracted field's PHV and CLOT allocation.