libFirm
Source References

Firm requires a debugging module fulfilling this interface, else no debugging information is passed to the backend. More...

Data Structures

struct  src_loc_t
 A sourcecode location. More...
 

Typedefs

typedef void merge_pair_func(ir_node *new_node, ir_node *old_node, dbg_action action)
 The type of the debug info merge function. More...
 
typedef void merge_sets_func(ir_node *const *new_node_array, int new_num_entries, ir_node *const *old_node_array, int old_num_entries, dbg_action action)
 The type of the debug info merge sets function. More...
 
typedef src_loc_t(* retrieve_dbg_func) (dbg_info const *dbg)
 The type of the debug info retriever function. More...
 
typedef void(* retrieve_type_dbg_func) (char *buffer, size_t buffer_size, const type_dbg_info *tdbgi)
 The type of the type debug info retrieve function. More...
 
typedef struct dbg_info dbg_info
 Source Reference. More...
 
typedef struct type_dbg_info type_dbg_info
 Source Type Reference. More...
 

Enumerations

enum  dbg_action {
  dbg_error = 0, dbg_opt_ssa, dbg_opt_auxnode, dbg_const_eval,
  dbg_opt_cse, dbg_straightening, dbg_if_simplification, dbg_algebraic_simplification,
  dbg_write_after_write, dbg_write_after_read, dbg_read_after_write, dbg_read_after_read,
  dbg_read_a_const, dbg_dead_code, dbg_opt_confirm, dbg_gvn_pre,
  dbg_combo, dbg_jumpthreading, dbg_backend, dbg_max
}
 An enumeration indicating the action performed by a transformation. More...
 

Functions

const char * dbg_action_2_str (dbg_action a)
 Converts a debug_action into a string. More...
 
void dbg_init (merge_pair_func *dbg_info_merge_pair, merge_sets_func *dbg_info_merge_sets)
 Initializes the debug support. More...
 
void ir_set_debug_retrieve (retrieve_dbg_func func)
 Sets a debug info retriever. More...
 
void ir_set_type_debug_retrieve (retrieve_type_dbg_func func)
 Sets global print_type_dbg_info function in firm. More...
 
src_loc_t ir_retrieve_dbg_info (dbg_info const *dbg)
 Retrieve the debug info. More...
 
void ir_retrieve_type_dbg_info (char *buffer, size_t buffer_size, const type_dbg_info *tdbgi)
 Retrieve type debug info. More...
 

Detailed Description

Firm requires a debugging module fulfilling this interface, else no debugging information is passed to the backend.

The interface requires a datatype representing the debugging information. Firm supports administrating a reference to the debug information in every Firm node. Further Firm optimizations call routines to propagate debug information from old nodes to new nodes if the optimization replaces the old ones by the new ones.


Data Structure Documentation

struct src_loc_t

A sourcecode location.

Definition at line 136 of file dbginfo.h.

Data Fields
unsigned column column number (starting at 1; 0 if unknown)
char const * file the name of the source (usually a file)
unsigned line line number (starting at 1; 0 if unknown)

Typedef Documentation

Source Reference.

An abstract data type containing information for debugging support.

This opaque data type is not defined anywhere in the Firm library, but pointers to this type can be stored in Firm nodes.

Definition at line 40 of file firm_types.h.

typedef void merge_pair_func(ir_node *new_node, ir_node *old_node, dbg_action action)

The type of the debug info merge function.

Parameters
new_nodethe new ir node
old_nodethe old ir node
actionthe action that triggers the merge
See also
dbg_init()

Definition at line 91 of file dbginfo.h.

typedef void merge_sets_func(ir_node *const *new_node_array, int new_num_entries, ir_node *const *old_node_array, int old_num_entries, dbg_action action)

The type of the debug info merge sets function.

Parameters
new_node_arrayarray of new nodes
new_num_entriesnumber of entries in new_node_array
old_node_arrayarray of old nodes
old_num_entriesnumber of entries in old_node_array
actionthe action that triggers the merge
See also
dbg_init()

Definition at line 104 of file dbginfo.h.

