88 buildDate = options.getBuildDate();
89 compileCommand = options.getCompileCommand();
90 progName = options.file;
91 auto fileName = progName.findlast(
'/');
94 if (fileName) progName = fileName;
95 auto fileext = progName.find(
".");
96 progName = progName.replace(fileext,
"");
97 progName = progName.trim(
"/\t\n\r");
98 compilerVersion = options.compilerVersion;
104 unsigned max_n_groups;
105 unsigned max_n_members_per_group;
106 unsigned bound_to_action_data_table_handle;
107 void setAttributes(
const IR::P4Table *tbl,
108 const std::map<const cstring, struct TableAttributes> &tableAttrmap) {
110 max_n_members_per_group = 0;
111 auto n_groups = tbl->properties->getProperty(
"n_groups_max");
113 auto n_groups_expr = n_groups->value->to<IR::ExpressionValue>()->expression;
114 max_n_groups = n_groups_expr->to<IR::Constant>()->asInt();
116 auto n_members = tbl->properties->getProperty(
"n_members_per_group_max");
118 auto n_members_expr = n_members->value->to<IR::ExpressionValue>()->expression;
119 max_n_members_per_group = n_members_expr->to<IR::Constant>()->asInt();
122 cstring actionDataTableName = tbl->name.originalName;
123 actionDataTableName = actionDataTableName.replace(
"_sel",
"");
124 auto actionTableAttr = ::get(tableAttrmap, actionDataTableName);
125 bound_to_action_data_table_handle = actionTableAttr.tableHandle;
133 const p4configv1::P4Info &p4info;
136 IR::IndexedVector<IR::Declaration> tables;
137 std::vector<const IR::Declaration_Instance *> externs;
140 std::map<const cstring, struct TableAttributes> tableAttrmap;
141 std::map<cstring, struct actionAttributes> actionAttrMap;
142 std::map<cstring, struct externAttributes> externAttrMap;
145 std::map<cstring, size_t> context_handle_map;
149 const p4configv1::P4Info &p4info,
DpdkOptions &options)
150 : refmap(refmap), structure(structure), p4info(p4info), options(options) {}
152 void serializeContextJson(std::ostream *destination);
155 size_t getHandleId(
cstring name);
156 void collectHandleId();
160 const IR::KeyElement *key,
int position);
162 bool addRefTables(
const cstring tbl_name,
const IR::P4Table **memberTable,
167 int byte_array_index);
169 void setActionAttributes(
const IR::P4Table *table);
170 void setDefaultActionHandle(
const IR::P4Table *table);
171 void CollectTablesAndSetAttributes();
Definition dpdkContext.h:130