Commit d74d8807 by Daniel Kraft Committed by Daniel Kraft

trans.h (gfc_get_return_label): Removed.

2010-07-21  Daniel Kraft  <d@domob.eu>

	* trans.h (gfc_get_return_label): Removed.
	(gfc_generate_return): New method.
	(gfc_trans_deferred_vars): Update gfc_wrapped_block rather than
	returning a tree directly.
	* trans-stmt.c (gfc_trans_return): Use `gfc_generate_return'.
	(gfc_trans_block_construct): Update for new interface to
	`gfc_trans_deferred_vars'.
	* trans-decl.c (current_function_return_label): Removed.
	(current_procedure_symbol): New variable.
	(gfc_get_return_label): Removed.
	(gfc_trans_deferred_vars): Update gfc_wrapped_block rather than
	returning a tree directly.
	(get_proc_result), (gfc_generate_return): New methods.
	(gfc_generate_function_code): Clean up and do init/cleanup here
	also with gfc_wrapped_block.  Remove return-label but rather
	return directly.

From-SVN: r162373
parent 426797b2
2010-07-21 Daniel Kraft <d@domob.eu>
* trans.h (gfc_get_return_label): Removed.
(gfc_generate_return): New method.
(gfc_trans_deferred_vars): Update gfc_wrapped_block rather than
returning a tree directly.
* trans-stmt.c (gfc_trans_return): Use `gfc_generate_return'.
(gfc_trans_block_construct): Update for new interface to
`gfc_trans_deferred_vars'.
* trans-decl.c (current_function_return_label): Removed.
(current_procedure_symbol): New variable.
(gfc_get_return_label): Removed.
(gfc_trans_deferred_vars): Update gfc_wrapped_block rather than
returning a tree directly.
(get_proc_result), (gfc_generate_return): New methods.
(gfc_generate_function_code): Clean up and do init/cleanup here
also with gfc_wrapped_block. Remove return-label but rather
return directly.
2010-07-19 Steven G. Kargl <kargl@gcc.gnu.org> 2010-07-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/44929 PR fortran/44929
......
...@@ -491,7 +491,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check, ...@@ -491,7 +491,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check,
/* Translate the RETURN statement. */ /* Translate the RETURN statement. */
tree tree
gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED) gfc_trans_return (gfc_code * code)
{ {
if (code->expr1) if (code->expr1)
{ {
...@@ -500,16 +500,16 @@ gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED) ...@@ -500,16 +500,16 @@ gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED)
tree result; tree result;
/* If code->expr is not NULL, this return statement must appear /* If code->expr is not NULL, this return statement must appear
in a subroutine and current_fake_result_decl has already in a subroutine and current_fake_result_decl has already
been generated. */ been generated. */
result = gfc_get_fake_result_decl (NULL, 0); result = gfc_get_fake_result_decl (NULL, 0);
if (!result) if (!result)
{ {
gfc_warning ("An alternate return at %L without a * dummy argument", gfc_warning ("An alternate return at %L without a * dummy argument",
&code->expr1->where); &code->expr1->where);
return build1_v (GOTO_EXPR, gfc_get_return_label ()); return gfc_generate_return ();
} }
/* Start a new block for this statement. */ /* Start a new block for this statement. */
gfc_init_se (&se, NULL); gfc_init_se (&se, NULL);
...@@ -521,13 +521,12 @@ gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED) ...@@ -521,13 +521,12 @@ gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED)
fold_convert (TREE_TYPE (result), se.expr)); fold_convert (TREE_TYPE (result), se.expr));
gfc_add_expr_to_block (&se.pre, tmp); gfc_add_expr_to_block (&se.pre, tmp);
tmp = build1_v (GOTO_EXPR, gfc_get_return_label ()); tmp = gfc_generate_return ();
gfc_add_expr_to_block (&se.pre, tmp); gfc_add_expr_to_block (&se.pre, tmp);
gfc_add_block_to_block (&se.pre, &se.post);
return gfc_finish_block (&se.pre); return gfc_finish_block (&se.pre);
} }
else
return build1_v (GOTO_EXPR, gfc_get_return_label ()); return gfc_generate_return ();
} }
...@@ -847,8 +846,7 @@ gfc_trans_block_construct (gfc_code* code) ...@@ -847,8 +846,7 @@ gfc_trans_block_construct (gfc_code* code)
{ {
gfc_namespace* ns; gfc_namespace* ns;
gfc_symbol* sym; gfc_symbol* sym;
stmtblock_t body; gfc_wrapped_block body;
tree tmp;
ns = code->ext.block.ns; ns = code->ext.block.ns;
gcc_assert (ns); gcc_assert (ns);
...@@ -858,14 +856,12 @@ gfc_trans_block_construct (gfc_code* code) ...@@ -858,14 +856,12 @@ gfc_trans_block_construct (gfc_code* code)
gcc_assert (!sym->tlink); gcc_assert (!sym->tlink);
sym->tlink = sym; sym->tlink = sym;
gfc_start_block (&body);
gfc_process_block_locals (ns); gfc_process_block_locals (ns);
tmp = gfc_trans_code (ns->code); gfc_start_wrapped_block (&body, gfc_trans_code (ns->code));
tmp = gfc_trans_deferred_vars (sym, tmp); gfc_trans_deferred_vars (sym, &body);
gfc_add_expr_to_block (&body, tmp); return gfc_finish_wrapped_block (&body);
return gfc_finish_block (&body);
} }
......
...@@ -408,9 +408,6 @@ tree gfc_build_label_decl (tree); ...@@ -408,9 +408,6 @@ tree gfc_build_label_decl (tree);
Do not use if the function has an explicit result variable. */ Do not use if the function has an explicit result variable. */
tree gfc_get_fake_result_decl (gfc_symbol *, int); tree gfc_get_fake_result_decl (gfc_symbol *, int);
/* Get the return label for the current function. */
tree gfc_get_return_label (void);
/* Add a decl to the binding level for the current function. */ /* Add a decl to the binding level for the current function. */
void gfc_add_decl_to_function (tree); void gfc_add_decl_to_function (tree);
...@@ -456,6 +453,8 @@ void gfc_generate_function_code (gfc_namespace *); ...@@ -456,6 +453,8 @@ void gfc_generate_function_code (gfc_namespace *);
void gfc_generate_block_data (gfc_namespace *); void gfc_generate_block_data (gfc_namespace *);
/* Output a decl for a module variable. */ /* Output a decl for a module variable. */
void gfc_generate_module_vars (gfc_namespace *); void gfc_generate_module_vars (gfc_namespace *);
/* Get the appropriate return statement for a procedure. */
tree gfc_generate_return (void);
struct GTY(()) module_htab_entry { struct GTY(()) module_htab_entry {
const char *name; const char *name;
...@@ -533,7 +532,7 @@ tree gfc_build_library_function_decl_with_spec (tree name, const char *spec, ...@@ -533,7 +532,7 @@ tree gfc_build_library_function_decl_with_spec (tree name, const char *spec,
void gfc_process_block_locals (gfc_namespace*); void gfc_process_block_locals (gfc_namespace*);
/* Output initialization/clean-up code that was deferred. */ /* Output initialization/clean-up code that was deferred. */
tree gfc_trans_deferred_vars (gfc_symbol*, tree); void gfc_trans_deferred_vars (gfc_symbol*, gfc_wrapped_block *);
/* somewhere! */ /* somewhere! */
tree pushdecl (tree); tree pushdecl (tree);
......
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