PandA-2024.02
Public Member Functions | Data Fields | Private Attributes
liveness Class Reference

#include <liveness.hpp>

Collaboration diagram for liveness:
Collaboration graph
[legend]

Public Member Functions

 liveness (const HLS_managerRef HLSMgr, const ParameterConstRef Param)
 Constructor. More...
 
 ~liveness ()
 Destructor. More...
 
void set_live_in (const vertex &v, unsigned int var)
 Store a variable alive at the input of the given vertex. More...
 
void set_live_in (const vertex &v, const CustomOrderedSet< unsigned int > &live_set)
 Store a set of variables alive at the input of the given vertex. More...
 
void set_live_in (const vertex &v, const CustomOrderedSet< unsigned int >::const_iterator first, const CustomOrderedSet< unsigned int >::const_iterator last)
 Store the variables alive at the input of the given vertex. More...
 
void erase_el_live_in (const vertex &v, unsigned int var)
 erase a variable from the live in More...
 
void set_live_out (const vertex &v, const CustomOrderedSet< unsigned int > &vars)
 Store the variables alive at the output of the given vertex. More...
 
void set_live_out (const vertex &v, unsigned int var)
 Store a variable alive at the output of the given vertex. More...
 
void set_live_out (const vertex &v, const CustomOrderedSet< unsigned int >::const_iterator first, const CustomOrderedSet< unsigned int >::const_iterator last)
 Store the variables alive at the output of the given vertex. More...
 
void erase_el_live_out (const vertex &v, unsigned int var)
 erase a variable from the live out More...
 
const CustomOrderedSet< unsigned int > & get_live_in (const vertex &v) const
 Get the set of variables live at the input of a vertex. More...
 
const CustomOrderedSet< unsigned int > & get_live_out (const vertex &v) const
 Get the set of variables live at the output of a vertex. More...
 
const std::list< vertex > & get_support () const
 return the support set of the live in/out More...
 
vertex get_op_where_defined (unsigned int var) const
 return which operation defines the variable More...
 
bool has_op_where_defined (unsigned int var) const
 return true in case there exist an operation defining it More...
 
void add_op_definition (unsigned int var, vertex v)
 add a definition vertex for a variable More...
 
bool is_defined (unsigned int var) const
 return true in case the variable var for a given opoeration v has been defined More...
 
const CustomOrderedSet< vertex > & get_state_in (vertex state, vertex op, unsigned int var) const
 given a variable and a state it returns the set of states from which the variable may come More...
 
bool has_state_in (vertex state, vertex op, unsigned int var) const
 return true in case the variable for a given op and a given state has a state in More...
 
void add_state_in_for_var (unsigned int var, vertex op, vertex state, vertex state_in)
 put into relation for a given variable used in a state the state from which the variable comes More...
 
const CustomOrderedSet< vertex > & get_state_out (vertex state, vertex op, unsigned int var) const
 given a variable and a state it returns the set of destination states where the variable may be used More...
 
bool has_state_out (vertex state, vertex op, unsigned int var) const
 return true in case the variable for a given op and a given state has a state out More...
 
void add_state_out_for_var (unsigned int var, vertex op, vertex state, vertex state_in)
 put into relation for a given variable defined in a state the state to which the variable goes More...
 
const CustomOrderedSet< vertex > & get_state_where_end (vertex op) const
 return in which support vertex the operation is ending More...
 
void add_state_for_ending_op (vertex op, vertex v)
 add an ending state for a given operation More...
 
const CustomOrderedSet< vertex > & get_state_where_run (vertex op) const
 return in which support vertex the operation is running More...
 
void add_state_for_running_op (vertex op, vertex v)
 add a running state for a given operation More...
 
void add_name (vertex v, const std::string &name)
 define the name of a state More...
 
const std::string & get_name (vertex v) const
 return the name of the given state More...
 
void add_support_state (vertex v)
 add a support state More...
 
