2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * File name: ir/debug/dbginfo.c
23 * Purpose: Implements the Firm interface to debug information.
24 * Author: Goetz Lindenmaier
25 * Modified by: Michael Beck
28 * Copyright: (c) 2001-2006 Universität Karlsruhe
35 #include "dbginfo_t.h"
40 merge_pair_func *__dbg_info_merge_pair = default_dbg_info_merge_pair;
42 merge_sets_func *__dbg_info_merge_sets = default_dbg_info_merge_sets;
44 snprint_dbg_func *__dbg_info_snprint = (snprint_dbg_func *)0;
46 void dbg_init( merge_pair_func *mpf, merge_sets_func *msf, snprint_dbg_func *snprint_dbg )
48 __dbg_info_merge_pair = mpf ? mpf : default_dbg_info_merge_pair;
49 __dbg_info_merge_sets = msf ? msf : default_dbg_info_merge_sets;
50 __dbg_info_snprint = snprint_dbg;
54 void set_irn_dbg_info(ir_node *n, dbg_info *db) {
56 } /* set_irn_dbg_info */
58 struct dbg_info *get_irn_dbg_info(const ir_node *n) {
60 } /* get_irn_dbg_info */
63 /* Routines to access the field of an entity containing the
64 debugging information. */
65 void set_entity_dbg_info(ir_entity *ent, dbg_info *db) {
67 } /* set_entity_dbg_info */
69 dbg_info *get_entity_dbg_info(const ir_entity *ent) {
71 } /* get_entity_dbg_info */
73 /* Routines to access the field of a type containing the
74 debugging information. */
75 void set_type_dbg_info(ir_type *tp, dbg_info *db) {
77 } /* set_type_dbg_info */
79 dbg_info *get_type_dbg_info(const ir_type *tp) {
81 } /* get_type_dbg_info */
84 * Converts a debug_action into a string.
86 const char *dbg_action_2_str(dbg_action a) {
87 #define CASE(a) case a: return #a
92 CASE(dbg_opt_auxnode);
95 CASE(dbg_straightening);
96 CASE(dbg_if_simplification);
97 CASE(dbg_algebraic_simplification);
98 CASE(dbg_write_after_write);
99 CASE(dbg_write_after_read);
100 CASE(dbg_read_after_write);
101 CASE(dbg_read_after_read);
102 CASE(dbg_read_a_const);
103 CASE(dbg_rem_poly_call);
105 CASE(dbg_opt_confirm);
109 return "string conversion not implemented";
111 assert(!"Missing debug action in dbg_action_2_str()");
115 } /* dbg_action_2_str */
118 void default_dbg_info_merge_pair(ir_node *nw, ir_node *old, dbg_action info) {
119 dbg_info *new_db = get_irn_dbg_info(nw);
121 set_irn_dbg_info(nw, get_irn_dbg_info(old));
122 } /* default_dbg_info_merge_pair */
124 void default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
125 ir_node **old_nodes, int n_old_nodes,
127 if (n_old_nodes == 1) {
128 dbg_info *old_db = get_irn_dbg_info(old_nodes[0]);
131 for (i = 0; i < n_new_nodes; ++i)
132 if (get_irn_dbg_info(new_nodes[i]) == NULL)
133 set_irn_dbg_info(new_nodes[i], old_db);
135 } /* default_dbg_info_merge_sets */