41 bool early_exit_flag =
false;
42 mutable int never_backtracks_cache = -1;
48 bool stop_on_error =
true;
51 void runDebugHooks(
const char *visitorName,
const IR::Node *node);
54 return Visitor::init_apply(root);
69 BUG_CHECK(visitor->check_clone(&v),
"Incorrect clone in PassManager");
76 typename std::enable_if<
77 std::is_convertible<
decltype(t(
nullptr)),
const IR::Node *>::value,
int>::type = 0)
82 typename std::enable_if<std::is_same<
decltype(t(
nullptr)),
void>::value,
int>::type = 0)
90 typename std::enable_if<std::is_same<
decltype(t()),
void>::value,
int>::type = 0)
97 PassManager(
const std::initializer_list<VisitorRef> &init) { addPasses(init); }
98 void addPasses(
const std::initializer_list<VisitorRef> &init) {
99 never_backtracks_cache = -1;
101 if (p.visitor) passes.emplace_back(p.visitor);
103 void removePasses(
const std::vector<cstring> &exclude);
104 void listPasses(std::ostream &, cstring sep)
const;
105 const IR::Node *apply_visitor(
const IR::Node *,
const char * = 0)
override;
106 bool backtrack(trigger &trig)
override;
107 bool never_backtracks()
override;
108 void setStopOnError(
bool stop) { stop_on_error = stop; }
109 void addDebugHook(
DebugHook h,
bool recursive =
false) {
110 debugHooks.push_back(h);
112 for (
auto pass : passes)
113 if (
auto child =
dynamic_cast<PassManager *
>(pass))
114 child->addDebugHook(h, recursive);
116 void addDebugHooks(std::vector<DebugHook> hooks,
bool recursive =
false) {
117 debugHooks.insert(debugHooks.end(), hooks.begin(), hooks.end());
119 for (
auto pass : passes)
120 if (
auto child =
dynamic_cast<PassManager *
>(pass))
121 child->addDebugHooks(hooks, recursive);
123 void early_exit() { early_exit_flag =
true; }
124 PassManager *clone()
const override {
return new PassManager(*
this); }
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
std::function< void(const char *manager, unsigned seqNo, const char *pass, const IR::Node *node)> DebugHook
Definition ir/pass_manager.h:38