* tree-nested.c (finalize_nesting_tree_1): Declare the
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Jun 2009 06:17:51 +0000 (06:17 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Jun 2009 06:17:51 +0000 (06:17 +0000)
frame_decl in the binding tree.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148198 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-nested.c

index 2daa2ff..5dc609e 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-05  Alexandre Oliva  <aoliva@redhat.com>
+
+       * tree-nested.c (finalize_nesting_tree_1): Declare the
+       frame_decl in the binding tree.
+
 2009-06-04  Cary Coutant  <ccoutant@google.com>
 
        * basic-block.h (struct basic_block_def): Add discriminator field.
index e45f8de..df55770 100644 (file)
@@ -1,5 +1,5 @@
 /* Nested function decomposition for GIMPLE.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -2179,10 +2179,26 @@ finalize_nesting_tree_1 (struct nesting_info *root)
       /* In some cases the frame type will trigger the -Wpadded warning.
         This is not helpful; suppress it. */
       int save_warn_padded = warn_padded;
+      tree *adjust;
+
       warn_padded = 0;
       layout_type (root->frame_type);
       warn_padded = save_warn_padded;
       layout_decl (root->frame_decl, 0);
+
+      /* Remove root->frame_decl from root->new_local_var_chain, so
+        that we can declare it also in the lexical blocks, which
+        helps ensure virtual regs that end up appearing in its RTL
+        expression get substituted in instantiate_virtual_regs().  */
+      for (adjust = &root->new_local_var_chain;
+          *adjust != root->frame_decl;
+          adjust = &TREE_CHAIN (*adjust))
+       gcc_assert (TREE_CHAIN (*adjust));
+      *adjust = TREE_CHAIN (*adjust);
+
+      TREE_CHAIN (root->frame_decl) = NULL_TREE;
+      declare_vars (root->frame_decl,
+                   gimple_seq_first_stmt (gimple_body (context)), true);
     }
 
   /* If any parameters were referenced non-locally, then we need to