91 bool preorder(
const IR::BFN::ParserState *state)
override {
92 if (state->gress != gress)
return false;
94 for (
const auto *p4State : state->p4States) {
95 for (
auto annot : p4State->annotations->annotations) {
96 if (annot->name.name ==
"critical") {
97 auto &exprs = annot->expr;
98 if (exprs.size() == 1) {
99 auto gress = exprs[0]->to<IR::StringLiteral>();
102 "Invalid use of %1%, correct usage is: "
103 "@pragma critical [ingress/egress]",
107 if (gress && gress->value == toString(state->gress)) {
108 LOG3(
"@critical specified on " << state->name);
109 critical_states.insert(state);
112 }
else if (exprs.size() == 0) {
113 LOG3(
"@critical specified on " << state->name);
114 critical_states.insert(state);
126 : gress(gr), critical_states(cs) {}
147 return ingress_user_critical_states;
151 return egress_user_critical_states;
154 bool is_on_critical_path(
const IR::BFN::ParserState *state)
const;
155 bool is_user_specified_critical_state(
const IR::BFN::ParserState *state)
const;
158 static bool is_on_critical_path(
const IR::BFN::ParserState *state,
161 static bool is_user_specified_critical_state(
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:51