diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2009-09-11 07:44:06 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2009-09-11 07:44:06 +0000 |
commit | 0b7e34d7dd48aac05ea218b61c84e3a8561fbd77 (patch) | |
tree | 7c4b3b077cdf1c1d929802c227b67ec378a3d383 /gcc/var-tracking.c | |
parent | 878f62e5bdb9b1adb8f234c36af5c39292c23713 (diff) | |
download | gcc-0b7e34d7dd48aac05ea218b61c84e3a8561fbd77.zip gcc-0b7e34d7dd48aac05ea218b61c84e3a8561fbd77.tar.gz gcc-0b7e34d7dd48aac05ea218b61c84e3a8561fbd77.tar.bz2 |
re PR debug/41276 (Segmentation fault in lookup_page_table_entry)
PR debug/41276
PR debug/41307
* cselib.c (cselib_expand_value_rtx_cb): Document callback
interface.
(cselib_expand_value_rtx_1): Use callback for SUBREGs. Adjust
for VALUEs, to implement the documented interface.
* var-tracking.c (vt_expand_loc_callback): Handle SUBREGs.
Adjust for VALUEs and anything else, to implement the
documented interface.
From-SVN: r151628
Diffstat (limited to 'gcc/var-tracking.c')
-rw-r--r-- | gcc/var-tracking.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 475ba57..0e665b9 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -6243,7 +6243,8 @@ check_wrap_constant (enum machine_mode mode, rtx result) } /* Callback for cselib_expand_value, that looks for expressions - holding the value in the var-tracking hash tables. */ + holding the value in the var-tracking hash tables. Return X for + standard processing, anything else is to be used as-is. */ static rtx vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) @@ -6254,19 +6255,46 @@ vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) location_chain loc; rtx result; - gcc_assert (GET_CODE (x) == VALUE); + if (GET_CODE (x) == SUBREG) + { + rtx subreg = SUBREG_REG (x); + + if (GET_CODE (SUBREG_REG (x)) != VALUE) + return x; + + subreg = cselib_expand_value_rtx_cb (SUBREG_REG (x), regs, + max_depth - 1, + vt_expand_loc_callback, data); + + if (!subreg) + return NULL; + + result = simplify_gen_subreg (GET_MODE (x), subreg, + GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x)); + + /* Invalid SUBREGs are ok in debug info. ??? We could try + alternate expansions for the VALUE as well. */ + if (!result && (REG_P (subreg) || MEM_P (subreg))) + result = gen_rtx_raw_SUBREG (GET_MODE (x), subreg, SUBREG_BYTE (x)); + + return result; + } + + if (GET_CODE (x) != VALUE) + return x; if (VALUE_RECURSED_INTO (x)) - return NULL; + return x; dv = dv_from_value (x); var = (variable) htab_find_with_hash (vars, dv, dv_htab_hash (dv)); if (!var) - return NULL; + return x; if (var->n_var_parts == 0) - return NULL; + return x; gcc_assert (var->n_var_parts == 1); @@ -6283,7 +6311,10 @@ vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) } VALUE_RECURSED_INTO (x) = false; - return result; + if (result) + return result; + else + return x; } /* Expand VALUEs in LOC, using VARS as well as cselib's equivalence |