bool are_in_conflict (vertex op1, vertex op2) const
 states if two operations are in conflict (i.e. More...
 
void set_HLS (hlsRef _HLS)
 
vertex get_start_op (vertex state) const
 Return the operation from which the computation start. More...
 
void set_start_op (vertex state, vertex op)
 Set the starting operation for a specified chained state. More...
 
void add_dummy_state (vertex state)
 add a state to the set of dummy vertices More...
 
bool is_a_dummy_state (vertex state)
 check if a state is a dummy state More...
 
bool non_in_parallel (vertex v1, vertex v2, const BBGraphConstRef cdg) const
 

Data Fields

std::map< vertex, vertexstart_op
 map a chained vertex with one of the starting operation More...
 

Private Attributes

const tree_managerRef TreeM
 The tree manager. More...
 
const ParameterConstRef Param
 class containing all the parameters More...
 
std::map< vertex, CustomOrderedSet< unsigned int > > live_in
 This is the map from each vertex to the set of variables live at the input of vertex. More...
 
std::map< vertex, CustomOrderedSet< unsigned int > > live_out
 This is the map from each vertex to the set of variables live at the output of vertex. More...
 
const std::string null_vertex_string
 null vertex string More...
 
const CustomOrderedSet< unsigned int > empty_set
 used to return a reference to an empty set More...
 
std::list< vertexsupport_set
 vertex over which the live in/out is computed More...
 
std::map< unsigned int, vertexvar_op_definition
 store which operation defines the variable More...
 
std::map< vertex, CustomOrderedSet< vertex > > ending_operations
 store where an operation is terminating its execution More...
 
std::map< vertex, CustomOrderedSet< vertex > > running_operations
 store where an operation run and need its input More...
 
std::map< vertex, std::map< vertex, std::map< unsigned int, CustomOrderedSet< vertex > > > > state_in_definitions
 store where a variable comes from given a support state and an operation More...
 
std::map< vertex, std::map< vertex, std::map< unsigned int, CustomOrderedSet< vertex > > > > state_out_definitions
 store along which transitions the variable has to be stored More...
 
std::map< vertex, std::string > names
 store the name of each state More...
 
hlsRef HLS
 
const HLS_managerRef HLSMgr
 
CustomOrderedSet< vertexdummy_states
 

Detailed Description

Definition at line 72 of file liveness.hpp.

Constructor & Destructor Documentation

◆ liveness()

liveness::liveness ( const HLS_managerRef  _HLSMgr,
const ParameterConstRef  _Param 
)

Constructor.

Header include.

Parameters
HLSMgris the HLS manager
Paramis the refcount to the class containing all the parameters

. include behavior include HLS include tree includes

Definition at line 70 of file liveness.cpp.

References ~liveness().

Here is the call graph for this function:

◆ ~liveness()

liveness::~liveness ( )
default

Destructor.

Referenced by liveness().

Here is the caller graph for this function:

Member Function Documentation

◆ add_dummy_state()

void liveness::add_dummy_state ( vertex  state)
inline

add a state to the set of dummy vertices

Parameters
stateis the dummy state

Definition at line 386 of file liveness.hpp.

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ add_name()

void liveness::add_name ( vertex  v,
const std::string &  name 
)
inline

define the name of a state

Parameters
vis state
nameis a string associated with the vertex v

Definition at line 329 of file liveness.hpp.

References get_name().

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_op_definition()

void liveness::add_op_definition ( unsigned int  var,
vertex  v 
)
inline

add a definition vertex for a variable

Parameters
varis the variable defined
vis the operation defining the variable

Definition at line 233 of file liveness.hpp.

References add_state_in_for_var(), add_state_out_for_var(), get_state_in(), get_state_out(), get_state_where_end(), has_state_in(), has_state_out(), and is_defined().

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_state_for_ending_op()

void liveness::add_state_for_ending_op ( vertex  op,
vertex  v 
)
inline

add an ending state for a given operation

Parameters
opis the operation
vis the support vertex where the variable is defined

Definition at line 303 of file liveness.hpp.

References get_state_where_run().

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_state_for_running_op()

void liveness::add_state_for_running_op ( vertex  op,
vertex  v 
)
inline

add a running state for a given operation

Parameters
opis the operation
vis the support vertex where the variable is in execution and need its input

Definition at line 319 of file liveness.hpp.

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ add_state_in_for_var()

void liveness::add_state_in_for_var ( unsigned int  var,
vertex  op,
vertex  state,
vertex  state_in 
)

put into relation for a given variable used in a state the state from which the variable comes

Parameters
varis the variable
stateis the state where var is used
state_inis the state from which the variable comes

Definition at line 195 of file liveness.cpp.

References state_in_definitions.

Referenced by add_op_definition(), and FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ add_state_out_for_var()

void liveness::add_state_out_for_var ( unsigned int  var,
vertex  op,
vertex  state,
vertex  state_in 
)

put into relation for a given variable defined in a state the state to which the variable goes

Parameters
varis the variable
stateis the state where var is defined
state_inis the state to which the variable goes

Definition at line 230 of file liveness.cpp.

References state_out_definitions.

Referenced by add_op_definition(), and FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ add_support_state()

void liveness::add_support_state ( vertex  v)
inline

add a support state

Parameters
vis the support state

Definition at line 344 of file liveness.hpp.

References are_in_conflict().

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ are_in_conflict()

bool liveness::are_in_conflict ( vertex  op1,
vertex  op2 
) const

states if two operations are in conflict (i.e.

may be executed concurrently)

Parameters
op1is an operation node
op2is an operation node

Definition at line 257 of file liveness.cpp.

References StateTransitionGraphManager::CGetAstg(), FunctionBehavior::DFG, distance(), FunctionBehavior::FBB, hls::functionId, GET_BB_INDEX, get_state_where_run(), StateTransitionGraphManager::GetAstg(), HLS, HLSMgr, hls::STG, lenet_tvm::target, THROW_ASSERT, and THROW_ERROR.

Referenced by add_support_state(), and cdfc_module_binding::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase_el_live_in()

void liveness::erase_el_live_in ( const vertex v,
unsigned int  var 
)

erase a variable from the live in

Parameters
vis the vertex
varis the variable

Definition at line 104 of file liveness.cpp.

References live_in.

◆ erase_el_live_out()

void liveness::erase_el_live_out ( const vertex v,
unsigned int  var 
)

erase a variable from the live out

Parameters
vis the vertex
varis the variable

Definition at line 137 of file liveness.cpp.

References live_out.

Referenced by update_liveout_with_prev().

Here is the caller graph for this function:

◆ get_live_in()

const CustomOrderedSet< unsigned int > & liveness::get_live_in ( const vertex v) const

◆ get_live_out()

const CustomOrderedSet< unsigned int > & liveness::get_live_out ( const vertex v) const

Get the set of variables live at the output of a vertex.

Parameters
vis the vertex
Returns
a set containing the identifiers of the variables

Definition at line 142 of file liveness.cpp.

References empty_set, and live_out.

Referenced by reg_binding::compute_is_without_enable(), mux_connection_binding::connect_to_registers(), and FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ get_name()

const std::string & liveness::get_name ( vertex  v) const

return the name of the given state

Parameters
vis the state

Definition at line 247 of file liveness.cpp.

References names, NULL_VERTEX, null_vertex_string, and THROW_ASSERT.

Referenced by add_name(), mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), mux_connection_binding::create_single_conn(), get_start_op(), get_state_in(), get_state_out(), and mux_connection_binding::input_logic().

