c-common.c (c_unsafe_for_reeval): New function.

* c-common.c (c_unsafe_for_reeval): New function.
        (add_c_tree_codes): Register it.
        * c-common.h: Declare it.
        * tree.c (lang_unsafe_for_reeval): New hook.
        (unsafe_for_reeval): Call it.
        * tree.h: Declare it.

From-SVN: r37623
This commit is contained in:
Richard Henderson 2000-11-21 11:09:38 -08:00 committed by Richard Henderson
parent 3adbce3d89
commit 3fe30ff6f7
5 changed files with 40 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2000-11-21 Richard Henderson <rth@redhat.com>
* c-common.c (c_unsafe_for_reeval): New function.
(add_c_tree_codes): Register it.
* c-common.h: Declare it.
* tree.c (lang_unsafe_for_reeval): New hook.
(unsafe_for_reeval): Call it.
* tree.h: Declare it.
2000-11-21 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (i386_simplify_dwarf_addr): Simplify @GOT

View file

@ -5924,6 +5924,20 @@ c_safe_from_p (target, exp)
return 1;
}
/* Hook used by unsafe_for_reeval to handle language-specific tree codes. */
int
c_unsafe_for_reeval (exp)
tree exp;
{
/* Statement expressions may not be reevaluated. */
if (TREE_CODE (exp) == STMT_EXPR)
return 2;
/* Walk all other expressions. */
return -1;
}
/* Tree code classes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
@ -5971,6 +5985,7 @@ add_c_tree_codes ()
memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
c_tree_code_name,
(LAST_C_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
lang_unsafe_for_reeval = c_unsafe_for_reeval;
}
#define CALLED_AS_BUILT_IN(NODE) \

View file

@ -757,9 +757,10 @@ extern struct rtx_def *c_expand_expr PARAMS ((tree, rtx,
enum expand_modifier));
extern int c_safe_from_p PARAMS ((rtx, tree));
#endif
extern int c_unsafe_for_reeval PARAMS ((tree));
/* In dump.c */
typedef struct dump_info *dump_info_p;

View file

@ -179,6 +179,9 @@ static void finish_vector_type PARAMS((tree));
void (*lang_unsave) PARAMS ((tree *));
void (*lang_unsave_expr_now) PARAMS ((tree));
/* If non-null, these are language-specific helper functions for
unsafe_for_reeval. Return negative to not handle some tree. */
int (*lang_unsafe_for_reeval) PARAMS ((tree));
tree global_trees[TI_MAX];
tree integer_types[itk_none];
@ -1778,7 +1781,12 @@ unsafe_for_reeval (expr)
break;
default:
/* ??? Add a lang hook if it becomes necessary. */
if (lang_unsafe_for_reeval != 0)
{
tmp = (*lang_unsafe_for_reeval) (expr);
if (tmp >= 0)
return tmp;
}
break;
}

View file

@ -2255,7 +2255,11 @@ extern void (*lang_unsave_expr_now) PARAMS ((tree));
/* Return 0 if it is safe to evaluate EXPR multiple times,
return 1 if it is safe if EXPR is unsaved afterward, or
return 2 if it is completely unsafe. */
extern int unsafe_for_reeval PARAMS ((tree));
extern int unsafe_for_reeval PARAMS ((tree));
/* If non-null, these are language-specific helper functions for
unsafe_for_reeval. Return negative to not handle some tree. */
extern int (*lang_unsafe_for_reeval) PARAMS ((tree));
/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
or offset that depends on a field within a record.