P4C
The P4 Compiler
|
Public Member Functions | |
ClotInfo (PhvUse &uses) | |
void | adjust_clots (const PhvInfo &phv) |
assoc::map< const PHV::FieldSlice *, Clot *, PHV::FieldSlice::Greater > * | allocated_slices (const PHV::Field *field) const |
assoc::map< const PHV::FieldSlice *, Clot *, PHV::FieldSlice::Greater > * | allocated_slices (const PHV::FieldSlice *slice) const |
bool | allocated_unmodified_undigested (const PHV::Field *field) const |
bool | clot_covers_slice (const Clot *clot, const PHV::FieldSlice *slice) const |
const std::set< const PHV::Field * > * | clot_eligible_fields () const |
Produces the set of CLOT-eligible fields. | |
std::map< const Clot *, std::vector< const IR::BFN::EmitChecksum * > > & | clot_to_emit_checksum () |
const std::map< const Clot *, std::vector< const IR::BFN::EmitChecksum * > > & | clot_to_emit_checksum () const |
const std::map< const Clot *, std::pair< gress_t, std::set< cstring > >, Clot::Less > & | clot_to_parser_states () const |
const std::vector< Clot * > & | clots () |
const std::map< const PHV::Field *, std::vector< const IR::BFN::EmitChecksum * > > & | field_to_checksum_updates () |
const Clot * | fully_allocated (const PHV::Field *field) const |
std::set< const Clot *, Clot::Less > * | fully_allocated (const PHV::FieldSlice &slice) const |
std::set< const Clot *, Clot::Less > * | fully_allocated (const PHV::FieldSlice *slice) const |
std::map< int, const PHV::Field * > | get_csum_fields (const Clot *clot) const |
std::map< int, PHV::Container > | get_overwrite_containers (const Clot *clot, const PhvInfo &phv) const |
const ordered_map< std::pair< const IR::BFN::ParserState *, const IR::HeaderStack * >, std::set< unsigned > > & | header_stack_elements () |
bool | is_added_by_mau (cstring h) const |
Determines whether h is a header that might be added by MAU. | |
bool | is_checksum (const PHV::Field *field) const |
Determines whether a field is a checksum field. | |
bool | is_checksum (const PHV::FieldSlice *slice) const |
bool | is_modified (const PHV::Field *field) const |
bool | is_modified (const PHV::FieldSlice *slice) const |
bool | is_readonly (const PHV::Field *field) const |
bool | is_readonly (const PHV::FieldSlice *slice) const |
bool | is_slice_below_min_offset (const PHV::FieldSlice *slice, int max_packet_bit_offset) const |
bool | is_unused (const PHV::Field *field) const |
bool | is_unused (const PHV::FieldSlice *slice) const |
void | merge_parser_states (gress_t gress, cstring dst_state_name, cstring src_state_name) |
const Clot * | parser_state_to_clot (const IR::BFN::LoweredParserState *state, unsigned tag) const |
const std::set< const Clot * > | parser_state_to_clots (const IR::BFN::LoweredParserState *state) const |
std::map< cstring, std::set< const Clot * > > & | parser_state_to_clots (gress_t gress) |
const std::map< cstring, std::set< const Clot * > > & | parser_state_to_clots (gress_t gress) const |
const ordered_map< const IR::BFN::ParserState *, std::vector< const PHV::Field * > > & | parser_state_to_fields () const |
const ordered_map< const IR::BFN::ParserState *, std::vector< const IR::HeaderStack * > > & | parser_state_to_header_stacks () const |
std::string | print (const PhvInfo *phvInfo=nullptr) const |
cstring | sanitize_state_name (cstring state_name, gress_t gress) const |
assoc::map< const PHV::FieldSlice *, Clot *, PHV::FieldSlice::Greater > * | slice_clots (const PHV::Field *field) const |
assoc::map< const PHV::FieldSlice *, Clot *, PHV::FieldSlice::Greater > * | slice_clots (const PHV::FieldSlice *slice) const |
bool | slice_overwritten (const PhvInfo &phvInfo, const Clot *clot, const PHV::FieldSlice *f) const |
bool | slice_overwritten_by_phv (const PhvInfo &phvInfo, const Clot *clot, const PHV::FieldSlice *f) const |
Clot * | whole_field_clot (const PHV::Field *field) const |
Public Attributes | |
CollectParserInfo | parserInfo |
std::set< const PHV::Field * > | pov_extracted_without_fields |
Friends | |
class | AllocateClot |
class | ClotCandidate |
class | CollectClotInfo |
class | GreedyClotAllocator |
void ClotInfo::adjust_clots | ( | const PhvInfo & | phv | ) |
Adjusts all allocated CLOTs so that they neither start nor end with an overwritten field slice. See CLOT allocation adjustment (README.md).
|
inline |
field
is read-only or modified. Otherwise, if the field
is unused, returns a map from each CLOT-allocated slice for the field to its corresponding CLOT.
|
inline |
slice
is read-only or modified. Otherwise, if the field containing the slice
is unused, returns each CLOT-allocated slice that overlaps with the given slice
, mapped to its corresponding CLOT.
|
inline |
field
is (1) fully allocated to clot, (2) not modified by MAUs, and (3) not digested. For these fields, it is safe to ignore deparser read to shrink their live ranges, because deparser can emit them directly from clot. bool ClotInfo::clot_covers_slice | ( | const Clot * | clot, |
const PHV::FieldSlice * | slice ) const |
slice
is covered by the given clot
.
|
inline |
|
inline |
std::set< const Clot *, Clot::Less > * ClotInfo::fully_allocated | ( | const PHV::FieldSlice * | slice | ) | const |
std::map< int, const PHV::Field * > ClotInfo::get_csum_fields | ( | const Clot * | clot | ) | const |
std::map< int, PHV::Container > ClotInfo::get_overwrite_containers | ( | const Clot * | clot, |
const PhvInfo & | phv ) const |
bool ClotInfo::is_modified | ( | const PHV::Field * | field | ) | const |
Determines whether a field is modified, as defined in CLOT allocator and metric (README.md).
bool ClotInfo::is_readonly | ( | const PHV::Field * | field | ) | const |
Determines whether a field is read-only, as defined in CLOT allocator and metric (README.md).
bool ClotInfo::is_slice_below_min_offset | ( | const PHV::FieldSlice * | slice, |
int | max_packet_bit_offset ) const |
Returns false if packet offset of the slice is less than hdr_len_adj and if the slice cannot be trimmed to increase its offset.
bool ClotInfo::is_unused | ( | const PHV::Field * | field | ) | const |
Determines whether a field is unused, as defined in CLOT allocator and metric (README.md).
void ClotInfo::merge_parser_states | ( | gress_t | gress, |
cstring | dst_state_name, | ||
cstring | src_state_name ) |
If gress::src_state_name state has CLOT extracts, then add them as gress::dst_state_name extracts as well.
This is because MergeLoweredParserStates merges LoweredParser states, their CLOT extracts need to be merged accordingly so ClotResourcesLogging has correct information for logging.
Sanitizes state name before lookup in the parser_state_to_clots_
If state name is not prefixed with gress, then it will be prefixed If a state is compiler generated auxiliary state (thus containing '.$' substring), then the generated appendix is stripped to regenerate original state name.
|
inline |
field
, mapped to the CLOTs containing those slices. assoc::map< const PHV::FieldSlice *, Clot *, PHV::FieldSlice::Greater > * ClotInfo::slice_clots | ( | const PHV::FieldSlice * | slice | ) | const |
slice
, mapped to the corresponding CLOTs. bool ClotInfo::slice_overwritten | ( | const PhvInfo & | phvInfo, |
const Clot * | clot, | ||
const PHV::FieldSlice * | f ) const |
Determines whether a field slice in a CLOT will be overwritten by a PHV container or a checksum calculation when deparsed. See CLOT allocator and metric (README.md).
f
is a field slice covered by clot
and at least part of f
will be overwritten by a PHV container or a checksum calculation when deparsed. bool ClotInfo::slice_overwritten_by_phv | ( | const PhvInfo & | phvInfo, |
const Clot * | clot, | ||
const PHV::FieldSlice * | f ) const |
Determines whether a field slice in a CLOT will be overwritten by a PHV container when deparsed. See CLOT allocator and metric (README.md).
f
is a field slice covered by clot
and at least part of f
will be overwritten by a PHV container when deparsed. Clot * ClotInfo::whole_field_clot | ( | const PHV::Field * | field | ) | const |
std::set<const PHV::Field *> ClotInfo::pov_extracted_without_fields |
A POV is in this set if there is a path through the parser in which the field is not extracted, but its POV bit is set.