Commit ebaae582 by Steven Bosscher

tree.h (SWITCH_COND, [...]): Add tree checks.

	* tree.h (SWITCH_COND, SWITCH_BODY, SWITCH_LABELS, CASE_LOW,
	CASE_HIGH, CASE_LABEL, ASM_STRING, ASM_OUTPUTS, ASM_INPUTS,
	ASM_CLOBBERS): Add tree checks.

	* c-common.h (SWITCH_TYPE): Rename to SWITCH_STMT_TYPE.
	(SWITCH_STMT_COND, SWITCH_STMT_BODY): New.
	* c-common.def (SWITCH_STMT): Update to match.
	* c-common.c (c_do_switch_warnings): Use SWITCH_STMT accessor
	macros instead of SWITCH_EXPR ones.
	* c-dump.c (c_dump_tree): Likewise.
	* c-gimplify.c (gimplify_switch_stmt): Likewise.
	* c-typeck.c (c_start_case, do_case, c_finish_case): Likewise.

cp/
	* decl.c (finish_case_label): Use SWITCH_STMT accessor macros
	instead of SWITCH_EXPR ones.
	* pt.c (tsubst_expr): Likewise.
	* semantics.c (begin_switch_stmt, finish_switch_cond,
	finish_switch_stmt): Likewise.

doc/
	* c-tree.texi (SWITCH_STMT): Update accessor macro names.

