aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+gcc@tbsaunde.org>2016-07-13 02:43:43 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2016-07-13 02:43:43 +0000
commit37a5199721af7f322f681cd17efb673d70209d52 (patch)
tree6743a0203c0e5509e7021bc68d14dec280c80387 /gcc
parent3cc578b969fb0000072519ed61312ee6ad0f0197 (diff)
downloadgcc-37a5199721af7f322f681cd17efb673d70209d52.zip
gcc-37a5199721af7f322f681cd17efb673d70209d52.tar.gz
gcc-37a5199721af7f322f681cd17efb673d70209d52.tar.bz2
ipa.c: remove static_{ctors,dtors} globals
gcc/ChangeLog: 2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * ipa.c (record_cdtor_fn): Adjust. (build_cdtor_fns): Likewise. (ipa_cdtor_merge): Make static_ctors and static_dtors local variables. From-SVN: r238281
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa.c37
2 files changed, 24 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 16198c1..1e15b96 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+ * ipa.c (record_cdtor_fn): Adjust.
+ (build_cdtor_fns): Likewise.
+ (ipa_cdtor_merge): Make static_ctors and static_dtors local
+ variables.
+
+2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
* genextract.c (struct accum_extract): Add constructor and make
members auto_vec.
(gen_insn): Adjust.
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 6722d3b..2609e32 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -989,11 +989,6 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
cgraph_build_static_cdtor_1 (which, body, priority, false);
}
-/* A vector of FUNCTION_DECLs declared as static constructors. */
-static vec<tree> static_ctors;
-/* A vector of FUNCTION_DECLs declared as static destructors. */
-static vec<tree> static_dtors;
-
/* When target does not have ctors and dtors, we call all constructor
and destructor by special initialization/destruction function
recognized by collect2.
@@ -1002,12 +997,12 @@ static vec<tree> static_dtors;
destructors and turn them into normal functions. */
static void
-record_cdtor_fn (struct cgraph_node *node)
+record_cdtor_fn (struct cgraph_node *node, vec<tree> *ctors, vec<tree> *dtors)
{
if (DECL_STATIC_CONSTRUCTOR (node->decl))
- static_ctors.safe_push (node->decl);
+ ctors->safe_push (node->decl);
if (DECL_STATIC_DESTRUCTOR (node->decl))
- static_dtors.safe_push (node->decl);
+ dtors->safe_push (node->decl);
node = cgraph_node::get (node->decl);
DECL_DISREGARD_INLINE_LIMITS (node->decl) = 1;
}
@@ -1018,7 +1013,7 @@ record_cdtor_fn (struct cgraph_node *node)
they are destructors. */
static void
-build_cdtor (bool ctor_p, vec<tree> cdtors)
+build_cdtor (bool ctor_p, const vec<tree> &cdtors)
{
size_t i,j;
size_t len = cdtors.length ();
@@ -1135,20 +1130,20 @@ compare_dtor (const void *p1, const void *p2)
functions have magic names which are detected by collect2. */
static void
-build_cdtor_fns (void)
+build_cdtor_fns (vec<tree> *ctors, vec<tree> *dtors)
{
- if (!static_ctors.is_empty ())
+ if (!ctors->is_empty ())
{
gcc_assert (!targetm.have_ctors_dtors || in_lto_p);
- static_ctors.qsort (compare_ctor);
- build_cdtor (/*ctor_p=*/true, static_ctors);
+ ctors->qsort (compare_ctor);
+ build_cdtor (/*ctor_p=*/true, *ctors);
}
- if (!static_dtors.is_empty ())
+ if (!dtors->is_empty ())
{
gcc_assert (!targetm.have_ctors_dtors || in_lto_p);
- static_dtors.qsort (compare_dtor);
- build_cdtor (/*ctor_p=*/false, static_dtors);
+ dtors->qsort (compare_dtor);
+ build_cdtor (/*ctor_p=*/false, *dtors);
}
}
@@ -1161,14 +1156,16 @@ build_cdtor_fns (void)
static unsigned int
ipa_cdtor_merge (void)
{
+ /* A vector of FUNCTION_DECLs declared as static constructors. */
+ auto_vec<tree, 20> ctors;
+ /* A vector of FUNCTION_DECLs declared as static destructors. */
+ auto_vec<tree, 20> dtors;
struct cgraph_node *node;
FOR_EACH_DEFINED_FUNCTION (node)
if (DECL_STATIC_CONSTRUCTOR (node->decl)
|| DECL_STATIC_DESTRUCTOR (node->decl))
- record_cdtor_fn (node);
- build_cdtor_fns ();
- static_ctors.release ();
- static_dtors.release ();
+ record_cdtor_fn (node, &ctors, &dtors);
+ build_cdtor_fns (&ctors, &dtors);
return 0;
}