![]() |
P4C
The P4 Compiler
|
Classes | |
struct | alias_t |
Public Types | |
typedef const decltype(alias) ::value_type | alias_value_t |
enum | mod_cond_loc_t { MC_ADT , MC_IMMED } |
Public Member Functions | |
Action (Action &&)=delete | |
Action (const Action &)=delete | |
Action (const char *n, int l) | |
Action (Table *, Actions *, pair_t &, int) | |
void | add_direct_resources (json::vector &direct_resources, const Call &att) const |
void | add_indirect_resources (json::vector &indirect_resources, const Call &att) const |
void | add_p4_params (json::vector &, bool include_default=true) const |
std::string | alias_lookup (int lineno, std::string name, int &lo, int &hi) const |
void | check_and_add_resource (json::vector &resources, json::map &resource) const |
void | check_conditional (Table::Format::Field &field) const |
void | check_next (Table *tbl) |
void | check_next_ref (Table *tbl, const Table::Ref &ref) const |
bool | equiv (Action *a) |
bool | equivVLIW (Action *a) |
void | gen_simple_tbl_cfg (json::vector &) const |
const p4_param * | has_param (std::string param) const |
bool | has_rng () |
bool | immediate_conditional (int lo, int sz, std::string &condition) const |
bool | is_color_aware () const |
void | pass1 (Table *tbl) |
std::map< std::string, std::vector< alias_value_t * > > | reverse_alias () const |
void | setup_mod_cond_values (value_t &map) |
Public Attributes | |
int | addr = -1 |
std::multimap< std::string, alias_t > | alias |
std::vector< Call > | attached |
int | code = -1 |
std::unique_ptr< json::map > | context_json |
bool | default_allowed = false |
std::string | default_disallowed_reason = "" |
bool | default_only = false |
unsigned | handle = 0 |
bool | hit_allowed = true |
std::string | hit_disallowed_reason = "" |
std::vector< std::unique_ptr< Instruction > > | instr |
bool | is_constant = false |
int | lineno = -1 |
bool | minmax_use = false |
std::map< std::string, std::vector< bitvec > > | mod_cond_values |
std::string | name |
int | next_table_encode = -1 |
NextTables | next_table_miss_ref |
NextTables | next_table_ref |
p4_params | p4_params_list |
int | position_in_assembly = -1 |
int | pred_comb_sel = -1 |
std::string | rng_param_name = "" |
bitvec | slot_use |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Action &a) |
std::ostream & | operator<< (std::ostream &out, const alias_t &a) |
void Table::Actions::Action::check_conditional | ( | Table::Format::Field & | field | ) | const |
Determines if the field, which has a particular range of bits in the format, is controlled by a conditional variable. This is required for context JSON information on parameters in the action data table pack format, or in the immediate fields:
-is_mod_field_conditionally_value -mod_field_conditionally_mask_field_name
void Table::Actions::Action::check_next | ( | Table * | tbl | ) |
By the end of this function, both next_table and next_table_miss_ref will have been created and validated.
Each action must have at least next_table or a next_table_miss from the node.
The next_table_encode is the entry into the next_table_hitmap, if a next_table hit map is provided. If the next_table hit map is empty, then the next_table_encode won't have been set. If the action can be used on a hit, then either a next_table_ref/next_table_encode would be provided.
The next_table_ref could come from the next_table as an int value, which would be on offset into the hit_map
void Table::Actions::Action::gen_simple_tbl_cfg | ( | json::vector & | actions_cfg | ) | const |
For action data tables, the entirety of the action configuration is not necessary, as the information is per match table, not per action data table. The only required parameters are the name, handle, and p4_parameters
Even at some point, even actions that have the different p4_parameters could even share a member, if for example, one of the parameters is not stored in the action data table, but rather as an index for a counter/meter etc. The compiler/driver do not have support for this yet.
bool Table::Actions::Action::immediate_conditional | ( | int | lo, |
int | sz, | ||
std::string & | condition ) const |
void Table::Actions::Action::setup_mod_cond_values | ( | value_t & | map | ) |
Builds a map of conditional variable to which bits in the action data format that they control. Used for JSON later.