Commit 35ed859b by Richard Guenther Committed by Richard Biener

tree-flow.h (struct fieldoff): Decompose field to type, size and decl.

2006-01-05  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (struct fieldoff): Decompose field to
	type, size and decl.
	* tree-ssa-alias.c (create_sft): Take type as parameter.
	(create_overlap_variables_for): Store type, size and decl
	in the fieldoff structure.
	* tree-ssa-structalias.c (fieldoff_compare): Adjust users
	of struct fieldoff.
	(push_fields_onto_fieldstack): Likewise.
	(create_variable_info_for): Likewise.  Use offset for the
	SFT name if the decl is not available.

From-SVN: r109376
parent 9220c30c
2006-01-05 Richard Guenther <rguenther@suse.de>
* tree-flow.h (struct fieldoff): Decompose field to
type, size and decl.
* tree-ssa-alias.c (create_sft): Take type as parameter.
(create_overlap_variables_for): Store type, size and decl
in the fieldoff structure.
* tree-ssa-structalias.c (fieldoff_compare): Adjust users
of struct fieldoff.
(push_fields_onto_fieldstack): Likewise.
(create_variable_info_for): Likewise. Use offset for the
SFT name if the decl is not available.
2006-01-04 Paul Brook <paul@codesourcery.com> 2006-01-04 Paul Brook <paul@codesourcery.com>
* config/m68k/m68k.c (m68k_output_mi_thunk): Use jmp, not jsr. * config/m68k/m68k.c (m68k_output_mi_thunk): Use jmp, not jsr.
......
...@@ -863,7 +863,9 @@ tree maybe_fold_tmr (tree); ...@@ -863,7 +863,9 @@ tree maybe_fold_tmr (tree);
struct fieldoff struct fieldoff
{ {
tree field; tree type;
tree size;
tree decl;
HOST_WIDE_INT offset; HOST_WIDE_INT offset;
}; };
typedef struct fieldoff fieldoff_s; typedef struct fieldoff fieldoff_s;
......
...@@ -2515,14 +2515,14 @@ get_or_create_used_part_for (size_t uid) ...@@ -2515,14 +2515,14 @@ get_or_create_used_part_for (size_t uid)
} }
/* Create and return a structure sub-variable for field FIELD of /* Create and return a structure sub-variable for field type FIELD of
variable VAR. */ variable VAR. */
static tree static tree
create_sft (tree var, tree field) create_sft (tree var, tree field)
{ {
var_ann_t ann; var_ann_t ann;
tree subvar = create_tag_raw (STRUCT_FIELD_TAG, TREE_TYPE (field), "SFT"); tree subvar = create_tag_raw (STRUCT_FIELD_TAG, field, "SFT");
/* We need to copy the various flags from VAR to SUBVAR, so that /* We need to copy the various flags from VAR to SUBVAR, so that
they are is_global_var iff the original variable was. */ they are is_global_var iff the original variable was. */
...@@ -2578,9 +2578,9 @@ create_overlap_variables_for (tree var) ...@@ -2578,9 +2578,9 @@ create_overlap_variables_for (tree var)
for (i = 0; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++) for (i = 0; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++)
{ {
if (!DECL_SIZE (fo->field) if (!fo->size
|| TREE_CODE (DECL_SIZE (fo->field)) != INTEGER_CST || TREE_CODE (fo->size) != INTEGER_CST
|| TREE_CODE (TREE_TYPE (fo->field)) == ARRAY_TYPE || TREE_CODE (fo->type) == ARRAY_TYPE
|| fo->offset < 0) || fo->offset < 0)
{ {
notokay = true; notokay = true;
...@@ -2632,8 +2632,8 @@ create_overlap_variables_for (tree var) ...@@ -2632,8 +2632,8 @@ create_overlap_variables_for (tree var)
HOST_WIDE_INT fosize; HOST_WIDE_INT fosize;
tree currfotype; tree currfotype;
fosize = TREE_INT_CST_LOW (DECL_SIZE (fo->field)); fosize = TREE_INT_CST_LOW (fo->size);
currfotype = TREE_TYPE (fo->field); currfotype = fo->type;
/* If this field isn't in the used portion, /* If this field isn't in the used portion,
or it has the exact same offset and size as the last or it has the exact same offset and size as the last
...@@ -2650,7 +2650,7 @@ create_overlap_variables_for (tree var) ...@@ -2650,7 +2650,7 @@ create_overlap_variables_for (tree var)
sv->offset = fo->offset; sv->offset = fo->offset;
sv->size = fosize; sv->size = fosize;
sv->next = *subvars; sv->next = *subvars;
sv->var = create_sft (var, fo->field); sv->var = create_sft (var, fo->type);
if (dump_file) if (dump_file)
{ {
......
...@@ -3540,8 +3540,8 @@ fieldoff_compare (const void *pa, const void *pb) ...@@ -3540,8 +3540,8 @@ fieldoff_compare (const void *pa, const void *pb)
if (foa->offset != fob->offset) if (foa->offset != fob->offset)
return foa->offset - fob->offset; return foa->offset - fob->offset;
foasize = TREE_INT_CST_LOW (DECL_SIZE (foa->field)); foasize = TREE_INT_CST_LOW (foa->size);
fobsize = TREE_INT_CST_LOW (DECL_SIZE (fob->field)); fobsize = TREE_INT_CST_LOW (fob->size);
return foasize - fobsize; return foasize - fobsize;
} }
...@@ -3597,7 +3597,9 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack, ...@@ -3597,7 +3597,9 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
fieldoff_s *pair; fieldoff_s *pair;
pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL); pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
pair->field = field; pair->type = TREE_TYPE (field);
pair->size = DECL_SIZE (field);
pair->decl = field;
pair->offset = offset + bitpos_of_field (field); pair->offset = offset + bitpos_of_field (field);
count++; count++;
} }
...@@ -3842,12 +3844,11 @@ create_variable_info_for (tree decl, const char *name) ...@@ -3842,12 +3844,11 @@ create_variable_info_for (tree decl, const char *name)
unsigned int newindex = VEC_length (varinfo_t, varmap); unsigned int newindex = VEC_length (varinfo_t, varmap);
fieldoff_s *fo = NULL; fieldoff_s *fo = NULL;
unsigned int i; unsigned int i;
tree field;
for (i = 0; !notokay && VEC_iterate (fieldoff_s, fieldstack, i, fo); i++) for (i = 0; !notokay && VEC_iterate (fieldoff_s, fieldstack, i, fo); i++)
{ {
if (!DECL_SIZE (fo->field) if (! fo->size
|| TREE_CODE (DECL_SIZE (fo->field)) != INTEGER_CST || TREE_CODE (fo->size) != INTEGER_CST
|| fo->offset < 0) || fo->offset < 0)
{ {
notokay = true; notokay = true;
...@@ -3882,8 +3883,7 @@ create_variable_info_for (tree decl, const char *name) ...@@ -3882,8 +3883,7 @@ create_variable_info_for (tree decl, const char *name)
return index; return index;
} }
field = fo->field; vi->size = TREE_INT_CST_LOW (fo->size);
vi->size = TREE_INT_CST_LOW (DECL_SIZE (field));
vi->offset = fo->offset; vi->offset = fo->offset;
for (i = 1; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++) for (i = 1; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++)
{ {
...@@ -3891,14 +3891,16 @@ create_variable_info_for (tree decl, const char *name) ...@@ -3891,14 +3891,16 @@ create_variable_info_for (tree decl, const char *name)
const char *newname; const char *newname;
char *tempname; char *tempname;
field = fo->field;
newindex = VEC_length (varinfo_t, varmap); newindex = VEC_length (varinfo_t, varmap);
asprintf (&tempname, "%s.%s", vi->name, alias_get_name (field)); if (fo->decl)
asprintf (&tempname, "%s.%s", vi->name, alias_get_name (fo->decl));
else
asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC, vi->name, fo->offset);
newname = ggc_strdup (tempname); newname = ggc_strdup (tempname);
free (tempname); free (tempname);
newvi = new_var_info (decl, newindex, newname, newindex); newvi = new_var_info (decl, newindex, newname, newindex);
newvi->offset = fo->offset; newvi->offset = fo->offset;
newvi->size = TREE_INT_CST_LOW (DECL_SIZE (field)); newvi->size = TREE_INT_CST_LOW (fo->size);
newvi->fullsize = vi->fullsize; newvi->fullsize = vi->fullsize;
insert_into_field_list (vi, newvi); insert_into_field_list (vi, newvi);
VEC_safe_push (varinfo_t, heap, varmap, newvi); VEC_safe_push (varinfo_t, heap, varmap, newvi);
......
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