typedef src_loc_t(* retrieve_dbg_func) (dbg_info const *dbg)

The type of the debug info retriever function.

When given a dbg_info returns the name (usually the filename), line number and column number of the definition. Any part of the returned information may be NULL/0, which means it is not available.

Definition at line 149 of file dbginfo.h.

typedef void(* retrieve_type_dbg_func) (char *buffer, size_t buffer_size, const type_dbg_info *tdbgi)

The type of the type debug info retrieve function.

Prints a human readable source representation of a type to a buffer. (Used for generating debug info like stabs or dwarf)

Definition at line 163 of file dbginfo.h.

typedef struct type_dbg_info type_dbg_info

Source Type Reference.

Definition at line 43 of file firm_types.h.

Enumeration Type Documentation

enum dbg_action

An enumeration indicating the action performed by a transformation.

Enumerator
dbg_error 
dbg_opt_ssa 

Optimization of the SSA representation, e.g.

removal of superfluent Phi nodes.

dbg_opt_auxnode 

Removal of unnecessary auxiliary nodes.

dbg_const_eval 

A Firm subgraph was evaluated to a single constant.

dbg_opt_cse 

A Firm node was replaced due to common subexpression elimination.

dbg_straightening 

A Firm subgraph was replaced by a single, existing block.

dbg_if_simplification 

The control flow of an if is changed as either the else, the then or both blocks are empty.

dbg_algebraic_simplification 

A Firm subgraph was replaced because of an algebraic simplification.

dbg_write_after_write 

A Firm subgraph was replaced because of a write after write optimization.

dbg_write_after_read 

A Firm subgraph was replaced because of a write after read optimization.

dbg_read_after_write 

A Firm subgraph was replaced because of a read after write optimization.

dbg_read_after_read 

A Firm subgraph was replaced because of a read after read optimization.

dbg_read_a_const 

A Firm subgraph was replaced because of a read a constant optimization.

dbg_dead_code 

Removing unreachable code, i.e.

blocks that are never executed.

dbg_opt_confirm 

A Firm subgraph was replace because of a Confirmation.

dbg_gvn_pre 

A Firm node was replace because of the GVN-PRE algorithm.

dbg_combo 

A Firm node was replace because of the combo algorithm.

dbg_jumpthreading 

A Firm node was replace because of the jumpthreading algorithm.

dbg_backend 

A Firm subgraph was replaced because of a Backend transformation.

dbg_max 

Maximum value.

Definition at line 45 of file dbginfo.h.

Function Documentation

const char* dbg_action_2_str ( dbg_action  a)

Converts a debug_action into a string.

Parameters
athe debug action
void dbg_init ( merge_pair_func dbg_info_merge_pair,
merge_sets_func dbg_info_merge_sets 
)

Initializes the debug support.

This function takes pointers to two functions that merge the debug information when a transformation of a Firm graph is performed. Firm transformations call one of these functions.

  • dbg_info_merge_pair() is called in the following situation: The optimization replaced the old node by the new one. The new node might be a recent allocated node not containing any debug information, or just another node from somewhere in the graph with the same semantics.
  • dbg_info_merge_sets() is called in the following situation: The optimization replaced a subgraph by another subgraph. There is no obviously mapping between single nodes in both subgraphs. The optimization simply passes two lists to the debug module, one containing the nodes in the old subgraph, the other containing the nodes in the new subgraph. The same node can be in both lists.

Further both functions pass an enumeration indicating the action performed by the transformation, e.g. the kind of optimization performed.

src_loc_t ir_retrieve_dbg_info ( dbg_info const *  dbg)

Retrieve the debug info.

void ir_retrieve_type_dbg_info ( char *  buffer,
size_t  buffer_size,
const type_dbg_info tdbgi 
)

Retrieve type debug info.

void ir_set_debug_retrieve ( retrieve_dbg_func  func)

Sets a debug info retriever.

Parameters
functhe debug retriever function.
void ir_set_type_debug_retrieve ( retrieve_type_dbg_func  func)

Sets global print_type_dbg_info function in firm.