48fd5e614770fa40099fbbf94d74cbe235bf4d11
[libfirm] / ir / be / be.h
1 #ifndef _BE_MAIN_H
2 #define _BE_MAIN_H
3
4 #include <stdio.h>
5 #include "irarch.h"
6 #include "archop.h"
7 #include "lower_dw.h"
8 #include "dbginfo.h"
9 #include "ifconv.h"
10 #include "beirg.h"
11
12 #define LC_STOP_AND_RESET_TIMER(timer) do { lc_timer_stop(timer); lc_timer_reset(timer); } while(0)
13
14 /**
15  * This structure contains parameters that should be
16  * propagated to the libFirm parameter set.
17  */
18 typedef struct backend_params {
19         /** Additional opcodes settings. */
20         const arch_ops_info *arch_op_settings;
21
22         /** Settings for architecture dependent optimizations */
23         const arch_dep_params_t *dep_param;
24
25         /** if set, the backend cannot handle DWORD access */
26         unsigned do_dw_lowering;
27
28         /** the architecture specific intrinsic function creator */
29         create_intrinsic_fkt *arch_create_intrinsic_fkt;
30
31         /** the context parameter for the create intrinsic function */
32         void *create_intrinsic_ctx;
33
34         /** backend settings for if-conversion */
35         const opt_if_conv_info_t *if_conv_info;
36 } backend_params;
37
38 /**
39  * Register the Firm backend command line options.
40  */
41 void be_opt_register(void);
42
43 /**
44  * Parse one backend argument.
45  */
46 int be_parse_arg(const char *arg);
47
48 /**
49  * Initialize the Firm backend. Must be run BEFORE init_firm()!
50  *
51  * @return libFirm configuration parameters for the selected
52  *         backend
53  */
54 const backend_params *be_init(void);
55
56 /**
57  * Main interface to the frontend.
58  */
59 void be_main(FILE *file_handle, const char *cup_name);
60
61 /** The type of the debug info retriever function. */
62 typedef const char *(*retrieve_dbg_func)(const dbg_info *dbg, unsigned *line);
63
64 /**
65  * Sets a debug info retriever.
66  *
67  * @param func   the debug retriever function.
68  */
69 void be_set_debug_retrieve(retrieve_dbg_func func);
70
71 /**
72  * Retrieve the debug info.
73  */
74 const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);
75
76 typedef struct _be_main_env_t be_main_env_t;
77 typedef struct _be_options_t be_options_t;
78
79 #endif /* _BE_MAIN_H */