Commit 3ad45f7f by Steven Bosscher

re PR pch/53880 (compile time regression when generating precompiled headers for boost)

	PR pch/53880
	* gengtype.c (struct walk_type_data): Add have_this_obj field.
	(walk_type): For functions that take a this_obj argument and
	that process fields with a GTY((length)) argument, write the
	test that write_types_local_process_field will write also at the
	head of the loop, effectively unswitching the loop.
	(write_func_for_structure, write_local_func_for_structure): Clear
	have_this_obj before calling walk_type.
	(write_local_func_for_structure): Set have_this_obj before walk_type.
	(write_array): Set have_this_obj for output of local pointer walking
	functions but not for marker functions.
	(write_types_local_process_field): Assert have_this_obj is set.

	* rtl.h (simplify_using_condition): Adjust prototype using bitmap
	from coretypes.h.

From-SVN: r189999
parent 0d13c974
2012-07-31 Steven Bosscher <steven@gcc.gnu.org>
PR pch/53880
* gengtype.c (struct walk_type_data): Add have_this_obj field.
(walk_type): For functions that take a this_obj argument and
that process fields with a GTY((length)) argument, write the
test that write_types_local_process_field will write also at the
head of the loop, effectively unswitching the loop.
(write_func_for_structure, write_local_func_for_structure): Clear
have_this_obj before calling walk_type.
(write_local_func_for_structure): Set have_this_obj before walk_type.
(write_array): Set have_this_obj for output of local pointer walking
functions but not for marker functions.
(write_types_local_process_field): Assert have_this_obj is set.
* rtl.h (simplify_using_condition): Adjust prototype using bitmap
from coretypes.h.
2012-07-30 Nathan Froyd <froydnj@gcc.gnu.org> 2012-07-30 Nathan Froyd <froydnj@gcc.gnu.org>
......
...@@ -2303,6 +2303,7 @@ struct walk_type_data ...@@ -2303,6 +2303,7 @@ struct walk_type_data
bool fn_wants_lvalue; bool fn_wants_lvalue;
bool in_record_p; bool in_record_p;
int loopcounter; int loopcounter;
bool have_this_obj;
}; };
/* Print a mangled name representing T to OF. */ /* Print a mangled name representing T to OF. */
...@@ -2618,6 +2619,9 @@ walk_type (type_p t, struct walk_type_data *d) ...@@ -2618,6 +2619,9 @@ walk_type (type_p t, struct walk_type_data *d)
output_escaped_param (d, length, "length"); output_escaped_param (d, length, "length");
else else
oprintf (d->of, "l%d", loopcounter); oprintf (d->of, "l%d", loopcounter);
if (d->have_this_obj)
/* Try to unswitch loops (see PR53880). */
oprintf (d->of, ") && ((void *)%s == this_obj", oldval);
oprintf (d->of, "); i%d++) {\n", loopcounter); oprintf (d->of, "); i%d++) {\n", loopcounter);
d->indent += 2; d->indent += 2;
d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter); d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter);
...@@ -3105,6 +3109,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param, ...@@ -3105,6 +3109,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param,
d.prev_val[1] = "not valid postage"; /* Guarantee an error. */ d.prev_val[1] = "not valid postage"; /* Guarantee an error. */
d.prev_val[3] = "x"; d.prev_val[3] = "x";
d.val = "(*x)"; d.val = "(*x)";
d.have_this_obj = false;
oprintf (d.of, "\n"); oprintf (d.of, "\n");
oprintf (d.of, "void\n"); oprintf (d.of, "void\n");
...@@ -3400,6 +3405,7 @@ static const struct write_types_data pch_wtd = { ...@@ -3400,6 +3405,7 @@ static const struct write_types_data pch_wtd = {
static void static void
write_types_local_process_field (type_p f, const struct walk_type_data *d) write_types_local_process_field (type_p f, const struct walk_type_data *d)
{ {
gcc_assert (d->have_this_obj);
switch (f->kind) switch (f->kind)
{ {
case TYPE_POINTER: case TYPE_POINTER:
...@@ -3458,6 +3464,7 @@ write_local_func_for_structure (const_type_p orig_s, type_p s, type_p *param) ...@@ -3458,6 +3464,7 @@ write_local_func_for_structure (const_type_p orig_s, type_p s, type_p *param)
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag, s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag); s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
d.indent = 2; d.indent = 2;
d.have_this_obj = true;
walk_type (s, &d); walk_type (s, &d);
oprintf (d.of, "}\n"); oprintf (d.of, "}\n");
} }
...@@ -3967,6 +3974,7 @@ write_array (outf_p f, pair_p v, const struct write_types_data *wtd) ...@@ -3967,6 +3974,7 @@ write_array (outf_p f, pair_p v, const struct write_types_data *wtd)
oprintf (d.of, "{\n"); oprintf (d.of, "{\n");
d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name; d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name;
d.process_field = write_types_local_process_field; d.process_field = write_types_local_process_field;
d.have_this_obj = true;
walk_type (v->type, &d); walk_type (v->type, &d);
oprintf (f, "}\n\n"); oprintf (f, "}\n\n");
} }
...@@ -3978,6 +3986,7 @@ write_array (outf_p f, pair_p v, const struct write_types_data *wtd) ...@@ -3978,6 +3986,7 @@ write_array (outf_p f, pair_p v, const struct write_types_data *wtd)
oprintf (f, "{\n"); oprintf (f, "{\n");
d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name; d.prev_val[0] = d.prev_val[1] = d.prev_val[2] = d.val = v->name;
d.process_field = write_types_process_field; d.process_field = write_types_process_field;
d.have_this_obj = false;
walk_type (v->type, &d); walk_type (v->type, &d);
free (prevval3); free (prevval3);
oprintf (f, "}\n\n"); oprintf (f, "}\n\n");
......
...@@ -2620,7 +2620,7 @@ extern rtx compare_and_jump_seq (rtx, rtx, enum rtx_code, rtx, int, rtx); ...@@ -2620,7 +2620,7 @@ extern rtx compare_and_jump_seq (rtx, rtx, enum rtx_code, rtx, int, rtx);
/* In loop-iv.c */ /* In loop-iv.c */
extern rtx canon_condition (rtx); extern rtx canon_condition (rtx);
extern void simplify_using_condition (rtx, rtx *, struct bitmap_head_def *); extern void simplify_using_condition (rtx, rtx *, bitmap);
/* In final.c */ /* In final.c */
extern unsigned int compute_alignments (void); extern unsigned int compute_alignments (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment