Commit 5088b058 by Richard Henderson Committed by Richard Henderson

c-common.def (RETURN_STMT): Remove.

        * c-common.def (RETURN_STMT): Remove.
        * c-common.h (RETURN_STMT_EXPR): Remove.
        (c_expand_return, build_return_stmt): Remove.
        (c_common_stmt_codes): Remove RETURN_STMT.
        * c-dump.c (dump_next_stmt): Remove.
        (c_dump_tree): Remove RETURN_STMT.
        * c-decl.c (finish_function): Use c_finish_return.
        * c-parse.in (stmt): Likewise.
        * c-gimplify.c (gimplify_return_stmt): Remove.
        (c_gimplify_expr): Remove RETURN_STMT.
        * c-pretty-print.c (pp_c_statement): Likewise.
        * c-semantics.c (build_return_stmt): Remove.
        * c-tree.h (c_finish_return): Declare.
        * c-typeck.c (c_finish_return): Rename from c_expand_return.
        Return void.  Build RETURN_EXPR directly.
        * tree-dump.h (dump_next_stmt): Remove.
cp/
        * dump.c (cp_dump_tree): Don't use dump_next_stmt.
        * parser.c (cp_parser_jump_statement): Update commentary.
        * pt.c (tsubst_expr): Use RETURN_EXPR.
        * semantics.c (finish_return_stmt): Likewise.
        (finalize_nrv_r): Likewise.
        * typeck.c, typeck2.c: Update file start commentary.

