PandA-2024.02
Public Member Functions | Protected Member Functions | Protected Attributes
VcdSignalSelection Class Reference

#include <VcdSignalSelection.hpp>

Inheritance diagram for VcdSignalSelection:
Inheritance graph
[legend]
Collaboration diagram for VcdSignalSelection:
Collaboration graph
[legend]

Public Member Functions

 VcdSignalSelection (const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager)
 Constructor. More...
 
 ~VcdSignalSelection () override
 Destructor. More...
 
DesignFlowStep_Status Exec () override
 Executes the step. More...
 
bool HasToBeExecuted () const override
 Check if this step has actually to be executed. More...
 
- Public Member Functions inherited from HLS_step
 HLS_step (const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef())
 Constructor. More...
 
 ~HLS_step () override
 Destructor. More...
 
std::string GetSignature () const override
 Return a unified identifier of this design step. More...
 
std::string GetName () const override
 Return the name of this design step. More...
 
virtual std::string GetKindText () const
 Return the name of the type of this frontend flow step. More...
 
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory () const final
 Return the factory to create this type of steps. More...
 
void ComputeRelationships (DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override
 Compute the relationships of a step with other steps. More...
 
- Public Member Functions inherited from DesignFlowStep
 DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
virtual ~DesignFlowStep ()
 Destructor. More...
 
virtual void Initialize ()
 Initialize the step (i.e., like a constructor, but executed just before exec. More...
 
DesignFlowStep_Status GetStatus () const
 Return the status of this design step. More...
 
virtual void WriteDot (std::ostream &out) const
 Write the label for a dot graph. More...
 
bool IsComposed () const
 Returns if this step is composed. More...
 
int CGetDebugLevel () const
 Return the debug level of the step. More...
 
virtual void PrintInitialIR () const
 Dump the initial intermediate representation. More...
 
virtual void PrintFinalIR () const
 Dump the final intermediate representation. More...
 

Protected Member Functions

const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > ComputeHLSRelationships (const DesignFlowStep::RelationshipType relationship_type) const override
 Return the set of analyses in relationship with this design step. More...
 
void SelectInitialAddrParam (const CustomOrderedSet< unsigned int > &reached_body_fun_ids, CustomUnorderedMap< unsigned int, TreeNodeSet > &address_parameters)
 Selects the initial set of function parameters to skip, iterating on the reached functions with a body and inserting the parm_decl tree_nodes in param_to_skip. More...
 
void InitialSsaIsAddress (const tree_nodeConstRef &tn, const CustomUnorderedSet< unsigned int > &addr_fun_ids, const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &call_id_to_called_id)
 Determines if the tree_node tn assigns an ssa_name representing an address. More...
 
void InitialPhiResIsAddress (const tree_nodeConstRef &tn)
 Determines if the tree_node tn assigns an ssa_name representing an address. More...
 
void SelectInitialSsa (const CustomOrderedSet< unsigned int > &reached_body_fun_ids, const CustomUnorderedSet< unsigned int > &addr_fun_ids, const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &call_id_to_called_id)
 Selects the initial set of ssa to skip, iterating on the reached functions with a body and inserting the ssa tree_nodes in ssa_to_skip. More...
 
void SingleStepPropagateParamToSsa (const TreeNodeMap< size_t > &used_ssa, const TreeNodeSet &address_parameters)
 Single step used in the loop of PropagateAddrParamToSsa() More...
 
void PropagateAddrParamToSsa (const CustomUnorderedMap< unsigned int, TreeNodeSet > &address_parameters, const CustomOrderedSet< unsigned int > &reached_body_fun_ids)
 Propagates the information on the ssa to skip to all the ssa in the functions with body. More...
 
void SingleStepPropagateAddrSsa (const tree_nodeRef &curr_tn)
 Single step used in the loop of PropagateAddrSsa() More...
 
void PropagateAddrSsa ()
 Propagates the information on the ssa representing addresses across all the ssa in the functions with body. More...
 
void DetectInvalidReturns (const CustomOrderedSet< unsigned int > &reached_body_functions, CustomUnorderedSet< unsigned int > &addr_fun_ids)
 Detects return statements resulting in values to be skipped in the discrepancy analysis. More...
 
void InProcedurePropagateAddr (const CustomUnorderedMap< unsigned int, TreeNodeSet > &address_parameters, const CustomOrderedSet< unsigned int > &reached_body_functions, CustomUnorderedSet< unsigned int > &addr_fun_ids)
 Propagates the information on the ssa to skip to all the ssa in the functions with body. More...
 
void CrossPropagateAddrSsa (CustomUnorderedMap< unsigned int, TreeNodeSet > &address_parameters, const CustomOrderedSet< unsigned int > &reached_body_functions, const CustomUnorderedSet< unsigned int > &addr_fun_ids, const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &fu_id_to_call_ids, const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &call_id_to_called_id)
 Propagates the information on the parameters to skip across function calls. More...
 
void SelectAddrSsa (const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &fu_id_to_call_ids, const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &call_id_to_called_id)
 Compute the ssa representing address values. More...
 
bool IsAddressType (const unsigned int type_index) const
 Checks if type_index represents an address type. More...
 
void SelectInternalSignals (CustomUnorderedMap< unsigned int, UnorderedSetStdStable< std::string >> &fun_id_to_sig_names) const
 

Protected Attributes

const tree_managerRef TM
 
const DiscrepancyRef Discr
 
std::string present_state_name
 The name of the present state signal. More...
 
- Protected Attributes inherited from HLS_step
const HLS_managerRef HLSMgr
 information about all the HLS synthesis More...
 
const HLSFlowStep_Type hls_flow_step_type
 The type of this step. More...
 
const HLSFlowStepSpecializationConstRef hls_flow_step_specialization
 The information about specialization. More...
 
- Protected Attributes inherited from DesignFlowStep
bool composed
 True if this step represents a composition of design flow steps (e.g., a flow); must be set by specialized constructors. More...
 
const Wrefcount< const DesignFlowManagerdesign_flow_manager
 The design flow manager. More...
 
const ParameterConstRef parameters
 Set of input parameters. More...
 
int debug_level
 The debug level. More...
 
const int output_level
 The output level. More...
 

Additional Inherited Members

- Public Types inherited from DesignFlowStep
enum  RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP }
 The relationship type. More...
 
- Static Public Member Functions inherited from HLS_step
static std::string EnumToName (const HLSFlowStep_Type hls_flow_step_type)
 Given a HLS flow step type, return the name of the type. More...
 
static const std::string ComputeSignature (const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization)
 Compute the signature of a hls flow step. More...
 
- Static Protected Attributes inherited from HLS_step
static CustomUnorderedMap< std::string, HLSFlowStep_Typecommand_line_name_to_enum
 Map hls step name to enum. More...
 

Detailed Description

Definition at line 45 of file VcdSignalSelection.hpp.

Constructor & Destructor Documentation

◆ VcdSignalSelection()

VcdSignalSelection::VcdSignalSelection ( const ParameterConstRef  _parameters,
const HLS_managerRef  _HLSMgr,
const DesignFlowManagerConstRef  _design_flow_manager 
)

Constructor.

Author
Pietro Fezzardi pietr.nosp@m.ofez.nosp@m.zardi.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Definition at line 62 of file VcdSignalSelection.cpp.

References DesignFlowStep::debug_level, GET_CLASS, HLS_step::HLSMgr, DesignFlowStep::parameters, STR, THROW_ASSERT, VERILOG, and ~VcdSignalSelection().

Here is the call graph for this function:

◆ ~VcdSignalSelection()

VcdSignalSelection::~VcdSignalSelection ( )
overridedefault

Destructor.

Referenced by VcdSignalSelection().

Here is the caller graph for this function:

Member Function Documentation

◆ ComputeHLSRelationships()

const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > VcdSignalSelection::ComputeHLSRelationships ( const DesignFlowStep::RelationshipType  relationship_type) const
overrideprotectedvirtual

Return the set of analyses in relationship with this design step.

Reimplemented from HLS_step.

Definition at line 88 of file VcdSignalSelection.cpp.

References CALL_GRAPH_UNFOLDING, DesignFlowStep::DEPENDENCE_RELATIONSHIP, HW_PATH_COMPUTATION, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::PRECEDENCE_RELATIONSHIP, THROW_UNREACHABLE, and TOP_FUNCTION.

◆ CrossPropagateAddrSsa()

void VcdSignalSelection::CrossPropagateAddrSsa ( CustomUnorderedMap< unsigned int, TreeNodeSet > &  address_parameters,
const CustomOrderedSet< unsigned int > &  reached_body_functions,
const CustomUnorderedSet< unsigned int > &  addr_fun_ids,
const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  fu_id_to_call_ids,
const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  call_id_to_called_id 
)
protected

Propagates the information on the parameters to skip across function calls.

If a function is called with a parameter which is a ssa marked to skip, then the parm_decl associated to that paramter must be marked to skip. This propagation is based on the ssa names already marked to be skipped

Parameters
[in,out]address_parametersSet of parm_decl tree_nodes of the parameters to skip
[in]reached_body_functionsList of the ids of the reached functions with body
[in]addr_fun_idsList of ids of the reached functions that return an address value
[in]fu_id_to_call_idsMaps a function id to the set of ids of operations where it calls other functions
[in]call_id_to_called_idMaps the id of a call operation to the id of the called function

Definition at line 546 of file VcdSignalSelection.cpp.

References BUILTIN_WAIT_CALL, FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpGraphInfo(), OpGraph::CGetOpNodeInfo(), Discr, FunctionBehavior::FCFG, BehavioralHelper::function_has_to_be_printed(), BehavioralHelper::get_function_name(), tree_node::get_kind(), GET_NODE, BehavioralHelper::has_implementation(), HLS_step::HLSMgr, BehavioralHelper::is_operating_system_function(), BehavioralHelper::is_var_args(), MEMCPY, STR, THROW_ASSERT, THROW_WARNING, and TM.

Referenced by SelectAddrSsa().

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

◆ DetectInvalidReturns()

void VcdSignalSelection::DetectInvalidReturns ( const CustomOrderedSet< unsigned int > &  reached_body_functions,
CustomUnorderedSet< unsigned int > &  addr_fun_ids 
)
protected

Detects return statements resulting in values to be skipped in the discrepancy analysis.

Parameters
[in]reached_body_functionsList of the ids of the reached functions with body
[in,out]addr_fun_idsList of ids of the reached functions that return an address value

Definition at line 500 of file VcdSignalSelection.cpp.

References OpGraph::CGetInEdges(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpGraphInfo(), OpGraph::CGetOpNodeInfo(), Discr, ENTRY_ID, EXIT_ID, FunctionBehavior::FCFG, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_helper::get_type_index(), HLS_step::HLSMgr, IsAddressType(), and TM.

Referenced by InProcedurePropagateAddr().

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

◆ Exec()

DesignFlowStep_Status VcdSignalSelection::Exec ( )
overridevirtual

◆ HasToBeExecuted()

bool VcdSignalSelection::HasToBeExecuted ( ) const
overridevirtual

Check if this step has actually to be executed.

Returns
true if the step has to be executed

Implements DesignFlowStep.

Definition at line 1026 of file VcdSignalSelection.cpp.

◆ InitialPhiResIsAddress()

void VcdSignalSelection::InitialPhiResIsAddress ( const tree_nodeConstRef tn)
protected

Determines if the tree_node tn assigns an ssa_name representing an address.

Parameters
[in]tnThe node to analyze

Definition at line 231 of file VcdSignalSelection.cpp.

References gimple_phi::CGetDefEdgesList(), Discr, tree_node::get_kind(), GET_NODE, tree_node::GetString(), tree_node::index, phi, gimple_phi::res, STR, THROW_ASSERT, and tree_node::ToString().

Referenced by SelectInitialSsa().

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

◆ InitialSsaIsAddress()

void VcdSignalSelection::InitialSsaIsAddress ( const tree_nodeConstRef tn,
const CustomUnorderedSet< unsigned int > &  addr_fun_ids,
const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  call_id_to_called_id 
)
protected

Determines if the tree_node tn assigns an ssa_name representing an address.

The ssa to be skipped at the beginning are

  • variables representing addresses (pointers, arrays, vectors)
  • integer variables resulting from pointers casted to integer
  • ssa_name referred to a function's parameter marked as to skip
  • ssa_name to which is assigned the return value of a function to skip If curr_tn must be skipped it is added to ssa_to_skip.
    Parameters
    [in]tnThe node to analyze
    [in]addr_fun_idsList of ids of the reached functions that return an address value
    [in]call_id_to_called_idMap the id of a call to the id of the called function

Definition at line 137 of file VcdSignalSelection.cpp.

References Discr, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_helper::get_type_index(), tree_node::GetString(), tree_node::index, tree_helper::is_a_complex(), tree_helper::is_real(), IsAddressType(), DesignFlowStep::parameters, STR, THROW_ASSERT, TM, and tree_node::ToString().

Referenced by SelectInitialSsa().

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

◆ InProcedurePropagateAddr()

void VcdSignalSelection::InProcedurePropagateAddr ( const CustomUnorderedMap< unsigned int, TreeNodeSet > &  address_parameters,
const CustomOrderedSet< unsigned int > &  reached_body_functions,
CustomUnorderedSet< unsigned int > &  addr_fun_ids 
)
protected

Propagates the information on the ssa to skip to all the ssa in the functions with body.

This propagation is based on the ssa_name and param_decl already marked to skip.

Parameters
[in]address_parametersSet of parm_decl tree_nodes of the parameters to skip
[in]reached_body_functionsList of the ids of the reached functions with body
[in,out]addr_fun_idsList of ids of the reached functions that return an address value

Definition at line 536 of file VcdSignalSelection.cpp.

References DetectInvalidReturns(), PropagateAddrParamToSsa(), and PropagateAddrSsa().

Referenced by SelectAddrSsa().

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

◆ IsAddressType()

bool VcdSignalSelection::IsAddressType ( const unsigned int  type_index) const
protected

Checks if type_index represents an address type.

Definition at line 80 of file VcdSignalSelection.cpp.

References tree_helper::GetElements(), tree_helper::is_a_pointer(), tree_helper::is_a_vector(), tree_helper::is_an_array(), and TM.

Referenced by DetectInvalidReturns(), Exec(), InitialSsaIsAddress(), SelectAddrSsa(), SelectInitialAddrParam(), and SelectInitialSsa().

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

◆ PropagateAddrParamToSsa()

void VcdSignalSelection::PropagateAddrParamToSsa ( const CustomUnorderedMap< unsigned int, TreeNodeSet > &  address_parameters,
const CustomOrderedSet< unsigned int > &  reached_body_fun_ids 
)
protected

Propagates the information on the ssa to skip to all the ssa in the functions with body.

This propagation mark to skip all the ssa_name tree_nodes wich are referred to a param_decl already marked to be skipped. The propagation is intra procedural.

Parameters
[in]address_parametersSet of parm_decl tree_nodes of the parameters to skip
[in]reached_body_functionsList of the ids of the reached functions with body

Definition at line 358 of file VcdSignalSelection.cpp.

References FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), tree_helper::ComputeSsaUses(), ENTRY_ID, EXIT_ID, FunctionBehavior::FCFG, tree_node::get_kind(), HLS_step::HLSMgr, SingleStepPropagateParamToSsa(), THROW_ASSERT, and TM.

Referenced by InProcedurePropagateAddr().

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

◆ PropagateAddrSsa()

void VcdSignalSelection::PropagateAddrSsa ( )
protected

Propagates the information on the ssa representing addresses across all the ssa in the functions with body.

The propagation is intra procedural.

Definition at line 481 of file VcdSignalSelection.cpp.

References Discr, tree_node::GetString(), SingleStepPropagateAddrSsa(), and THROW_ASSERT.

Referenced by InProcedurePropagateAddr().

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

◆ SelectAddrSsa()

void VcdSignalSelection::SelectAddrSsa ( const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  fu_id_to_call_ids,
const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  call_id_to_called_id 
)
protected

Compute the ssa representing address values.

They must be manipulated in a different way by the discrepancy analysis

Parameters
[in]fu_id_to_call_idsMaps a function id to the set of ids of operations where it calls other functions
[in]call_id_to_called_idMaps the id of a call operation to the id of the called function

Definition at line 743 of file VcdSignalSelection.cpp.

References FunctionBehavior::CGetBehavioralHelper(), CrossPropagateAddrSsa(), Discr, BehavioralHelper::GetFunctionReturnType(), HLS_step::HLSMgr, InProcedurePropagateAddr(), IsAddressType(), SelectInitialAddrParam(), and SelectInitialSsa().

Referenced by Exec().

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

◆ SelectInitialAddrParam()

void VcdSignalSelection::SelectInitialAddrParam ( const CustomOrderedSet< unsigned int > &  reached_body_fun_ids,
CustomUnorderedMap< unsigned int, TreeNodeSet > &  address_parameters 
)
protected

Selects the initial set of function parameters to skip, iterating on the reached functions with a body and inserting the parm_decl tree_nodes in param_to_skip.

Parameters
[in]reached_body_fun_idsList of ids of the reached functions with body
[out]address_parametersThe set of parm_decl tree_nodes representing addresses

Definition at line 115 of file VcdSignalSelection.cpp.

References GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_helper::get_type_index(), tree_node::GetString(), IsAddressType(), THROW_ASSERT, TM, and tree_node::ToString().

Referenced by SelectAddrSsa().

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

◆ SelectInitialSsa()

void VcdSignalSelection::SelectInitialSsa ( const CustomOrderedSet< unsigned int > &  reached_body_fun_ids,
const CustomUnorderedSet< unsigned int > &  addr_fun_ids,
const CustomUnorderedMap< unsigned int, UnorderedSetStdStable< unsigned int >> &  call_id_to_called_id 
)
protected

Selects the initial set of ssa to skip, iterating on the reached functions with a body and inserting the ssa tree_nodes in ssa_to_skip.

Parameters
[in]reached_body_fun_idsList of ids of the reached functions with body
[in]addr_fun_idsList of ids of the reached functions that return an address value
[in]call_id_to_called_idMap the id of a call to the id of the called function

Definition at line 250 of file VcdSignalSelection.cpp.

References FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), Discr, ENTRY_ID, EXIT_ID, FunctionBehavior::FCFG, tree_node::get_kind(), tree_helper::get_type_index(), HLS_step::HLSMgr, InitialPhiResIsAddress(), InitialSsaIsAddress(), tree_helper::is_a_complex(), tree_helper::is_real(), IsAddressType(), THROW_ASSERT, and TM.