From-SVN: r94315
parent 7a706738
2005-01-27 Steven Bosscher <stevenb@suse.de>
* tree.h (SWITCH_COND, SWITCH_BODY, SWITCH_LABELS, CASE_LOW,
CASE_HIGH, CASE_LABEL, ASM_STRING, ASM_OUTPUTS, ASM_INPUTS,
ASM_CLOBBERS): Add tree checks.
* c-common.h (SWITCH_TYPE): Rename to SWITCH_STMT_TYPE.
(SWITCH_STMT_COND, SWITCH_STMT_BODY): New.
* c-common.def (SWITCH_STMT): Update to match.
* c-common.c (c_do_switch_warnings): Use SWITCH_STMT accessor
macros instead of SWITCH_EXPR ones.
* c-dump.c (c_dump_tree): Likewise.
* c-gimplify.c (gimplify_switch_stmt): Likewise.
* c-typeck.c (c_start_case, do_case, c_finish_case): Likewise.
* doc/c-tree.texi (SWITCH_STMT): Update accessor macro names.
2005-01-27 Alan Modra <amodra@bigpond.net.au>
* unwind-dw2.c (execute_stack_op): Add missing cases for
......@@ -97,9 +114,9 @@
2004-11-11 Eric Christopher <echristo@redhat.com>
* config/frv/frv.md: Add fr400_integer automaton. Don't
allow TYPE_MUL, TYPE_MACC, or TYPE_CUT to issue in parallel
to TYPE_MACC.
* config/frv/frv.md: Add fr400_integer automaton. Don't
allow TYPE_MUL, TYPE_MACC, or TYPE_CUT to issue in parallel
to TYPE_MACC.
2005-01-26 Steven Bosscher <stevenb@suse.de>
......
......@@ -3676,7 +3676,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt)
else
switch_location = input_location;
type = SWITCH_TYPE (switch_stmt);
type = SWITCH_STMT_TYPE (switch_stmt);
default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
if (warn_switch_default && !default_node)
......@@ -3688,7 +3688,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt)
default case, or when -Wswitch-enum was specified. */
if (((warn_switch && !default_node) || warn_switch_enum)
&& type && TREE_CODE (type) == ENUMERAL_TYPE
&& TREE_CODE (SWITCH_COND (switch_stmt)) != INTEGER_CST)
&& TREE_CODE (SWITCH_STMT_COND (switch_stmt)) != INTEGER_CST)
{
tree chain;
......
......@@ -52,7 +52,7 @@ DEFTREECODE (BREAK_STMT, "break_stmt", tcc_expression, 0)
DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_expression, 0)
/* Used to represent a 'switch' statement. The operands are
SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
SWITCH_STMT_COND, SWITCH_STMT_BODY and SWITCH_STMT_TYPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_expression, 3)
/* A STMT_EXPR represents a statement-expression. The
......
......@@ -733,7 +733,9 @@ extern void finish_file (void);
#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
/* STMT_EXPR accessor. */
#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
......
......@@ -80,8 +80,8 @@ c_dump_tree (void *dump_info, tree t)
case SWITCH_STMT:
dump_stmt (di, t);
dump_child ("cond", SWITCH_COND (t));
dump_child ("body", SWITCH_BODY (t));
dump_child ("cond", SWITCH_STMT_COND (t));
dump_child ("body", SWITCH_STMT_BODY (t));
break;
case WHILE_STMT:
......
......@@ -454,12 +454,12 @@ gimplify_switch_stmt (tree *stmt_p)
break_block = begin_bc_block (bc_break);
body = SWITCH_BODY (stmt);
body = SWITCH_STMT_BODY (stmt);
if (!body)
body = build_empty_stmt ();
*stmt_p = build3 (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
body, NULL_TREE);
*stmt_p = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt),
SWITCH_STMT_COND (stmt), body, NULL_TREE);
SET_EXPR_LOCATION (*stmt_p, stmt_locus);
gimplify_stmt (stmt_p);
......
......@@ -6563,8 +6563,7 @@ c_start_case (tree exp)
/* Add this new SWITCH_STMT to the stack. */
cs = XNEW (struct c_switch);
cs->switch_stmt = build_stmt ((enum tree_code) SWITCH_STMT, exp, NULL_TREE,
orig_type);
cs->switch_stmt = build_stmt (SWITCH_STMT, exp, NULL_TREE, orig_type);
cs->orig_type = orig_type;
cs->cases = splay_tree_new (case_compare, NULL, NULL);
cs->next = c_switch_stack;
......@@ -6583,7 +6582,7 @@ do_case (tree low_value, tree high_value)
if (c_switch_stack)
{
label = c_add_case_label (c_switch_stack->cases,
SWITCH_COND (c_switch_stack->switch_stmt),
SWITCH_STMT_COND (c_switch_stack->switch_stmt),
c_switch_stack->orig_type,
low_value, high_value);
if (label == error_mark_node)
......@@ -6604,7 +6603,7 @@ c_finish_case (tree body)
{
struct c_switch *cs = c_switch_stack;
SWITCH_BODY (cs->switch_stmt) = body;
SWITCH_STMT_BODY (cs->switch_stmt) = body;
/* Emit warnings as needed. */
c_do_switch_warnings (cs->cases, cs->switch_stmt);
......
2005-01-27 Steven Bosscher <stevenb@suse.de>
* decl.c (finish_case_label): Use SWITCH_STMT accessor macros
instead of SWITCH_EXPR ones.
* pt.c (tsubst_expr): Likewise.
* semantics.c (begin_switch_stmt, finish_switch_cond,
finish_switch_stmt): Likewise.
2005-01-26 J"orn Rennecke <joern.rennecke@st.com>
PR c++/18370
......
......@@ -2383,7 +2383,7 @@ finish_case_label (tree low_value, tree high_value)
}
/* Find the condition on which this switch statement depends. */
cond = SWITCH_COND (switch_stack->switch_stmt);
cond = SWITCH_STMT_COND (switch_stack->switch_stmt);
if (cond && TREE_CODE (cond) == TREE_LIST)
cond = TREE_VALUE (cond);
......
......@@ -8192,9 +8192,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case SWITCH_STMT:
stmt = begin_switch_stmt ();
tmp = tsubst_expr (SWITCH_COND (t), args, complain, in_decl);
tmp = tsubst_expr (SWITCH_STMT_COND (t), args, complain, in_decl);
finish_switch_cond (tmp, stmt);
tsubst_expr (SWITCH_BODY (t), args, complain, in_decl);
tsubst_expr (SWITCH_STMT_BODY (t), args, complain, in_decl);
finish_switch_stmt (stmt);
break;
......
......@@ -858,7 +858,7 @@ begin_switch_stmt (void)
scope = do_pushlevel (sk_block);
TREE_CHAIN (r) = scope;
begin_cond (&SWITCH_COND (r));
begin_cond (&SWITCH_STMT_COND (r));
return r;
}
......@@ -902,11 +902,11 @@ finish_switch_cond (tree cond, tree switch_stmt)
cond = index;
}
}
finish_cond (&SWITCH_COND (switch_stmt), cond);
SWITCH_TYPE (switch_stmt) = orig_type;
finish_cond (&SWITCH_STMT_COND (switch_stmt), cond);
SWITCH_STMT_TYPE (switch_stmt) = orig_type;
add_stmt (switch_stmt);
push_switch (switch_stmt);
SWITCH_BODY (switch_stmt) = push_stmt_list ();
SWITCH_STMT_BODY (switch_stmt) = push_stmt_list ();
}
/* Finish the body of a switch-statement, which may be given by
......@@ -917,7 +917,8 @@ finish_switch_stmt (tree switch_stmt)
{
tree scope;
SWITCH_BODY (switch_stmt) = pop_stmt_list (SWITCH_BODY (switch_stmt));
SWITCH_STMT_BODY (switch_stmt) =
pop_stmt_list (SWITCH_STMT_BODY (switch_stmt));
pop_switch ();
finish_stmt ();
......
......@@ -1573,11 +1573,11 @@ cleanups must be executed in the reverse order in which they appear.
@item SWITCH_STMT
Used to represent a @code{switch} statement. The @code{SWITCH_COND} is
the expression on which the switch is occurring. See the documentation
Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND}
is the expression on which the switch is occurring. See the documentation
for an @code{IF_STMT} for more information on the representation used
for the condition. The @code{SWITCH_BODY} is the body of the switch
statement. The @code{SWITCH_TYPE} is the original type of switch
for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch
statement. The @code{SWITCH_STMT_TYPE} is the original type of switch
expression as given in the source, before any compiler conversions.
@item TRY_BLOCK
......
......@@ -1227,15 +1227,15 @@ struct tree_vec GTY(())
/* SWITCH_EXPR accessors. These give access to the condition, body and
original condition type (before any compiler conversions)
of the switch statement, respectively. */
#define SWITCH_COND(NODE) TREE_OPERAND ((NODE), 0)
#define SWITCH_BODY(NODE) TREE_OPERAND ((NODE), 1)
#define SWITCH_LABELS(NODE) TREE_OPERAND ((NODE), 2)
#define SWITCH_COND(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0)
#define SWITCH_BODY(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1)
#define SWITCH_LABELS(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 2)
/* CASE_LABEL_EXPR accessors. These give access to the high and low values
of a case label, respectively. */
#define CASE_LOW(NODE) TREE_OPERAND ((NODE), 0)
#define CASE_HIGH(NODE) TREE_OPERAND ((NODE), 1)
#define CASE_LABEL(NODE) TREE_OPERAND ((NODE), 2)
#define CASE_LOW(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 0)
#define CASE_HIGH(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 1)
#define CASE_LABEL(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 2)
/* The operands of a BIND_EXPR. */
#define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0))
......@@ -1250,10 +1250,10 @@ struct tree_vec GTY(())
instruction (e.g., "mov x, y"). ASM_OUTPUTS, ASM_INPUTS, and
ASM_CLOBBERS represent the outputs, inputs, and clobbers for the
statement. */
#define ASM_STRING(NODE) TREE_OPERAND ((NODE), 0)
#define ASM_OUTPUTS(NODE) TREE_OPERAND ((NODE), 1)
#define ASM_INPUTS(NODE) TREE_OPERAND ((NODE), 2)
#define ASM_CLOBBERS(NODE) TREE_OPERAND ((NODE), 3)
#define ASM_STRING(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 0)
#define ASM_OUTPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 1)
#define ASM_INPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 2)
#define ASM_CLOBBERS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 3)
/* Nonzero if we want to create an ASM_INPUT instead of an
ASM_OPERAND with no operands. */
#define ASM_INPUT_P(NODE) (TREE_STATIC (NODE))
......
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