ia32_emitter.h 1.71 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
2
3
4
5
6
/**
 * Header file for ia32 emitter, containing some function definitions and types.
 * @author Christian Wuerdig
 * $Id$
 */

7
8
9
#ifndef _IA32_EMITTER_H_
#define _IA32_EMITTER_H_

Christian Würdig's avatar
Christian Würdig committed
10
#include "irargs_t.h"  // this also inlucdes <libcore/lc_print.h>
11
#include "irnode.h"
Christian Würdig's avatar
Christian Würdig committed
12
#include "debug.h"
13

Christian Würdig's avatar
Christian Würdig committed
14
15
#include "../bearch.h"

Christian Würdig's avatar
Christian Würdig committed
16
17
#include "bearch_ia32_t.h"

18
typedef struct _ia32_emit_env_t {
Christian Würdig's avatar
Christian Würdig committed
19
20
21
	FILE                  *out;
	const arch_env_t      *arch_env;
	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

Christian Würdig's avatar
Christian Würdig committed
26
const lc_arg_env_t *ia32_get_arg_env(void);
27

28
29
30
31
const char *ia32_emit_binop(const ir_node *irn, ia32_emit_env_t *env);
const char *ia32_emit_unop(const ir_node *irn, ia32_emit_env_t *env);
const char *ia32_emit_am(const ir_node *irn, ia32_emit_env_t *env);
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);
Christian Würdig's avatar
Christian Würdig committed
36
37
const char *get_ia32_in_reg_name(ir_node *irn, int pos);

Christian Würdig's avatar
Christian Würdig committed
38
void ia32_gen_routine(FILE *F, ir_graph *irg, const ia32_code_gen_t *cg);
Christian Würdig's avatar
Christian Würdig committed
39

Michael Beck's avatar
Michael Beck committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
 * Sections.
 */
typedef enum section_t {
	NO_SECTION     = -1,  /**< no section selected yet. */
	SECTION_TEXT   = 0,   /**< text section */
	SECTION_DATA   = 1,   /**< data section */
	SECTION_RODATA = 2,   /**< rodata section */
	SECTION_COMMON = 3,   /**< common section */
	SECTION_MAX    = 4
} section_t;

/**
 * Switch to a new section.
 */
void ia32_switch_section(FILE *f, section_t sec);

typedef enum asm_flavour_t {
	ASM_LINUX_GAS = 0,  /**< Linux gas */
	ASM_MINGW_GAS = 1,  /**< MinGW gas */
	ASM_MAX       = 2
} asm_flavour_t;

extern asm_flavour_t asm_flavour;

65
#endif /* _IA32_EMITTER_H_ */