Here is the caller graph for this function:

◆ get_op_where_defined()

vertex liveness::get_op_where_defined ( unsigned int  var) const

return which operation defines the variable

Parameters
varis the variable

Definition at line 154 of file liveness.cpp.

References tree_manager::get_tree_node_const(), THROW_ASSERT, tree_node::ToString(), TreeM, and var_op_definition.

Referenced by mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), get_support(), module_binding_check< vertex_type >::initialize_structures(), and port_swapping::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_start_op()

vertex liveness::get_start_op ( vertex  state) const

Return the operation from which the computation start.

More than one operation can be a starting operation in a chained vertex, we choose one randomly.

Parameters
stateis the chaining state
Returns
is the associated operation that start the computation in a chaining vertex

Definition at line 391 of file liveness.cpp.

References get_name(), start_op, and THROW_ASSERT.

Referenced by set_HLS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_state_in()

const CustomOrderedSet< vertex > & liveness::get_state_in ( vertex  state,
vertex  op,
unsigned int  var 
) const

given a variable and a state it returns the set of states from which the variable may come

Parameters
stateis the state where the variable is used
opis the operation that uses the variable
varis the variable

Definition at line 166 of file liveness.cpp.

References get_name(), state_in_definitions, and THROW_ASSERT.

Referenced by add_op_definition(), mux_connection_binding::connect_to_registers(), and mux_connection_binding::create_single_conn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_state_out()

const CustomOrderedSet< vertex > & liveness::get_state_out ( vertex  state,
vertex  op,
unsigned int  var 
) const

given a variable and a state it returns the set of destination states where the variable may be used

Parameters
stateis the state where the variable is defined
opis the operation that defines the variable
varis the variable

Definition at line 200 of file liveness.cpp.

References get_name(), state_out_definitions, and THROW_ASSERT.

Referenced by add_op_definition(), and mux_connection_binding::create_connections().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_state_where_end()

const CustomOrderedSet< vertex > & liveness::get_state_where_end ( vertex  op) const

return in which support vertex the operation is ending

Parameters
opis the operation

Definition at line 235 of file liveness.cpp.

References ending_operations, and THROW_ASSERT.

Referenced by add_op_definition(), mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), estimate_muxes(), and port_swapping::InternalExec().

Here is the caller graph for this function:

◆ get_state_where_run()

const CustomOrderedSet< vertex > & liveness::get_state_where_run ( vertex  op) const

