Commit 61d6b1cc by Mike Stump

expr.c (expand_expr, [...]): All cleanups have to be protected by interim exception handling code.

        * expr.c (expand_expr, defer_cleanups_to, expand_cleanups_to): All
        cleanups have to be protected by interim exception handling code.
        * stmt.c (expand_decl_cleanup, expand_cleanups): Ditto.
        * toplev.c (interim_eh_hook): Hook for interim exception handling.
        * toplev.c (interim_eh): Default implementation for exception
        handling that does nothing.
        * toplev.c (main): Set default for interim_eh_hook.

From-SVN: r7666
parent 6bc55d05
...@@ -180,6 +180,7 @@ static void do_jump_for_compare PROTO((rtx, rtx, rtx)); ...@@ -180,6 +180,7 @@ static void do_jump_for_compare PROTO((rtx, rtx, rtx));
static rtx compare PROTO((tree, enum rtx_code, enum rtx_code)); static rtx compare PROTO((tree, enum rtx_code, enum rtx_code));
static rtx do_store_flag PROTO((tree, rtx, enum machine_mode, int)); static rtx do_store_flag PROTO((tree, rtx, enum machine_mode, int));
static tree defer_cleanups_to PROTO((tree)); static tree defer_cleanups_to PROTO((tree));
extern void (*interim_eh_hook) PROTO((tree));
/* Record for each mode whether we can move a register directly to or /* Record for each mode whether we can move a register directly to or
from an object of that mode in memory. If we can't, we won't try from an object of that mode in memory. If we can't, we won't try
...@@ -4616,6 +4617,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4616,6 +4617,7 @@ expand_expr (exp, target, tmode, modifier)
= tree_cons (NULL_TREE, TREE_OPERAND (exp, 2), cleanups_this_call); = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2), cleanups_this_call);
/* That's it for this cleanup. */ /* That's it for this cleanup. */
TREE_OPERAND (exp, 2) = 0; TREE_OPERAND (exp, 2) = 0;
(*interim_eh_hook) (NULL_TREE);
} }
return RTL_EXPR_RTL (exp); return RTL_EXPR_RTL (exp);
...@@ -5657,12 +5659,14 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5657,12 +5659,14 @@ expand_expr (exp, target, tmode, modifier)
/* Now add in the conditionalized cleanups. */ /* Now add in the conditionalized cleanups. */
cleanups_this_call cleanups_this_call
= tree_cons (NULL_TREE, new_cleanups, cleanups_this_call); = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
(*interim_eh_hook) (NULL_TREE);
} }
return temp; return temp;
} }
case TARGET_EXPR: case TARGET_EXPR:
{ {
int need_exception_region = 0;
/* Something needs to be initialized, but we didn't know /* Something needs to be initialized, but we didn't know
where that thing was when building the tree. For example, where that thing was when building the tree. For example,
it could be the return value of a function, or a parameter it could be the return value of a function, or a parameter
...@@ -5674,6 +5678,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5674,6 +5678,7 @@ expand_expr (exp, target, tmode, modifier)
tree slot = TREE_OPERAND (exp, 0); tree slot = TREE_OPERAND (exp, 0);
tree exp1; tree exp1;
rtx temp;
if (TREE_CODE (slot) != VAR_DECL) if (TREE_CODE (slot) != VAR_DECL)
abort (); abort ();
...@@ -5709,6 +5714,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5709,6 +5714,7 @@ expand_expr (exp, target, tmode, modifier)
cleanups_this_call = tree_cons (NULL_TREE, cleanups_this_call = tree_cons (NULL_TREE,
TREE_OPERAND (exp, 2), TREE_OPERAND (exp, 2),
cleanups_this_call); cleanups_this_call);
need_exception_region = 1;
} }
} }
} }
...@@ -5738,7 +5744,12 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5738,7 +5744,12 @@ expand_expr (exp, target, tmode, modifier)
/* Mark it as expanded. */ /* Mark it as expanded. */
TREE_OPERAND (exp, 1) = NULL_TREE; TREE_OPERAND (exp, 1) = NULL_TREE;
return expand_expr (exp1, target, tmode, modifier); temp = expand_expr (exp1, target, tmode, modifier);
if (need_exception_region)
(*interim_eh_hook) (NULL_TREE);
return temp;
} }
case INIT_EXPR: case INIT_EXPR:
...@@ -8279,6 +8290,7 @@ defer_cleanups_to (old_cleanups) ...@@ -8279,6 +8290,7 @@ defer_cleanups_to (old_cleanups)
while (cleanups_this_call != old_cleanups) while (cleanups_this_call != old_cleanups)
{ {
(*interim_eh_hook) (TREE_VALUE (cleanups_this_call));
cleanups_this_call = TREE_CHAIN (cleanups_this_call); cleanups_this_call = TREE_CHAIN (cleanups_this_call);
} }
...@@ -8314,6 +8326,7 @@ expand_cleanups_to (old_cleanups) ...@@ -8314,6 +8326,7 @@ expand_cleanups_to (old_cleanups)
{ {
while (cleanups_this_call != old_cleanups) while (cleanups_this_call != old_cleanups)
{ {
(*interim_eh_hook) (TREE_VALUE (cleanups_this_call));
expand_expr (TREE_VALUE (cleanups_this_call), const0_rtx, VOIDmode, 0); expand_expr (TREE_VALUE (cleanups_this_call), const0_rtx, VOIDmode, 0);
cleanups_this_call = TREE_CHAIN (cleanups_this_call); cleanups_this_call = TREE_CHAIN (cleanups_this_call);
} }
......
...@@ -138,6 +138,8 @@ extern tree rtl_expr_chain; ...@@ -138,6 +138,8 @@ extern tree rtl_expr_chain;
static tree empty_cleanup_list; static tree empty_cleanup_list;
#endif #endif
extern void (*interim_eh_hook) PROTO((tree));
/* Functions and data structures for expanding case statements. */ /* Functions and data structures for expanding case statements. */
/* Case label structure, used to hold info on labels within case /* Case label structure, used to hold info on labels within case
...@@ -3483,6 +3485,7 @@ expand_decl_cleanup (decl, cleanup) ...@@ -3483,6 +3485,7 @@ expand_decl_cleanup (decl, cleanup)
= temp_tree_cons (decl, cleanup, thisblock->data.block.cleanups); = temp_tree_cons (decl, cleanup, thisblock->data.block.cleanups);
/* If this block has a cleanup, it belongs in stack_block_stack. */ /* If this block has a cleanup, it belongs in stack_block_stack. */
stack_block_stack = thisblock; stack_block_stack = thisblock;
(*interim_eh_hook) (NULL_TREE);
} }
return 1; return 1;
} }
...@@ -3562,6 +3565,8 @@ expand_cleanups (list, dont_do) ...@@ -3562,6 +3565,8 @@ expand_cleanups (list, dont_do)
expand_cleanups (TREE_VALUE (tail), dont_do); expand_cleanups (TREE_VALUE (tail), dont_do);
else else
{ {
(*interim_eh_hook) (TREE_VALUE (tail));
/* Cleanups may be run multiple times. For example, /* Cleanups may be run multiple times. For example,
when exiting a binding contour, we expand the when exiting a binding contour, we expand the
cleanups associated with that contour. When a goto cleanups associated with that contour. When a goto
......
...@@ -254,6 +254,12 @@ struct rtx_def *(*lang_expand_expr) (); ...@@ -254,6 +254,12 @@ struct rtx_def *(*lang_expand_expr) ();
void (*incomplete_decl_finalize_hook) () = 0; void (*incomplete_decl_finalize_hook) () = 0;
/* Pointer to function for interim exception handling implementation.
This interface will change, and it is only here until a better interface
replaces it. */
void (*interim_eh_hook) PROTO((tree));
/* Nonzero if generating code to do profiling. */ /* Nonzero if generating code to do profiling. */
int profile_flag = 0; int profile_flag = 0;
...@@ -997,6 +1003,15 @@ decl_name (decl, kind) ...@@ -997,6 +1003,15 @@ decl_name (decl, kind)
return IDENTIFIER_POINTER (DECL_NAME (decl)); return IDENTIFIER_POINTER (DECL_NAME (decl));
} }
/* This is the default interim_eh_hook function. */
void
interim_eh (finalization)
tree finalization;
{
/* Don't do anything by default. */
}
static int need_error_newline; static int need_error_newline;
/* Function of last error message; /* Function of last error message;
...@@ -3341,6 +3356,7 @@ main (argc, argv, envp) ...@@ -3341,6 +3356,7 @@ main (argc, argv, envp)
decl_printable_name = decl_name; decl_printable_name = decl_name;
lang_expand_expr = (struct rtx_def *(*)()) do_abort; lang_expand_expr = (struct rtx_def *(*)()) do_abort;
interim_eh_hook = interim_eh;
/* Initialize whether `char' is signed. */ /* Initialize whether `char' is signed. */
flag_signed_char = DEFAULT_SIGNED_CHAR; flag_signed_char = DEFAULT_SIGNED_CHAR;
......
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