sparc: implement float->unsigned conversions
[libfirm] / ir / be / bedbgout.c
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Stabs support.
23  * @author  Michael Beck
24  * @date    11.9.2006
25  */
26 #include "config.h"
27
28 #include "be_dbgout_t.h"
29 #include "bemodule.h"
30 #include "irtools.h"
31
32 static dbg_handle *handle = NULL;
33
34 void be_dbg_close(void)
35 {
36         if (handle->ops->close)
37                 handle->ops->close(handle);
38 }
39
40 void be_dbg_unit_begin(const char *filename)
41 {
42         if (handle->ops->unit_begin)
43                 handle->ops->unit_begin(handle, filename);
44 }
45
46 void be_dbg_unit_end(void)
47 {
48         if (handle->ops->unit_end)
49                 handle->ops->unit_end(handle);
50 }
51
52 void be_dbg_method_begin(const ir_entity *ent)
53 {
54         if (handle->ops->method_begin)
55                 handle->ops->method_begin(handle, ent);
56 }
57
58 void be_dbg_method_end(void)
59 {
60         if (handle->ops->method_end)
61                 handle->ops->method_end(handle);
62 }
63
64 void be_dbg_types(void)
65 {
66         if (handle->ops->types)
67                 handle->ops->types(handle);
68 }
69
70 void be_dbg_variable(const ir_entity *ent)
71 {
72         if (handle->ops->variable)
73                 handle->ops->variable(handle, ent);
74 }
75
76 void be_dbg_set_dbg_info(dbg_info *dbgi)
77 {
78         if (handle->ops->set_dbg_info)
79                 handle->ops->set_dbg_info(handle, dbgi);
80 }
81
82 static be_module_list_entry_t       *dbgout_modules         = NULL;
83 static be_create_dbgout_module_func  selected_dbgout_module = NULL;
84
85 void be_dbg_open(void)
86 {
87         handle = selected_dbgout_module();
88 }
89
90 void be_register_dbgout_module(const char *name,
91                                be_create_dbgout_module_func func)
92 {
93         if (selected_dbgout_module == NULL)
94                 selected_dbgout_module = func;
95         be_add_module_to_list(&dbgout_modules, name, (void*)func);
96 }
97
98 static dbg_handle *create_null_dbgout_module(void)
99 {
100         static const debug_ops null_ops = {
101                 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
102         };
103         static dbg_handle null_handle = { &null_ops };
104         return &null_handle;
105 }
106
107 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_dbgout)
108 void be_init_dbgout(void)
109 {
110         lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
111
112         be_add_module_list_opt(be_grp, "debuginfo", "debug info format",
113                                &dbgout_modules, (void**) &selected_dbgout_module);
114         be_register_dbgout_module("none", create_null_dbgout_module);
115 }