Commit caf93cb0 by Eric Christopher

builtins.c (expand_builtin_setjmp_receiver): Fix comment for code removal.

2004-07-21  Eric Christopher  <echristo@redhat.com>

	* builtins.c (expand_builtin_setjmp_receiver): Fix comment for code
	removal.
	* c-decl.c (pop_scope): Ditto.
	* calls.c (expand_call): Remove call to current_nesting_level,
	update comment accordingly. Remove calls to expand_start_target_temps
	and expand_end_target_temps.
	* cfgexpand.c (construct_init_block): Remove call to
	expand_start_bindings_and_block.
	(construct_exit_block): Remove call to expand_end_bindings.
	* expr.c (safe_from_p): Remove BIND_EXPR handling.
	(expand_expr_real_1): Ditto. Fix formatting.
	(expand_vars): Delete.
	* stmt.c (POPSTACK): Remove block_stack.
	(stmt_status): Remove x_block_stack.
	(block_stack): Delete.
	(expand_start_bindings_and_block): Ditto.
	(expand_start_target_temps): Ditto.
	(expand_end_target_temps): Ditto.
	(current_nesting_level): Ditto.
	(warn_about_unused_variables): Ditto.
	(expand_end_bindings): Ditto.
	* tree.h: Remove declarations for above.

2004-07-21  Eric Christopher  <echristo@redhat.com>

	* decl.c (poplevel): Inline unused variable checking.
	Change formatting.

