3 * File name: ir/debug/dbginfo.c
4 * Purpose: Implements the Firm interface to debug information.
5 * Author: Goetz Lindenmaier
6 * Modified by: Michael Beck
9 * Copyright: (c) 2001-2006 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 #include "dbginfo_t.h"
22 merge_pair_func *__dbg_info_merge_pair = default_dbg_info_merge_pair;
24 merge_sets_func *__dbg_info_merge_sets = default_dbg_info_merge_sets;
26 snprint_dbg_func *__dbg_info_snprint = (snprint_dbg_func *)0;
28 void dbg_init( merge_pair_func *mpf, merge_sets_func *msf, snprint_dbg_func *snprint_dbg )
30 __dbg_info_merge_pair = mpf ? mpf : default_dbg_info_merge_pair;
31 __dbg_info_merge_sets = msf ? msf : default_dbg_info_merge_sets;
32 __dbg_info_snprint = snprint_dbg;
36 void set_irn_dbg_info(ir_node *n, dbg_info *db) {
38 } /* set_irn_dbg_info */
40 struct dbg_info *get_irn_dbg_info(const ir_node *n) {
42 } /* get_irn_dbg_info */
45 /* Routines to access the field of an entity containing the
46 debugging information. */
47 void set_entity_dbg_info(ir_entity *ent, dbg_info *db) {
49 } /* set_entity_dbg_info */
51 dbg_info *get_entity_dbg_info(const ir_entity *ent) {
53 } /* get_entity_dbg_info */
55 /* Routines to access the field of a type containing the
56 debugging information. */
57 void set_type_dbg_info(ir_type *tp, dbg_info *db) {
59 } /* set_type_dbg_info */
61 dbg_info *get_type_dbg_info(const ir_type *tp) {
63 } /* get_type_dbg_info */
66 * Converts a debug_action into a string.
68 const char *dbg_action_2_str(dbg_action a) {
69 #define CASE(a) case a: return #a
74 CASE(dbg_opt_auxnode);
77 CASE(dbg_straightening);
78 CASE(dbg_if_simplification);
79 CASE(dbg_algebraic_simplification);
80 CASE(dbg_write_after_write);
81 CASE(dbg_write_after_read);
82 CASE(dbg_read_after_write);
83 CASE(dbg_read_after_read);
84 CASE(dbg_read_a_const);
85 CASE(dbg_rem_poly_call);
87 CASE(dbg_opt_confirm);
91 return "string conversion not implemented";
93 assert(!"Missing debug action in dbg_action_2_str()");
97 } /* dbg_action_2_str */
100 void default_dbg_info_merge_pair(ir_node *nw, ir_node *old, dbg_action info) {
101 dbg_info *new_db = get_irn_dbg_info(nw);
103 set_irn_dbg_info(nw, get_irn_dbg_info(old));
104 } /* default_dbg_info_merge_pair */
106 void default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
107 ir_node **old_nodes, int n_old_nodes,
109 if (n_old_nodes == 1) {
110 dbg_info *old_db = get_irn_dbg_info(old_nodes[0]);
113 for (i = 0; i < n_new_nodes; ++i)
114 if (get_irn_dbg_info(new_nodes[i]) == NULL)
115 set_irn_dbg_info(new_nodes[i], old_db);
117 } /* default_dbg_info_merge_sets */