Commit 0b8424d6 authored by Michael Beck's avatar Michael Beck
Browse files

- add support for ASM includes, needed for fehler125.c

[r20935]
parent 478a800c
......@@ -252,4 +252,13 @@ ir_exc_region_t get_irp_next_region_nr(void);
/** Returns a new, unique label number. */
ir_label_t get_irp_next_label_nr(void);
/** Add a new global asm include. */
void add_irp_asm(ident *asm_string);
/** Return the number of global asm includes. */
int get_irp_n_asms(void);
/** Return the global asm include at position pos. */
ident *get_irp_asm(int pos);
#endif
......@@ -1704,6 +1704,7 @@ static void init_asm_constraints(void)
static arch_env_t *ia32_init(FILE *file_handle) {
static int inited = 0;
ia32_isa_t *isa;
int i, n;
if (inited)
return NULL;
......@@ -1742,6 +1743,14 @@ static arch_env_t *ia32_init(FILE *file_handle) {
intrinsic_env.isa = isa;
ia32_handle_intrinsics();
/* emit asm includes */
n = get_irp_n_asms();
for (i = 0; i < n; ++i) {
be_emit_cstring("#APP\n");
be_emit_ident(get_irp_asm(i));
be_emit_cstring("\n#NO_APP\n");
}
/* needed for the debug support */
be_gas_emit_switch_section(GAS_SECTION_TEXT);
be_emit_cstring(".Ltext0:\n");
......
......@@ -63,6 +63,7 @@ static ir_prog *new_incomplete_ir_prog(void) {
res->types = NEW_ARR_F(ir_type *, 0);
res->modes = NEW_ARR_F(ir_mode *, 0);
res->opcodes = NEW_ARR_F(ir_op *, 0);
res->global_asms = NEW_ARR_F(ident *, 0);
res->last_region_nr = 0;
res->last_label_nr = 1; /* 0 is reserved as non-label */
res->max_irg_idx = 0;
......@@ -127,7 +128,7 @@ void init_irprog_2(void) {
/* Create a new ir prog. Automatically called by init_firm through
init_irprog. */
ir_prog *new_ir_prog (void) {
ir_prog *new_ir_prog(void) {
return complete_ir_prog(new_incomplete_ir_prog());
}
......@@ -147,6 +148,7 @@ void free_ir_prog(void) {
finish_op();
DEL_ARR_F(irp->opcodes);
DEL_ARR_F(irp->global_asms);
irp->name = NULL;
irp->const_code_irg = NULL;
......@@ -163,7 +165,7 @@ ir_graph *get_irp_main_irg(void) {
}
void set_irp_main_irg(ir_graph *main_irg) {
assert (irp);
assert(irp);
irp->main_irg = main_irg;
}
......@@ -399,7 +401,6 @@ ir_node** get_irp_ip_outedges(void) {
return irp->ip_outedges;
}
irg_callee_info_state get_irp_callee_info_state(void) {
return irp->callee_info_state;
}
......@@ -417,3 +418,19 @@ ir_exc_region_t (get_irp_next_region_nr)(void) {
ir_label_t (get_irp_next_label_nr)(void) {
return _get_irp_next_label_nr();
}
/* Add a new global asm include */
void add_irp_asm(ident *asm_string) {
ARR_APP1(ident *, irp->global_asms, asm_string);
}
/* Return the number of global asm includes. */
int get_irp_n_asms(void) {
return ARR_LEN(irp->global_asms);
}
/* Return the global asm include at position pos. */
ident *get_irp_asm(int pos) {
assert(pos <= 0 && pos < get_irp_n_asms());
return irp->global_asms[pos];
}
......@@ -533,6 +533,7 @@ struct ir_prog {
ir_type **types; /**< A list of all types in the ir. */
ir_mode **modes; /**< A list of all modes in the ir. */
ir_op **opcodes; /**< A list of all opcodes in the ir. */
ident **global_asms; /**< An array of global ASM insertions. */
/* -- states of and access to generated information -- */
irg_phase_state phase_state; /**< The state of construction. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment