diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-26 17:27:24 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-26 17:27:24 -0700 |
commit | 525c6bf5a6b91fa09f57b79bad9737ab3733601d (patch) | |
tree | 1e34e5e9ca494cf80b9eeedaeeb9ab699cb921c7 /gcc | |
parent | 81d1fb087780b62dbbb3994dfeeb93f76a9773cc (diff) | |
download | gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.zip gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.tar.gz gcc-525c6bf5a6b91fa09f57b79bad9737ab3733601d.tar.bz2 |
tree.c (staticp): Return the static object.
* tree.c (staticp): Return the static object.
* tree.h (staticp): Update decl.
* langhooks.h (struct lang_hooks): Change staticp return type to tree.
* langhooks.c (lhd_staticp): Return NULL_TREE.
* langhooks-def.h (lhd_staticp): Update decl.
* c-common.c (c_staticp): Return the static object.
* c-common.h (c_staticp): Update decl.
From-SVN: r86650
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/c-common.c | 9 | ||||
-rw-r--r-- | gcc/c-common.h | 2 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.c | 4 | ||||
-rw-r--r-- | gcc/langhooks.h | 2 | ||||
-rw-r--r-- | gcc/tree.c | 25 | ||||
-rw-r--r-- | gcc/tree.h | 6 |
8 files changed, 33 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 802f45c..cf1dc09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2004-08-26 Richard Henderson <rth@redhat.com> + * tree.c (staticp): Return the static object. + * tree.h (staticp): Update decl. + * langhooks.h (struct lang_hooks): Change staticp return type to tree. + * langhooks.c (lhd_staticp): Return NULL_TREE. + * langhooks-def.h (lhd_staticp): Update decl. + * c-common.c (c_staticp): Return the static object. + * c-common.h (c_staticp): Update decl. + +2004-08-26 Richard Henderson <rth@redhat.com> + * config/alpha/alpha.h (HARD_REGNO_MODE_OK): Allow complex float modes. diff --git a/gcc/c-common.c b/gcc/c-common.c index 7e691660..8b7ee2c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3828,13 +3828,12 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, /* Hook used by staticp to handle language-specific tree codes. */ -bool +tree c_staticp (tree exp) { - if (TREE_CODE (exp) == COMPOUND_LITERAL_EXPR - && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp))) - return true; - return false; + return (TREE_CODE (exp) == COMPOUND_LITERAL_EXPR + && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp)) + ? exp : NULL); } diff --git a/gcc/c-common.h b/gcc/c-common.h index 1c9286e..94f3249 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -840,7 +840,7 @@ extern int vector_types_convertible_p (tree t1, tree t2); extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *); -extern bool c_staticp (tree); +extern tree c_staticp (tree); extern int c_common_unsafe_for_reeval (tree); diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 06e3c02..087fe41 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -50,7 +50,7 @@ extern tree lhd_return_null_tree_v (void); extern tree lhd_return_null_tree (tree); extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); extern int lhd_safe_from_p (rtx, tree); -extern bool lhd_staticp (tree); +extern tree lhd_staticp (tree); extern void lhd_print_tree_nothing (FILE *, tree, int); extern const char *lhd_decl_printable_name (tree, int); extern int lhd_types_compatible_p (tree, tree); diff --git a/gcc/langhooks.c b/gcc/langhooks.c index e932042..9f0a236 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -125,10 +125,10 @@ lhd_safe_from_p (rtx ARG_UNUSED (x), tree ARG_UNUSED (exp)) /* Called from staticp. */ -bool +tree lhd_staticp (tree ARG_UNUSED (exp)) { - return false; + return NULL; } /* Called from check_global_declarations. */ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 586db38..9853252 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -299,7 +299,7 @@ struct lang_hooks bool (*mark_addressable) (tree); /* Hook called by staticp for language-specific tree codes. */ - bool (*staticp) (tree); + tree (*staticp) (tree); /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the DECL_NODE with a newly GC-allocated copy. */ @@ -1366,7 +1366,7 @@ array_type_nelts (tree type) /* Return true if arg is static -- a reference to an object in static storage. This is not the same as the C meaning of `static'. */ -bool +tree staticp (tree arg) { switch (TREE_CODE (arg)) @@ -1375,19 +1375,21 @@ staticp (tree arg) /* Nested functions aren't static, since taking their address involves a trampoline. */ return ((decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg)) - && ! DECL_NON_ADDR_CONST_P (arg)); + && ! DECL_NON_ADDR_CONST_P (arg) + ? arg : NULL); case VAR_DECL: return ((TREE_STATIC (arg) || DECL_EXTERNAL (arg)) && ! DECL_THREAD_LOCAL (arg) - && ! DECL_NON_ADDR_CONST_P (arg)); + && ! DECL_NON_ADDR_CONST_P (arg) + ? arg : NULL); case CONSTRUCTOR: - return TREE_STATIC (arg); + return TREE_STATIC (arg) ? arg : NULL; case LABEL_DECL: case STRING_CST: - return true; + return arg; case COMPONENT_REF: /* If the thing being referenced is not a field, then it is @@ -1398,20 +1400,15 @@ staticp (tree arg) /* If we are referencing a bitfield, we can't evaluate an ADDR_EXPR at compile time and so it isn't a constant. */ if (DECL_BIT_FIELD (TREE_OPERAND (arg, 1))) - return false; + return NULL; return staticp (TREE_OPERAND (arg, 0)); case BIT_FIELD_REF: - return false; + return NULL; -#if 0 - /* This case is technically correct, but results in setting - TREE_CONSTANT on ADDR_EXPRs that cannot be evaluated at - compile time. */ case INDIRECT_REF: - return TREE_CONSTANT (TREE_OPERAND (arg, 0)); -#endif + return TREE_CONSTANT (TREE_OPERAND (arg, 0)) ? arg : NULL; case ARRAY_REF: case ARRAY_RANGE_REF: @@ -1426,7 +1423,7 @@ staticp (tree arg) >= (unsigned int) LAST_AND_UNUSED_TREE_CODE) return lang_hooks.staticp (arg); else - return false; + return NULL; } } @@ -3184,10 +3184,10 @@ extern int integer_pow2p (tree); extern int integer_nonzerop (tree); -/* staticp (tree x) is true if X is a reference to data allocated - at a fixed address in memory. */ +/* staticp (tree x) is nonzero if X is a reference to data allocated + at a fixed address in memory. Returns the outermost data. */ -extern bool staticp (tree); +extern tree staticp (tree); /* save_expr (EXP) returns an expression equivalent to EXP but it can be used multiple times within context CTX |