added function for convertion debug info
[libfirm] / ir / debug / dbginfo.c
1 /*
2  * Project:     libFIRM
3  * File name:   ir/debug/dbginfo.c
4  * Purpose:     Implements the Firm interface to debug information.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     2001
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2001-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifdef HAVE_CONFIG_H
14 # include "config.h"
15 #endif
16
17 #include "dbginfo_t.h"
18 #include "irnode_t.h"
19 #include "type_t.h"
20 #include "entity_t.h"
21
22 void
23 default_dbg_info_merge_pair(ir_node *nw, ir_node *old, dbg_action info) {
24   set_irn_dbg_info(nw, get_irn_dbg_info(old));
25 }
26
27 void
28 default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
29             ir_node **old_nodes, int n_old_nodes,
30             dbg_action info) {
31 }
32
33 merge_pair_func *__dbg_info_merge_pair = default_dbg_info_merge_pair;
34
35 merge_sets_func *__dbg_info_merge_sets = default_dbg_info_merge_sets;
36
37 snprint_dbg_func *__dbg_info_snprint   = (snprint_dbg_func *)0;
38
39 void dbg_init( merge_pair_func *mpf, merge_sets_func *msf, snprint_dbg_func *snprint_dbg )
40 {
41   __dbg_info_merge_pair = mpf ? mpf : default_dbg_info_merge_pair;
42   __dbg_info_merge_sets = msf ? msf : default_dbg_info_merge_sets;
43   __dbg_info_snprint    = snprint_dbg;
44 }
45
46
47 void
48 set_irn_dbg_info(ir_node *n, struct dbg_info* db) {
49   n->dbi = db;
50 }
51
52 struct dbg_info *
53 get_irn_dbg_info(ir_node *n) {
54   return n->dbi;
55 }
56
57
58 /* Routines to access the field of an entity containing the
59    debugging information. */
60 void set_entity_dbg_info(entity *ent, dbg_info* db) {
61   ent->dbi = db;
62 }
63 dbg_info *get_entity_dbg_info(entity *ent) {
64   return ent->dbi;
65 }
66 /* Routines to access the field of a type containing the
67    debugging information. */
68 void set_type_dbg_info(type *tp, dbg_info* db) {
69   tp->dbi = db;
70 }
71 dbg_info *get_type_dbg_info(type *tp) {
72   return tp->dbi;
73 }