]> granicus.if.org Git - llvm/commit
[TableGen] Introduce a generic automaton (DFA) backend
authorJames Molloy <jmolloy@google.com>
Fri, 4 Oct 2019 09:03:36 +0000 (09:03 +0000)
committerJames Molloy <jmolloy@google.com>
Fri, 4 Oct 2019 09:03:36 +0000 (09:03 +0000)
commit1b7dd0a628c258b637a15fdbb4a28b74e4320b84
treedc7db6c86134ca039f4770eabd5f40ecb7ca266c
parent14bd9bbfc1d68ab571d345037cd031b741b58843
[TableGen] Introduce a generic automaton (DFA) backend

Summary:
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.

Reviewers: t.p.northover

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67968

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373718 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Automaton.h [new file with mode: 0644]
include/llvm/TableGen/Automaton.td [new file with mode: 0644]
unittests/TableGen/Automata.td [new file with mode: 0644]
unittests/TableGen/AutomataTest.cpp [new file with mode: 0644]
unittests/TableGen/CMakeLists.txt
utils/TableGen/CMakeLists.txt
utils/TableGen/DFAEmitter.cpp [new file with mode: 0644]
utils/TableGen/DFAEmitter.h [new file with mode: 0644]
utils/TableGen/TableGen.cpp
utils/TableGen/TableGenBackends.h