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