54 const IR::Node *postorder(IR::BlockStatement *stat)
override {
55 if (!stat->components.empty())
return stat;
56 if (stat->annotations->size() != 1)
return stat;
57 auto anno = stat->annotations->getSingle(IR::Annotation::hiddenAnnotation);
58 if (!anno)
return stat;
60 return new IR::BlockStatement(stat->srcInfo);
69 Cloner() { setName(
"Cloner"); }
70 const IR::Node *postorder(IR::EmptyStatement *stat)
override {
74 return new IR::BlockStatement(stat->srcInfo);
76 const IR::Node *postorder(IR::BlockStatement *stat)
override {
80 if (stat->components.empty()) {
81 auto annos =
new IR::Annotations();
84 annos->add(
new IR::Annotation(IR::Annotation::hiddenAnnotation, {}));
85 auto result =
new IR::BlockStatement(stat->srcInfo, annos);
86 LOG2(
"Cloning " << getOriginal()->
id <<
" into " << result->id);
91 return Transform::postorder(stat);
104 passes.push_back(
new Cloner());
105 if (!typeChecking) typeChecking =
new TypeChecking(&refMap, typeMap);
109 setName(
"SimplifyDefUse");
static P4CContext & get()
Definition parser_options.cpp:539
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24