LLVM 19.0.0git
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.
 
 Automaton (const Automaton &Other)
 
void reset ()
 Reset the automaton to its initial state.
 
void enableTranscription (bool Enable=true)
 Enable or disable transcription.
 
bool add (const ActionT &A)
 Transition the automaton based on input symbol A.
 
bool canAdd (const ActionT &A)
 Return true if the automaton can be transitioned based on input symbol A.
 
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.
 

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 160 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 191 of file Automaton.h.

◆ Automaton() [2/2]

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

Definition at line 203 of file Automaton.h.

References llvm::Other.

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 233 of file Automaton.h.

References A, and I.

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 244 of file Automaton.h.

References A, and I.

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 220 of file Automaton.h.

References assert(), and llvm::Enable.

◆ 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 252 of file Automaton.h.

References assert().

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 212 of file Automaton.h.


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