Merge lp:~rsandifo/gcc-linaro/lp-714921-4.5 into lp:gcc-linaro/4.5

Proposed by Richard Sandiford
Status: Merged
Merged at revision: 99491
Proposed branch: lp:~rsandifo/gcc-linaro/lp-714921-4.5
Merge into: lp:gcc-linaro/4.5
Diff against target: 322 lines (+156/-19) (has conflicts)
2 files modified
ChangeLog.linaro (+29/-0)
gcc/dwarf2out.c (+127/-19)
Text conflict in ChangeLog.linaro
To merge this branch: bzr merge lp:~rsandifo/gcc-linaro/lp-714921-4.5
Reviewer Review Type Date Requested Status
Andrew Stubbs (community) Approve
Review via email: mp+56525@code.launchpad.net

Description of the change

Patch was committed upstream. This backport includes two small changes
from one of Jakub's earlier patches (see ChangeLog).

This may still go into upstream 4.5, but it isn't certain yet.

To post a comment you must log in.
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild has taken a snapshot of this branch at r99490 and queued it for build.

The snapshot is available at:
 http://ex.seabright.co.nz/snapshots/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5.tar.xdelta3.xz

and will be built on the following builders:
 a8-builder a9-builder i686 x86_64

You can track the build queue at:
 http://ex.seabright.co.nz/helpers/scheduler

cbuild-snapshot: gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5
cbuild-ancestor: lp:gcc-linaro+bzr99489
cbuild-state: check

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on i686-lucid-cbuild102-scorpius-i686r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5/logs/i686-lucid-cbuild102-scorpius-i686r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro+bzr99489.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5/logs/i686-lucid-cbuild102-scorpius-i686r1/gcc-testsuite.txt

cbuild-checked: i686-lucid-cbuild102-scorpius-i686r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on x86_64-maverick-cbuild102-crucis-x86_64r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5/logs/x86_64-maverick-cbuild102-crucis-x86_64r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro+bzr99489.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5/logs/x86_64-maverick-cbuild102-crucis-x86_64r1/gcc-testsuite.txt

cbuild-checked: x86_64-maverick-cbuild102-crucis-x86_64r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :
Download full text (161.8 KiB)

cbuild successfully built this on armv7l-maverick-cbuild102-ursa2-cortexa8r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99490~rsandifo~lp-714921-4.5/logs/armv7l-maverick-cbuild102-ursa2-cortexa8r1