From-SVN: r85019
parent d942072c
2004-07-21 Eric Christopher <echristo@redhat.com>
* builtins.c (expand_builtin_setjmp_receiver): Fix comment for code
removal.
* c-decl.c (pop_scope): Ditto.
* calls.c (expand_call): Remove call to current_nesting_level,
update comment accordingly. Remove calls to expand_start_target_temps
and expand_end_target_temps.
* cfgexpand.c (construct_init_block): Remove call to
expand_start_bindings_and_block.
(construct_exit_block): Remove call to expand_end_bindings.
* expr.c (safe_from_p): Remove BIND_EXPR handling.
(expand_expr_real_1): Ditto. Fix formatting.
(expand_vars): Delete.
* stmt.c (POPSTACK): Remove block_stack.
(stmt_status): Remove x_block_stack.
(block_stack): Delete.
(expand_start_bindings_and_block): Ditto.
(expand_start_target_temps): Ditto.
(expand_end_target_temps): Ditto.
(current_nesting_level): Ditto.
(warn_about_unused_variables): Ditto.
(expand_end_bindings): Ditto.
* tree.h: Remove declarations for above.
2004-07-21 Steven Bosscher <stevenb@suse.de>
* rtl.h (insn_note): Remove NOTE_INSN_PREDICTION.
......@@ -125,7 +150,6 @@
for EXTRA_SECTION_FUNCTIONS.
* doc/install.texi: Update binutils requirements.
>>>>>>> 2.4622
2004-07-20 Nathan Sidwell <nathan@codesourcery.com>
* vec.h (VEC_T_length, VEC_T_index, VEC_T_iterate, VEC_T_truncate,
......
......@@ -571,8 +571,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
emit_insn (gen_rtx_CLOBBER (VOIDmode, static_chain_rtx));
/* Now put in the code to restore the frame pointer, and argument
pointer, if needed. The code below is from expand_end_bindings
in stmt.c; see detailed documentation there. */
pointer, if needed. */
#ifdef HAVE_nonlocal_goto
if (! HAVE_nonlocal_goto)
#endif
......
......@@ -746,9 +746,7 @@ pop_scope (void)
goto common_symbol;
case VAR_DECL:
/* Warnings for unused variables. Keep this in sync with
stmt.c:warn_about_unused_variables, which we cannot use
since it expects a different data structure. */
/* Warnings for unused variables. */
if (warn_unused_variable
&& !TREE_USED (p)
&& !DECL_IN_SYSTEM_HEADER (p)
......
......@@ -2232,15 +2232,11 @@ expand_call (tree exp, rtx target, int ignore)
finished with regular parsing. Which means that some of the
machinery we use to generate tail-calls is no longer in place.
This is most often true of sjlj-exceptions, which we couldn't
tail-call to anyway.
tail-call to anyway. */
If current_nesting_level () == 0, we're being called after
the function body has been expanded. This can happen when
setting up trampolines in expand_function_end. */
if (currently_expanding_call++ != 0
|| !flag_optimize_sibling_calls
|| !rtx_equal_function_value_matters
|| current_nesting_level () == 0
|| args_size.var
|| lookup_stmt_eh_region (exp) >= 0)
try_tail_call = 0;
......@@ -2372,15 +2368,6 @@ expand_call (tree exp, rtx target, int ignore)
sibcall_failure instead of continuing the loop. */
start_sequence ();
if (pass == 0)
{
/* We know at this point that there are not currently any
pending cleanups. If, however, in the process of evaluating
the arguments we were to create some, we'll need to be
able to get rid of them. */
expand_start_target_temps ();
}
/* Don't let pending stack adjusts add up to too much.
Also, do all pending adjustments now if there is any chance
this might be a call to alloca or if we are expanding a sibling
......@@ -3093,14 +3080,6 @@ expand_call (tree exp, rtx target, int ignore)
if (args[i].aligned_regs)
free (args[i].aligned_regs);
if (pass == 0)
{
/* Undo the fake expand_start_target_temps we did earlier. If
there had been any cleanups created, we've already set
sibcall_failure. */
expand_end_target_temps ();
}
/* If this function is returning into a memory location marked as
readonly, it means it is initializing that location. We normally treat
functions as not clobbering such locations, so we need to specify that
......
......@@ -292,8 +292,6 @@ construct_init_block (void)
basic_block init_block, first_block;
edge e;
expand_start_bindings_and_block (0, NULL_TREE);
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
if (e->dest == ENTRY_BLOCK_PTR->next_bb)
break;
......@@ -341,8 +339,6 @@ construct_exit_block (void)
/* The following insns belong to the top scope. */
record_block_change (DECL_INITIAL (current_function_decl));
expand_end_bindings (NULL_TREE, 1, 0);
/* Generate rtl for function exit. */
expand_function_end ();
......
2004-07-21 Eric Christopher <echristo@redhat.com>
* decl.c (poplevel): Inline unused variable checking.
Change formatting.
2004-07-21 Paolo Bonzini <bonzini@gnu.org>
* typeck.c (build_binary_op): Do not use RDIV_EXPR for
......
......@@ -502,14 +502,6 @@ poplevel (int keep, int reverse, int functionbody)
else
decls = current_binding_level->names;
/* When not in function-at-a-time mode, expand_end_bindings will
warn about unused variables. But, in function-at-a-time mode
expand_end_bindings is not passed the list of variables in the
current scope, and therefore no warning is emitted. So, we
explicitly warn here. */
if (!processing_template_decl)
warn_about_unused_variables (getdecls ());
/* If there were any declarations or structure tags in that level,
or if this level is a function body,
create a BLOCK to record them for the life of this function. */
......@@ -534,6 +526,16 @@ poplevel (int keep, int reverse, int functionbody)
leaving_for_scope
= current_binding_level->kind == sk_for && flag_new_for_scope == 1;
/* Before we remove the declarations first check for unused variables. */
if (warn_unused_variable
&& !processing_template_decl)
for (decl = getdecls (); decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == VAR_DECL
&& ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
warning ("%Junused variable '%D'", decl, decl);
/* Remove declarations for all the DECLs in this level. */
for (link = decls; link; link = TREE_CHAIN (link))
{
......@@ -603,8 +605,10 @@ poplevel (int keep, int reverse, int functionbody)
{
/* Remove the binding. */
decl = link;
if (TREE_CODE (decl) == TREE_LIST)
decl = TREE_VALUE (decl);
if (DECL_P (decl))
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
......@@ -9080,6 +9084,7 @@ xref_basetypes (tree ref, tree base_list)
my_friendly_assert (TYPE_MAIN_VARIANT (ref) == ref, 20040712);
binfo = make_tree_binfo (max_bases);
TYPE_BINFO (ref) = binfo;
BINFO_OFFSET (binfo) = size_zero_node;
BINFO_TYPE (binfo) = ref;
......
......@@ -5861,11 +5861,6 @@ safe_from_p (rtx x, tree exp, int top_p)
case SAVE_EXPR:
return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
case BIND_EXPR:
/* The only operand we look at is operand 1. The rest aren't
part of the expression. */
return safe_from_p (x, TREE_OPERAND (exp, 1), 0);
default:
break;
}
......@@ -6063,23 +6058,6 @@ expand_var (tree var)
}
}
/* Expands declarations of variables in list VARS. */
static void
expand_vars (tree vars)
{
for (; vars; vars = TREE_CHAIN (vars))
{
tree var = vars;
if (DECL_EXTERNAL (var))
continue;
expand_var (var);
expand_decl_init (var);
}
}
/* Subroutine of expand_expr. Expand the two operands of a binary
expression EXP0 and EXP1 placing the results in OP0 and OP1.
The value may be stored in TARGET if TARGET is nonzero. The
......@@ -6624,31 +6602,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
expand_goto (LABELED_BLOCK_LABEL (EXIT_BLOCK_LABELED_BLOCK (exp)));
return const0_rtx;
case BIND_EXPR:
{
tree block = BIND_EXPR_BLOCK (exp);
int mark_ends;
/* If we're in functions-as-trees mode, this BIND_EXPR represents
the block, so we need to emit NOTE_INSN_BLOCK_* notes. */
mark_ends = (block != NULL_TREE);
expand_start_bindings_and_block (mark_ends ? 0 : 2, block);
/* If VARS have not yet been expanded, expand them now. */
expand_vars (BIND_EXPR_VARS (exp));
/* TARGET was clobbered early in this function. The correct
indicator or whether or not we need the value of this
expression is the IGNORE variable. */
temp = expand_expr (BIND_EXPR_BODY (exp),
ignore ? const0_rtx : target,
tmode, modifier);
expand_end_bindings (BIND_EXPR_VARS (exp), mark_ends, 0);
return temp;
}
case CONSTRUCTOR:
/* If we don't need the result, just ensure we evaluate any
subexpressions. */
......@@ -8617,6 +8570,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
case TARGET_EXPR:
case CASE_LABEL_EXPR:
case VA_ARG_EXPR:
case BIND_EXPR:
/* Lowered by gimplify.c. */
abort ();
......
......@@ -212,8 +212,6 @@ do { struct nesting *target = STACK; \
do { this = nesting_stack; \
if (cond_stack == this) \
cond_stack = cond_stack->next; \
if (block_stack == this) \
block_stack = block_stack->next; \
if (case_stack == this) \
case_stack = case_stack->next; \
nesting_depth = nesting_stack->depth - 1; \
......@@ -223,9 +221,6 @@ do { struct nesting *target = STACK; \
struct stmt_status GTY(())
{
/* Chain of all pending binding contours. */
struct nesting * x_block_stack;
/* If any new stacks are added here, add them to POPSTACKS too. */
/* Chain of all pending conditional statements. */
......@@ -249,7 +244,6 @@ struct stmt_status GTY(())
location_t x_emit_locus;
};
#define block_stack (cfun->stmt->x_block_stack)
#define cond_stack (cfun->stmt->x_cond_stack)
#define case_stack (cfun->stmt->x_case_stack)
#define nesting_stack (cfun->stmt->x_nesting_stack)
......@@ -2061,98 +2055,6 @@ expand_return (tree retval)
}
}
/* Generate the RTL code for entering a binding contour.
The variables are declared one by one, by calls to `expand_decl'.
FLAGS is a bitwise or of the following flags:
1 - Nonzero if this construct should be visible to
`exit_something'.
2 - Nonzero if this contour does not require a
NOTE_INSN_BLOCK_BEG note. Virtually all calls from
language-independent code should set this flag because they
will not create corresponding BLOCK nodes. (There should be
a one-to-one correspondence between NOTE_INSN_BLOCK_BEG notes
and BLOCKs.) If this flag is set, MARK_ENDS should be zero
when expand_end_bindings is called.
If we are creating a NOTE_INSN_BLOCK_BEG note, a BLOCK may
optionally be supplied. If so, it becomes the NOTE_BLOCK for the
note. */
void
expand_start_bindings_and_block (int flags, tree block)
{
struct nesting *thisblock = ALLOC_NESTING ();
rtx note;
int exit_flag = ((flags & 1) != 0);
int block_flag = ((flags & 2) == 0);
/* If a BLOCK is supplied, then the caller should be requesting a
NOTE_INSN_BLOCK_BEG note. */
if (!block_flag && block)
abort ();
/* Create a note to mark the beginning of the block. */
note = emit_note (NOTE_INSN_DELETED);
/* Make an entry on block_stack for the block we are entering. */
thisblock->desc = BLOCK_NESTING;
thisblock->next = block_stack;
thisblock->all = nesting_stack;
thisblock->depth = ++nesting_depth;
thisblock->data.block.block_target_temp_slot_level = target_temp_slot_level;
/* When we insert instructions after the last unconditional cleanup,
we don't adjust last_insn. That means that a later add_insn will
clobber the instructions we've just added. The easiest way to
fix this is to just insert another instruction here, so that the
instructions inserted after the last unconditional cleanup are
never the last instruction. */
emit_note (NOTE_INSN_DELETED);
thisblock->data.block.first_insn = note;
thisblock->data.block.block_start_count = ++current_block_start_count;
thisblock->exit_label = exit_flag ? gen_label_rtx () : 0;
block_stack = thisblock;
nesting_stack = thisblock;
/* Make a new level for allocating stack slots. */
push_temp_slots ();
}
/* Specify the scope of temporaries created by TARGET_EXPRs. Similar
to CLEANUP_POINT_EXPR, but handles cases when a series of calls to
expand_expr are made. After we end the region, we know that all
space for all temporaries that were created by TARGET_EXPRs will be
destroyed and their space freed for reuse. */
void
expand_start_target_temps (void)
{
/* This is so that even if the result is preserved, the space
allocated will be freed, as we know that it is no longer in use. */
push_temp_slots ();
/* Start a new binding layer that will keep track of all cleanup
actions to be performed. */
expand_start_bindings (2);
target_temp_slot_level = temp_slot_level;
}
void
expand_end_target_temps (void)
{
expand_end_bindings (NULL_TREE, 0, 0);
/* This is so that even if the result is preserved, the space
allocated will be freed, as we know that it is no longer in use. */
pop_temp_slots ();
}
/* Given a pointer to a BLOCK node return nonzero if (and only if) the node
in question represents the outermost pair of curly braces (i.e. the "body
block") of a function or method.
......@@ -2185,15 +2087,6 @@ is_body_block (tree stmt)
return 0;
}
/* Return an opaque pointer to the current nesting level, so frontend code
can check its own sanity. */
struct nesting *
current_nesting_level (void)
{
return cfun ? block_stack : 0;
}
/* Emit code to restore vital registers at the beginning of a nonlocal goto
handler. */
static void
......@@ -2264,70 +2157,6 @@ expand_nl_goto_receiver (void)
emit_insn (gen_rtx_ASM_INPUT (VOIDmode, ""));
}
/* Warn about any unused VARS (which may contain nodes other than
VAR_DECLs, but such nodes are ignored). The nodes are connected
via the TREE_CHAIN field. */
void
warn_about_unused_variables (tree vars)
{
tree decl;
if (warn_unused_variable)
for (decl = vars; decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == VAR_DECL
&& ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
warning ("%Junused variable '%D'", decl, decl);
}
/* Generate RTL code to terminate a binding contour.
VARS is the chain of VAR_DECL nodes for the variables bound in this
contour. There may actually be other nodes in this chain, but any
nodes other than VAR_DECLS are ignored.
MARK_ENDS is nonzero if we should put a note at the beginning
and end of this binding contour.
DONT_JUMP_IN is positive if it is not valid to jump into this contour,
zero if we can jump into this contour only if it does not have a saved
stack level, and negative if we are not to check for invalid use of
labels (because the front end does that). */
void
expand_end_bindings (tree vars, int mark_ends ATTRIBUTE_UNUSED,
int dont_jump_in ATTRIBUTE_UNUSED)
{
struct nesting *thisblock = block_stack;
/* If any of the variables in this scope were not used, warn the
user. */
warn_about_unused_variables (vars);
if (thisblock->exit_label)
{
do_pending_stack_adjust ();
emit_label (thisblock->exit_label);
}
/* Mark the beginning and end of the scope if requested. */
/* Get rid of the beginning-mark if we don't make an end-mark. */
NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED;
/* Restore the temporary level of TARGET_EXPRs. */
target_temp_slot_level = thisblock->data.block.block_target_temp_slot_level;
/* Restore block_stack level for containing block. */
POPSTACK (block_stack);
/* Pop the stack slot nesting and free any slots at this level. */
pop_temp_slots ();
}
/* Generate RTL for the automatic variable declaration DECL.
(Other kinds of declarations are simply ignored if seen here.) */
......
......@@ -3360,11 +3360,6 @@ extern void expand_stack_alloc (tree, tree);
extern rtx expand_stack_save (void);
extern void expand_stack_restore (tree);
extern void expand_return (tree);
extern void expand_start_bindings_and_block (int, tree);
#define expand_start_bindings(flags) \
expand_start_bindings_and_block(flags, NULL_TREE)
extern void expand_end_bindings (tree, int, int);
extern void warn_about_unused_variables (tree);
extern int is_body_block (tree);
extern struct nesting * current_nesting_level (void);
......@@ -3632,8 +3627,6 @@ extern void expand_asm_expr (tree);
extern bool asm_op_is_mem_input (tree, tree);
extern tree resolve_asm_operand_names (tree, tree, tree);
extern void init_stmt_for_function (void);
extern void expand_start_target_temps (void);
extern void expand_end_target_temps (void);
extern void expand_elseif (tree);
extern void expand_decl (tree);
extern void expand_anon_union_decl (tree, tree, 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