From 38d0a271db93f082fb438f59a7947036d6bffbed Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Wed, 27 May 2015 12:52:02 +0100 Subject: [PATCH] Gather all label counting in one place prior to code generation. --- re2c/src/codegen/emit_dfa.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/re2c/src/codegen/emit_dfa.cc b/re2c/src/codegen/emit_dfa.cc index 37dfb89d..c6aa233b 100644 --- a/re2c/src/codegen/emit_dfa.cc +++ b/re2c/src/codegen/emit_dfa.cc @@ -111,6 +111,10 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s { vUsedLabels.insert(it->second->label); } + if (vUsedLabels.count(head->label)) + { + vUsedLabels.insert(start_label); + } // Generate prolog if (bProlog) @@ -195,7 +199,6 @@ void DFA::emit(Output & output, uint32_t& ind, const RegExpMap* specMap, const s // The start_label is not always the first to be emitted, so we may have to jump. c.f. Initial::emit() if (vUsedLabels.count(head->label)) { - vUsedLabels.insert(start_label); o << indent(ind) << "goto " << labelPrefix << start_label << ";\n"; } -- 2.40.0