0a4ae0fb627913e9dc9b576261ef8cd2714fe69d
[libfirm] / ir / be / ia32 / ia32_emitter.h
1 #ifndef _IA32_EMITTER_H_
2 #define _IA32_EMITTER_H_
3
4 #include "irargs_t.h"  // this also inlucdes <libcore/lc_print.h>
5 #include "irnode.h"
6 #include "debug.h"
7
8 #include "../bearch.h"
9
10 #include "bearch_ia32_t.h"
11
12 typedef struct _ia32_emit_env_t {
13         FILE                  *out;
14         const arch_env_t      *arch_env;
15         const ia32_code_gen_t *cg;
16         ia32_isa_t            *isa;
17         DEBUG_ONLY(firm_dbg_module_t *mod;)
18 } ia32_emit_env_t;
19
20 const lc_arg_env_t *ia32_get_arg_env(void);
21
22 char *ia32_emit_binop(const ir_node *irn, ia32_emit_env_t *env);
23 char *ia32_emit_unop(const ir_node *irn, ia32_emit_env_t *env);
24 char *ia32_emit_am(const ir_node *irn, ia32_emit_env_t *env);
25
26 char *ia32_emit_x87_binop(const ir_node *n, ia32_emit_env_t *env);
27
28 int get_ia32_reg_nr(ir_node *irn, int posi, int in_out);
29 const char *get_ia32_in_reg_name(ir_node *irn, int pos);
30
31 void ia32_gen_routine(FILE *F, ir_graph *irg, const ia32_code_gen_t *cg);
32
33 /**
34  * Sections.
35  */
36 typedef enum section_t {
37         NO_SECTION     = -1,  /**< no section selected yet. */
38         SECTION_TEXT   = 0,   /**< text section */
39         SECTION_DATA   = 1,   /**< data section */
40         SECTION_RODATA = 2,   /**< rodata section */
41         SECTION_COMMON = 3,   /**< common section */
42         SECTION_MAX    = 4
43 } section_t;
44
45 /**
46  * Switch to a new section.
47  */
48 void ia32_switch_section(FILE *f, section_t sec);
49
50 typedef enum asm_flavour_t {
51         ASM_LINUX_GAS = 0,  /**< Linux gas */
52         ASM_MINGW_GAS = 1,  /**< MinGW gas */
53         ASM_MAX       = 2
54 } asm_flavour_t;
55
56 extern asm_flavour_t asm_flavour;
57
58 #endif /* _IA32_EMITTER_H_ */