trans.h (struct gfc_ss_info): New field refcount.

* trans.h (struct gfc_ss_info): New field refcount.
	* trans-array.c (free_ss_info): Decrement refcount. Return early if
	still non-zero.
	(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss): Increment
	refcount.

From-SVN: r180883
This commit is contained in:
Mikael Morin 2011-11-03 22:50:06 +00:00
parent f28cd38e36
commit c7bf4f1e64
3 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans.h (struct gfc_ss_info): New field refcount.
* trans-array.c (free_ss_info): Decrement refcount. Return early if
still non-zero.
(gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss): Increment
refcount.
2011-11-03 Mikael Morin <mikael@gcc.gnu.org> 2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans-array.c (gfc_trans_create_temp_array): Move invariant condition * trans-array.c (gfc_trans_create_temp_array): Move invariant condition

View File

@ -489,6 +489,11 @@ gfc_free_ss_chain (gfc_ss * ss)
static void static void
free_ss_info (gfc_ss_info *ss_info) free_ss_info (gfc_ss_info *ss_info)
{ {
ss_info->refcount--;
if (ss_info->refcount > 0)
return;
gcc_assert (ss_info->refcount == 0);
free (ss_info); free (ss_info);
} }
@ -532,6 +537,7 @@ gfc_get_array_ss (gfc_ss *next, gfc_expr *expr, int dimen, gfc_ss_type type)
int i; int i;
ss_info = gfc_get_ss_info (); ss_info = gfc_get_ss_info ();
ss_info->refcount++;
ss_info->type = type; ss_info->type = type;
ss_info->expr = expr; ss_info->expr = expr;
@ -556,6 +562,7 @@ gfc_get_temp_ss (tree type, tree string_length, int dimen)
int i; int i;
ss_info = gfc_get_ss_info (); ss_info = gfc_get_ss_info ();
ss_info->refcount++;
ss_info->type = GFC_SS_TEMP; ss_info->type = GFC_SS_TEMP;
ss_info->string_length = string_length; ss_info->string_length = string_length;
ss_info->data.temp.type = type; ss_info->data.temp.type = type;
@ -580,6 +587,7 @@ gfc_get_scalar_ss (gfc_ss *next, gfc_expr *expr)
gfc_ss_info *ss_info; gfc_ss_info *ss_info;
ss_info = gfc_get_ss_info (); ss_info = gfc_get_ss_info ();
ss_info->refcount++;
ss_info->type = GFC_SS_SCALAR; ss_info->type = GFC_SS_SCALAR;
ss_info->expr = expr; ss_info->expr = expr;

View File

@ -185,6 +185,7 @@ gfc_ss_type;
typedef struct gfc_ss_info typedef struct gfc_ss_info
{ {
int refcount;
gfc_ss_type type; gfc_ss_type type;
gfc_expr *expr; gfc_expr *expr;
tree string_length; tree string_length;