summaryrefslogtreecommitdiffhomepage
path: root/ir/be/begnuas.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-11-28 10:24:18 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2016-11-28 10:43:27 +0100
commit3c638b452cb30940cb53dc140fb0ac813b9dd502 (patch)
treeec9bdc8bd30acb87309d158b76243285429e28c8 /ir/be/begnuas.c
parent36e39904b65e1c5f726333f65350afb8758c4ade (diff)
be: Factor out common code to handle switch tables.
Diffstat (limited to 'ir/be/begnuas.c')
-rw-r--r--ir/be/begnuas.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c
index b7c8cbf..75fa57f 100644
--- a/ir/be/begnuas.c
+++ b/ir/be/begnuas.c
@@ -1528,9 +1528,7 @@ static void emit_global_decls(be_main_env_t const *const main_env)
}
}
-void be_emit_jump_table(const ir_node *node, const ir_switch_table *table,
- ir_entity const *const entity, ir_mode *entry_mode,
- emit_target_func emit_target)
+void be_emit_jump_table(ir_node const *const node, be_switch_attr_t const *const swtch, ir_mode *const entry_mode, emit_target_func const emit_target)
{
/* go over all proj's and collect their jump targets */
unsigned n_outs = arch_get_irn_n_outs(node);
@@ -1541,6 +1539,8 @@ void be_emit_jump_table(const ir_node *node, const ir_switch_table *table,
targets[pn] = proj;
}
+ ir_switch_table const *const table = swtch->table;
+
/* go over table to determine max value (note that we normalized the
* ranges so that the minimum is 0) */
size_t n_entries = ir_switch_table_get_n_entries(table);
@@ -1589,7 +1589,8 @@ void be_emit_jump_table(const ir_node *node, const ir_switch_table *table,
}
/* emit table */
- unsigned const pointer_size = get_mode_size_bytes(entry_mode);
+ unsigned const pointer_size = get_mode_size_bytes(entry_mode);
+ ir_entity const *const entity = swtch->table_entity;
if (entity) {
if (!is_macho())
be_gas_emit_switch_section(GAS_SECTION_RODATA);