return in which support vertex the operation is running

Parameters
opis the operation

Definition at line 241 of file liveness.cpp.

References running_operations, and THROW_ASSERT.

Referenced by add_state_for_ending_op(), are_in_conflict(), mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), mux_connection_binding::create_single_conn(), port_swapping::InternalExec(), and cdfc_module_binding::InternalExec().

Here is the caller graph for this function:

◆ get_support()

const std::list<vertex>& liveness::get_support ( ) const
inline

◆ has_op_where_defined()

bool liveness::has_op_where_defined ( unsigned int  var) const

return true in case there exist an operation defining it

Definition at line 161 of file liveness.cpp.

References var_op_definition.

Referenced by get_support(), module_binding_check< vertex_type >::initialize_structures(), and port_swapping::InternalExec().

Here is the caller graph for this function:

◆ has_state_in()

bool liveness::has_state_in ( vertex  state,
vertex  op,
unsigned int  var 
) const

return true in case the variable for a given op and a given state has a state in

Parameters
stateis the state where the variable is used
opis the operation that uses the variable
varis the variable

Definition at line 177 of file liveness.cpp.

References state_in_definitions.

Referenced by add_op_definition(), mux_connection_binding::connect_to_registers(), and mux_connection_binding::create_single_conn().

Here is the caller graph for this function:

◆ has_state_out()

bool liveness::has_state_out ( vertex  state,
vertex  op,
unsigned int  var 
) const

return true in case the variable for a given op and a given state has a state out

Parameters
stateis the state where the variable is defined
opis the operation that defines the variable
varis the variable

Definition at line 212 of file liveness.cpp.

References state_out_definitions.

Referenced by add_op_definition(), and mux_connection_binding::create_connections().

Here is the caller graph for this function:

◆ is_a_dummy_state()

bool liveness::is_a_dummy_state ( vertex  state)
inline

check if a state is a dummy state

Parameters
stateis the state checked
Returns
true in case the state is a dummy state, false otherwise

Definition at line 396 of file liveness.hpp.

References non_in_parallel().

Referenced by reg_binding::compute_is_without_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_defined()

bool liveness::is_defined ( unsigned int  var) const

return true in case the variable var for a given opoeration v has been defined

Parameters
varis the variable

Definition at line 78 of file liveness.cpp.

References var_op_definition.

Referenced by add_op_definition().

Here is the caller graph for this function:

◆ non_in_parallel()

bool liveness::non_in_parallel ( vertex  v1,
vertex  v2,
const BBGraphConstRef  cdg 
) const

Definition at line 403 of file liveness.cpp.

References BBGraph::CGetBBNodeInfo().

Referenced by is_a_dummy_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_HLS()

void liveness::set_HLS ( hlsRef  _HLS)
inline

Definition at line 362 of file liveness.hpp.

References get_start_op(), and set_start_op().

Referenced by cdfc_module_binding::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_live_in() [1/3]

void liveness::set_live_in ( const vertex v,
unsigned int  var 
)

Store a variable alive at the input of the given vertex.

Parameters
vis the vertex
theidentifier of the variable

Definition at line 88 of file liveness.cpp.

References live_in.

Referenced by FSM_NI_SSA_liveness::InternalExec().

Here is the caller graph for this function:

◆ set_live_in() [2/3]

void liveness::set_live_in ( const vertex v,
const CustomOrderedSet< unsigned int > &  live_set 
)

Store a set of variables alive at the input of the given vertex.

Parameters
vis the vertex
live_setthe set of ids of live variables

Definition at line 93 of file liveness.cpp.

References live_in.

◆ set_live_in() [3/3]

void liveness::set_live_in ( const vertex v,
const CustomOrderedSet< unsigned int >::const_iterator  first,
const CustomOrderedSet< unsigned int >::const_iterator  last 
)

Store the variables alive at the input of the given vertex.

Parameters
vis the vertex
firstis the first iterator of a set to be merged in the live in
lastis the last iterator of a set to be merged in the live in

Definition at line 98 of file liveness.cpp.

References live_in.

◆ set_live_out() [1/3]

void liveness::set_live_out ( const vertex v,
const CustomOrderedSet< unsigned int > &  vars 
)

Store the variables alive at the output of the given vertex.

Parameters
vis the vertex
varsis a set containing the identifiers of the variables

Definition at line 126 of file liveness.cpp.

References live_out.

Referenced by FSM_NI_SSA_liveness::InternalExec(), and update_liveout_with_prev().

Here is the caller graph for this function:

◆ set_live_out() [2/3]

void liveness::set_live_out ( const vertex v,
unsigned int  var 
)

Store a variable alive at the output of the given vertex.

