[PATCH] D26870: Outliner: Add uniquely terminated strings for a suffix tree

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 14:16:50 PST 2016


paquette created this revision.
paquette added reviewers: MatzeB, qcolombet, echristo, chandlerc, dblaikie.
paquette added a subscriber: llvm-commits.
paquette set the repository for this revision to rL LLVM.
Herald added subscribers: modocache, mgorny, mehdi_amini.

This is the first commit out of three necessary for upstreaming the outliner described in the RFC at http://lists.llvm.org/pipermail/llvm-dev/2016-August/104170.html

Specifically, it's the first out of the things the outliner needs: a string type, a suffix tree type, and the actual outlining pass.

This commit adds two uniquely terminated string types for use in a suffix tree. These two types allow the user to specify "strings" of objects, given that those objects can be partially ordered. TerminatedStrings all contain a unique terminator character at the end. This ensures that every input string to the suffix tree contains only unique suffixes. This property is necessary for the construction algorithm to work properly.

TerminatedStrings are single strings, while TerminatedStringLists are, in effect, compound strings formed by concatenating TerminatedStrings. This is useful because it allows us to search for repeated substrings in a collection of strings, while maintaining the boundaries between those strings. For example, the outliner uses a SuffixTree on a collection of strings formed by the instructions inside specific MachineBasicBlocks. This allows us to maintain a 1-1 relationship between strings and basic blocks, but also lets us query the entire structure as a regular string.

This is useful because it allows us to define general things as "strings", including, say, things that would be difficult to properly hash. As long as we have some way to partially order our objects, they can be placed into a TerminatedString or TerminatedStringList.


Repository:
  rL LLVM

https://reviews.llvm.org/D26870

Files:
  include/llvm/ADT/TerminatedString.h
  unittests/ADT/CMakeLists.txt
  unittests/ADT/TerminatedStringListTest.cpp
  unittests/ADT/TerminatedStringTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26870.78561.patch
Type: text/x-patch
Size: 31587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161118/8dab34cc/attachment.bin>


More information about the llvm-commits mailing list