]> granicus.if.org Git - re2c/commitdiff
Gather all label counting in one place prior to code generation.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 27 May 2015 11:52:02 +0000 (12:52 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 27 May 2015 11:52:02 +0000 (12:52 +0100)
re2c/src/codegen/emit_dfa.cc

index 37dfb89d605abc6170c09e4a0caf6d1ecd2409dc..c6aa233b4f58a4745a9739c370fc4815a9c3dde9 100644 (file)
@@ -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";
        }