GCC Middle and Back End API Reference
ana::state_machine Class Referenceabstract

#include <sm.h>

Inheritance diagram for ana::state_machine:
Collaboration diagram for ana::state_machine:

Data Structures

class  state
 

Public Types

typedef const state_machine::statestate_t
 

Public Member Functions

 state_machine (const char *name, logger *logger)
 
virtual ~state_machine ()
 
virtual bool inherited_state_p () const =0
 
virtual state_t alt_get_inherited_state (const sm_state_map &, const svalue *, const extrinsic_state &) const
 
virtual bool has_alt_get_inherited_state_p () const
 
virtual state_machine::state_t get_default_state (const svalue *) const
 
const char * get_name () const
 
state_t get_state_by_name (const char *name) const
 
virtual bool on_stmt (sm_context *sm_ctxt, const supernode *node, const gimple *stmt) const =0
 
virtual void on_phi (sm_context *sm_ctxt, const supernode *node, const gphi *phi, tree rhs) const
 
virtual void on_condition (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue *lhs, enum tree_code op, const svalue *rhs) const
 
virtual void on_bounded_ranges (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue &sval, const bounded_ranges &ranges) const
 
virtual void on_pop_frame (sm_state_map *smap, const frame_region *frame_reg) const
 
virtual bool can_purge_p (state_t s) const =0
 
virtual std::unique_ptr< pending_diagnosticon_leak (tree var) const
 
virtual bool reset_when_passed_to_unknown_fn_p (state_t s, bool is_mutable) const
 
state_t maybe_get_merged_state (state_t state_a, state_t state_b) const
 
virtual state_t maybe_get_merged_states_nonequal (state_t state_a, state_t state_b) const
 
void validate (state_t s) const
 
void dump_to_pp (pretty_printer *pp) const
 
json::objectto_json () const
 
state_t get_start_state () const
 
loggerget_logger () const
 
void set_logger (logger *logger)
 
