Commit 525c6bf5 by Richard Henderson Committed by Richard Henderson

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
parent 81d1fb08
2004-08-26 Richard Henderson <rth@redhat.com> 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 * config/alpha/alpha.h (HARD_REGNO_MODE_OK): Allow complex float
modes. modes.
......
...@@ -3828,13 +3828,12 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, ...@@ -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. */ /* Hook used by staticp to handle language-specific tree codes. */
bool tree
c_staticp (tree exp) c_staticp (tree exp)
{ {
if (TREE_CODE (exp) == COMPOUND_LITERAL_EXPR return (TREE_CODE (exp) == COMPOUND_LITERAL_EXPR
&& TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp))) && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp))
return true; ? exp : NULL);
return false;
} }
......
...@@ -840,7 +840,7 @@ extern int vector_types_convertible_p (tree t1, tree t2); ...@@ -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 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); extern int c_common_unsafe_for_reeval (tree);
......
...@@ -50,7 +50,7 @@ extern tree lhd_return_null_tree_v (void); ...@@ -50,7 +50,7 @@ extern tree lhd_return_null_tree_v (void);
extern tree lhd_return_null_tree (tree); extern tree lhd_return_null_tree (tree);
extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
extern int lhd_safe_from_p (rtx, tree); 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 void lhd_print_tree_nothing (FILE *, tree, int);
extern const char *lhd_decl_printable_name (tree, int); extern const char *lhd_decl_printable_name (tree, int);
extern int lhd_types_compatible_p (tree, tree); extern int lhd_types_compatible_p (tree, tree);
......
...@@ -125,10 +125,10 @@ lhd_safe_from_p (rtx ARG_UNUSED (x), tree ARG_UNUSED (exp)) ...@@ -125,10 +125,10 @@ lhd_safe_from_p (rtx ARG_UNUSED (x), tree ARG_UNUSED (exp))
/* Called from staticp. */ /* Called from staticp. */
bool tree
lhd_staticp (tree ARG_UNUSED (exp)) lhd_staticp (tree ARG_UNUSED (exp))
{ {
return false; return NULL;
} }
/* Called from check_global_declarations. */ /* Called from check_global_declarations. */
......
...@@ -299,7 +299,7 @@ struct lang_hooks ...@@ -299,7 +299,7 @@ struct lang_hooks
bool (*mark_addressable) (tree); bool (*mark_addressable) (tree);
/* Hook called by staticp for language-specific tree codes. */ /* 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 /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
DECL_NODE with a newly GC-allocated copy. */ DECL_NODE with a newly GC-allocated copy. */
......
...@@ -1366,7 +1366,7 @@ array_type_nelts (tree type) ...@@ -1366,7 +1366,7 @@ array_type_nelts (tree type)
/* Return true if arg is static -- a reference to an object in /* 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'. */ static storage. This is not the same as the C meaning of `static'. */
bool tree
staticp (tree arg) staticp (tree arg)
{ {
switch (TREE_CODE (arg)) switch (TREE_CODE (arg))
...@@ -1375,19 +1375,21 @@ staticp (tree arg) ...@@ -1375,19 +1375,21 @@ staticp (tree arg)
/* Nested functions aren't static, since taking their address /* Nested functions aren't static, since taking their address
involves a trampoline. */ involves a trampoline. */
return ((decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg)) 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: case VAR_DECL:
return ((TREE_STATIC (arg) || DECL_EXTERNAL (arg)) return ((TREE_STATIC (arg) || DECL_EXTERNAL (arg))
&& ! DECL_THREAD_LOCAL (arg) && ! DECL_THREAD_LOCAL (arg)
&& ! DECL_NON_ADDR_CONST_P (arg)); && ! DECL_NON_ADDR_CONST_P (arg)
? arg : NULL);
case CONSTRUCTOR: case CONSTRUCTOR:
return TREE_STATIC (arg); return TREE_STATIC (arg) ? arg : NULL;
case LABEL_DECL: case LABEL_DECL:
case STRING_CST: case STRING_CST:
return true; return arg;
case COMPONENT_REF: case COMPONENT_REF:
/* If the thing being referenced is not a field, then it is /* If the thing being referenced is not a field, then it is
...@@ -1398,20 +1400,15 @@ staticp (tree arg) ...@@ -1398,20 +1400,15 @@ staticp (tree arg)
/* If we are referencing a bitfield, we can't evaluate an /* If we are referencing a bitfield, we can't evaluate an
ADDR_EXPR at compile time and so it isn't a constant. */ ADDR_EXPR at compile time and so it isn't a constant. */
if (DECL_BIT_FIELD (TREE_OPERAND (arg, 1))) if (DECL_BIT_FIELD (TREE_OPERAND (arg, 1)))
return false; return NULL;
return staticp (TREE_OPERAND (arg, 0)); return staticp (TREE_OPERAND (arg, 0));
case BIT_FIELD_REF: 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: case INDIRECT_REF:
return TREE_CONSTANT (TREE_OPERAND (arg, 0)); return TREE_CONSTANT (TREE_OPERAND (arg, 0)) ? arg : NULL;
#endif
case ARRAY_REF: case ARRAY_REF:
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
...@@ -1426,7 +1423,7 @@ staticp (tree arg) ...@@ -1426,7 +1423,7 @@ staticp (tree arg)
>= (unsigned int) LAST_AND_UNUSED_TREE_CODE) >= (unsigned int) LAST_AND_UNUSED_TREE_CODE)
return lang_hooks.staticp (arg); return lang_hooks.staticp (arg);
else else
return false; return NULL;
} }
} }
......
...@@ -3184,10 +3184,10 @@ extern int integer_pow2p (tree); ...@@ -3184,10 +3184,10 @@ extern int integer_pow2p (tree);
extern int integer_nonzerop (tree); extern int integer_nonzerop (tree);
/* staticp (tree x) is true if X is a reference to data allocated /* staticp (tree x) is nonzero if X is a reference to data allocated
at a fixed address in memory. */ 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 /* save_expr (EXP) returns an expression equivalent to EXP
but it can be used multiple times within context CTX but it can be used multiple times within context CTX
......
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