DCFG
Dynamic Control Flow Graph
 All Classes Functions
Public Member Functions | List of all members
dcfg_api::DCFG_ROUTINE Class Referenceabstract

Interface to information about a routine in an image. More...

#include <dcfg_api.H>

Inheritance diagram for dcfg_api::DCFG_ROUTINE:
dcfg_api::DCFG_LOOP_CONTAINER dcfg_api::DCFG_GRAPH_BASE

Public Member Functions

virtual DCFG_ID get_process_id () const =0
 Get the process ID.
 
virtual DCFG_ID get_image_id () const =0
 Get the image ID.
 
virtual DCFG_ID get_routine_id () const =0
 Get routine ID, which equals the basic-block ID of the entry node.
 
virtual const std::string * get_symbol_name () const =0
 Get symbol name of this routine.
 
virtual UINT32 get_entry_edge_ids (DCFG_ID_CONTAINER &edge_ids) const =0
 Get set of entry edge IDs.
 
virtual UINT32 get_exit_edge_ids (DCFG_ID_CONTAINER &edge_ids) const =0
 Get set of exit edge IDs.
 
virtual DCFG_ID get_idom_node_id (DCFG_ID node_id) const =0
 Get immediate dominator.
 
virtual UINT64 get_entry_count () const =0
 Get dynamic entry count.
 
virtual UINT64 get_entry_count_for_thread (UINT32 thread_id) const =0
 Get dynamic entry count per thread.
 
- Public Member Functions inherited from dcfg_api::DCFG_LOOP_CONTAINER
virtual UINT32 get_loop_ids (DCFG_ID_CONTAINER &node_ids) const =0
 Get the set of loop IDs.
 
virtual DCFG_LOOP_CPTR get_loop_info (DCFG_ID loop_id) const =0
 Get access to data for a loop.
 
- Public Member Functions inherited from dcfg_api::DCFG_GRAPH_BASE
virtual UINT32 get_basic_block_ids (DCFG_ID_CONTAINER &node_ids) const =0
 Get IDs of all basic blocks in the structure.
 
virtual UINT32 get_internal_edge_ids (DCFG_ID_CONTAINER &edge_ids) const =0
 Get list of internal edge IDs.
 
virtual UINT32 get_inbound_edge_ids (DCFG_ID_CONTAINER &edge_ids) const =0
 Get list of in-bound edge IDs.
 
virtual UINT32 get_outbound_edge_ids (DCFG_ID_CONTAINER &edge_ids) const =0
 Get list of out-bound edge IDs.
 
virtual UINT64 get_instr_count () const =0
 Get the total dynamic instruction count.
 
virtual UINT64 get_instr_count_for_thread (UINT32 thread_id) const =0
 Get per-thread dynamic instruction count.
 

Detailed Description

Interface to information about a routine in an image.

A routine is also known as a subroutine, function, or procedure.

Member Function Documentation

virtual UINT64 dcfg_api::DCFG_ROUTINE::get_entry_count ( ) const
pure virtual

Get dynamic entry count.

This is the number of times the routine was called or otherwise entered. By the DCFG definition, a routine can only be entered at its entry node. A call within a routine to its entry node is considered an entry (via recursion). If there is a branch within a routine to its entry node, it will also be considered an entry (this is unusual).

Returns
Number of times routine was entered, summed across all threads.
virtual UINT64 dcfg_api::DCFG_ROUTINE::get_entry_count_for_thread ( UINT32  thread_id) const
pure virtual

Get dynamic entry count per thread.

See DCFG_ROUTINE::get_entry_count() for entry-count definition.

Returns
Number of times routine was entered in given thread.
Parameters
[in]thread_idThread number. Typically, threads are consecutively numbered from zero to DCFG_PROCESS::get_highest_thread_id().
virtual UINT32 dcfg_api::DCFG_ROUTINE::get_entry_edge_ids ( DCFG_ID_CONTAINER edge_ids) const
pure virtual

Get set of entry edge IDs.

For routines, these are typically from "call" statements, but they can also include branches to routines for unstructured code. The source of an entry edge will be from another routine except in the case of direct recursion (call from routine to itself). The target of an entry edge will always be the entry node. This set does not include incoming return edges. If you also want return edges, use DCFG_GRAPH_BASE::get_inbound_edge_ids().

Returns
Number of IDs that were added to edge_ids.
Parameters
[out]edge_idsContainer to which exit edge IDs are added. Previous contents of the container are not emptied by this call, so it should be emptied by the programmer before the call if desired. The programmer can use any implementation of DCFG_ID_CONTAINER: DCFG_ID_VECTOR, DCFG_ID_SET, etc.
virtual UINT32 dcfg_api::DCFG_ROUTINE::get_exit_edge_ids ( DCFG_ID_CONTAINER edge_ids) const
pure virtual

Get set of exit edge IDs.

For routines, these are typically from "return" statements, but they can also include branches out of routines for unstructured code. The target of an exit edge will be to another routine except for direct recursion. This set does not include outgoing call edges. If you also want call edges, use DCFG_GRAPH_BASE::get_outbound_edge_ids().

Returns
Number of IDs that were added to edge_ids.
Parameters
[out]edge_idsContainer to which exit edge IDs are added. Previous contents of the container are not emptied by this call, so it should be emptied by the programmer before the call if desired. The programmer can use any implementation of DCFG_ID_CONTAINER: DCFG_ID_VECTOR, DCFG_ID_SET, etc.
virtual DCFG_ID dcfg_api::DCFG_ROUTINE::get_idom_node_id ( DCFG_ID  node_id) const
pure virtual

Get immediate dominator.

The immediate dominator (idom) is the last node before the given node that must be executed before the given node is executed. The idom of the entry node is itself. The idom must be within the routine, i.e., it does not consider edges between routines. Idoms relationships are used in many graph algorithms.

Returns
ID number of idom of node_id or zero (0) if node_id is not in this routine.
Parameters
[in]node_idID number of dominated node.
virtual DCFG_ID dcfg_api::DCFG_ROUTINE::get_image_id ( ) const
pure virtual

Get the image ID.

Returns
Image ID of this routine.
virtual DCFG_ID dcfg_api::DCFG_ROUTINE::get_process_id ( ) const
pure virtual

Get the process ID.

Returns
Process ID of this routine.
virtual DCFG_ID dcfg_api::DCFG_ROUTINE::get_routine_id ( ) const
pure virtual

Get routine ID, which equals the basic-block ID of the entry node.

By the DCFG definition, a routine can only have one entry node. If there is a call into the "middle" of a routine, that entry point defines a separate routine in a DCFG.

Returns
ID number of entry node.
virtual const std::string* dcfg_api::DCFG_ROUTINE::get_symbol_name ( ) const
pure virtual

Get symbol name of this routine.

For more comprehensive symbol and source-code data, use DCFG_BASIC_BLOCK::get_symbol_name(), DCFG_BASIC_BLOCK::get_source_filename(), and DCFG_BASIC_BLOCK::get_source_line_number() for one or more basic blocks in this routine.

Returns
Pointer to name of the symbol at the entry node of the routine if it exists, NULL otherwise.

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