4f124340e6c56f86c2fa88c6b145603758c5a868
[libfirm] / ir / debug / dbginfo.c
1 /*
2 **  Copyright (C) 2001 by Universitaet Karlsruhe
3 **  All rights reserved.
4 **
5 **  Authors: Goetz Lindenmaier
6 **
7 **  dbginfo: This is a empty implementation of the Firm interface to
8 **  debugging support.  It only guarantees that the Firm library compiles
9 **  and runs without any real debugging support.
10 **  The functions herein are declared weak so that they can be overriden
11 **  by a real implementation.
12 */
13
14 /* $Id$ */
15
16 #ifdef HAVE_CONFIG_H
17 # include <config.h>
18 #endif
19
20 #include "dbginfo_t.h"
21 #include "irnode_t.h"
22 #include "type_t.h"
23 #include "entity_t.h"
24
25
26 INLINE void
27 dbg_info_merge_pair(ir_node *nw, ir_node *old, dbg_action info) {
28   set_irn_dbg_info(nw, get_irn_dbg_info(old));
29 }
30
31 INLINE void
32 dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
33                     ir_node **old_nodes, int n_old_nodes,
34                     dbg_action info) {
35 }
36
37
38 static void (*__dbg_info_merge_pair)(ir_node *nw, ir_node *old, dbg_action info)
39      = &dbg_info_merge_pair;
40
41 static void (*__dbg_info_merge_sets)(ir_node **new_nodes, int n_new_nodes,
42                               ir_node **old_nodes, int n_old_nodes,
43                               dbg_action info)
44      = &dbg_info_merge_sets;
45
46
47 void dbg_init( void (merge_pair)(ir_node *nw, ir_node *old, dbg_action info) ,
48                void (merge_sets)(ir_node **new_nodes, int n_new_nodes,
49                                  ir_node **old_nodes, int n_old_nodes,
50                                   dbg_action info)
51                ) {
52   __dbg_info_merge_pair = merge_pair;
53   __dbg_info_merge_sets = merge_sets;
54 }
55
56
57 INLINE void
58 set_irn_dbg_info(ir_node *n, struct dbg_info* db) {
59   n->dbi = db;
60 }
61
62 INLINE struct dbg_info *
63 get_irn_dbg_info(ir_node *n) {
64   return n->dbi;
65 }
66
67
68 /* Routines to access the field of an entity containing the
69    debugging information. */
70 INLINE void set_entity_dbg_info(entity *ent, dbg_info* db) {
71   ent->dbi = db;
72 }
73 INLINE dbg_info *get_entity_dbg_info(entity *ent) {
74   return ent->dbi;
75 }
76 /* Routines to access the field of a type containing the
77    debugging information. */
78 INLINE void set_type_dbg_info(type *tp, dbg_info* db) {
79   tp->dbi = db;
80 }
81 INLINE dbg_info *get_type_dbg_info(type *tp) {
82   return tp->dbi;
83 }