a1b3dd9de41672b850695254a64db64561ad4b75
[libfirm] / ir / be / be.h
1 /*
2  * Copyright (C) 1995-2007 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 #ifndef _BE_MAIN_H
21 #define _BE_MAIN_H
22
23 #include <stdio.h>
24 #include "irarch.h"
25 #include "archop.h"
26 #include "lower_dw.h"
27 #include "dbginfo.h"
28 #include "ifconv.h"
29
30 #include <libcore/lc_timing.h>
31
32 #define LC_STOP_AND_RESET_TIMER(timer) do { lc_timer_stop(timer); lc_timer_reset(timer); } while(0)
33
34 /**
35  * This structure contains parameters that should be
36  * propagated to the libFirm parameter set.
37  */
38 typedef struct backend_params {
39         /** Additional opcodes settings. */
40         const arch_ops_info *arch_op_settings;
41
42         /** Settings for architecture dependent optimizations */
43         const arch_dep_params_t *dep_param;
44
45         /** if set, the backend cannot handle DWORD access */
46         unsigned do_dw_lowering;
47
48         /** the architecture specific intrinsic function creator */
49         create_intrinsic_fkt *arch_create_intrinsic_fkt;
50
51         /** the context parameter for the create intrinsic function */
52         void *create_intrinsic_ctx;
53
54         /** backend settings for if-conversion */
55         const opt_if_conv_info_t *if_conv_info;
56 } backend_params;
57
58 /**
59  * Register the Firm backend command line options.
60  */
61 void be_opt_register(void);
62
63 /**
64  * Parse one backend argument.
65  */
66 int be_parse_arg(const char *arg);
67
68 /**
69  * Initialize the Firm backend. Must be run BEFORE init_firm()!
70  *
71  * @return libFirm configuration parameters for the selected
72  *         backend
73  */
74 const backend_params *be_init(void);
75
76 /**
77  * Main interface to the frontend.
78  */
79 void be_main(FILE *file_handle, const char *cup_name);
80
81 /** The type of the debug info retriever function. */
82 typedef const char *(*retrieve_dbg_func)(const dbg_info *dbg, unsigned *line);
83
84 /**
85  * Sets a debug info retriever.
86  *
87  * @param func   the debug retriever function.
88  */
89 void be_set_debug_retrieve(retrieve_dbg_func func);
90
91 /**
92  * Retrieve the debug info.
93  */
94 const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);
95
96 typedef struct be_main_env_t be_main_env_t;
97 typedef struct be_options_t  be_options_t;
98
99 #endif /* _BE_MAIN_H */