* 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
+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>
* c-decl.c (start_function): Don't call make_decl_rtl. Don't
additional tree codes used in the GNU C++ compiler (see tree.def
for the standard codes).
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>
This file is part of GCC.
DO_COND, respectively. */
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. */
DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0)
#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
#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
expression statement. */
#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
#define c_common_stmt_codes \
EXPR_STMT, DECL_STMT, FOR_STMT, \
- WHILE_STMT, DO_STMT, RETURN_STMT, \
+ WHILE_STMT, DO_STMT, \
BREAK_STMT, CONTINUE_STMT, SWITCH_STMT
/* TRUE if a code represents a statement. The front end init
extern void emit_local_var (tree);
extern void make_rtl_for_local_static (tree);
-extern tree c_expand_return (tree);
extern tree do_case (tree, tree);
extern tree build_stmt (enum tree_code, ...);
extern tree build_case_label (tree, tree, tree);
extern tree build_continue_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);
DEFAULT_MAIN_RETURN;
#else
if (flag_isoc99)
- c_expand_return (integer_zero_node);
+ c_finish_return (integer_zero_node);
#endif
}
}
/* 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>
This file is part of GCC.
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. */
bool
case BREAK_STMT:
case CONTINUE_STMT:
dump_stmt (di, t);
- dump_next_stmt (di, t);
break;
case DECL_STMT:
dump_stmt (di, t);
dump_child ("decl", DECL_STMT_DECL (t));
- dump_next_stmt (di, t);
break;
case DO_STMT:
dump_stmt (di, t);
dump_child ("body", DO_BODY (t));
dump_child ("cond", DO_COND (t));
- dump_next_stmt (di, t);
break;
case EXPR_STMT:
dump_stmt (di, t);
dump_child ("expr", EXPR_STMT_EXPR (t));
- dump_next_stmt (di, t);
break;
case FOR_STMT:
dump_child ("cond", FOR_COND (t));
dump_child ("expr", FOR_EXPR (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;
case SWITCH_STMT:
dump_stmt (di, t);
dump_child ("cond", SWITCH_COND (t));
dump_child ("body", SWITCH_BODY (t));
- dump_next_stmt (di, t);
break;
case WHILE_STMT:
dump_stmt (di, t);
dump_child ("cond", WHILE_COND (t));
dump_child ("body", WHILE_BODY (t));
- dump_next_stmt (di, t);
break;
case STMT_EXPR:
by the C-based front ends. The structure of gimplified, or
language-independent, trees is dictated by the grammar described in this
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>
Re-written to support lowering of whole function trees, documentation
and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com>
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
and initialization explicit. */
case EXPR_STMT:
return gimplify_expr_stmt (expr_p);
- case RETURN_STMT:
- return gimplify_return_stmt (expr_p);
-
case DECL_STMT:
return gimplify_decl_stmt (expr_p);
else
add_stmt (build_continue_stmt ()); }
| RETURN ';'
- { stmt_count++; c_expand_return (NULL_TREE); }
+ { stmt_count++; c_finish_return (NULL_TREE); }
| RETURN expr ';'
- { stmt_count++; c_expand_return ($2); }
+ { stmt_count++; c_finish_return ($2); }
| asm_stmt
| GOTO identifier ';'
{ tree decl;
pp_needs_newline (pp) = true;
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:
pp_declaration (pp, DECL_STMT_DECL (stmt));
pp_needs_newline (pp) = true;
}
}
-/* 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. */
tree
extern tree c_begin_stmt_expr (void);
extern tree c_finish_stmt_expr (tree);
extern void c_finish_expr_stmt (tree);
+extern void c_finish_return (tree);
extern tree build_offsetof (tree, tree);
/* Set to 0 at beginning of a function definition, set to 1 if
/* This file is part of the C front end.
It contains routines to build C expressions given their operands,
including computing the types of the result, C-specific error 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). */
+ and some optimization. */
#include "config.h"
#include "system.h"
emit_queue ();
}
\f
-/* Expand a C `return' statement.
- RETVAL is the expression for what to return,
- or a null pointer for `return;' with no value. */
+/* Generate a C `return' statement. RETVAL is the expression for what
+ to return, or a null pointer for `return;' with no value. */
-tree
-c_expand_return (tree retval)
+void
+c_finish_return (tree retval)
{
tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
current_function_returns_value = 1;
if (t == error_mark_node)
- return NULL_TREE;
+ return;
inner = t = convert (TREE_TYPE (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));
}
\f
struct c_switch {
+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.
/* 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>
This file is part of GCC.
dump_string (di, "cleanup");
dump_child ("body", TRY_STMTS (t));
dump_child ("hdlr", TRY_HANDLERS (t));
- dump_next_stmt (di, t);
break;
case EH_SPEC_BLOCK:
dump_stmt (di, t);
dump_child ("body", EH_SPEC_STMTS (t));
dump_child ("raises", EH_SPEC_RAISES (t));
- dump_next_stmt (di, t);
break;
case PTRMEM_CST:
dump_stmt (di, t);
dump_child ("parm", HANDLER_PARMS (t));
dump_child ("body", HANDLER_BODY (t));
- dump_next_stmt (di, t);
break;
case MUST_NOT_THROW_EXPR:
dump_stmt (di, t);
dump_child ("body", TREE_OPERAND (t, 0));
- dump_next_stmt (di, t);
break;
case USING_STMT:
dump_stmt (di, t);
dump_child ("nmsp", USING_STMT_NAMESPACE (t));
- dump_next_stmt (di, t);
break;
case CLEANUP_STMT:
dump_child ("decl", CLEANUP_DECL (t));
dump_child ("expr", CLEANUP_EXPR (t));
dump_child ("body", CLEANUP_BODY (t));
- dump_next_stmt (di, t);
break;
case IF_STMT:
dump_child ("cond", IF_COND (t));
dump_child ("then", THEN_CLAUSE (t));
dump_child ("else", ELSE_CLAUSE (t));
- dump_next_stmt (di, t);
break;
default:
jump-statement:
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
cp_parser_jump_statement (cp_parser* parser)
(TREE_OPERAND (t, 0), args));
break;
- case RETURN_STMT:
- finish_return_stmt (tsubst_expr (RETURN_STMT_EXPR (t),
+ case RETURN_EXPR:
+ finish_return_stmt (tsubst_expr (TREE_OPERAND (t, 0),
args, complain, in_decl));
break;
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
}
}
- r = build_stmt (RETURN_STMT, expr);
+ r = build_stmt (RETURN_EXPR, expr);
r = maybe_cleanup_point_expr (r);
r = add_stmt (r);
finish_stmt ();
/* 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
about the value of the RESULT_DECL. */
- else if (TREE_CODE (*tp) == RETURN_STMT)
- RETURN_STMT_EXPR (*tp) = dp->result;
+ else if (TREE_CODE (*tp) == RETURN_EXPR)
+ TREE_OPERAND (*tp, 0) = dp->result;
/* Change all cleanups for the NRV to only run when an exception is
thrown. */
else if (TREE_CODE (*tp) == CLEANUP_STMT
}
/* 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
RESULT_DECL for the function. */
/* This file is part of the C++ front end.
It contains routines to build C++ expressions given their operands,
including computing the types of the result, C and C++ specific error
- 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). */
+ checks, and some optimization. */
#include "config.h"
#include "system.h"
/* This file is part of the C++ front end.
It contains routines to build C++ expressions given their operands,
including computing the types of the result, C and C++ specific error
- 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). */
+ checks, and some optimization. */
#include "config.h"
#include "system.h"
extern void dump_int (dump_info_p, const char *, int);
extern void dump_string (dump_info_p, const char *);
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_type (dump_info_p, tree);
extern void dump_function (enum tree_dump_index, tree);