aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/function.c3
-rw-r--r--gcc/function.h5
-rw-r--r--gcc/gengtype.c4
-rw-r--r--gcc/ipa-struct-reorg.c2
-rw-r--r--gcc/tree-parloops.c4
-rw-r--r--gcc/tree-ssa-structalias.c6
7 files changed, 28 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7225fa4..7c00d0b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/function.c b/gcc/function.c
index 56abe4d..f549c77 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -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
diff --git a/gcc/function.h b/gcc/function.h
index 27bde1c..ff71c9a 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -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;
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 80acba0..ca7d5b4 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -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");
}
}
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index e4bc7fa..1985cec 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -3628,7 +3628,7 @@ do_reorg_1 (void)
pop_cfun ();
}
- cfun = NULL;
+ set_cfun (NULL);
}
/* This function creates new global struct variables.
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index ca829f7..afa2ed5 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -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;
}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 90c1d47..b175d25 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -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;