PandA-2024.02
|
#include <liveness.hpp>
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, vertex > | start_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< vertex > | support_set |
vertex over which the live in/out is computed More... | |
std::map< unsigned int, vertex > | var_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< vertex > | dummy_states |
Definition at line 72 of file liveness.hpp.
liveness::liveness | ( | const HLS_managerRef | _HLSMgr, |
const ParameterConstRef | _Param | ||
) |
Constructor.
Header include.
HLSMgr | is the HLS manager |
Param | is 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().
|
default |
|
inline |
add a state to the set of dummy vertices
state | is the dummy state |
Definition at line 386 of file liveness.hpp.
Referenced by FSM_NI_SSA_liveness::InternalExec().
|
inline |
define the name of a state
v | is state |
name | is 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().
|
inline |
add a definition vertex for a variable
var | is the variable defined |
v | is 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().
add an ending state for a given operation
op | is the operation |
v | is 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().
add a running state for a given operation
op | is the operation |
v | is 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().
put into relation for a given variable used in a state the state from which the variable comes
var | is the variable |
state | is the state where var is used |
state_in | is 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().
put into relation for a given variable defined in a state the state to which the variable goes
var | is the variable |
state | is the state where var is defined |
state_in | is 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().
|
inline |
add a support state
v | is the support state |
Definition at line 344 of file liveness.hpp.
References are_in_conflict().
Referenced by FSM_NI_SSA_liveness::InternalExec().
states if two operations are in conflict (i.e.
may be executed concurrently)
op1 | is an operation node |
op2 | is 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().
void liveness::erase_el_live_in | ( | const vertex & | v, |
unsigned int | var | ||
) |
erase a variable from the live in
v | is the vertex |
var | is the variable |
Definition at line 104 of file liveness.cpp.
References live_in.
void liveness::erase_el_live_out | ( | const vertex & | v, |
unsigned int | var | ||
) |
erase a variable from the live out
v | is the vertex |
var | is the variable |
Definition at line 137 of file liveness.cpp.
References live_out.
Referenced by update_liveout_with_prev().
const CustomOrderedSet< unsigned int > & liveness::get_live_in | ( | const vertex & | v | ) | const |
Get the set of variables live at the input of a vertex.
v | is the vertex |
Definition at line 109 of file liveness.cpp.
References empty_set, and live_in.
Referenced by reg_binding::bind(), reg_binding::compute_is_without_enable(), mux_connection_binding::connect_to_registers(), compatibility_based_register::create_compatibility_graph(), conflict_based_register::create_conflict_graph(), fsm_controller::create_state_machine(), FSM_NI_SSA_liveness::InternalExec(), values_scheme::InternalExec(), vertex_coloring_register::RegisterBinding(), chordal_coloring_register::RegisterBinding(), and weighted_clique_register::RegisterBinding().
const CustomOrderedSet< unsigned int > & liveness::get_live_out | ( | const vertex & | v | ) | const |
Get the set of variables live at the output of a vertex.
v | is the vertex |
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().
const std::string & liveness::get_name | ( | vertex | v | ) | const |
return the name of the given state
v | is 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().
vertex liveness::get_op_where_defined | ( | unsigned int | var | ) | const |
return which operation defines the variable
var | is 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().
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.
state | is the chaining state |
Definition at line 391 of file liveness.cpp.
References get_name(), start_op, and THROW_ASSERT.
Referenced by set_HLS().
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
state | is the state where the variable is used |
op | is the operation that uses the variable |
var | is 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().
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
state | is the state where the variable is defined |
op | is the operation that defines the variable |
var | is 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().
const CustomOrderedSet< vertex > & liveness::get_state_where_end | ( | vertex | op | ) | const |
return in which support vertex the operation is ending
op | is 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().
const CustomOrderedSet< vertex > & liveness::get_state_where_run | ( | vertex | op | ) | const |
return in which support vertex the operation is running
op | is 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().
|
inline |
return the support set of the live in/out
Definition at line 212 of file liveness.hpp.
References get_op_where_defined(), has_op_where_defined(), and support_set.
Referenced by reg_binding::bind(), reg_binding::compute_is_without_enable(), compatibility_based_register::create_compatibility_graph(), conflict_based_register::create_conflict_graph(), values_scheme::InternalExec(), vertex_coloring_register::RegisterBinding(), chordal_coloring_register::RegisterBinding(), and weighted_clique_register::RegisterBinding().
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().
return true in case the variable for a given op and a given state has a state in
state | is the state where the variable is used |
op | is the operation that uses the variable |
var | is 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().
return true in case the variable for a given op and a given state has a state out
state | is the state where the variable is defined |
op | is the operation that defines the variable |
var | is 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().
check if a state is a dummy state
state | is the state checked |
Definition at line 396 of file liveness.hpp.
References non_in_parallel().
Referenced by reg_binding::compute_is_without_enable().
bool liveness::is_defined | ( | unsigned int | var | ) | const |
return true in case the variable var for a given opoeration v has been defined
var | is the variable |
Definition at line 78 of file liveness.cpp.
References var_op_definition.
Referenced by add_op_definition().
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().
|
inline |
Definition at line 362 of file liveness.hpp.
References get_start_op(), and set_start_op().
Referenced by cdfc_module_binding::InternalExec().
void liveness::set_live_in | ( | const vertex & | v, |
unsigned int | var | ||
) |
Store a variable alive at the input of the given vertex.
v | is the vertex |
the | identifier of the variable |
Definition at line 88 of file liveness.cpp.
References live_in.
Referenced by FSM_NI_SSA_liveness::InternalExec().
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.
v | is the vertex |
live_set | the set of ids of live variables |
Definition at line 93 of file liveness.cpp.
References live_in.
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.
v | is the vertex |
first | is the first iterator of a set to be merged in the live in |
last | is the last iterator of a set to be merged in the live in |
Definition at line 98 of file liveness.cpp.
References live_in.
void liveness::set_live_out | ( | const vertex & | v, |
const CustomOrderedSet< unsigned int > & | vars | ||
) |
Store the variables alive at the output of the given vertex.
v | is the vertex |
vars | is 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().
void liveness::set_live_out | ( | const vertex & | v, |
unsigned int | var | ||
) |
Store a variable alive at the output of the given vertex.
v | is the vertex |
the | identifier of the variable |
Definition at line 121 of file liveness.cpp.
References live_out.
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.
v | is the vertex |
first | is the first iterator of a set to be merged in the live out |
last | is 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 the starting operation for a specified chained state.
state | is the chained state |
op | is the operation |
Definition at line 398 of file liveness.cpp.
References start_op.
Referenced by set_HLS().
|
private |
Definition at line 117 of file liveness.hpp.
|
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().
|
private |
store where an operation is terminating its execution
Definition at line 100 of file liveness.hpp.
Referenced by get_state_where_end().
|
private |
Definition at line 114 of file liveness.hpp.
Referenced by are_in_conflict().
|
private |
Definition at line 115 of file liveness.hpp.
Referenced by are_in_conflict().
|
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().
|
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().
|
private |
|
private |
class containing all the parameters
Definition at line 79 of file liveness.hpp.
|
private |
store where an operation run and need its input
Definition at line 103 of file liveness.hpp.
Referenced by get_state_where_run().
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().
|
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().
|
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().
|
private |
vertex over which the live in/out is computed
Definition at line 94 of file liveness.hpp.
Referenced by get_support().
|
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().