Do not emit cld in the CopyB prologue. The ABI mandates that DF is cleared, so do...
[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  * @version $Id: bestabs.c 17143 2008-01-02 20:56:33Z beck $
26  */
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include "be_dbgout_t.h"
32 #include "bemodule.h"
33 #include "irtools.h"
34
35 static dbg_handle *handle = NULL;
36
37 void be_dbg_close(void) {
38         if (handle->ops->close)
39                 handle->ops->close(handle);
40 }
41
42 void be_dbg_so(const char *filename) {
43         if (handle->ops->so)
44                 handle->ops->so(handle, filename);
45 }
46
47 void be_dbg_main_program(void) {
48         if (handle->ops->main_program)
49                 handle->ops->main_program(handle);
50 }
51
52 void be_dbg_method_begin(ir_entity *ent, const be_stack_layout_t *layout) {
53         if (handle->ops->method_begin)
54                 handle->ops->method_begin(handle, ent, layout);
55 }
56
57 void be_dbg_method_end(void) {
58         if (handle->ops->method_end)
59                 handle->ops->method_end(handle);
60 }
61
62 void be_dbg_types(void) {
63         if (handle->ops->types)
64                 handle->ops->types(handle);
65 }
66
67 void be_dbg_variable(ir_entity *ent) {
68         if (handle->ops->variable)
69                 handle->ops->variable(handle, ent);
70 }
71
72 void be_dbg_set_dbg_info(dbg_info *dbgi) {
73         if (handle->ops->set_dbg_info)
74                 handle->ops->set_dbg_info(handle, dbgi);
75 }
76
77 static be_module_list_entry_t       *dbgout_modules         = NULL;
78 static be_create_dbgout_module_func  selected_dbgout_module = NULL;
79
80 void be_dbg_open(void) {
81         handle = selected_dbgout_module();
82 }
83
84 void be_register_dbgout_module(const char *name,
85                                be_create_dbgout_module_func func);
86
87 void be_register_dbgout_module(const char *name,
88                                be_create_dbgout_module_func func)
89 {
90         if (selected_dbgout_module == NULL)
91                 selected_dbgout_module = func;
92         be_add_module_to_list(&dbgout_modules, name, func);
93 }
94
95 static dbg_handle *create_null_dbgout_module(void)
96 {
97         static const debug_ops null_ops;
98         static dbg_handle null_handle = { &null_ops };
99         return &null_handle;
100 }
101
102 void be_init_dbgout(void) {
103         lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
104
105         be_add_module_list_opt(be_grp, "debuginfo", "debug info format",
106                                &dbgout_modules, (void**) &selected_dbgout_module);
107         be_register_dbgout_module("null", create_null_dbgout_module);
108 }
109
110 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_dbgout);