Parameters
vis the vertex
theidentifier of the variable

Definition at line 121 of file liveness.cpp.

References live_out.

◆ set_live_out() [3/3]

void liveness::set_live_out ( const vertex v,
const CustomOrderedSet< unsigned int >::const_iterator  first,
const CustomOrderedSet< unsigned int >::const_iterator  last 
)

Store the variables alive at the output of the given vertex.

Parameters
vis the vertex
firstis the first iterator of a set to be merged in the live out
lastis the last iterator of a set to be merged in the live out

Definition at line 131 of file liveness.cpp.

References live_out.

◆ set_start_op()

void liveness::set_start_op ( vertex  state,
vertex  op 
)

Set the starting operation for a specified chained state.

Parameters
stateis the chained state
opis the operation

Definition at line 398 of file liveness.cpp.

References start_op.

Referenced by set_HLS().

Here is the caller graph for this function:

Field Documentation

◆ dummy_states

CustomOrderedSet<vertex> liveness::dummy_states
private

Definition at line 117 of file liveness.hpp.

◆ empty_set

const CustomOrderedSet<unsigned int> liveness::empty_set
private

used to return a reference to an empty set

Definition at line 91 of file liveness.hpp.

Referenced by get_live_in(), and get_live_out().

◆ ending_operations

std::map<vertex, CustomOrderedSet<vertex> > liveness::ending_operations
private

store where an operation is terminating its execution

Definition at line 100 of file liveness.hpp.

Referenced by get_state_where_end().

◆ HLS

hlsRef liveness::HLS
private

Definition at line 114 of file liveness.hpp.

Referenced by are_in_conflict().

◆ HLSMgr

const HLS_managerRef liveness::HLSMgr
private

Definition at line 115 of file liveness.hpp.

Referenced by are_in_conflict().

◆ live_in

std::map<vertex, CustomOrderedSet<unsigned int> > liveness::live_in
private

This is the map from each vertex to the set of variables live at the input of vertex.

Definition at line 82 of file liveness.hpp.

Referenced by erase_el_live_in(), get_live_in(), and set_live_in().

◆ live_out

std::map<vertex, CustomOrderedSet<unsigned int> > liveness::live_out
private

This is the map from each vertex to the set of variables live at the output of vertex.

Definition at line 85 of file liveness.hpp.

Referenced by erase_el_live_out(), get_live_out(), and set_live_out().

◆ names

std::map<vertex, std::string> liveness::names
private

store the name of each state

Definition at line 112 of file liveness.hpp.

Referenced by get_name().

◆ null_vertex_string

const std::string liveness::null_vertex_string
private

null vertex string

Definition at line 88 of file liveness.hpp.

Referenced by get_name().

◆ Param

const ParameterConstRef liveness::Param
private

class containing all the parameters

Definition at line 79 of file liveness.hpp.

◆ running_operations

std::map<vertex, CustomOrderedSet<vertex> > liveness::running_operations
private

store where an operation run and need its input

Definition at line 103 of file liveness.hpp.

Referenced by get_state_where_run().

◆ start_op

std::map<vertex, vertex> liveness::start_op

map a chained vertex with one of the starting operation

Definition at line 207 of file liveness.hpp.

Referenced by get_start_op(), and set_start_op().

◆ state_in_definitions

std::map<vertex, std::map<vertex, std::map<unsigned int, CustomOrderedSet<vertex> > > > liveness::state_in_definitions
private

store where a variable comes from given a support state and an operation

Definition at line 106 of file liveness.hpp.

Referenced by add_state_in_for_var(), get_state_in(), and has_state_in().

◆ state_out_definitions

std::map<vertex, std::map<vertex, std::map<unsigned int, CustomOrderedSet<vertex> > > > liveness::state_out_definitions
private

store along which transitions the variable has to be stored

Definition at line 109 of file liveness.hpp.

Referenced by add_state_out_for_var(), get_state_out(), and has_state_out().

◆ support_set

std::list<vertex> liveness::support_set
private

vertex over which the live in/out is computed

Definition at line 94 of file liveness.hpp.

Referenced by get_support().

◆ TreeM

const tree_managerRef liveness::TreeM
private

The tree manager.

Definition at line 76 of file liveness.hpp.

Referenced by get_op_where_defined().

◆ var_op_definition

std::map<unsigned int, vertex> liveness::var_op_definition
private

store which operation defines the variable

Definition at line 97 of file liveness.hpp.

Referenced by get_op_where_defined(), has_op_where_defined(), and is_defined().


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

Generated on Mon Feb 12 2024 13:03:56 for PandA-2024.02 by doxygen 1.8.13