diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-01-13 14:26:47 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-01-13 14:26:47 +0100 |
commit | 9e73c69087510db9321f4f6d91280519a643ff55 (patch) | |
tree | fae80dc8dbd8c47b814e5717a77e62989818b18a /gcc/var-tracking.c | |
parent | dc2f28c58b10c17fbc717178a9c99a77ba4ecf56 (diff) | |
download | gcc-9e73c69087510db9321f4f6d91280519a643ff55.tar.gz |
re PR debug/41371 (var-tracking is slow and memory hungry)
PR debug/41371
* var-tracking.c (values_to_unmark): New variable.
(find_loc_in_1pdv): Clear VALUE_RECURSED_INTO of values in
values_to_unmark vector. Moved body to...
(find_loc_in_1pdv_1): ... this. Don't clear VALUE_RECURSED_INTO,
instead queue it into values_to_unmark vector.
(vt_find_locations): Free values_to_unmark vector.
From-SVN: r155858
Diffstat (limited to 'gcc/var-tracking.c')
-rw-r--r-- | gcc/var-tracking.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index db7778b8e74..0822fecab34 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -1,5 +1,5 @@ /* Variable tracking routines for the GNU compiler. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -2252,12 +2252,18 @@ dv_changed_p (decl_or_value dv) : DECL_CHANGED (dv_as_decl (dv))); } -/* Return a location list node whose loc is rtx_equal to LOC, in the +/* Vector of VALUEs that should have VALUE_RECURSED_INTO bit cleared + at the end of find_loc_in_1pdv. Not a static variable in find_loc_in_1pdv + to avoid constant allocation/freeing of it. */ +static VEC(rtx, heap) *values_to_unmark; + +/* Helper function for find_loc_in_1pdv. + Return a location list node whose loc is rtx_equal to LOC, in the location list of a one-part variable or value VAR, or in that of any values recursively mentioned in the location lists. */ static location_chain -find_loc_in_1pdv (rtx loc, variable var, htab_t vars) +find_loc_in_1pdv_1 (rtx loc, variable var, htab_t vars) { location_chain node; @@ -2285,18 +2291,33 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars) { location_chain where; VALUE_RECURSED_INTO (node->loc) = true; - if ((where = find_loc_in_1pdv (loc, var, vars))) - { - VALUE_RECURSED_INTO (node->loc) = false; - return where; - } - VALUE_RECURSED_INTO (node->loc) = false; + VEC_safe_push (rtx, heap, values_to_unmark, node->loc); + if ((where = find_loc_in_1pdv_1 (loc, var, vars))) + return where; } } return NULL; } +/* Return a location list node whose loc is rtx_equal to LOC, in the + location list of a one-part variable or value VAR, or in that of + any values recursively mentioned in the location lists. */ + +static location_chain +find_loc_in_1pdv (rtx loc, variable var, htab_t vars) +{ + location_chain ret; + unsigned int i; + rtx value; + + ret = find_loc_in_1pdv_1 (loc, var, vars); + for (i = 0; VEC_iterate (rtx, values_to_unmark, i, value); i++) + VALUE_RECURSED_INTO (value) = false; + VEC_truncate (rtx, values_to_unmark, 0); + return ret; +} + /* Hash table iteration argument passed to variable_merge. */ struct dfset_merge { @@ -5648,6 +5669,7 @@ vt_find_locations (void) FOR_EACH_BB (bb) gcc_assert (VTI (bb)->flooded); + VEC_free (rtx, heap, values_to_unmark); free (bb_order); fibheap_delete (worklist); fibheap_delete (pending); |