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

Classes

struct  ActionProfile_Model
 
struct  ActionSelector_Model
 
class  AdjustLengths
 
struct  Algorithm_Model
 
class  CheckIfMultiEntryPoint
 
struct  Cloner_Model
 
struct  CloneType_Model
 
class  CollectBridgedFields
 
class  CollectDigestFields
 
class  ComputeCallGraph
 
class  ComputeTableCallGraph
 
struct  Control_Model
 
class  ConversionContext
 
class  ConvertConcreteHeaderRefToPathExpression
 
class  Converter
 
class  ConvertMetadata
 
struct  Counter_Model
 
struct  CounterOrMeter_Model
 
struct  CounterType_Model
 
struct  Deparser_Model
 
class  DetectDuplicates
 
struct  DigestReceiver_Model
 
struct  DirectCounter_Model
 
struct  DirectMeter_Model
 
class  DiscoverStructure
 
class  ExpressionConverter
 
class  ExternConverter
 
class  FieldListConverter
 
class  FindHeaderReference
 
class  FindRecirculated
 
class  FixApplyStatement
 
class  FixBridgedIntrinsicMetadata
 
class  FixChecksum
 
class  FixDuplicatePathExpression
 
class  FixEgressParserDuplicateReference
 
class  FixExtracts
 
class  FixIdleTimeout
 
class  FixMultiEntryPoint
 
class  FixParamType
 
class  FixParserCounter
 
class  FixParserPriority
 
class  FixPktgenHeaderPath
 
class  GetV1ModelVersion
 
struct  Hash_Model
 
class  InsertChecksumDeposit
 
class  InsertChecksumError
 
class  InsertCompilerGeneratedStartState
 
class  LpfConverter
 
struct  Meter_Model
 
class  MeterConverter
 
struct  MeterType_Model
 
class  ModifyParserForChecksum
 
class  MoveIntrinsicMetadata
 
struct  Parser_Model
 
class  ParserCounterSelectCaseConverter
 
struct  ParserCounterSelectExprConverter
 
class  PostTranslationFix
 
class  PrimitiveConverter
 
class  ProgramStructure
 Information about the structure of a P4-14 program, used to convert it to a P4-16 program. More...
 
struct  Random_Model
 
struct  Register_Model
 
class  RemoveBuiltins
 
class  RenameFieldPath
 
class  Rewriter
 
struct  StandardMetadataType_Model
 
class  StatefulAluConverter
 
class  StatementConverter
 
struct  Switch_Model
 
struct  TableAttributes_Model
 
class  TNA_ProgramStructure
 
class  TnaConverter
 
class  TnaProgramStructure
 
class  Truncate
 
class  TypeConverter
 
class  V1Model
 
struct  VerifyUpdate_Model
 
class  WREDConverter
 

Typedefs

using DigestFieldList
 
using EndStates = std::map<cstring, ordered_map<cstring, ordered_set<cstring>>>
 
using ExtractToState = assoc::map<const IR::Member *, const IR::ParserState *>
 
using StateToExtracts = assoc::map<const IR::ParserState *, std::vector<const IR::Member *>>
 

Functions

void add_custom_enum_if_crc_poly (const IR::Expression *expr, IR::Vector< IR::Argument > &declArgs)
 
void add_custom_enum_if_crc_poly (const IR::Expression *expr, IR::Vector< IR::Argument > *declArgs)
 
