diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2014-08-28 06:24:23 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2014-08-28 06:24:23 +0000 |
commit | e08cf836163a847ddfa4ffb8514a16be6d747dff (patch) | |
tree | 7441d5b00c8fa3ed69eb9de67d3b23585faddea1 | |
parent | b37c2fe0fe71ba09d7eac796c4b1c03d5261d932 (diff) | |
download | gcc-e08cf836163a847ddfa4ffb8514a16be6d747dff.zip gcc-e08cf836163a847ddfa4ffb8514a16be6d747dff.tar.gz gcc-e08cf836163a847ddfa4ffb8514a16be6d747dff.tar.bz2 |
rtl.h (get_pool_constant, [...]): Replace rtx parameters with const_rtx parameters.
gcc/
* rtl.h (get_pool_constant, rtx_referenced_p): Replace rtx parameters
with const_rtx parameters.
* varasm.c (get_pool_constant): Likewise.
* rtlanal.c (rtx_referenced_p_1): Delete.
(rtx_referenced_p): Use FOR_EACH_SUBRTX instead of for_each_rtx.
Assert that the rtx we're looking for is nonnull. Allow searches
for constant pool SYMBOL_REFs.
From-SVN: r214654
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/rtl.h | 4 | ||||
-rw-r--r-- | gcc/rtlanal.c | 46 | ||||
-rw-r--r-- | gcc/varasm.c | 2 |
4 files changed, 31 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c19637..9481150 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> + * rtl.h (get_pool_constant, rtx_referenced_p): Replace rtx parameters + with const_rtx parameters. + * varasm.c (get_pool_constant): Likewise. + * rtlanal.c (rtx_referenced_p_1): Delete. + (rtx_referenced_p): Use FOR_EACH_SUBRTX instead of for_each_rtx. + Assert that the rtx we're looking for is nonnull. Allow searches + for constant pool SYMBOL_REFs. + +2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> + * reload1.c: Include rtl-iter.h. (note_reg_elim_costly): Turn from being a for_each_rtx callback to being a function that examines each subrtx itself. @@ -2557,7 +2557,7 @@ extern rtx force_const_mem (enum machine_mode, rtx); /* In varasm.c */ struct function; -extern rtx get_pool_constant (rtx); +extern rtx get_pool_constant (const_rtx); extern rtx get_pool_constant_mark (rtx, bool *); extern enum machine_mode get_pool_mode (const_rtx); extern rtx simplify_subtraction (rtx); @@ -2800,7 +2800,7 @@ extern void copy_reg_eh_region_note_backward (rtx, rtx, rtx); extern int inequality_comparisons_p (const_rtx); extern rtx replace_rtx (rtx, rtx, rtx); extern int replace_label (rtx *, void *); -extern int rtx_referenced_p (rtx, rtx); +extern bool rtx_referenced_p (const_rtx, const_rtx); extern bool tablejump_p (const_rtx, rtx *, rtx_jump_table_data **); extern int computed_jump_p (const_rtx); extern bool tls_referenced_p (rtx); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index e6e13a6..0e80426 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see static void set_of_1 (rtx, const_rtx, void *); static bool covers_regno_p (const_rtx, unsigned int); static bool covers_regno_no_parallel_p (const_rtx, unsigned int); -static int rtx_referenced_p_1 (rtx *, void *); static int computed_jump_p_1 (const_rtx); static void parms_set (rtx, const_rtx, void *); @@ -2832,37 +2831,28 @@ replace_label (rtx *x, void *data) return 0; } -/* When *BODY is equal to X or X is directly referenced by *BODY - return nonzero, thus FOR_EACH_RTX stops traversing and returns nonzero - too, otherwise FOR_EACH_RTX continues traversing *BODY. */ +/* Return true if X is referenced in BODY. */ -static int -rtx_referenced_p_1 (rtx *body, void *x) +bool +rtx_referenced_p (const_rtx x, const_rtx body) { - rtx y = (rtx) x; - - if (*body == NULL_RTX) - return y == NULL_RTX; - - /* Return true if a label_ref *BODY refers to label Y. */ - if (GET_CODE (*body) == LABEL_REF && LABEL_P (y)) - return XEXP (*body, 0) == y; - - /* If *BODY is a reference to pool constant traverse the constant. */ - if (GET_CODE (*body) == SYMBOL_REF - && CONSTANT_POOL_ADDRESS_P (*body)) - return rtx_referenced_p (y, get_pool_constant (*body)); - - /* By default, compare the RTL expressions. */ - return rtx_equal_p (*body, y); -} + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, body, ALL) + if (const_rtx y = *iter) + { + /* Check if a label_ref Y refers to label X. */ + if (GET_CODE (y) == LABEL_REF && LABEL_P (y) && XEXP (y, 0) == x) + return true; -/* Return true if X is referenced in BODY. */ + if (rtx_equal_p (x, y)) + return true; -int -rtx_referenced_p (rtx x, rtx body) -{ - return for_each_rtx (&body, rtx_referenced_p_1, x); + /* If Y is a reference to pool constant traverse the constant. */ + if (GET_CODE (y) == SYMBOL_REF + && CONSTANT_POOL_ADDRESS_P (y)) + iter.substitute (get_pool_constant (y)); + } + return false; } /* If INSN is a tablejump return true and store the label (before jump table) to diff --git a/gcc/varasm.c b/gcc/varasm.c index f2d5a26..c820f75 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3724,7 +3724,7 @@ force_const_mem (enum machine_mode mode, rtx x) /* Given a constant pool SYMBOL_REF, return the corresponding constant. */ rtx -get_pool_constant (rtx addr) +get_pool_constant (const_rtx addr) { return SYMBOL_REF_CONSTANT (addr)->constant; } |