28 setName(
"InlineControlFlow");
32 const IR::V1Program *global;
34 const IR::Node *preorder(IR::Apply *a)
override {
35 if (global && !global->get<IR::V1Table>(a->name))
36 error(
"%s: No table named %s", a->srcInfo, a->name);
39 const IR::Node *preorder(IR::Primitive *p)
override {
40 if (
auto cf = global ? global->get<IR::V1Control>(p->name) : 0) {
41 const IR::V1Control *control;
42 if (
auto act = findContext<IR::ActionFunction>())
43 error(
"%s: Trying to call control flow %s in action %s", p->srcInfo, p->name,
45 else if (
auto table = findContext<IR::V1Table>())
46 error(
"%s: Trying to call control flow %s in table %s", p->srcInfo, p->name,
48 else if ((control = findContext<IR::V1Control>()) && control->name == p->name)
49 error(
"%s: Recursive call to control flow %s", p->srcInfo, p->name);
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:51