LLVM  10.0.0svn
Public Member Functions | List of all members
llvm::Automaton< ActionT > Class Template Reference

A deterministic finite-state automaton. More...

#include "llvm/Support/Automaton.h"

Inheritance diagram for llvm::Automaton< ActionT >:
Inheritance graph
[legend]

Public Member Functions

template<typename InfoT >
 Automaton (ArrayRef< InfoT > Transitions, ArrayRef< NfaStatePair > TranscriptionTable={})
 Create an automaton. More...
 
 Automaton (const Automaton &)=default
 
void reset ()
 Reset the automaton to its initial state. More...
 
void enableTranscription (bool Enable=true)
 Enable or disable transcription. More...
 
bool add (const ActionT &A)
 Transition the automaton based on input symbol A. More...
 
bool canAdd (const ActionT &A)
 Return true if the automaton can be transitioned based on input symbol A. More...
 
ArrayRef< NfaPathgetNfaPaths ()
 Obtain a set of possible paths through the input nondeterministic automaton that could be obtained from the sequence of input actions presented to this deterministic automaton. More...
 

Detailed Description

template<typename ActionT>
class llvm::Automaton< ActionT >

A deterministic finite-state automaton.

The automaton is defined in TableGen; this object drives an automaton defined by tblgen-emitted tables.

An automaton accepts a sequence of input tokens ("actions"). This class is templated on the type of these actions.

Definition at line 158 of file Automaton.h.

Constructor & Destructor Documentation

◆ Automaton() [1/2]

template<typename ActionT>
template<typename InfoT >
llvm::Automaton< ActionT >::Automaton ( ArrayRef< InfoT >  Transitions,
ArrayRef< NfaStatePair TranscriptionTable = {} 
)
inline

Create an automaton.

Parameters
TransitionsThe Transitions table as created by TableGen. Note that because the action type differs per automaton, the table type is templated as ArrayRef<InfoT>.
TranscriptionTableThe TransitionInfo table as created by TableGen.

Providing the TranscriptionTable argument as non-empty will enable the use of transcription, which analyzes the possible paths in the original NFA taken by the DFA. NOTE: This is substantially more work than simply driving the DFA, so unless you require the getPaths() method leave this empty.

Definition at line 189 of file Automaton.h.

◆ Automaton() [2/2]

template<typename ActionT>
llvm::Automaton< ActionT >::Automaton ( const Automaton< ActionT > &  )
default

Member Function Documentation

◆ add()

template<typename ActionT>
bool llvm::Automaton< ActionT >::add ( const ActionT &  A)
inline

Transition the automaton based on input symbol A.

Return true if the automaton transitioned to a valid state, false if the automaton transitioned to an invalid state.

If this function returns false, all methods are undefined until reset() is called.

Definition at line 225 of file Automaton.h.

Referenced by llvm::DFAPacketizer::reserveResources().

◆ canAdd()

template<typename ActionT>
bool llvm::Automaton< ActionT >::canAdd ( const ActionT &  A)
inline

Return true if the automaton can be transitioned based on input symbol A.

Definition at line 236 of file Automaton.h.

Referenced by llvm::DFAPacketizer::canReserveResources().

◆ enableTranscription()

template<typename ActionT>
void llvm::Automaton< ActionT >::enableTranscription ( bool  Enable = true)
inline

Enable or disable transcription.

Transcription is only available if TranscriptionTable was provided to the constructor.

Definition at line 212 of file Automaton.h.

Referenced by llvm::DFAPacketizer::DFAPacketizer(), and llvm::DFAPacketizer::setTrackResources().

◆ getNfaPaths()

template<typename ActionT>
ArrayRef<NfaPath> llvm::Automaton< ActionT >::getNfaPaths ( )
inline

Obtain a set of possible paths through the input nondeterministic automaton that could be obtained from the sequence of input actions presented to this deterministic automaton.

Definition at line 244 of file Automaton.h.

Referenced by llvm::DFAPacketizer::getUsedResources().

◆ reset()

template<typename ActionT>
void llvm::Automaton< ActionT >::reset ( )
inline

Reset the automaton to its initial state.

Definition at line 204 of file Automaton.h.

Referenced by llvm::DFAPacketizer::clearResources().


The documentation for this class was generated from the following file: