[PATCH] D67968: [TableGen] Introduce a generic automaton (DFA) backend

James Molloy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 08:51:50 PDT 2019


jmolloy created this revision.
jmolloy added a reviewer: t.p.northover.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

This patch introduces -gen-automata, a backend for generating deterministic finite-state automata.

DFAs are already generated by the -gen-dfa-packetizer backend. This backend is more generic and will
hopefully be used to implement the DFA generation (and determinization) for the packetizer in the
future.

This backend allows not only generation of a DFA from an NFA (nondeterministic finite-state
automaton), it also emits sidetables that allow a path through the DFA under a sequence of inputs to
be analyzed, and the equivalent set of all possible NFA transitions extracted.

This allows a user to not just answer "can my problem be solved?" but also "what is the
solution?". Clearly this analysis is more expensive than just playing a DFA forwards so is
opt-in. The DFAPacketizer has this behaviour already but this is a more compact and generic
representation.

Examples are bundled in unittests/TableGen/Automata.td. Some are trivial, but the BinPacking example
is a stripped-down version of the original target problem I set out to solve, where we pack values
(actually immediates) into bins (an immediate pool in a VLIW bundle) subject to a set of esoteric
constraints.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67968

Files:
  llvm/include/llvm/Support/Automaton.h
  llvm/include/llvm/TableGen/Automaton.td
  llvm/unittests/TableGen/Automata.td
  llvm/unittests/TableGen/AutomataTest.cpp
  llvm/unittests/TableGen/CMakeLists.txt
  llvm/utils/TableGen/CMakeLists.txt
  llvm/utils/TableGen/DFAEmitter.cpp
  llvm/utils/TableGen/DFAEmitter.h
  llvm/utils/TableGen/TableGen.cpp
  llvm/utils/TableGen/TableGenBackends.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67968.221549.patch
Type: text/x-patch
Size: 46245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190924/78e911d8/attachment-0001.bin>


More information about the llvm-commits mailing list