Commit b43f2a92 authored by Matthias Braun's avatar Matthias Braun
Browse files

- Fix address_mode optimizer not removing nodes

- Need to mark used entities globally, not per-irg

[r12703]
parent bba30111
...@@ -1506,6 +1506,7 @@ static void *ia32_init(FILE *file_handle) { ...@@ -1506,6 +1506,7 @@ static void *ia32_init(FILE *file_handle) {
if (inited) if (inited)
return NULL; return NULL;
inited = 1;
set_tarval_output_modes(); set_tarval_output_modes();
...@@ -1558,7 +1559,11 @@ static void *ia32_init(FILE *file_handle) { ...@@ -1558,7 +1559,11 @@ static void *ia32_init(FILE *file_handle) {
be_emit_cstring(&isa->emit, ".Ltext0:\n"); be_emit_cstring(&isa->emit, ".Ltext0:\n");
be_emit_write_line(&isa->emit); be_emit_write_line(&isa->emit);
inited = 1; /* we mark referenced global entities, so we can only emit those which
* are actually referenced. (Note: you mustn't use the type visited flag
* elsewhere in the backend)
*/
inc_master_type_visited();
return isa; return isa;
} }
......
...@@ -2104,9 +2104,6 @@ void ia32_gen_routine(ia32_code_gen_t *cg, ir_graph *irg) { ...@@ -2104,9 +2104,6 @@ void ia32_gen_routine(ia32_code_gen_t *cg, ir_graph *irg) {
env.arch_env = cg->arch_env; env.arch_env = cg->arch_env;
env.cg = cg; env.cg = cg;
/* we mark referenced global entities */
inc_master_type_visited();
ia32_register_emitters(); ia32_register_emitters();
ia32_emit_func_prolog(&env, irg); ia32_emit_func_prolog(&env, irg);
......
...@@ -1022,51 +1022,45 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn) { ...@@ -1022,51 +1022,45 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn) {
DBG((dbg, LEVEL_1, "\tLEA [%+F + %+F * %d + %d]\n", base, index, scale, get_ia32_am_offs_int(res))); DBG((dbg, LEVEL_1, "\tLEA [%+F + %+F * %d + %d]\n", base, index, scale, get_ia32_am_offs_int(res)));
assert(irn && "Couldn't find result proj");
/* get the result Proj of the Add/Sub */
try_add_to_sched(irn, res);
/* exchange the old op with the new LEA */
try_remove_from_sched(irn);
exchange(irn, res);
/* we will exchange it, report here before the Proj is created */ /* we will exchange it, report here before the Proj is created */
if (shift && lea && lea_o) { if (shift && lea && lea_o) {
try_remove_from_sched(shift); try_remove_from_sched(shift);
try_remove_from_sched(lea); try_remove_from_sched(lea);
try_remove_from_sched(lea_o); try_remove_from_sched(lea_o);
DBG_OPT_LEA4(irn, lea_o, lea, shift, res); DBG_OPT_LEA4(irn, lea_o, lea, shift, res);
} } else if (shift && lea) {
else if (shift && lea) {
try_remove_from_sched(shift); try_remove_from_sched(shift);
try_remove_from_sched(lea); try_remove_from_sched(lea);
DBG_OPT_LEA3(irn, lea, shift, res); DBG_OPT_LEA3(irn, lea, shift, res);
} } else if (shift && lea_o) {
else if (shift && lea_o) {
try_remove_from_sched(shift); try_remove_from_sched(shift);
try_remove_from_sched(lea_o); try_remove_from_sched(lea_o);
DBG_OPT_LEA3(irn, lea_o, shift, res); DBG_OPT_LEA3(irn, lea_o, shift, res);
} } else if (lea && lea_o) {
else if (lea && lea_o) {
try_remove_from_sched(lea); try_remove_from_sched(lea);
try_remove_from_sched(lea_o); try_remove_from_sched(lea_o);
DBG_OPT_LEA3(irn, lea_o, lea, res); DBG_OPT_LEA3(irn, lea_o, lea, res);
} } else if (shift) {
else if (shift) {
try_remove_from_sched(shift); try_remove_from_sched(shift);
DBG_OPT_LEA2(irn, shift, res); DBG_OPT_LEA2(irn, shift, res);
} } else if (lea) {
else if (lea) {
try_remove_from_sched(lea); try_remove_from_sched(lea);
DBG_OPT_LEA2(irn, lea, res); DBG_OPT_LEA2(irn, lea, res);
} } else if (lea_o) {
else if (lea_o) {
try_remove_from_sched(lea_o); try_remove_from_sched(lea_o);
DBG_OPT_LEA2(irn, lea_o, res); DBG_OPT_LEA2(irn, lea_o, res);
} } else {
else
DBG_OPT_LEA1(irn, res); DBG_OPT_LEA1(irn, res);
}
/* get the result Proj of the Add/Sub */
try_add_to_sched(irn, res);
try_remove_from_sched(irn);
assert(irn && "Couldn't find result proj");
/* exchange the old op with the new LEA */
exchange(irn, res);
} }
return res; return res;
......
Supports Markdown
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