P4C
The P4 Compiler
Loading...
Searching...
No Matches
PHV::v2::ParserPackingValidator Class Reference

#include <parser_packing_validator.h>

Inheritance diagram for PHV::v2::ParserPackingValidator:
[legend]

Public Member Functions

 ParserPackingValidator (const PhvInfo &phv, const MapFieldToParserStates &parser, const CollectParserInfo &parser_info, const FieldDefUse &defuse, const PragmaNoInit &pa_no_init, std::set< FieldRange > &mauInitFields)
 
const AllocErrorcan_pack (const FieldSliceAllocStartMap &alloc, bool add_mau_inits=false) const override
 
const AllocErrorcan_pack (const FieldSliceStart &a, const FieldSliceStart &b, bool add_mau_inits=false) const
 
void set_trivial_alloc (bool trivial) const
 
void set_trivial_pass (bool trivial) const
 
- Public Member Functions inherited from PHV::ParserPackingValidatorInterface

Detailed Description

what we have done wrong: only check against candidate and allocated: this is because we assume that slice lists make sure that the packing is okay because they are very likely coming out from a header. But, it is not true for (1) bridged metadata, they are metadata and we packed them. (2) fancy usage of header fields. (3) result came from co-packer or table key optimization packing. (4) pa_byte_pack.

Member Function Documentation

◆ can_pack() [1/2]

const AllocError * PHV::v2::ParserPackingValidator::can_pack ( const FieldSliceAllocStartMap & alloc,
bool add_mau_inits = false ) const
overridevirtual
Returns
an error if we allocated slices in the format of alloc. c is optional for 32-bit container half-word extract optimization.

make sure that every pair of field slices can be packed.

Implements PHV::ParserPackingValidatorInterface.

◆ can_pack() [2/2]

const AllocError * PHV::v2::ParserPackingValidator::can_pack ( const FieldSliceStart & a,
const FieldSliceStart & b,
bool add_mau_inits = false ) const
Returns
an error if we cannot allocated a and b in a container. c is optional for 32-bit container half-word extract optimization.