aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgbuild.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-25 20:45:08 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-25 20:45:08 +0000
commit95c43227c5170be95578e3209419c06b41d17fb4 (patch)
tree9830f6f34a5652a0c7846c548b3436ea07f5bb78 /gcc/cfgbuild.c
parent6bb9bf637ae44ae9d07012fac08e35a446d11ea4 (diff)
downloadgcc-95c43227c5170be95578e3209419c06b41d17fb4.zip
gcc-95c43227c5170be95578e3209419c06b41d17fb4.tar.gz
gcc-95c43227c5170be95578e3209419c06b41d17fb4.tar.bz2
Add rtx_jump_table_data::get_labels method
gcc/ * rtl.h (rtx_jump_table_data::get_labels): New method. * cfgbuild.c (make_edges): Replace hand-coded lookup of labels with use of the new rtx_jump_table_data::get_labels method. (purge_dead_tablejump_edges): Strengthen param "table" from rtx to rtx_jump_table_data *. Simplify by using get_labels method. * cfgrtl.c (delete_insn): Replace use of JUMP_TABLE_DATA_P with a dyn_cast, introducing local "table", using it to replace label-lookup logic with a get_labels method call. (patch_jump_insn): Simplify using get_labels method. * dwarf2cfi.c (create_trace_edges): Likewise. * rtlanal.c (label_is_jump_target_p): Likewise. From-SVN: r214476
Diffstat (limited to 'gcc/cfgbuild.c')
-rw-r--r--gcc/cfgbuild.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 8bbf325..3cd782c 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -263,14 +263,9 @@ make_edges (basic_block min, basic_block max, int update_p)
/* Recognize a tablejump and do the right thing. */
else if (tablejump_p (insn, NULL, &table))
{
- rtvec vec;
+ rtvec vec = table->get_labels ();
int j;
- if (GET_CODE (PATTERN (table)) == ADDR_VEC)
- vec = XVEC (PATTERN (table), 0);
- else
- vec = XVEC (PATTERN (table), 1);
-
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
make_label_edge (edge_cache, bb,
XEXP (RTVEC_ELT (vec, j), 0), 0);
@@ -398,7 +393,7 @@ mark_tablejump_edge (rtx label)
}
static void
-purge_dead_tablejump_edges (basic_block bb, rtx table)
+purge_dead_tablejump_edges (basic_block bb, rtx_jump_table_data *table)
{
rtx_insn *insn = BB_END (bb);
rtx tmp;
@@ -407,10 +402,7 @@ purge_dead_tablejump_edges (basic_block bb, rtx table)
edge_iterator ei;
edge e;
- if (GET_CODE (PATTERN (table)) == ADDR_VEC)
- vec = XVEC (PATTERN (table), 0);
- else
- vec = XVEC (PATTERN (table), 1);
+ vec = table->get_labels ();
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
mark_tablejump_edge (XEXP (RTVEC_ELT (vec, j), 0));