Referenced by SelectAddrSsa().

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

◆ SelectInternalSignals()

void VcdSignalSelection::SelectInternalSignals ( CustomUnorderedMap< unsigned int, UnorderedSetStdStable< std::string >> &  fun_id_to_sig_names) const
protected

Definition at line 807 of file VcdSignalSelection.cpp.

References Discr, ENTRY_ID, EXIT_ID, FunctionBehavior::FCFG, refcount< T >::get(), GET_NAME, HLS_step::HLSMgr, phi, starts_with(), STR, THROW_ASSERT, TM, and WRAPPED_PROXY_PREFIX.

Referenced by Exec().

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

◆ SingleStepPropagateAddrSsa()

void VcdSignalSelection::SingleStepPropagateAddrSsa ( const tree_nodeRef curr_tn)
protected

◆ SingleStepPropagateParamToSsa()

void VcdSignalSelection::SingleStepPropagateParamToSsa ( const TreeNodeMap< size_t > &  used_ssa,
const TreeNodeSet address_parameters 
)
protected

Single step used in the loop of PropagateAddrParamToSsa()

Definition at line 327 of file VcdSignalSelection.cpp.

References Discr, GET_NODE, tree_node::GetString(), THROW_ASSERT, and tree_node::ToString().

Referenced by PropagateAddrParamToSsa().

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

Field Documentation

◆ Discr

const DiscrepancyRef VcdSignalSelection::Discr
protected

◆ present_state_name

std::string VcdSignalSelection::present_state_name
protected

The name of the present state signal.

Definition at line 53 of file VcdSignalSelection.hpp.

Referenced by Exec().

◆ TM

const tree_managerRef VcdSignalSelection::TM
protected

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

Generated on Mon Feb 12 2024 13:04:09 for PandA-2024.02 by doxygen 1.8.13