* 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
+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
/* 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);
}
\f
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 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);
/* Called from staticp. */
-bool
+tree
lhd_staticp (tree ARG_UNUSED (exp))
{
- return false;
+ return NULL;
}
/* Called from check_global_declarations. */
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. */
/* 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))
/* 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
/* 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:
>= (unsigned int) LAST_AND_UNUSED_TREE_CODE)
return lang_hooks.staticp (arg);
else
- return false;
+ return NULL;
}
}
\f
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