OSDN Git Service

* tree-ssa-structalias.c (ipa_pta_execute): Rename 'cfun' to
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2007 00:11:47 +0000 (00:11 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2007 00:11:47 +0000 (00:11 +0000)
'func'.
* tree-parloops.c (create_loop_fn): Use set_cfun.
* gengtype.c (open_base_files): Emit #undef cfun.
* ipa-struct-reorg.c (do_reorg_1): Use set_cfun.
* function.h (cfun): New define.
* function.c: Undefine cfun.

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

gcc/ChangeLog
gcc/function.c
gcc/function.h
gcc/gengtype.c
gcc/ipa-struct-reorg.c
gcc/tree-parloops.c
gcc/tree-ssa-structalias.c

index 7225fa4..7c00d0b 100644 (file)
@@ -1,3 +1,13 @@
+2007-11-07  Tom Tromey  <tromey@redhat.com>
+
+       * tree-ssa-structalias.c (ipa_pta_execute): Rename 'cfun' to
+       'func'. 
+       * tree-parloops.c (create_loop_fn): Use set_cfun.
+       * gengtype.c (open_base_files): Emit #undef cfun.
+       * ipa-struct-reorg.c (do_reorg_1): Use set_cfun.
+       * function.h (cfun): New define.
+       * function.c: Undefine cfun.
+
 2007-11-07  Eric B. Weddington  <eweddington@cso.atmel.com>
 
        * config/avr/avr.c (avr_mcu_types): Add attiny88.
index 56abe4d..f549c77 100644 (file)
@@ -66,6 +66,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "timevar.h"
 #include "vecprim.h"
 
+/* So we can assign to cfun in this file.  */
+#undef cfun
+
 #ifndef LOCAL_ALIGNMENT
 #define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
 #endif
index 27bde1c..ff71c9a 100644 (file)
@@ -466,6 +466,11 @@ struct function GTY(())
 /* The function currently being compiled.  */
 extern GTY(()) struct function *cfun;
 
+/* In order to ensure that cfun is not set directly, we redefine it so
+   that it is not an lvalue.  Rather than assign to cfun, use
+   push_cfun or set_cfun.  */
+#define cfun (cfun + 0)
+
 /* Pointer to chain of `struct function' for containing functions.  */
 extern GTY(()) struct function *outer_function_chain;
 
index 80acba0..ca7d5b4 100644 (file)
@@ -1543,6 +1543,10 @@ open_base_files (void)
     gtype_desc_c = create_file ("GCC", "gtype-desc.c");
     for (ifp = ifiles; *ifp; ifp++)
       oprintf (gtype_desc_c, "#include \"%s\"\n", *ifp);
+
+    /* Make sure we handle "cfun" specially.  */
+    oprintf (gtype_desc_c, "\n/* See definition in function.h.  */\n");
+    oprintf (gtype_desc_c, "#undef cfun\n");
   }
 }
 
index e4bc7fa..1985cec 100644 (file)
@@ -3628,7 +3628,7 @@ do_reorg_1 (void)
        pop_cfun ();
       }
 
-  cfun = NULL;
+  set_cfun (NULL);
 }
 
 /* This function creates new global struct variables.
index ca829f7..afa2ed5 100644 (file)
@@ -1,5 +1,5 @@
 /* Loop autoparallelization.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    Contributed by Sebastian Pop <pop@cri.ensmp.fr> and
    Zdenek Dvorak <dvorakz@suse.cz>.
 
@@ -1252,7 +1252,7 @@ create_loop_fn (void)
 
   /* The call to allocate_struct_function clobbers CFUN, so we need to restore
      it.  */
-  cfun = act_cfun;
+  set_cfun (act_cfun);
 
   return decl;
 }
index 90c1d47..b175d25 100644 (file)
@@ -5561,17 +5561,17 @@ ipa_pta_execute (void)
     {
       if (node->analyzed && cgraph_is_master_clone (node))
        {
-         struct function *cfun = DECL_STRUCT_FUNCTION (node->decl);
+         struct function *func = DECL_STRUCT_FUNCTION (node->decl);
          basic_block bb;
          tree old_func_decl = current_function_decl;
          if (dump_file)
            fprintf (dump_file,
                     "Generating constraints for %s\n",
                     cgraph_node_name (node));
-         push_cfun (cfun);
+         push_cfun (func);
          current_function_decl = node->decl;
 
-         FOR_EACH_BB_FN (bb, cfun)
+         FOR_EACH_BB_FN (bb, func)
            {
              block_stmt_iterator bsi;
              tree phi;