This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] tree-inline.c: VECify cfun_stack.


Hi,

Attached is a patch to VECify cfun_stack.

Tested on i686-pc-linux-gnu.  Honza, are you planning to touch this
part of code in near future?  If not, I'll check in this patch in 24
hours.

Kazu Hirata

2005-05-27  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-inline.c (cfun_stack): Change the type to
	VEC(function_p,heap).
	(push_cfun, pop_cfun): Use VEC instead of VARRAY.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.187
diff -u -d -p -r1.187 tree-inline.c
--- tree-inline.c	19 May 2005 10:38:41 -0000	1.187
+++ tree-inline.c	21 May 2005 03:17:55 -0000
@@ -1805,28 +1805,25 @@ estimate_num_insns (tree expr)
   return num;
 }
 
+typedef struct function *function_p;
+
+DEF_VEC_P(function_p);
+DEF_VEC_ALLOC_P(function_p,heap);
+
 /* Initialized with NOGC, making this poisonous to the garbage collector.  */
-static varray_type cfun_stack;
+static VEC(function_p,heap) *cfun_stack;
 
 void
 push_cfun (struct function *new_cfun)
 {
-  static bool initialized = false;
-
-  if (!initialized)
-    {
-      VARRAY_GENERIC_PTR_NOGC_INIT (cfun_stack, 20, "cfun_stack");
-      initialized = true;
-    }
-  VARRAY_PUSH_GENERIC_PTR (cfun_stack, cfun);
+  VEC_safe_push (function_p, heap, cfun_stack, cfun);
   cfun = new_cfun;
 }
 
 void
 pop_cfun (void)
 {
-  cfun = (struct function *)VARRAY_TOP_GENERIC_PTR (cfun_stack);
-  VARRAY_POP (cfun_stack);
+  cfun = VEC_pop (function_p, cfun_stack);
 }
 
 /* Install new lexical TREE_BLOCK underneath 'current_block'.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]