P4C
The P4 Compiler
Loading...
Searching...
No Matches
ClotCandidate Class Reference
Inheritance diagram for ClotCandidate:
[legend]

Public Member Functions

 ClotCandidate (const ClotInfo &clotInfo, const Pseudoheader *pseudoheader, const std::vector< const FieldSliceExtractInfo * > &extract_infos, bool afterAllocatedClot=false, bool beforeAllocatedClot=false)
 
unsigned bit_in_byte_offset () const
 The bit-in-byte offset of the first extract in the candidate.
 
const std::map< unsigned, StatePairSetbyte_gaps (const CollectParserInfo &parserInfo, const ClotCandidate *other) const
 
const std::vector< unsigned > & can_end_indices () const
 
const std::vector< unsigned > & can_start_indices () const
 
const std::vector< const FieldSliceExtractInfo * > & extracts () const
 
const ClotCandidatemark_adjacencies (bool afterAllocatedClot, bool beforeAllocatedClot) const
 
unsigned max_size_in_bits () const
 The maximum length of the candidate, in bits.
 
bool operator< (const ClotCandidate &other) const
 Lexicographic order according to (number of unused bits, number of read-only bits, id).
 
std::string print () const
 
unsigned size_in_bits (const IR::BFN::ParserState *parser_state) const
 The length of the candidate for a given parser state, in bits.
 
const ordered_map< const IR::BFN::ParserState *, unsigned > & state_bit_offsets () const
 The state-relative offsets, in bits, of the first extract in the candidate.
 
ordered_set< const IR::BFN::ParserState * > states () const
 The parser states containing this candidate's extracts.
 
gress_t thread () const
 The pipe thread for the extracts in this candidate.
 
- Public Member Functions inherited from LiftLess< ClotCandidate >
 OPERATOR (equal, Equal)
 
 OPERATOR (greater, Greater)
 
 OPERATOR (greater_equal, GreaterEqual)
 
 OPERATOR (less, Less)
 
 OPERATOR (less_equal, LessEqual)
 
 OPERATOR (not_equal, NotEqual)
 
bool operator!= (const ClotCandidate &other) const
 
bool operator<= (const ClotCandidate &other) const
 
bool operator== (const ClotCandidate &other) const
 
bool operator> (const ClotCandidate &other) const
 
bool operator>= (const ClotCandidate &other) const
 

Public Attributes

bool afterAllocatedClot
 
bool beforeAllocatedClot
 
const unsigned id
 
PovBitSet pov_bits
 
const Pseudoheaderpseudoheader
 

Member Function Documentation

◆ byte_gaps()

const std::map< unsigned, StatePairSet > ClotCandidate::byte_gaps ( const CollectParserInfo & parserInfo,
const ClotCandidate * other ) const

Produces a map wherein the keys are all possible gap sizes, in bytes, between the end of this candidate and the start of another candidate when this candidate is parsed before the other candidate in the input packet. This key set corresponds to the GAPS function, as defined in CLOT allocator and metric (README.md).

Each possible gap size is mapped to the set of parser states that realize that gap. Each set member is a pair, wherein the first component is the state containing this candidate, and the second component is the state containing other.

◆ can_end_indices()

const std::vector< unsigned > & ClotCandidate::can_end_indices ( ) const

The indices into the vector returned by extracts, corresponding to fields that can end a CLOT, in descending order.

◆ can_start_indices()

const std::vector< unsigned > & ClotCandidate::can_start_indices ( ) const

The indices into the vector returned by extracts, corresponding to fields that can start a CLOT, in ascending order.

◆ mark_adjacencies()

const ClotCandidate * ClotCandidate::mark_adjacencies ( bool afterAllocatedClot,
bool beforeAllocatedClot ) const

Functionally updates this candidate with the given arguments by ORing them with the corresponding fields. If this results in no change, then this candidate is returned; otherwise, a new candidate is returned.

◆ max_size_in_bits()

unsigned ClotCandidate::max_size_in_bits ( ) const

The maximum length of the candidate, in bits.

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

◆ operator<()

bool ClotCandidate::operator< ( const ClotCandidate & other) const
virtual

Lexicographic order according to (number of unused bits, number of read-only bits, id).

Implements LiftLess< ClotCandidate >.

Member Data Documentation

◆ afterAllocatedClot

bool ClotCandidate::afterAllocatedClot

Indicates whether the candidate might immediately succeed an allocated CLOT with a 0-byte gap. When adjusting this candidate, if fields are removed from the beginning of the candidate, we need to make sure to remove at least Device::pardeSpec().byteInterClotGap() bytes.

◆ beforeAllocatedClot

bool ClotCandidate::beforeAllocatedClot

Indicates whether the candidate might immediately precede an allocated CLOT with a 0-byte gap. When adjusting this candidate, if fields are removed from the end of the candidate, we need to make sure to remove at least Device::pardeSpec().byteInterClotGap() bytes.