aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1995-02-28 15:05:01 -0800
committerPer Bothner <bothner@gcc.gnu.org>1995-02-28 15:05:01 -0800
commit7c38c3ad5e0d6123089abf8249641df57aab5f42 (patch)
tree293d65753f9edcbd0d5c06bad7f132a177ce6ca1 /gcc
parentdc4f83ca6a03f9c3351501bedabd4ad30b28ed34 (diff)
downloadgcc-7c38c3ad5e0d6123089abf8249641df57aab5f42.zip
gcc-7c38c3ad5e0d6123089abf8249641df57aab5f42.tar.gz
gcc-7c38c3ad5e0d6123089abf8249641df57aab5f42.tar.bz2
expr.c (expand_expr): If non-local variable is expanded...
* expr.c (expand_expr): If non-local variable is expanded, set FUNCTION_NEEDS_STATIC_CHAIN (current_function_decl). * expr.c (expand_expr case ADDR_EXPR): Check for trampoline using FUNCTION_NEEDS_STATIC_CHAIN, instead of decl_function_context. From-SVN: r9095
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index cd0472d..7787593 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4148,6 +4148,15 @@ expand_expr (exp, target, tmode, modifier)
/* Mark as non-local and addressable. */
DECL_NONLOCAL (exp) = 1;
+
+ /* This is currently too late to be useful, since
+ init_function_start needs to know whether a static chain
+ is needed. However, it would be a useful optimization
+ if we could defer setting up static chains and trampolines
+ until we see that we actually need them due to references
+ to non-local non-static variables. */
+ FUNCTION_NEEDS_STATIC_CHAIN (current_function_decl) = 1;
+
mark_addressable (exp);
if (GET_CODE (DECL_RTL (exp)) != MEM)
abort ();
@@ -6178,7 +6187,7 @@ expand_expr (exp, target, tmode, modifier)
/* Are we taking the address of a nested function? */
if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL
- && decl_function_context (TREE_OPERAND (exp, 0)) != 0)
+ && FUNCTION_NEEDS_STATIC_CHAIN (TREE_OPERAND (exp, 0)))
{
op0 = trampoline_address (TREE_OPERAND (exp, 0));
op0 = force_operand (op0, target);