aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index c8153b8..a6b17da 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5624,15 +5624,22 @@ in_array_bounds_p (tree ref)
return true;
}
+/* Return true if T (assumed to be a DECL) is a global variable. */
+
+bool
+is_global_var (tree t)
+{
+ return (TREE_STATIC (t) || DECL_EXTERNAL (t));
+}
+
/* Return true if T (assumed to be a DECL) must be assigned a memory
location. */
bool
needs_to_live_in_memory (tree t)
{
- return (DECL_NEEDS_TO_LIVE_IN_MEMORY_INTERNAL (t)
- || TREE_STATIC (t)
- || DECL_EXTERNAL (t)
+ return (TREE_ADDRESSABLE (t)
+ || is_global_var (t)
|| (TREE_CODE (t) == RESULT_DECL
&& aggregate_value_p (t, current_function_decl)));
}