void log (const char *fmt,...) const ATTRIBUTE_GCC_DIAG(2
 
void void start_log_line () const
 
void end_log_line () const
 
void enter_scope (const char *scope_name)
 
void exit_scope (const char *scope_name)
 
pretty_printerget_logger_pp () const
 
FILE * get_logger_file () const
 

Protected Member Functions

state_t add_state (const char *name)
 
state_t add_custom_state (state *s)
 
unsigned alloc_state_id ()
 

Protected Attributes

state_t m_start
 

Private Member Functions

 DISABLE_COPY_AND_ASSIGN (state_machine)
 

Private Attributes

const char * m_name
 
auto_delete_vec< statem_states
 
unsigned m_next_state_id
 
loggerm_logger
 

Detailed Description

An abstract base class for a state machine describing an API.
Manages a set of state objects, and has various virtual functions
for pattern-matching on statements.   

Member Typedef Documentation

◆ state_t

Constructor & Destructor Documentation

◆ state_machine()

ana::state_machine::state_machine ( const char * name,
logger * logger )

◆ ~state_machine()

virtual ana::state_machine::~state_machine ( )
inlinevirtual

Member Function Documentation

◆ add_custom_state()

state_t ana::state_machine::add_custom_state ( state * s)
inlineprotected

References m_states.

◆ add_state()

state_t ana::state_machine::add_state ( const char * name)
protected

◆ alloc_state_id()

unsigned ana::state_machine::alloc_state_id ( )
inlineprotected

References m_next_state_id.

◆ alt_get_inherited_state()

virtual state_t ana::state_machine::alt_get_inherited_state ( const sm_state_map & ,
const svalue * ,
const extrinsic_state &  ) const
inlinevirtual

References NULL.

◆ can_purge_p()

virtual bool ana::state_machine::can_purge_p ( state_t s) const
pure virtual

◆ DISABLE_COPY_AND_ASSIGN()

ana::state_machine::DISABLE_COPY_AND_ASSIGN ( state_machine )
private

◆ dump_to_pp()

void ana::state_machine::dump_to_pp ( pretty_printer * pp) const

◆ end_log_line()

void ana::log_user::end_log_line ( ) const
inlineinherited
A shortcut for ending a log line from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::end_log_line(), and ana::log_user::m_logger.

◆ enter_scope()

void ana::log_user::enter_scope ( const char * scope_name)
inlineinherited
A shortcut for recording entry into a scope from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::enter_scope(), and ana::log_user::m_logger.

◆ exit_scope()

void ana::log_user::exit_scope ( const char * scope_name)
inlineinherited
A shortcut for recording exit from a scope from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::exit_scope(), and ana::log_user::m_logger.

◆ get_default_state()

virtual state_machine::state_t ana::state_machine::get_default_state ( const svalue * ) const
inlinevirtual

References m_start.

◆ get_logger()

logger * ana::log_user::get_logger ( ) const
inlineinherited

◆ get_logger_file()

FILE * ana::log_user::get_logger_file ( ) const
inlineinherited

◆ get_logger_pp()

pretty_printer * ana::log_user::get_logger_pp ( ) const
inlineinherited

◆ get_name()

const char * ana::state_machine::get_name ( ) const
inline

References m_name.

◆ get_start_state()

state_t ana::state_machine::get_start_state ( ) const
inline

References m_start.

◆ get_state_by_name()

state_t ana::state_machine::get_state_by_name ( const char * name) const

◆ has_alt_get_inherited_state_p()

virtual bool ana::state_machine::has_alt_get_inherited_state_p ( ) const
inlinevirtual

◆ inherited_state_p()

virtual bool ana::state_machine::inherited_state_p ( ) const
pure virtual

◆ log()

void ana::log_user::log ( const char * fmt,
... ) const
inlineinherited
A shortcut for calling log from a log_user, handling the common
case where the underlying logger is NULL via a no-op.   

References ap, ana::logger::log_va(), and ana::log_user::m_logger.

◆ maybe_get_merged_state()

state_t ana::state_machine::maybe_get_merged_state ( state_t state_a,
state_t state_b ) const
inline

◆ maybe_get_merged_states_nonequal()

virtual state_t ana::state_machine::maybe_get_merged_states_nonequal ( state_t state_a,
state_t state_b ) const
inlinevirtual

References NULL.

Referenced by maybe_get_merged_state().

◆ on_bounded_ranges()

virtual void ana::state_machine::on_bounded_ranges ( sm_context * sm_ctxt,
const supernode * node,
const gimple * stmt,
const svalue & sval,
const bounded_ranges & ranges ) const
inlinevirtual

◆ on_condition()

virtual void ana::state_machine::on_condition ( sm_context * sm_ctxt,
const supernode * node,
const gimple * stmt,
const svalue * lhs,
enum tree_code op,
const svalue * rhs ) const
inlinevirtual

◆ on_leak()

virtual std::unique_ptr< pending_diagnostic > ana::state_machine::on_leak ( tree var) const
virtual

◆ on_phi()

virtual void ana::state_machine::on_phi ( sm_context * sm_ctxt,
const supernode * node,
const gphi * phi,
tree rhs ) const
inlinevirtual

◆ on_pop_frame()

virtual void ana::state_machine::on_pop_frame ( sm_state_map * smap,
const frame_region * frame_reg ) const
inlinevirtual

◆ on_stmt()

virtual bool ana::state_machine::on_stmt ( sm_context * sm_ctxt,
const supernode * node,
const gimple * stmt ) const
pure virtual

◆ reset_when_passed_to_unknown_fn_p()

virtual bool ana::state_machine::reset_when_passed_to_unknown_fn_p ( state_t s,
bool is_mutable ) const
inlinevirtual

◆ set_logger()

void ana::log_user::set_logger ( logger * logger)
inherited

◆ start_log_line()

void ana::log_user::start_log_line ( ) const
inlineinherited
A shortcut for starting a log line from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::log_user::m_logger, and ana::logger::start_log_line().

◆ to_json()

json::object * ana::state_machine::to_json ( ) const

◆ validate()

void ana::state_machine::validate ( state_t s) const

Field Documentation

◆ m_logger

◆ m_name

const char* ana::state_machine::m_name
private

Referenced by get_name().

◆ m_next_state_id

unsigned ana::state_machine::m_next_state_id
private

Referenced by alloc_state_id().

◆ m_start

state_t ana::state_machine::m_start
protected

◆ m_states

auto_delete_vec<state> ana::state_machine::m_states
private

Referenced by add_custom_state().


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