ff77314271e2667a81dbdabe6bdcbd836c4cdc8c
[libfirm] / ir / debug / dbginfo.h
1 /*
2 **  Copyright (C) 2001 by Universitaet Karlsruhe
3 **  All rights reserved.
4 **
5 **  Authors: Goetz Lindenmaier
6 **
7 **  dbginfo: This is the Firm interface to debugging support.  Firm requires
8 **  a debugging module fulfilling this interface.
9 **  The interface requires a datatype representing the debugging information.
10 **  Firm supports administrating a reference to the debug information
11 **  in every firm node.  Further Firm optimizations call routines to
12 **  propagate debug information from old nodes to new nodes if the optimization
13 **  replaces the old ones by the new ones.
14 **
15 **  This file does not belong to the interface of the firm library.
16 */
17
18 /* $Id$ */
19
20 # ifndef _DBGINFO_H_
21 # define _DBGINFO_H_
22
23 #include "ident.h"
24
25 #ifndef _IR_NODE_TYPEDEF_
26 #define _IR_NODE_TYPEDEF_
27 typedef struct ir_node ir_node;
28 #endif
29
30 /* A datastructure containing information for debugging.  */
31 typedef struct dbg_info dbg_info;
32
33 /* Sets the functions called by libfirm when changing the IR.
34    The following routines are called by firm optmizations.  The optimization
35    passes an ident representing a string that describes the optimization
36    performed.
37    - dbg_info_merge_pair() is called in the following situation:
38      The optimization replaced the old node by the new one.  The new node
39      might be a recent allocated node not containing any debug information,
40      or just another node from somewhere in the graph with the same
41      semantics.
42    - dbg_info_merge_sets() is called in the following situation:
43      The optimization replaced a subgraph by another subgraph.  There is no
44      obviouse mapping between single nodes in both subgraphs.  The optimization
45      simply passes two lists to the debug module, one containing the nodes in
46      the old subgraph, the other containing the nodes in the new subgraph.
47 */
48 void dbg_init( void (merge_pair)(ir_node *nw, ir_node *old, ident *info),
49                void (merge_sets)(ir_node **new_nodes, ir_node **old_nodes,
50                                 ident *info)
51                );
52
53 /* Every Firm node contains a reference to a dbg_info struct. This reference
54    can be accessed by the debug support module by
55    dbg_info *get_irn_dbg_info(irnode *n);
56    void      set_irn_dbg_info(irnode *n, dbg_info *d);.
57    The module may not touch or change anything else in the Firm data structure.
58 */
59 inline void set_irn_dbg_info(ir_node *n, dbg_info* db);
60
61 inline dbg_info *get_irn_dbg_info(ir_node *n);
62
63
64
65 #endif /* _DBGINFO_H_ */