Otherwize RE2C emits too many unused tag variables and bloats the generated code.
insert_fallback_tags(dfa);
// try to minimize the number of tag variables
- if (opts->optimize_tags) optimize_tags(dfa);
+ compact_and_optimize_tags(dfa, opts->optimize_tags);
if (opts->dump_dfa_tagopt) dump_dfa(dfa);
freeze_tags(dfa);
namespace re2c
{
-void optimize_tags(dfa_t &dfa)
+void compact_and_optimize_tags(dfa_t &dfa, bool optimize)
{
tagver_t maxver = dfa.maxtagver;
if (maxver > 0) {
maxver = cfg_t::compact(cfg, ver2new);
cfg_t::renaming(cfg, ver2new, maxver);
- if (maxver > 0) {
+ if (optimize && maxver > 0) {
nver = static_cast<size_t>(maxver) + 1;
bool *live = new bool[cfg.nbbfin * nver];
bool *interf = new bool[nver * nver];
void fillpoints(const dfa_t &dfa, std::vector<size_t> &fill);
void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond, Warn &warn);
void insert_fallback_tags(dfa_t &dfa);
-void optimize_tags(dfa_t &dfa);
+void compact_and_optimize_tags(dfa_t &dfa, bool optimize);
void freeze_tags(dfa_t &dfa);
} // namespace re2c