[PATCH] D72682: Avoid creating an immutable map in the Automaton class.

Marcello Maggioni via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 22:21:08 PST 2020


kariddi created this revision.
kariddi added reviewers: jmolloy, ThomasRaoux.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
kariddi updated this revision to Diff 237853.
kariddi added a comment.

Updating a stale comment where the old map used to live


In the DFAPacketizer we copy the Transitions array
into a map in order to later access the transitions
based on a "Current State/Action" pair as a key.
This map lives in the Automaton object used by the DFAPacketizer.
It is never changed during the life of the object after
having been created during the creation of the Automaton
itself.

This map creation can make the creation of a DFAPacketizer
quite expensive if the target contains a considerable
amount of transition states.

Considering that TableGen already generates a
sorted list of transitions by State/Action pairs
we could just use that directly in our Automaton
and search entries with std::lower_bound instead of copying
it in a map and paying the execution time and memory cost.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72682

Files:
  llvm/include/llvm/Support/Automaton.h
  llvm/utils/TableGen/DFAEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72682.237853.patch
Type: text/x-patch
Size: 6337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200114/f0e22659/attachment.bin>


More information about the llvm-commits mailing list