unsigned long computeHashOverFieldList (const IR::Expression *expr, std::map< unsigned long, unsigned > &hashIndexMap, bool reserve_entry_zero)
 
 CONVERT_PRIMITIVE (add,)
 
 CONVERT_PRIMITIVE (add_header,)
 
 CONVERT_PRIMITIVE (add_to_field,)
 
 CONVERT_PRIMITIVE (bit_and,)
 
 CONVERT_PRIMITIVE (bit_andca,)
 
 CONVERT_PRIMITIVE (bit_andcb,)
 
 CONVERT_PRIMITIVE (bit_nand,)
 
 CONVERT_PRIMITIVE (bit_nor,)
 
 CONVERT_PRIMITIVE (bit_not,)
 
 CONVERT_PRIMITIVE (bit_or,)
 
 CONVERT_PRIMITIVE (bit_orca,)
 
 CONVERT_PRIMITIVE (bit_orcb,)
 
 CONVERT_PRIMITIVE (bit_xnor,)
 
 CONVERT_PRIMITIVE (bit_xor,)
 
 CONVERT_PRIMITIVE (bypass_egress)
 
 CONVERT_PRIMITIVE (bypass_egress, 1)
 
 CONVERT_PRIMITIVE (clone_e2e, 1)
 
 CONVERT_PRIMITIVE (clone_e2e,)
 
 CONVERT_PRIMITIVE (clone_egress_pkt_to_egress, 1)
 
 CONVERT_PRIMITIVE (clone_egress_pkt_to_egress,)
 
 CONVERT_PRIMITIVE (clone_i2e, 1)
 
 CONVERT_PRIMITIVE (clone_i2e,)
 
 CONVERT_PRIMITIVE (clone_ingress_pkt_to_egress, 1)
 
 CONVERT_PRIMITIVE (clone_ingress_pkt_to_egress,)
 
 CONVERT_PRIMITIVE (copy_header,)
 
 CONVERT_PRIMITIVE (count,)
 
 CONVERT_PRIMITIVE (count_from_hash)
 
 CONVERT_PRIMITIVE (count_from_hash, 2)
 
 CONVERT_PRIMITIVE (drop, 1)
 
 CONVERT_PRIMITIVE (drop,)
 
 CONVERT_PRIMITIVE (execute_meter, 5)
 
 CONVERT_PRIMITIVE (execute_meter, 6)
 
 CONVERT_PRIMITIVE (execute_meter,)
 
 CONVERT_PRIMITIVE (execute_meter_from_hash)
 
 CONVERT_PRIMITIVE (execute_meter_from_hash, 1)
 
 CONVERT_PRIMITIVE (execute_meter_from_hash_with_or)
 
 CONVERT_PRIMITIVE (execute_meter_from_hash_with_or, 1)
 
 CONVERT_PRIMITIVE (execute_meter_with_or)
 
 CONVERT_PRIMITIVE (execute_meter_with_or, 1)
 
 CONVERT_PRIMITIVE (exit,)
 
 CONVERT_PRIMITIVE (funnel_shift_right,)
 
 CONVERT_PRIMITIVE (generate_digest, 1)
 
 CONVERT_PRIMITIVE (generate_digest,)
 
 CONVERT_PRIMITIVE (invalidate)
 
 CONVERT_PRIMITIVE (invalidate, 1)
 
 CONVERT_PRIMITIVE (invalidate_digest)
 
 CONVERT_PRIMITIVE (invalidate_digest, 1)
 
 CONVERT_PRIMITIVE (mark_for_drop, 1)
 
 CONVERT_PRIMITIVE (mark_for_drop,)
 
 CONVERT_PRIMITIVE (mark_to_drop, 1)
 
 CONVERT_PRIMITIVE (max,)
 
 CONVERT_PRIMITIVE (min,)
 
 CONVERT_PRIMITIVE (modify_field,)
 
 CONVERT_PRIMITIVE (modify_field_conditionally,)
 
 CONVERT_PRIMITIVE (modify_field_from_rng,)
 
 CONVERT_PRIMITIVE (modify_field_rng_uniform, 2)
 
 CONVERT_PRIMITIVE (modify_field_rng_uniform,)
 
 CONVERT_PRIMITIVE (modify_field_with_hash_based_offset, 1)
 
 CONVERT_PRIMITIVE (modify_field_with_hash_based_offset, 2)
 
 CONVERT_PRIMITIVE (modify_field_with_hash_based_offset,)
 
 CONVERT_PRIMITIVE (modify_field_with_shift,)
 
 CONVERT_PRIMITIVE (no_op,)
 
 CONVERT_PRIMITIVE (pop,)
 
 CONVERT_PRIMITIVE (push,)
 
 CONVERT_PRIMITIVE (recirculate, 5)
 
 CONVERT_PRIMITIVE (recirculate, 8)
 
 CONVERT_PRIMITIVE (recirculate,)
 
 CONVERT_PRIMITIVE (recirculate_preserving_field_list, 5)
 
 CONVERT_PRIMITIVE (register_read,)
 
 CONVERT_PRIMITIVE (register_write,)
 
 CONVERT_PRIMITIVE (remove_header,)
 
 CONVERT_PRIMITIVE (resubmit, 1)
 
 CONVERT_PRIMITIVE (resubmit,)
 
 CONVERT_PRIMITIVE (sample_e2e)
 
 CONVERT_PRIMITIVE (sample_e2e, 1)
 
 CONVERT_PRIMITIVE (shift_left,)
 
 CONVERT_PRIMITIVE (shift_right,)
 
 CONVERT_PRIMITIVE (subtract,)
 
 CONVERT_PRIMITIVE (subtract_from_field,)
 
 CONVERT_PRIMITIVE (swap)
 
 CONVERT_PRIMITIVE (swap, 1)
 
 CONVERT_PRIMITIVE (truncate,)
 
IR::BlockStatement * generate_arch_neutral_hash_block_statement (P4V1::ProgramStructure *structure, const IR::Primitive *prim, const cstring temp, ExpressionConverter &conv, unsigned num_ops)
 
IR::BlockStatement * generate_hash_block_statement (P4V1::ProgramStructure *structure, const IR::Primitive *prim, const cstring temp, ExpressionConverter &conv, unsigned num_ops)
 
const IR::BlockStatement * generate_recirc_port_assignment (const IR::Expression *port)
 
