PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes
operations_cfg_computation Class Reference

Compute the control flow graph for the operations. More...

#include <operations_cfg_computation.hpp>

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

Public Member Functions

 operations_cfg_computation (const ParameterConstRef _parameters, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
 Constructor. More...
 
 ~operations_cfg_computation () override
 Destructor. More...
 
DesignFlowStep_Status InternalExec () override
 Computes the operations CFG graph data structure. More...
 
void Initialize () override
 Initialize the step (i.e., like a constructor, but executed just before exec. More...
 
- Public Member Functions inherited from FunctionFrontendFlowStep
 FunctionFrontendFlowStep (const application_managerRef AppM, const unsigned int function_id, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
 ~FunctionFrontendFlowStep () override
 Destructor. More...
 
void ComputeRelationships (DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
 Compute the relationships of a step with other steps. More...
 
std::string GetSignature () const override
 Return the signature of this step. More...
 
std::string GetName () const override
 Return the name of this design step. More...
 
DesignFlowStep_Status Exec () final
 Execute the step. More...
 
bool HasToBeExecuted () const override
 Check if this step has actually to be executed. More...
 
unsigned int CGetBBVersion () const
 
unsigned int GetBitValueVersion () const
 
void PrintInitialIR () const override
 Dump the initial intermediate representation. More...
 
void PrintFinalIR () const override
 Dump the final intermediate representation. More...
 
- Public Member Functions inherited from FrontendFlowStep
 FrontendFlowStep (const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
 ~FrontendFlowStep () override
 Destructor. More...
 
virtual std::string GetKindText () const
 Return the name of the type of this frontend flow step. More...
 
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory () const override
 Return the factory to create this type of steps. More...
 
void PrintTreeManager (const bool before) const
 Dump the tree manager. More...
 
- Public Member Functions inherited from DesignFlowStep
 DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
 Constructor. More...
 
virtual ~DesignFlowStep ()
 Destructor. 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...
 

Private Member Functions

std::string get_first_node (const tree_nodeRef &tn, const std::string &f_name) const
 Return the name of the first node given a tree node. More...
 
void clean_start_nodes ()
 Clean the list of start nodes. More...
 
void insert_start_node (const std::string &start_node)
 Insert a start node to the list of start nodes. More...
 
bool empty_start_nodes () const
 Return true if start_node is empty. More...
 
void init_start_nodes (const std::string &start_node)
 Initialize the list of start nodes. More...
 
void connect_start_nodes (const operations_graph_constructorRef ogc, const std::string &next, bool true_edge=false, bool false_edge=false, unsigned int nodeid=0)
 Connect start_node with the next node. More...
 
void build_operation_recursive (const tree_managerRef TM, const operations_graph_constructorRef ogc, const tree_nodeRef tn, const std::string &f_name, unsigned int bb_index)
 Builds recursively the operation for a given tree node. More...
 
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships (const DesignFlowStep::RelationshipType relationship_type) const override
 Return the set of analyses in relationship with this design step. More...
 

Private Attributes

std::map< unsigned int, std::string > label_decl_map
 relation between label declaration and first statement id More...
 
std::map< unsigned int, std::string > first_statement
 relation between basic block and first statement id More...
 
std::list< std::string > start_nodes
 store the name of the nodes at which the next node should be attached. More...
 
std::string actual_name
 store the name of the current vertex More...
 

Additional Inherited Members

- Public Types inherited from FrontendFlowStep
using FunctionRelationship = enum { ALL_FUNCTIONS, CALLED_FUNCTIONS, CALLING_FUNCTIONS, SAME_FUNCTION, WHOLE_APPLICATION }
 The different relationship type between function analysis. More...
 
- Public Types inherited from DesignFlowStep
enum  RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP }
 The relationship type. More...
 
- Static Public Member Functions inherited from FunctionFrontendFlowStep
static const std::string ComputeSignature (const FrontendFlowStepType frontend_flow_step_type, const unsigned int function_id)
 Compute the signature of a function frontend flow step. More...
 
- Static Public Member Functions inherited from FrontendFlowStep
static void CreateSteps (const DesignFlowManagerConstRef design_flow_manager, const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship >> &frontend_relationships, const application_managerConstRef application_manager, DesignFlowStepSet &relationships)
 Create the relationship steps of a step with other steps starting from already specified dependencies between frontend flow steps. More...
 
static const std::string EnumToKindText (const FrontendFlowStepType frontend_flow_step_type)
 Given a frontend flow step type, return the name of the type. More...
 
- Protected Member Functions inherited from FunctionFrontendFlowStep
void WriteBBGraphDot (const std::string &filename) const
 Write the current version of statement list in dot format. More...
 
- Protected Attributes inherited from FunctionFrontendFlowStep
const FunctionBehaviorRef function_behavior
 The function behavior of the function to be analyzed. More...
 
const unsigned int function_id
 The index of the function to be analyzed. More...
 
unsigned int bb_version
 The version of the basic block intermediate representation on which this step has been applied. More...
 
unsigned int bitvalue_version
 The version of the bitvalue information on which this step has been applied. More...
 
- Protected Attributes inherited from FrontendFlowStep
const application_managerRef AppM
 The application manager. More...
 
const FrontendFlowStepType frontend_flow_step_type
 The type of this step. More...
 
unsigned int print_counter
 Print counter. 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...
 

Detailed Description

Compute the control flow graph for the operations.

Definition at line 65 of file operations_cfg_computation.hpp.

Constructor & Destructor Documentation

◆ operations_cfg_computation()

operations_cfg_computation::operations_cfg_computation ( const ParameterConstRef  _parameters,
const application_managerRef  AppM,
unsigned int  function_id,
const DesignFlowManagerConstRef  design_flow_manager 
)

Constructor.

Parameters
Paramis the set of the parameters
AppMis the application manager
function_idis the identifier of the function

Definition at line 67 of file operations_cfg_computation.cpp.

References DesignFlowStep::debug_level, DEBUG_LEVEL_NONE, GET_CLASS, DesignFlowStep::parameters, and ~operations_cfg_computation().

Here is the call graph for this function:

◆ ~operations_cfg_computation()

operations_cfg_computation::~operations_cfg_computation ( )
overridedefault

Destructor.

Referenced by operations_cfg_computation().

Here is the caller graph for this function:

Member Function Documentation

◆ build_operation_recursive()

void operations_cfg_computation::build_operation_recursive ( const tree_managerRef  TM,
const operations_graph_constructorRef  ogc,
const tree_nodeRef  tn,
const std::string &  f_name,
unsigned int  bb_index 
)
private

Builds recursively the operation for a given tree node.

We assume a one to one mapping between nodeids and vertices

Parameters
TMis the tree manager.
ogcis the operation graph constructor used to add the vertices.
tnis the reference of the tree node we are currently analyzing
f_nameis the name of the function which the node we are analyzing belongs to

Definition at line 495 of file operations_cfg_computation.cpp.

References actual_name, ASSIGN, CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_DECL_NODES, CASE_FAKE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, tree_helper::CGetType(), connect_start_nodes(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, default_COND, tree_helper::find_obj_type_ref_function(), FIX_TRUNC_EXPR, FLOAT_EXPR, FunctionFrontendFlowStep::function_behavior, GET_CONST_NODE, get_first_node(), GET_INDEX_CONST_NODE, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_node::GetString(), INDENT_DBG_MEX, tree_helper::is_a_nop_function_decl(), tree_helper::IsArrayEquivType(), tree_helper::IsLoad(), tree_helper::IsPointerType(), tree_helper::IsStore(), tree_helper::IsUnsignedIntegerType(), tree_helper::IsVectorType(), MEMCPY, MEMSET, MULTI_READ_COND, NODE_NOT_YET_SUPPORTED_EC, NOP, tree_helper::NormalizeTypename(), phi, PRINT_DBG_MEX, tree_helper::print_function_name(), READ_COND, tree_helper::Size(), STR, SWITCH_COND, THROW_ASSERT, THROW_ERROR, THROW_ERROR_CODE, THROW_UNREACHABLE, TYPE_ASSIGN, TYPE_ATOMIC, TYPE_EXTERNAL, TYPE_FOR, TYPE_GENERIC, TYPE_GOTO, TYPE_IF, TYPE_INIT, TYPE_LABEL, TYPE_LAST_OP, TYPE_LOAD, TYPE_MEMCPY, TYPE_MULTIIF, TYPE_NOP, TYPE_OPAQUE, TYPE_PHI, TYPE_PREDICATED, TYPE_RET, TYPE_RW, TYPE_STORE, TYPE_SWITCH, TYPE_VPHI, TYPE_WHILE, and VECT_CONCATENATION.

Referenced by InternalExec().

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

◆ clean_start_nodes()

void operations_cfg_computation::clean_start_nodes ( )
private

Clean the list of start nodes.

Definition at line 450 of file operations_cfg_computation.cpp.

References start_nodes.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ ComputeFrontendRelationships()

const CustomUnorderedSet< std::pair< FrontendFlowStepType, FrontendFlowStep::FunctionRelationship > > operations_cfg_computation::ComputeFrontendRelationships ( const DesignFlowStep::RelationshipType  relationship_type) const
overrideprivatevirtual

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

Parameters
relationship_typeis the type of relationship to be considered

Implements FrontendFlowStep.

Definition at line 78 of file operations_cfg_computation.cpp.

References DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::parameters, DesignFlowStep::PRECEDENCE_RELATIONSHIP, SAME_FUNCTION, and THROW_UNREACHABLE.

◆ connect_start_nodes()

void operations_cfg_computation::connect_start_nodes ( const operations_graph_constructorRef  ogc,
const std::string &  next,
bool  true_edge = false,
bool  false_edge = false,
unsigned int  nodeid = 0 
)
private

Connect start_node with the next node.

Parameters
ogcis the operation graph constructor used to add the edges.
nextis the ending node of the edge that must be added to g.
true_edgewhen it is true the control edge is the true branch of an if then else statement.
false_edgewhen it is true the control edge is the false branch of an if then else statement.
nodeidis meaningful only in case true_edge and false_edge are both true and the control edge is associated with a switch statement.

Mark first operation of the application

Definition at line 466 of file operations_cfg_computation.cpp.

References FrontendFlowStep::AppM, CFG_SELECTOR, DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, ENTRY, F_COND, FunctionFrontendFlowStep::function_id, INDENT_DBG_MEX, start_nodes, STR, T_COND, and TYPE_FIRST_OP.

Referenced by build_operation_recursive(), and InternalExec().

Here is the caller graph for this function:

◆ empty_start_nodes()

bool operations_cfg_computation::empty_start_nodes ( ) const
private

Return true if start_node is empty.

Returns
true if start node is empty

Definition at line 455 of file operations_cfg_computation.cpp.

References start_nodes.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ get_first_node()

std::string operations_cfg_computation::get_first_node ( const tree_nodeRef tn,
const std::string &  f_name 
) const
private

Return the name of the first node given a tree node.

Parameters
tnis the tree node.
f_nameis the name of the function of the node we are analyzing
Returns
the name of the first node

Definition at line 387 of file operations_cfg_computation.cpp.

References CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_CST_NODES, CASE_DECL_NODES, CASE_FAKE_NODES, CASE_GIMPLE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, GET_INDEX_NODE, tree_node::get_kind(), tree_node::get_kind_text(), GET_NODE, label_decl_map, NODE_NOT_YET_SUPPORTED_EC, STR, THROW_ASSERT, and THROW_ERROR_CODE.

Referenced by build_operation_recursive(), and InternalExec().

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

◆ init_start_nodes()

void operations_cfg_computation::init_start_nodes ( const std::string &  start_node)
private

Initialize the list of start nodes.

Parameters
start_nodeis the starting node

Definition at line 460 of file operations_cfg_computation.cpp.

References start_nodes.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ Initialize()

void operations_cfg_computation::Initialize ( )
overridevirtual

Initialize the step (i.e., like a constructor, but executed just before exec.

Reimplemented from DesignFlowStep.

Definition at line 117 of file operations_cfg_computation.cpp.

References FunctionBehavior::BB, FunctionFrontendFlowStep::bb_version, FunctionFrontendFlowStep::function_behavior, and BBGraph::GetBBNodeInfo().

Here is the call graph for this function:

◆ insert_start_node()

void operations_cfg_computation::insert_start_node ( const std::string &  start_node)
private

Insert a start node to the list of start nodes.

Parameters
start_nodeis the starting node

Definition at line 445 of file operations_cfg_computation.cpp.

References start_nodes.

◆ InternalExec()

DesignFlowStep_Status operations_cfg_computation::InternalExec ( )
overridevirtual

Field Documentation

◆ actual_name

std::string operations_cfg_computation::actual_name
private

store the name of the current vertex

Definition at line 78 of file operations_cfg_computation.hpp.

Referenced by build_operation_recursive(), and InternalExec().

◆ first_statement

std::map<unsigned int, std::string> operations_cfg_computation::first_statement
private

relation between basic block and first statement id

Definition at line 72 of file operations_cfg_computation.hpp.

Referenced by InternalExec().

◆ label_decl_map

std::map<unsigned int, std::string> operations_cfg_computation::label_decl_map
private

relation between label declaration and first statement id

Definition at line 69 of file operations_cfg_computation.hpp.

Referenced by get_first_node(), and InternalExec().

◆ start_nodes

std::list<std::string> operations_cfg_computation::start_nodes
private

store the name of the nodes at which the next node should be attached.

Definition at line 75 of file operations_cfg_computation.hpp.

Referenced by clean_start_nodes(), connect_start_nodes(), empty_start_nodes(), init_start_nodes(), insert_start_node(), and InternalExec().


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

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