@@ -175,11 +175,20 @@ class Path {
175
175
// / Most P4 entities can be optionally annotated
176
176
class Annotation {
177
177
ID name;
178
+ // / Annotations that are simple expressions
178
179
inline Vector<Expression> expr;
180
+ // / Annotations described as key-value pairs
181
+ // TODO: this should be a map from ID not from cstring
182
+ inline NameMap<Expression> kv;
179
183
Annotation { if (!srcInfo) srcInfo = name.srcInfo ; }
180
184
Annotation (Util::SourceInfo si, ID n, const std::initializer_list<const IR::Expression *> &a)
181
185
: Node(si), name(n), expr(a) {}
186
+ Annotation (Util::SourceInfo si, ID n, const IR::Vector<IR::Expression> &a)
187
+ : Node(si), name(n), expr(a) {}
188
+ Annotation (Util::SourceInfo si, ID n, const NameMap<IR::Expression> &kv)
189
+ : Node(si), name(n), kv(kv) {}
182
190
Annotation (ID n, const std::initializer_list<const IR::Expression *> &a) : name(n), expr(a) {}
191
+ Annotation (ID n, const IR::Vector<IR::Expression> &a) : name(n), expr(a) {}
183
192
Annotation (ID n, intmax_t v) : name(n) {
184
193
expr.push_back (new IR::Constant (v)); }
185
194
// / Predefined annotations used by the compiler
0 commit comments