The test suite results changed compared to the branch point lp:gcc-linaro+bzr99489:
 -PASS: gcc.c-torture/compile/limits-fndefn.c -O3 -g (test for excess errors)
 +FAIL: gcc.c-torture/compile/limits-fndefn.c -O3 -g (test for excess errors)
 -PASS: largefile.c -O0 -I. (test for excess errors)
 +FAIL: largefile.c -O0 -I. (test for excess errors)
 +WARNING: program timed out.
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors)
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-loops execution test
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-loops (test for excess errors)
 +UNRESOLVED: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions compilation failed to produce executable
 +FAIL: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors)
 +UNRESOLVED: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-loops compilation failed to produce executable
 +FAIL: gfortran.dg/used_dummy_types_1.f90 -O3 -fomit-frame-pointer -funroll-loops (test for excess errors)
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -g execution test
 -PASS: gfortran.dg/used_dummy_types_1.f90 -O3 -g (test for excess errors)
 -PASS: gfortran.dg/used_dummy_types_1.f90 -Os execution test
 -PASS: gfortran.dg/used_dummy_types_1.f90 -Os (test for excess errors)
 +UNRESOLVED: gfortran.dg/used_dummy_types_1.f90 -O3 -g compilation failed to produce executable
 +FAIL: gfortran.dg/used_dummy_types_1.f90 -O3 -g (test for excess errors)
 +UNRESOLVED: gfortran.dg/used_dummy_types_1.f90 -Os compilation failed to produce executable
 +FAIL: gfortran.dg/used_dummy_types_1.f90 -Os (test for excess errors)
 -PASS: gfortran.dg/used_interface_ref.f90 -O0 execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O0 (test for excess errors)
 -PASS: gfortran.dg/used_interface_ref.f90 -O1 execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O1 (test for excess errors)
 -PASS: gfortran.dg/used_interface_ref.f90 -O2 execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O2 (test for excess errors)
 -PASS: gfortran.dg/used_interface_ref.f90 -O3 -fomit-frame-pointer execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors)
 -PASS: gfortran.dg/used_interface_ref.f90 -O3 -fomit-frame-pointer -funroll-loops execution test
 -PASS: gfortran.dg/used_interface_ref.f90 -O3 -fomit-frame-pointer -funroll-loops (test...

Revision history for this message
Michael Hope (michaelh1) wrote :

Please ignore the gfortran failues above. I changed the build environment while the test was running.

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

The A9 results have yet to come in, but this change seems core independent, so I very much doubt they'll find any trouble.

Please indicate in the ChangeLog that this is a backport.

OK with that change. Go ahead and merge to lp:gcc-linaro.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog.linaro'
2--- ChangeLog.linaro 2011-04-06 12:29:08 +0000
3+++ ChangeLog.linaro 2011-04-08 10:52:54 +0000
4@@ -1,7 +1,36 @@
5+<<<<<<< TREE
6 2011-04-06 Andrew Stubbs <ams@codesourcery.com>
7
8 Merge from FSF 4.5 branch r172013 (pre 4.5.3).
9
10+=======
11+2011-03-28 Richard Sandiford <richard.sandiford@linaro.org>
12+
13+ Backport from mainline:
14+ gcc/
15+ * dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced.
16+ (cached_dw_loc_list_def): New structure.
17+ (cached_dw_loc_list): New typedef.
18+ (cached_dw_loc_list_table): New variable.
19+ (cached_dw_loc_list_table_hash): New function.
20+ (cached_dw_loc_list_table_eq): Likewise.
21+ (add_location_or_const_value_attribute): Take a bool cache_p.
22+ Cache the list when the parameter is true.
23+ (gen_formal_parameter_die): Update caller.
24+ (gen_variable_die): Likewise.
25+ (dwarf2out_finish): Likewise.
26+ (dwarf2out_abstract_function): Nullify cached_dw_loc_list_table
27+ while generating debug info for the decl.
28+ (dwarf2out_function_decl): Clear cached_dw_loc_list_table.
29+ (dwarf2out_init): Initialize cached_dw_loc_list_table.
30+ (resolve_addr): Cache the result of resolving a chain of
31+ location lists.
32+
33+ From: 2010-10-12 Jakub Jelinek <jakub@redhat.com>
34+ * dwarf2out.c (dw_loc_list_node): Add emitted field.
35+ (output_loc_list): Return immediately if emitted is set, set it.
36+
37+>>>>>>> MERGE-SOURCE
38 2011-03-10 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
39
40 LP:730440
41
42=== modified file 'gcc/dwarf2out.c'
43--- gcc/dwarf2out.c 2011-03-10 14:55:10 +0000
44+++ gcc/dwarf2out.c 2011-04-08 10:52:54 +0000
45@@ -4256,6 +4256,12 @@
46 Only on head of list */
47 const char *section; /* Section this loclist is relative to */
48 dw_loc_descr_ref expr;
49+ /* True if all addresses in this and subsequent lists are known to be
50+ resolved. */
51+ bool resolved_addr;
52+ /* True if this list has been replaced by dw_loc_next. */
53+ bool replaced;
54+ bool emitted;
55 } dw_loc_list_node;
56
57 #if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
58@@ -5759,6 +5765,19 @@
59 /* Table of decl location linked lists. */
60 static GTY ((param_is (var_loc_list))) htab_t decl_loc_table;
61
62+/* A cached location list. */
63+struct GTY (()) cached_dw_loc_list_def {
64+ /* The DECL_UID of the decl that this entry describes. */
65+ unsigned int decl_id;
66+
67+ /* The cached location list. */
68+ dw_loc_list_ref loc_list;
69+};
70+typedef struct cached_dw_loc_list_def cached_dw_loc_list;
71+
72+/* Table of cached location lists. */
73+static GTY ((param_is (cached_dw_loc_list))) htab_t cached_dw_loc_list_table;
74+
75 /* A pointer to the base of a list of references to DIE's that
76 are uniquely identified by their tag, presence/absence of
77 children DIE's, and list of attribute/value pairs. */
78@@ -6112,7 +6131,7 @@
79 static void insert_int (HOST_WIDE_INT, unsigned, unsigned char *);
80 static void insert_float (const_rtx, unsigned char *);
81 static rtx rtl_for_decl_location (tree);
82-static bool add_location_or_const_value_attribute (dw_die_ref, tree,
83+static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool,
84 enum dwarf_attribute);
85 static bool tree_add_const_value_attribute (dw_die_ref, tree);
86 static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
87@@ -7731,6 +7750,24 @@
88 htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
89 }
90
91+/* Returns a hash value for X (which really is a cached_dw_loc_list_list). */
92+
93+static hashval_t
94+cached_dw_loc_list_table_hash (const void *x)
95+{
96+ return (hashval_t) ((const cached_dw_loc_list *) x)->decl_id;
97+}
98+
99+/* Return nonzero if decl_id of cached_dw_loc_list X is the same as
100+ UID of decl *Y. */
101+
102+static int
103+cached_dw_loc_list_table_eq (const void *x, const void *y)
104+{
105+ return (((const cached_dw_loc_list *) x)->decl_id
106+ == DECL_UID ((const_tree) y));
107+}
108+
109 /* Equate a DIE to a particular declaration. */
110
111 static void
112@@ -10355,6 +10392,10 @@
113 {
114 dw_loc_list_ref curr = list_head;
115
116+ if (list_head->emitted)
117+ return;
118+ list_head->emitted = true;
119+
120 ASM_OUTPUT_LABEL (asm_out_file, list_head->ll_symbol);
121
122 /* Walk the location list, and output each range + expression. */
123@@ -15920,15 +15961,22 @@
124 these things can crop up in other ways also.) Note that one type of
125 constant value which can be passed into an inlined function is a constant
126 pointer. This can happen for example if an actual argument in an inlined
127- function call evaluates to a compile-time constant address. */
128+ function call evaluates to a compile-time constant address.
129+
130+ CACHE_P is true if it is worth caching the location list for DECL,
131+ so that future calls can reuse it rather than regenerate it from scratch.
132+ This is true for BLOCK_NONLOCALIZED_VARS in inlined subroutines,
133+ since we will need to refer to them each time the function is inlined. */
134
135 static bool
136-add_location_or_const_value_attribute (dw_die_ref die, tree decl,
137+add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
138 enum dwarf_attribute attr)
139 {
140 rtx rtl;
141 dw_loc_list_ref list;
142 var_loc_list *loc_list;
143+ cached_dw_loc_list *cache;
144+ void **slot;
145
146 if (TREE_CODE (decl) == ERROR_MARK)
147 return false;
148@@ -15964,7 +16012,34 @@
149 && add_const_value_attribute (die, rtl))
150 return true;
151 }
152- list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2);
153+ /* If this decl is from BLOCK_NONLOCALIZED_VARS, we might need its
154+ list several times. See if we've already cached the contents. */
155+ list = NULL;
156+ if (loc_list == NULL || cached_dw_loc_list_table == NULL)
157+ cache_p = false;
158+ if (cache_p)
159+ {
160+ cache = (cached_dw_loc_list *)
161+ htab_find_with_hash (cached_dw_loc_list_table, decl, DECL_UID (decl));
162+ if (cache)
163+ list = cache->loc_list;
164+ }
165+ if (list == NULL)
166+ {
167+ list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2);
168+ /* It is usually worth caching this result if the decl is from
169+ BLOCK_NONLOCALIZED_VARS and if the list has at least two elements. */
170+ if (cache_p && list && list->dw_loc_next)
171+ {
172+ slot = htab_find_slot_with_hash (cached_dw_loc_list_table, decl,
173+ DECL_UID (decl), INSERT);
174+ cache = (cached_dw_loc_list *)
175+ ggc_alloc_cleared (sizeof (cached_dw_loc_list));
176+ cache->decl_id = DECL_UID (decl);
177+ cache->loc_list = list;
178+ *slot = cache;
179+ }
180+ }
181 if (list)
182 {
183 add_AT_location_description (die, attr, list);
184@@ -17532,7 +17607,7 @@
185 equate_decl_number_to_die (node, parm_die);
186 if (! DECL_ABSTRACT (node_or_origin))
187 add_location_or_const_value_attribute (parm_die, node_or_origin,
188- DW_AT_location);
189+ node == NULL, DW_AT_location);
190
191 break;
192
193@@ -17712,6 +17787,7 @@
194 tree context;
195 int was_abstract;
196 htab_t old_decl_loc_table;
197+ htab_t old_cached_dw_loc_list_table;
198
199 /* Make sure we have the actual abstract inline, not a clone. */
200 decl = DECL_ORIGIN (decl);
201@@ -17725,7 +17801,9 @@
202 DIE. Be sure to not clobber the outer location table nor use it or we would
203 get locations in abstract instantces. */
204 old_decl_loc_table = decl_loc_table;
205+ old_cached_dw_loc_list_table = cached_dw_loc_list_table;
206 decl_loc_table = NULL;
207+ cached_dw_loc_list_table = NULL;
208
209 /* Be sure we've emitted the in-class declaration DIE (if any) first, so
210 we don't get confused by DECL_ABSTRACT. */
211@@ -17750,6 +17828,7 @@
212
213 current_function_decl = save_fn;
214 decl_loc_table = old_decl_loc_table;
215+ cached_dw_loc_list_table = old_cached_dw_loc_list_table;
216 pop_cfun ();
217 }
218
219@@ -18431,9 +18510,8 @@
220 && !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl_or_origin)))
221 defer_location (decl_or_origin, var_die);
222 else
223- add_location_or_const_value_attribute (var_die,
224- decl_or_origin,
225- DW_AT_location);
226+ add_location_or_const_value_attribute (var_die, decl_or_origin,
227+ decl == NULL, DW_AT_location);
228 add_pubname (decl_or_origin, var_die);
229 }
230 else
231@@ -20049,6 +20127,7 @@
232 dwarf2out_decl (decl);
233
234 htab_empty (decl_loc_table);
235+ htab_empty (cached_dw_loc_list_table);
236 }
237
238 /* Output a marker (i.e. a label) for the beginning of the generated code for
239@@ -20649,6 +20728,11 @@
240 decl_loc_table = htab_create_ggc (10, decl_loc_table_hash,
241 decl_loc_table_eq, NULL);
242
243+ /* Allocate the cached_dw_loc_list_table. */
244+ cached_dw_loc_list_table
245+ = htab_create_ggc (10, cached_dw_loc_list_table_hash,
246+ cached_dw_loc_list_table_eq, NULL);
247+
248 /* Allocate the initial hunk of the decl_scope_table. */
249 decl_scope_table = VEC_alloc (tree, gc, 256);
250
251@@ -21278,30 +21362,53 @@
252 {
253 dw_die_ref c;
254 dw_attr_ref a;
255- dw_loc_list_ref *curr;
256+ dw_loc_list_ref *curr, *start, loc;
257 unsigned ix;
258
259 for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
260 switch (AT_class (a))
261 {
262 case dw_val_class_loc_list:
263- curr = AT_loc_list_ptr (a);
264- while (*curr)
265+ start = curr = AT_loc_list_ptr (a);
266+ loc = *curr;
267+ gcc_assert (loc);
268+ /* The same list can be referenced more than once. See if we have
269+ already recorded the result from a previous pass. */
270+ if (loc->replaced)
271+ *curr = loc->dw_loc_next;
272+ else if (!loc->resolved_addr)
273 {
274- if (!resolve_addr_in_expr ((*curr)->expr))
275+ /* As things stand, we do not expect or allow one die to
276+ reference a suffix of another die's location list chain.
277+ References must be identical or completely separate.
278+ There is therefore no need to cache the result of this
279+ pass on any list other than the first; doing so
280+ would lead to unnecessary writes. */
281+ while (*curr)
282 {
283- dw_loc_list_ref next = (*curr)->dw_loc_next;
284- if (next && (*curr)->ll_symbol)
285+ gcc_assert (!(*curr)->replaced && !(*curr)->resolved_addr);
286+ if (!resolve_addr_in_expr ((*curr)->expr))
287 {
288- gcc_assert (!next->ll_symbol);
289- next->ll_symbol = (*curr)->ll_symbol;
290+ dw_loc_list_ref next = (*curr)->dw_loc_next;
291+ if (next && (*curr)->ll_symbol)
292+ {
293+ gcc_assert (!next->ll_symbol);
294+ next->ll_symbol = (*curr)->ll_symbol;
295+ }
296+ *curr = next;
297 }
298- *curr = next;
299+ else
300+ curr = &(*curr)->dw_loc_next;
301 }
302+ if (loc == *start)
303+ loc->resolved_addr = 1;
304 else
305- curr = &(*curr)->dw_loc_next;
306+ {
307+ loc->replaced = 1;
308+ loc->dw_loc_next = *start;
309+ }
310 }
311- if (!AT_loc_list (a))
312+ if (!*start)
313 {
314 remove_AT (die, a->dw_attr);
315 ix--;
316@@ -21361,6 +21468,7 @@
317 add_location_or_const_value_attribute (
318 VEC_index (deferred_locations, deferred_locations_list, i)->die,
319 VEC_index (deferred_locations, deferred_locations_list, i)->variable,
320+ false,
321 DW_AT_location);
322 }
323

Subscribers

People subscribed via source and target branches