P4C
The P4 Compiler
Loading...
Searching...
No Matches
Parde::Lowered Namespace Reference

Classes

struct  ClearLoweredParserMatch
 
class  ComputeBufferRequirements
 Computes the number of bytes which must be available for each parser match to avoid a stall. More...
 
class  ComputeInitZeroContainers
 Computes containers that have fields relying on parser zero initialization. More...
 
struct  ComputeLoweredDeparserIR
 Generates lowered deparser IR with container references. More...
 
struct  ComputeLoweredParserIR
 Combines the high-level parser IR and the results of PHV allocation to produce a low-level, target-specific representation of the parser program. More...
 
class  ComputeMultiWriteContainers
 Collects all containers that are written more than once by the parser. More...
 
struct  EliminateEmptyStates
 Eliminates empty states. More...
 
struct  ExtractSimplifier
 Helper class that splits extract operations into multiple smaller extracts, such that each extract writes to exactly one PHV container. More...
 
struct  FindNegativeDeposits
 Find all of the states that do a checksum deposit but also do not extract/shift before doing it (= the end_pos is negative) and also all of the states from which we can get via 0 shift to a state that does this negative checksum deposit. More...
 
class  HoistCommonMatchOperations
 After parser lowering, we have converted the parser IR from P4 semantic (action->match) to hardware semantic (match->action), there may still be opportunities where we can merge matches where we could not before lowering (without breaking the P4 semantic). More...
 
struct  LowerDeparserIR
 
struct  LowerParserIR
 
struct  MergeLoweredParserStates
 After parser lowering, we have converted the parser IR from P4 semantic (action->match) to HW semantic (match->action), there may still be opportunities where we can merge states where we couldn't before lowering (without breaking the P4 semantic). More...
 
struct  RemoveNegativeDeposits
 Updates the IR so that every checksum deposit can also shift by at least one. More...
 
struct  ReplaceDeparserIR
 Replace deparser IR with lowered version. More...
 
struct  ReplaceParserIR
 The pass that replaces an IR::BRN::Parser node with an IR::BFN::LoweredParser node. More...
 
class  ResolveParserConstants
 Resolves constants in parser. More...
 
struct  RewriteEmitClot
 Replace Emits covered in a CLOT with EmitClot. More...
 
struct  RightShiftCsumMask
 
struct  RightShiftPacketRVal
 
struct  SplitGreedyParserStates
 This pass is used to ensure that there will be no conflicting partial_hdr_err_proc at the time the LoweredParserMatch is created. More...
 
class  WarnTernaryMatchFields
 Issues warning for invalid container participating in ternary match. More...
 

Functions

const safe_vector< IR::BFN::DigestField > * computeControlPlaneFormat (const PhvInfo &phv, const IR::Vector< IR::BFN::FieldLVal > &fields)
 
cstring debugInfoFor (const cstring fieldName, const PHV::AllocSlice &slice, bool includeContainerInfo)
 
cstring debugInfoFor (const IR::BFN::Extract *extract, const PHV::AllocSlice &slice, const le_bitrange &pov_range, const cstring pov_type_string)
 
cstring debugInfoFor (const IR::BFN::Extract *extract, const PHV::AllocSlice &slice, const nw_bitrange &bufferRange, bool includeRangeInfo)
 
cstring debugInfoFor (const IR::BFN::ParserLVal *lval, const PHV::AllocSlice &slice, bool includeContainerInfo)
 
std::map< PHV::Container, unsigned > getChecksumPhvSwap (const PhvInfo &phv, const IR::BFN::EmitChecksum *emitChecksum)
 
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)
 
const IR::BFN::ContainerBitRef * lowerSingleBit (const PhvInfo &phv, const IR::BFN::FieldLVal *fieldRef, const PHV::AllocContext *ctxt)
 
const IR::BFN::ContainerRef * lowerUnsplittableField (const PhvInfo &phv, const ClotInfo &clotInfo, const IR::BFN::FieldLVal *fieldRef, const char *unsplittableReason)
 
cstring sanitizeName (StringRef name)
 

Detailed Description

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

Function Documentation

◆ computeControlPlaneFormat()

const safe_vector< IR::BFN::DigestField > * Parde::Lowered::computeControlPlaneFormat ( const PhvInfo & phv,
const IR::Vector< IR::BFN::FieldLVal > & fields )

