diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-08-25 20:45:08 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-08-25 20:45:08 +0000 |
commit | 95c43227c5170be95578e3209419c06b41d17fb4 (patch) | |
tree | 9830f6f34a5652a0c7846c548b3436ea07f5bb78 /gcc/rtl.h | |
parent | 6bb9bf637ae44ae9d07012fac08e35a446d11ea4 (diff) | |
download | gcc-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/rtl.h')
-rw-r--r-- | gcc/rtl.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -479,6 +479,21 @@ class GTY(()) rtx_jump_table_data : public rtx_insn This is an instance of: DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN) from rtl.def. */ + +public: + + /* This can be either: + + (a) a table of absolute jumps, in which case PATTERN (this) is an + ADDR_VEC with arg 0 a vector of labels, or + + (b) a table of relative jumps (e.g. for -fPIC), in which case + PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and + arg 1 the vector of labels. + + This method gets the underlying vec. */ + + inline rtvec get_labels () const; }; class GTY(()) rtx_barrier : public rtx_insn @@ -1207,6 +1222,15 @@ inline rtx& SET_NEXT_INSN (rtx insn) -1 means this instruction has not been recognized yet. */ #define INSN_CODE(INSN) XINT (INSN, 5) +inline rtvec rtx_jump_table_data::get_labels () const +{ + rtx pat = PATTERN (this); + if (GET_CODE (pat) == ADDR_VEC) + return XVEC (pat, 0); + else + return XVEC (pat, 1); /* presumably an ADDR_DIFF_VEC */ +} + #define RTX_FRAME_RELATED_P(RTX) \ (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \ CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related) |