summaryrefslogtreecommitdiffhomepage
path: root/ir/be/begnuas.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-09-07 04:48:41 +0200
committerMatthias Braun <matze@braunis.de>2015-09-07 05:53:55 +0200
commitbb1e3f1e863778b4c87a8278becd4135c084d4ad (patch)
treea46ce11c1336fd2ca60565985a7aadabe66f599e /ir/be/begnuas.c
parentaba0611e4da95653d446873e33f1f80599a7e356 (diff)
begnuas/i32: properly emit jump tables in PIC mode
Diffstat (limited to 'ir/be/begnuas.c')
-rw-r--r--ir/be/begnuas.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c
index 9539e21..8223a78 100644
--- a/ir/be/begnuas.c
+++ b/ir/be/begnuas.c
@@ -1504,17 +1504,16 @@ static void emit_global_decls(const be_main_env_t *main_env)
}
void be_emit_jump_table(const ir_node *node, const ir_switch_table *table,
- ir_entity *entity, get_cfop_target_func get_cfop_target)
+ ir_entity const *const entity,
+ emit_target_func emit_target)
{
/* go over all proj's and collect their jump targets */
unsigned n_outs = arch_get_irn_n_outs(node);
const ir_node **targets = XMALLOCNZ(const ir_node*, n_outs);
foreach_out_edge(node, edge) {
- ir_node *proj = get_edge_src_irn(edge);
- unsigned pn = get_Proj_num(proj);
- ir_node *target = get_cfop_target(proj);
- assert(targets[pn] == NULL);
- targets[pn] = target;
+ ir_node *proj = get_edge_src_irn(edge);
+ unsigned pn = get_Proj_num(proj);
+ targets[pn] = proj;
}
/* go over table to determine max value (note that we normalized the
@@ -1580,11 +1579,11 @@ void be_emit_jump_table(const ir_node *node, const ir_switch_table *table,
}
for (unsigned long i = 0; i < length; ++i) {
- const ir_node *block = labels[i];
- if (block == NULL)
- block = targets[0];
+ const ir_node *target = labels[i];
+ if (target == NULL)
+ target = targets[0];
emit_size_type(pointer_size);
- be_gas_emit_block_name(block);
+ emit_target(entity, target);
be_emit_char('\n');
be_emit_write_line();
}