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 * @brief Implements the Firm interface to debug information.
23 * @author Goetz Lindenmaier, Michael Beck
31 #include "dbginfo_t.h"
36 merge_pair_func *__dbg_info_merge_pair = default_dbg_info_merge_pair;
38 merge_sets_func *__dbg_info_merge_sets = default_dbg_info_merge_sets;
40 snprint_dbg_func *__dbg_info_snprint = (snprint_dbg_func *)0;
42 void dbg_init( merge_pair_func *mpf, merge_sets_func *msf, snprint_dbg_func *snprint_dbg )
44 __dbg_info_merge_pair = mpf ? mpf : default_dbg_info_merge_pair;
45 __dbg_info_merge_sets = msf ? msf : default_dbg_info_merge_sets;
46 __dbg_info_snprint = snprint_dbg;
50 void set_irn_dbg_info(ir_node *n, dbg_info *db) {
52 } /* set_irn_dbg_info */
54 struct dbg_info *get_irn_dbg_info(const ir_node *n) {
56 } /* get_irn_dbg_info */
59 /* Routines to access the field of an entity containing the
60 debugging information. */
61 void set_entity_dbg_info(ir_entity *ent, dbg_info *db) {
63 } /* set_entity_dbg_info */
65 dbg_info *get_entity_dbg_info(const ir_entity *ent) {
67 } /* get_entity_dbg_info */
69 /* Routines to access the field of a type containing the
70 debugging information. */
71 void set_type_dbg_info(ir_type *tp, dbg_info *db) {
73 } /* set_type_dbg_info */
75 dbg_info *get_type_dbg_info(const ir_type *tp) {
77 } /* get_type_dbg_info */
80 * Converts a debug_action into a string.
82 const char *dbg_action_2_str(dbg_action a) {
83 #define CASE(a) case a: return #a
88 CASE(dbg_opt_auxnode);
91 CASE(dbg_straightening);
92 CASE(dbg_if_simplification);
93 CASE(dbg_algebraic_simplification);
94 CASE(dbg_write_after_write);
95 CASE(dbg_write_after_read);
96 CASE(dbg_read_after_write);
97 CASE(dbg_read_after_read);
98 CASE(dbg_read_a_const);
99 CASE(dbg_rem_poly_call);
101 CASE(dbg_opt_confirm);
105 return "string conversion not implemented";
107 assert(!"Missing debug action in dbg_action_2_str()");
111 } /* dbg_action_2_str */
114 void default_dbg_info_merge_pair(ir_node *nw, ir_node *old, dbg_action info) {
115 dbg_info *new_db = get_irn_dbg_info(nw);
117 set_irn_dbg_info(nw, get_irn_dbg_info(old));
118 } /* default_dbg_info_merge_pair */
120 void default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
121 ir_node **old_nodes, int n_old_nodes,
123 if (n_old_nodes == 1) {
124 dbg_info *old_db = get_irn_dbg_info(old_nodes[0]);
127 for (i = 0; i < n_new_nodes; ++i)
128 if (get_irn_dbg_info(new_nodes[i]) == NULL)
129 set_irn_dbg_info(new_nodes[i], old_db);
131 } /* default_dbg_info_merge_sets */