Given a sequence of fields, construct a packing format describing how the fields will be laid out once they're lowered to containers.

The container into which the last field was placed.

The number of unused bits which remain on the LSB side of the container after the last field was placed.

◆ debugInfoFor() [1/4]

cstring Parde::Lowered::debugInfoFor ( const cstring fieldName,
const PHV::AllocSlice & slice,
bool includeContainerInfo = true )

Construct debugging information describing a slice of a field.

Parameters
fieldNameField name.
sliceAn alloc_slice mapping a range of bits in the field to a range of bits in a container.
includeContainerInfoIf true, the result will include information about which bits in the container the field slice was mapped to.
Returns
a string describing which bits in the field are included in the slice, and describing the corresponding bits in the container.

◆ debugInfoFor() [2/4]

cstring Parde::Lowered::debugInfoFor ( const IR::BFN::Extract * extract,
const PHV::AllocSlice & slice,
const le_bitrange & pov_range,
const cstring pov_type_string )

Construct a string describing how an Extract primitive was mapped to a hardware extract operation (in case of extract from POV (state/flags) bits).

Parameters
extractThe original Extract primitive, with a field as the destination.
sliceAn alloc_slice mapping a range of bits in the field to a range of bits in a container.
pov_rangeThe range corresponding to the bits from POV state/flags bits.
pov_type_stringOptional string with info about type of POV (state/flags).
Returns
a string containing debugging info describing the mapping between the field, the container, and POV state/flags bits read by the Extract.

Describe the value that's being written into the destination container.

Describe the field slice that we're writing to.

◆ debugInfoFor() [3/4]

cstring Parde::Lowered::debugInfoFor ( const IR::BFN::Extract * extract,
const PHV::AllocSlice & slice,
const nw_bitrange & bufferRange,
bool includeRangeInfo )

Construct a string describing how an Extract primitive was mapped to a hardware extract operation.

Parameters
extractThe original Extract primitive, with a field as the destination.
sliceAn alloc_slice mapping a range of bits in the field to a range of bits in a container.
bufferRangeFor extracts that read from the input buffer, an input buffer range corresponding to the range of bits in the alloc_slice.
includeRangeInfoIf true, the range of bits being extracted into the destination container is printed even if it matches the size of the container exactly.
Returns
a string containing debugging info describing the mapping between the field, the container, and the constant or input buffer region read by the Extract.

◆ debugInfoFor() [4/4]

cstring Parde::Lowered::debugInfoFor ( const IR::BFN::ParserLVal * lval,
const PHV::AllocSlice & slice,
bool includeContainerInfo )

Construct debugging information describing a slice of a field.

Parameters
lvalA reference to a field.
sliceAn alloc_slice mapping a range of bits in the field to a range of bits in a container.
includeContainerInfoIf true, the result will include information about which bits in the container the field slice was mapped to.
Returns
a string describing which bits in the field are included in the slice, and describing the corresponding bits in the container.

◆ lowerFields()

std::pair< IR::Vector< IR::BFN::ContainerRef >, std::vector< Clot * > > Parde::Lowered::lowerFields ( const PhvInfo & phv,
const ClotInfo & clotInfo,
const IR::Vector< IR::BFN::FieldLVal > & fields,
bool is_checksum = false )

Maps a sequence of fields to a sequence of PHV containers. The sequence of fields is treated as ordered and non-overlapping; the resulting container sequence is the shortest one which maintains these properties.

◆ lowerSingleBit()

const IR::BFN::ContainerBitRef * Parde::Lowered::lowerSingleBit ( const PhvInfo & phv,
const IR::BFN::FieldLVal * fieldRef,
const PHV::AllocContext * ctxt )

Maps a POV bit field to a single bit within a container, represented as a ContainerBitRef. Checks that the allocation for the POV bit field is sane.

◆ lowerUnsplittableField()

const IR::BFN::ContainerRef * Parde::Lowered::lowerUnsplittableField ( const PhvInfo & phv,
const ClotInfo & clotInfo,
const IR::BFN::FieldLVal * fieldRef,
const char * unsplittableReason )

Maps a field which cannot be split between multiple containers to a single container, represented as a ContainerRef. Checks that the allocation for the field is sane.

◆ sanitizeName()

cstring Parde::Lowered::sanitizeName ( StringRef name)
Returns
a version of the provided state name which is safe to use in the generated assembly.