From: Ulya Trofimovich Date: Thu, 27 Oct 2016 14:34:56 +0000 (+0100) Subject: Added comment. X-Git-Tag: 1.0~39^2~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=994dba7ea6fc491a134652999687fb41cc2be1d8;p=re2c Added comment. --- diff --git a/re2c/src/ir/dfa/tag_indexing.cc b/re2c/src/ir/dfa/tag_indexing.cc index 916a26cf..e50e3f69 100644 --- a/re2c/src/ir/dfa/tag_indexing.cc +++ b/re2c/src/ir/dfa/tag_indexing.cc @@ -8,6 +8,23 @@ namespace re2c template struct cmp_t; template void doindex(cmd_t **pcmd, lookup_t &index); +/* note [indexing tag commands] + * + * After optimizations different commands may become equal up to + * reordering and removing duplicates. We want such commands to have + * identical representation and compare as equal: this may enable + * further optimizations like minimization, tag hoisting, tunnelling, + * etc. These optimizations need fast (constant time) comparison of + * two commands (especially Moore's minimization, which compares sets + * of transitions at once). + * + * So we bring each command to some 'normal form' and insert it into + * common index. Then we can address and compare commands by index, + * which is indeed constant time. + * + * However, after indexing different commands may share representation + * in memory, so they must not be modified. + */ void tag_indexing(dfa_t &dfa) { const size_t @@ -31,13 +48,6 @@ void tag_indexing(dfa_t &dfa) } } -// After renaming different tags may map to the same version, -// thus one set of versions may have different representations. -// Transition tags are treated as sets and should be unified. - -// After renaming different lists may become identical -// up to reordering and deleting duplicates. - template void doindex(cmd_t **pcmd, lookup_t &index) {