From-SVN: r83461
parent 0b4da8a1
2004-06-21 Richard Henderson <rth@redhat.com>
* c-common.def (RETURN_STMT): Remove.
* c-common.h (RETURN_STMT_EXPR): Remove.
(c_expand_return, build_return_stmt): Remove.
(c_common_stmt_codes): Remove RETURN_STMT.
* c-dump.c (dump_next_stmt): Remove.
(c_dump_tree): Remove RETURN_STMT.
* c-decl.c (finish_function): Use c_finish_return.
* c-parse.in (stmt): Likewise.
* c-gimplify.c (gimplify_return_stmt): Remove.
(c_gimplify_expr): Remove RETURN_STMT.
* c-pretty-print.c (pp_c_statement): Likewise.
* c-semantics.c (build_return_stmt): Remove.
* c-tree.h (c_finish_return): Declare.
* c-typeck.c (c_finish_return): Rename from c_expand_return.
Return void. Build RETURN_EXPR directly.
* tree-dump.h (dump_next_stmt): Remove.
2004-06-21 Zack Weinberg <zack@codesourcery.com> 2004-06-21 Zack Weinberg <zack@codesourcery.com>
* c-decl.c (start_function): Don't call make_decl_rtl. Don't * c-decl.c (start_function): Don't call make_decl_rtl. Don't
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
additional tree codes used in the GNU C++ compiler (see tree.def additional tree codes used in the GNU C++ compiler (see tree.def
for the standard codes). for the standard codes).
Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998,
1999, 2000, 2001 Free Software Foundation, Inc. 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
Written by Benjamin Chelf <chelf@codesourcery.com> Written by Benjamin Chelf <chelf@codesourcery.com>
This file is part of GCC. This file is part of GCC.
...@@ -49,10 +49,6 @@ DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2) ...@@ -49,10 +49,6 @@ DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)
DO_COND, respectively. */ DO_COND, respectively. */
DEFTREECODE (DO_STMT, "do_stmt", 'e', 2) DEFTREECODE (DO_STMT, "do_stmt", 'e', 2)
/* Used to represent a 'return' statement. The operand is
RETURN_STMT_EXPR. */
DEFTREECODE (RETURN_STMT, "return_stmt", 'e', 1)
/* Used to represent a 'break' statement. */ /* Used to represent a 'break' statement. */
DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0) DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0)
......
...@@ -930,11 +930,6 @@ extern void finish_file (void); ...@@ -930,11 +930,6 @@ extern void finish_file (void);
#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0) #define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1) #define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
/* RETURN_STMT accessors. These give the expression associated with a
return statement, and whether it should be ignored when expanding
(as opposed to inlining). */
#define RETURN_STMT_EXPR(NODE) TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
/* EXPR_STMT accessor. This gives the expression associated with an /* EXPR_STMT accessor. This gives the expression associated with an
expression statement. */ expression statement. */
#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
...@@ -978,7 +973,7 @@ enum c_tree_code { ...@@ -978,7 +973,7 @@ enum c_tree_code {
#define c_common_stmt_codes \ #define c_common_stmt_codes \
EXPR_STMT, DECL_STMT, FOR_STMT, \ EXPR_STMT, DECL_STMT, FOR_STMT, \
WHILE_STMT, DO_STMT, RETURN_STMT, \ WHILE_STMT, DO_STMT, \
BREAK_STMT, CONTINUE_STMT, SWITCH_STMT BREAK_STMT, CONTINUE_STMT, SWITCH_STMT
/* TRUE if a code represents a statement. The front end init /* TRUE if a code represents a statement. The front end init
...@@ -1012,13 +1007,11 @@ extern int anon_aggr_type_p (tree); ...@@ -1012,13 +1007,11 @@ extern int anon_aggr_type_p (tree);
extern void emit_local_var (tree); extern void emit_local_var (tree);
extern void make_rtl_for_local_static (tree); extern void make_rtl_for_local_static (tree);
extern tree c_expand_return (tree);
extern tree do_case (tree, tree); extern tree do_case (tree, tree);
extern tree build_stmt (enum tree_code, ...); extern tree build_stmt (enum tree_code, ...);
extern tree build_case_label (tree, tree, tree); extern tree build_case_label (tree, tree, tree);
extern tree build_continue_stmt (void); extern tree build_continue_stmt (void);
extern tree build_break_stmt (void); extern tree build_break_stmt (void);
extern tree build_return_stmt (tree);
extern void c_expand_asm_operands (tree, tree, tree, tree, int, location_t); extern void c_expand_asm_operands (tree, tree, tree, tree, int, location_t);
......
...@@ -6242,7 +6242,7 @@ finish_function (void) ...@@ -6242,7 +6242,7 @@ finish_function (void)
DEFAULT_MAIN_RETURN; DEFAULT_MAIN_RETURN;
#else #else
if (flag_isoc99) if (flag_isoc99)
c_expand_return (integer_zero_node); c_finish_return (integer_zero_node);
#endif #endif
} }
} }
......
/* Tree-dumping functionality for C-family languages. /* Tree-dumping functionality for C-family languages.
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com> Written by Mark Mitchell <mark@codesourcery.com>
This file is part of GCC. This file is part of GCC.
...@@ -37,14 +37,6 @@ dump_stmt (dump_info_p di, tree t) ...@@ -37,14 +37,6 @@ dump_stmt (dump_info_p di, tree t)
dump_int (di, "line", locus->line); dump_int (di, "line", locus->line);
} }
/* Dump the next statement after STMT. */
void
dump_next_stmt (dump_info_p di, tree t)
{
dump_child ("next", TREE_CHAIN (t));
}
/* Dump any C-specific tree codes and attributes of common codes. */ /* Dump any C-specific tree codes and attributes of common codes. */
bool bool
...@@ -66,26 +58,22 @@ c_dump_tree (void *dump_info, tree t) ...@@ -66,26 +58,22 @@ c_dump_tree (void *dump_info, tree t)
case BREAK_STMT: case BREAK_STMT:
case CONTINUE_STMT: case CONTINUE_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_next_stmt (di, t);
break; break;
case DECL_STMT: case DECL_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("decl", DECL_STMT_DECL (t)); dump_child ("decl", DECL_STMT_DECL (t));
dump_next_stmt (di, t);
break; break;
case DO_STMT: case DO_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("body", DO_BODY (t)); dump_child ("body", DO_BODY (t));
dump_child ("cond", DO_COND (t)); dump_child ("cond", DO_COND (t));
dump_next_stmt (di, t);
break; break;
case EXPR_STMT: case EXPR_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("expr", EXPR_STMT_EXPR (t)); dump_child ("expr", EXPR_STMT_EXPR (t));
dump_next_stmt (di, t);
break; break;
case FOR_STMT: case FOR_STMT:
...@@ -94,27 +82,18 @@ c_dump_tree (void *dump_info, tree t) ...@@ -94,27 +82,18 @@ c_dump_tree (void *dump_info, tree t)
dump_child ("cond", FOR_COND (t)); dump_child ("cond", FOR_COND (t));
dump_child ("expr", FOR_EXPR (t)); dump_child ("expr", FOR_EXPR (t));
dump_child ("body", FOR_BODY (t)); dump_child ("body", FOR_BODY (t));
dump_next_stmt (di, t);
break;
case RETURN_STMT:
dump_stmt (di, t);
dump_child ("expr", RETURN_STMT_EXPR (t));
dump_next_stmt (di, t);
break; break;
case SWITCH_STMT: case SWITCH_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("cond", SWITCH_COND (t)); dump_child ("cond", SWITCH_COND (t));
dump_child ("body", SWITCH_BODY (t)); dump_child ("body", SWITCH_BODY (t));
dump_next_stmt (di, t);
break; break;
case WHILE_STMT: case WHILE_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("cond", WHILE_COND (t)); dump_child ("cond", WHILE_COND (t));
dump_child ("body", WHILE_BODY (t)); dump_child ("body", WHILE_BODY (t));
dump_next_stmt (di, t);
break; break;
case STMT_EXPR: case STMT_EXPR:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
by the C-based front ends. The structure of gimplified, or by the C-based front ends. The structure of gimplified, or
language-independent, trees is dictated by the grammar described in this language-independent, trees is dictated by the grammar described in this
file. file.
Copyright (C) 2002, 2003 Free Software Foundation, Inc. Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net> Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net>
Re-written to support lowering of whole function trees, documentation Re-written to support lowering of whole function trees, documentation
and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com> and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com>
...@@ -467,17 +467,6 @@ gimplify_switch_stmt (tree *stmt_p) ...@@ -467,17 +467,6 @@ gimplify_switch_stmt (tree *stmt_p)
return GS_ALL_DONE; return GS_ALL_DONE;
} }
/* Genericize a RETURN_STMT by turning it into a RETURN_EXPR. */
static enum gimplify_status
gimplify_return_stmt (tree *stmt_p)
{
tree expr = RETURN_STMT_EXPR (*stmt_p);
expr = build1 (RETURN_EXPR, void_type_node, expr);
*stmt_p = expr;
return GS_OK;
}
/* Gimplifies a DECL_STMT node *STMT_P by making any necessary allocation /* Gimplifies a DECL_STMT node *STMT_P by making any necessary allocation
and initialization explicit. */ and initialization explicit. */
...@@ -614,9 +603,6 @@ c_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) ...@@ -614,9 +603,6 @@ c_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
case EXPR_STMT: case EXPR_STMT:
return gimplify_expr_stmt (expr_p); return gimplify_expr_stmt (expr_p);
case RETURN_STMT:
return gimplify_return_stmt (expr_p);
case DECL_STMT: case DECL_STMT:
return gimplify_decl_stmt (expr_p); return gimplify_decl_stmt (expr_p);
......
...@@ -2242,9 +2242,9 @@ stmt: ...@@ -2242,9 +2242,9 @@ stmt:
else else
add_stmt (build_continue_stmt ()); } add_stmt (build_continue_stmt ()); }
| RETURN ';' | RETURN ';'
{ stmt_count++; c_expand_return (NULL_TREE); } { stmt_count++; c_finish_return (NULL_TREE); }
| RETURN expr ';' | RETURN expr ';'
{ stmt_count++; c_expand_return ($2); } { stmt_count++; c_finish_return ($2); }
| asm_stmt | asm_stmt
| GOTO identifier ';' | GOTO identifier ';'
{ tree decl; { tree decl;
......
...@@ -1982,23 +1982,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt) ...@@ -1982,23 +1982,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)
pp_needs_newline (pp) = true; pp_needs_newline (pp) = true;
break; break;
case RETURN_STMT:
{
tree e = RETURN_STMT_EXPR (stmt);
pp_c_identifier (pp, "return");
pp_c_whitespace (pp);
if (e)
{
if (TREE_CODE (e) == INIT_EXPR
&& TREE_CODE (TREE_OPERAND (e, 0)) == RESULT_DECL)
e = TREE_OPERAND (e, 1);
pp_expression (pp, e);
}
pp_c_semicolon (pp);
pp_needs_newline (pp) = true;
}
break;
case DECL_STMT: case DECL_STMT:
pp_declaration (pp, DECL_STMT_DECL (stmt)); pp_declaration (pp, DECL_STMT_DECL (stmt));
pp_needs_newline (pp) = true; pp_needs_newline (pp) = true;
......
...@@ -247,14 +247,6 @@ emit_local_var (tree decl) ...@@ -247,14 +247,6 @@ emit_local_var (tree decl)
} }
} }
/* Build the node for a return statement and return it. */
tree
build_return_stmt (tree expr)
{
return (build_stmt (RETURN_STMT, expr));
}
/* Build a break statement node and return it. */ /* Build a break statement node and return it. */
tree tree
......
...@@ -272,6 +272,7 @@ extern void c_finish_for_stmt (tree, tree); ...@@ -272,6 +272,7 @@ extern void c_finish_for_stmt (tree, tree);
extern tree c_begin_stmt_expr (void); extern tree c_begin_stmt_expr (void);
extern tree c_finish_stmt_expr (tree); extern tree c_finish_stmt_expr (tree);
extern void c_finish_expr_stmt (tree); extern void c_finish_expr_stmt (tree);
extern void c_finish_return (tree);
extern tree build_offsetof (tree, tree); extern tree build_offsetof (tree, tree);
/* Set to 0 at beginning of a function definition, set to 1 if /* Set to 0 at beginning of a function definition, set to 1 if
......
...@@ -23,11 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -23,11 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* This file is part of the C front end. /* This file is part of the C front end.
It contains routines to build C expressions given their operands, It contains routines to build C expressions given their operands,
including computing the types of the result, C-specific error checks, including computing the types of the result, C-specific error checks,
and some optimization. and some optimization. */
There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
and to process initializations in declarations (since they work
like a strange sort of assignment). */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
...@@ -6248,12 +6244,11 @@ c_expand_asm_operands (tree string, tree outputs, tree inputs, ...@@ -6248,12 +6244,11 @@ c_expand_asm_operands (tree string, tree outputs, tree inputs,
emit_queue (); emit_queue ();
} }
/* Expand a C `return' statement. /* Generate a C `return' statement. RETVAL is the expression for what
RETVAL is the expression for what to return, to return, or a null pointer for `return;' with no value. */
or a null pointer for `return;' with no value. */
tree void
c_expand_return (tree retval) c_finish_return (tree retval)
{ {
tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)); tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
...@@ -6282,7 +6277,7 @@ c_expand_return (tree retval) ...@@ -6282,7 +6277,7 @@ c_expand_return (tree retval)
current_function_returns_value = 1; current_function_returns_value = 1;
if (t == error_mark_node) if (t == error_mark_node)
return NULL_TREE; return;
inner = t = convert (TREE_TYPE (res), t); inner = t = convert (TREE_TYPE (res), t);
...@@ -6340,7 +6335,7 @@ c_expand_return (tree retval) ...@@ -6340,7 +6335,7 @@ c_expand_return (tree retval)
retval = build (MODIFY_EXPR, TREE_TYPE (res), res, t); retval = build (MODIFY_EXPR, TREE_TYPE (res), res, t);
} }
return add_stmt (build_return_stmt (retval)); add_stmt (build_stmt (RETURN_EXPR, retval));
} }
struct c_switch { struct c_switch {
......
2004-06-21 Richard Henderson <rth@redhat.com> 2004-06-21 Richard Henderson <rth@redhat.com>
* dump.c (cp_dump_tree): Don't use dump_next_stmt.
* parser.c (cp_parser_jump_statement): Update commentary.
* pt.c (tsubst_expr): Use RETURN_EXPR.
* semantics.c (finish_return_stmt): Likewise.
(finalize_nrv_r): Likewise.
* typeck.c, typeck2.c: Update file start commentary.
2004-06-21 Richard Henderson <rth@redhat.com>
* semantics.c (finish_expr_stmt): Call verify_sequence_points. * semantics.c (finish_expr_stmt): Call verify_sequence_points.
2004-06-20 Richard Henderson <rth@redhat.com> 2004-06-20 Richard Henderson <rth@redhat.com>
......
/* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. /* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c.
Copyright (C) 2002, 2003 Free Software Foundation, Inc. Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@redhat.com> Contributed by Jason Merrill <jason@redhat.com>
This file is part of GCC. This file is part of GCC.
......
...@@ -366,14 +366,12 @@ cp_dump_tree (void* dump_info, tree t) ...@@ -366,14 +366,12 @@ cp_dump_tree (void* dump_info, tree t)
dump_string (di, "cleanup"); dump_string (di, "cleanup");
dump_child ("body", TRY_STMTS (t)); dump_child ("body", TRY_STMTS (t));
dump_child ("hdlr", TRY_HANDLERS (t)); dump_child ("hdlr", TRY_HANDLERS (t));
dump_next_stmt (di, t);
break; break;
case EH_SPEC_BLOCK: case EH_SPEC_BLOCK:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("body", EH_SPEC_STMTS (t)); dump_child ("body", EH_SPEC_STMTS (t));
dump_child ("raises", EH_SPEC_RAISES (t)); dump_child ("raises", EH_SPEC_RAISES (t));
dump_next_stmt (di, t);
break; break;
case PTRMEM_CST: case PTRMEM_CST:
...@@ -397,19 +395,16 @@ cp_dump_tree (void* dump_info, tree t) ...@@ -397,19 +395,16 @@ cp_dump_tree (void* dump_info, tree t)
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("parm", HANDLER_PARMS (t)); dump_child ("parm", HANDLER_PARMS (t));
dump_child ("body", HANDLER_BODY (t)); dump_child ("body", HANDLER_BODY (t));
dump_next_stmt (di, t);
break; break;
case MUST_NOT_THROW_EXPR: case MUST_NOT_THROW_EXPR:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("body", TREE_OPERAND (t, 0)); dump_child ("body", TREE_OPERAND (t, 0));
dump_next_stmt (di, t);
break; break;
case USING_STMT: case USING_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("nmsp", USING_STMT_NAMESPACE (t)); dump_child ("nmsp", USING_STMT_NAMESPACE (t));
dump_next_stmt (di, t);
break; break;
case CLEANUP_STMT: case CLEANUP_STMT:
...@@ -417,7 +412,6 @@ cp_dump_tree (void* dump_info, tree t) ...@@ -417,7 +412,6 @@ cp_dump_tree (void* dump_info, tree t)
dump_child ("decl", CLEANUP_DECL (t)); dump_child ("decl", CLEANUP_DECL (t));
dump_child ("expr", CLEANUP_EXPR (t)); dump_child ("expr", CLEANUP_EXPR (t));
dump_child ("body", CLEANUP_BODY (t)); dump_child ("body", CLEANUP_BODY (t));
dump_next_stmt (di, t);
break; break;
case IF_STMT: case IF_STMT:
...@@ -425,7 +419,6 @@ cp_dump_tree (void* dump_info, tree t) ...@@ -425,7 +419,6 @@ cp_dump_tree (void* dump_info, tree t)
dump_child ("cond", IF_COND (t)); dump_child ("cond", IF_COND (t));
dump_child ("then", THEN_CLAUSE (t)); dump_child ("then", THEN_CLAUSE (t));
dump_child ("else", ELSE_CLAUSE (t)); dump_child ("else", ELSE_CLAUSE (t));
dump_next_stmt (di, t);
break; break;
default: default:
......
...@@ -6241,7 +6241,7 @@ cp_parser_for_init_statement (cp_parser* parser) ...@@ -6241,7 +6241,7 @@ cp_parser_for_init_statement (cp_parser* parser)
jump-statement: jump-statement:
goto * expression ; goto * expression ;
Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_STMT, or GOTO_EXPR. */ Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_EXPR, or GOTO_EXPR. */
static tree static tree
cp_parser_jump_statement (cp_parser* parser) cp_parser_jump_statement (cp_parser* parser)
......
...@@ -7773,8 +7773,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7773,8 +7773,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
(TREE_OPERAND (t, 0), args)); (TREE_OPERAND (t, 0), args));
break; break;
case RETURN_STMT: case RETURN_EXPR:
finish_return_stmt (tsubst_expr (RETURN_STMT_EXPR (t), finish_return_stmt (tsubst_expr (TREE_OPERAND (t, 0),
args, complain, in_decl)); args, complain, in_decl));
break; break;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
building RTL. These routines are used both during actual parsing building RTL. These routines are used both during actual parsing
and during the instantiation of template functions. and during the instantiation of template functions.
Copyright (C) 1998, 1999, 2000, 2001, 2002, Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
2003, 2004 Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c. formerly in parse.y and pt.c.
...@@ -667,7 +667,7 @@ finish_return_stmt (tree expr) ...@@ -667,7 +667,7 @@ finish_return_stmt (tree expr)
} }
} }
r = build_stmt (RETURN_STMT, expr); r = build_stmt (RETURN_EXPR, expr);
r = maybe_cleanup_point_expr (r); r = maybe_cleanup_point_expr (r);
r = add_stmt (r); r = add_stmt (r);
finish_stmt (); finish_stmt ();
...@@ -3009,8 +3009,8 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) ...@@ -3009,8 +3009,8 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data)
/* Change all returns to just refer to the RESULT_DECL; this is a nop, /* Change all returns to just refer to the RESULT_DECL; this is a nop,
but differs from using NULL_TREE in that it indicates that we care but differs from using NULL_TREE in that it indicates that we care
about the value of the RESULT_DECL. */ about the value of the RESULT_DECL. */
else if (TREE_CODE (*tp) == RETURN_STMT) else if (TREE_CODE (*tp) == RETURN_EXPR)
RETURN_STMT_EXPR (*tp) = dp->result; TREE_OPERAND (*tp, 0) = dp->result;
/* Change all cleanups for the NRV to only run when an exception is /* Change all cleanups for the NRV to only run when an exception is
thrown. */ thrown. */
else if (TREE_CODE (*tp) == CLEANUP_STMT else if (TREE_CODE (*tp) == CLEANUP_STMT
...@@ -3052,7 +3052,7 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) ...@@ -3052,7 +3052,7 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data)
} }
/* Called from finish_function to implement the named return value /* Called from finish_function to implement the named return value
optimization by overriding all the RETURN_STMTs and pertinent optimization by overriding all the RETURN_EXPRs and pertinent
CLEANUP_STMTs and replacing all occurrences of VAR with RESULT, the CLEANUP_STMTs and replacing all occurrences of VAR with RESULT, the
RESULT_DECL for the function. */ RESULT_DECL for the function. */
......
...@@ -24,11 +24,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -24,11 +24,7 @@ Boston, MA 02111-1307, USA. */
/* This file is part of the C++ front end. /* This file is part of the C++ front end.
It contains routines to build C++ expressions given their operands, It contains routines to build C++ expressions given their operands,
including computing the types of the result, C and C++ specific error including computing the types of the result, C and C++ specific error
checks, and some optimization. checks, and some optimization. */
There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
and to process initializations in declarations (since they work
like a strange sort of assignment). */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
......
...@@ -26,11 +26,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -26,11 +26,7 @@ Boston, MA 02111-1307, USA. */
/* This file is part of the C++ front end. /* This file is part of the C++ front end.
It contains routines to build C++ expressions given their operands, It contains routines to build C++ expressions given their operands,
including computing the types of the result, C and C++ specific error including computing the types of the result, C and C++ specific error
checks, and some optimization. checks, and some optimization. */
There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
and to process initializations in declarations (since they work
like a strange sort of assignment). */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
......
...@@ -83,7 +83,6 @@ extern void dump_pointer (dump_info_p, const char *, void *); ...@@ -83,7 +83,6 @@ extern void dump_pointer (dump_info_p, const char *, void *);
extern void dump_int (dump_info_p, const char *, int); extern void dump_int (dump_info_p, const char *, int);
extern void dump_string (dump_info_p, const char *); extern void dump_string (dump_info_p, const char *);
extern void dump_stmt (dump_info_p, tree); extern void dump_stmt (dump_info_p, tree);
extern void dump_next_stmt (dump_info_p, tree);
extern void queue_and_dump_index (dump_info_p, const char *, tree, int); extern void queue_and_dump_index (dump_info_p, const char *, tree, int);
extern void queue_and_dump_type (dump_info_p, tree); extern void queue_and_dump_type (dump_info_p, tree);
extern void dump_function (enum tree_dump_index, tree); extern void dump_function (enum tree_dump_index, 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