P4C
The P4 Compiler
Loading...
Searching...
No Matches
table_utils.h
1#ifndef BACKENDS_P4TOOLS_COMMON_LIB_TABLE_UTILS_H_
2#define BACKENDS_P4TOOLS_COMMON_LIB_TABLE_UTILS_H_
3
4#include "ir/ir.h"
5#include "lib/cstring.h"
6
7namespace P4::P4Tools::TableUtils {
8
12 IR::KeyElement const *key;
13
16
18 size_t index;
19
22
26
27 explicit KeyProperties(IR::KeyElement const *key, cstring name, size_t index, cstring matchType,
28 bool isTainted)
30};
31
36
38 bool tableIsTainted = false;
39
41 bool tableIsImmutable = false;
42
44 bool defaultIsImmutable = false;
45
47 std::vector<KeyProperties> resolvedKeys;
48
51 std::map<cstring, int> actionIdMap;
52};
53
56void checkTableImmutability(const IR::P4Table &table, TableProperties &properties);
57
59std::vector<const IR::ActionListElement *> buildTableActionList(const IR::P4Table &table);
60
69bool compareLPMEntries(const IR::Entry *leftIn, const IR::Entry *rightIn, size_t lpmIndex);
70
72const IR::PathExpression *getDefaultActionName(const IR::P4Table &table);
73
77const IR::Expression *computeEntryMatch(const IR::P4Table &table, const IR::Entry &entry,
78 const IR::Key &key);
79
80} // namespace P4::P4Tools::TableUtils
81
82#endif /* BACKENDS_P4TOOLS_COMMON_LIB_TABLE_UTILS_H_ */
Definition cstring.h:85
KeyProperties define properties of table keys that are useful for execution.
Definition table_utils.h:10
size_t index
The index of this key within the current table.
Definition table_utils.h:18
bool isTainted
Definition table_utils.h:25
cstring matchType
The match type of this key (exact, ternary, lpm, etc...)
Definition table_utils.h:21
IR::KeyElement const * key
The original key element.
Definition table_utils.h:12
cstring name
The control plane name of the key.
Definition table_utils.h:15
Basic table properties that are set when initializing the TableStepper.
Definition table_utils.h:33
std::map< cstring, int > actionIdMap
Definition table_utils.h:51
bool defaultIsImmutable
Indicates whether the default action can be overridden.
Definition table_utils.h:44
std::vector< KeyProperties > resolvedKeys
Ordered list of key fields with useful properties.
Definition table_utils.h:47
bool tableIsTainted
Whether key expressions of the table contain taint. This makes it difficult to match.
Definition table_utils.h:38
bool tableIsImmutable
Whether the table is constant and can not accept control plane entries.
Definition table_utils.h:41
cstring tableName
Control plane name of the table.
Definition table_utils.h:35