2 * Header file for ia32 emitter, containing some function definitions and types.
3 * @author Christian Wuerdig, Matthias Braun
6 #ifndef _IA32_EMITTER_H_
7 #define _IA32_EMITTER_H_
13 #include "../bearch.h"
15 #include "bearch_ia32_t.h"
17 typedef struct _ia32_emit_env_t {
19 const arch_env_t *arch_env;
20 const ia32_code_gen_t *cg;
24 DEBUG_ONLY(firm_dbg_module_t *mod;)
27 static INLINE void ia32_emit_char(ia32_emit_env_t *env, char c)
29 obstack_1grow(env->obst, c);
33 static INLINE void ia32_emit_string_len(ia32_emit_env_t *env, const char *str, size_t l)
35 obstack_grow(env->obst, str, l);
39 static INLINE void ia32_emit_string(ia32_emit_env_t *env, const char *str)
41 size_t len = strlen(str);
42 ia32_emit_string_len(env, str, len);
45 #define ia32_emit_cstring(env,x) { ia32_emit_string_len(env, x, sizeof(x)-1); }
47 void ia32_emit_source_register(ia32_emit_env_t *env, const ir_node *node, int pos);
48 void ia32_emit_dest_register(ia32_emit_env_t *env, const ir_node *node, int pos);
49 void ia32_emit_x87_name(ia32_emit_env_t *env, const ir_node *node, int pos);
50 void ia32_emit_immediate(ia32_emit_env_t *env, const ir_node *node);
51 void ia32_emit_mode_suffix(ia32_emit_env_t *env, const ir_mode *mode);
52 void ia32_emit_extend_suffix(ia32_emit_env_t *env, const ir_mode *mode);
53 void ia32_emit_binop(ia32_emit_env_t *env, const ir_node *node);
54 void ia32_emit_unop(ia32_emit_env_t *env, const ir_node *node);
55 void ia32_emit_am(ia32_emit_env_t *env, const ir_node *node);
56 void ia32_emit_adr(ia32_emit_env_t *env, const ir_node *node);
57 void ia32_emit_x87_binop(ia32_emit_env_t *env, const ir_node *node);
58 void ia32_emit_finish_line(ia32_emit_env_t *env, const ir_node *node);
60 void ia32_gen_routine(ia32_code_gen_t *cg, FILE *F, ir_graph *irg);
65 typedef enum section_t {
66 NO_SECTION = -1, /**< no section selected yet. */
67 SECTION_TEXT = 0, /**< text section */
68 SECTION_DATA = 1, /**< data section */
69 SECTION_RODATA = 2, /**< rodata section */
70 SECTION_COMMON = 3, /**< common section */
71 SECTION_TLS = 4, /**< thread local storage section */
72 SECTION_CTOR = 5, /**< ctor section for instrumentation code init */
77 * Switch to a new section.
79 void ia32_switch_section(FILE *f, section_t sec);
81 typedef enum asm_flavour_t {
82 ASM_LINUX_GAS = 0, /**< Linux gas */
83 ASM_MINGW_GAS = 1, /**< MinGW gas */
87 extern asm_flavour_t asm_flavour;
89 #endif /* _IA32_EMITTER_H_ */