IR::BlockStatement * generate_tna_hash_block_statement (P4V1::TnaProgramStructure *structure, const IR::Primitive *prim, const cstring temp, ExpressionConverter &conv, unsigned num_ops, const IR::Expression *dest=nullptr)
 
bool use_v1model ()
 

Variables

const std::map< cstring, int > intrinsic_metadata
 
const std::vector< std::tuple< cstring, cstring, IR::Direction > > intrinsic_metadata_type
 

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

Typedef Documentation

◆ DigestFieldList

using P4::P4V1::DigestFieldList
Initial value:
std::map<cstring,
std::map<unsigned, std::pair<std::optional<cstring>, const IR::Expression *>>>
Definition cstring.h:85

Function Documentation

◆ add_custom_enum_if_crc_poly()

void P4::P4V1::add_custom_enum_if_crc_poly ( const IR::Expression * expr,
IR::Vector< IR::Argument > * declArgs )

TNA hash extern has two constructors: Hash(HashAlgorithm_t) Hash(HashAlgorithm_t, CRCPolynomial)

The second constructor could be Hash(crc_poly) if the frontend implements a more intelligent name lookup that is not only based on number of arguments. For now, we will insert an HashAlgorithm_t.CUSTOM.

◆ generate_arch_neutral_hash_block_statement()

IR::BlockStatement * P4::P4V1::generate_arch_neutral_hash_block_statement ( P4V1::ProgramStructure * structure,
const IR::Primitive * prim,
const cstring temp,
ExpressionConverter & conv,
unsigned num_ops )

Generate code template that bypasses architecture definition and uses internal architecture independent definition for hashes.

◆ generate_tna_hash_block_statement()

IR::BlockStatement * P4::P4V1::generate_tna_hash_block_statement ( P4V1::TnaProgramStructure * structure,
const IR::Primitive * prim,
const cstring temp,
ExpressionConverter & conv,
unsigned num_ops,
const IR::Expression * dest = nullptr )

Generate code template that matches to TNA architecture.

Variable Documentation

◆ intrinsic_metadata

const std::map<cstring, int> P4::P4V1::intrinsic_metadata
Initial value:
= {{"ig_prsr_ctrl"_cs, 0},
{"ig_intr_md"_cs, 1},
{"ig_pg_md"_cs, 2},
{"ig_intr_md_for_tm"_cs, 3},
{"ig_intr_md_from_parser_aux"_cs, 4},
{"ig_intr_md_for_mb"_cs, 5},
{"ig_intr_md_for_dprsr"_cs, 6},
{"eg_intr_md"_cs, 7},
{"eg_intr_md_from_parser_aux"_cs, 8},
{"eg_intr_md_for_mb"_cs, 9},
{"eg_intr_md_for_oport"_cs, 10},
{"eg_intr_md_for_dprsr"_cs, 11}}

◆ intrinsic_metadata_type

const std::vector<std::tuple<cstring, cstring, IR::Direction> > P4::P4V1::intrinsic_metadata_type
Initial value:
= {
std::make_tuple("ingress_parser_control_signals"_cs, "ig_prsr_ctrl"_cs, IR::Direction::In),
std::make_tuple("ingress_intrinsic_metadata_t"_cs, "ig_intr_md"_cs, IR::Direction::In),
std::make_tuple("generator_metadata_t"_cs, "ig_pg_md"_cs, IR::Direction::In),
std::make_tuple("ingress_intrinsic_metadata_for_tm_t"_cs, "ig_intr_md_for_tm"_cs,
IR::Direction::InOut),
std::make_tuple("ingress_intrinsic_metadata_from_parser_aux_t"_cs,
"ig_intr_md_from_parser_aux"_cs, IR::Direction::In),
std::make_tuple("ingress_intrinsic_metadata_for_mirror_buffer_t"_cs, "ig_intr_md_for_mb"_cs,
IR::Direction::In),
std::make_tuple("ingress_intrinsic_metadata_for_deparser_t"_cs, "ig_intr_md_for_dprsr"_cs,
IR::Direction::InOut),
std::make_tuple("egress_intrinsic_metadata_t"_cs, "eg_intr_md"_cs, IR::Direction::In),
std::make_tuple("egress_intrinsic_metadata_from_parser_aux_t"_cs,
"eg_intr_md_from_parser_aux"_cs, IR::Direction::In),
std::make_tuple("egress_intrinsic_metadata_for_mirror_buffer_t"_cs, "eg_intr_md_for_mb"_cs,
IR::Direction::In),
std::make_tuple("egress_intrinsic_metadata_for_output_port_t"_cs, "eg_intr_md_for_oport"_cs,
IR::Direction::InOut),
std::make_tuple("egress_intrinsic_metadata_for_deparser_t"_cs, "eg_intr_md_for_dprsr"_cs,
IR::Direction::InOut),
}