[PATCH] [loop] Move various lambda* types to obstack out of GC

Laurynas Biveinis laurynas.biveinis@gmail.com
Wed Apr 21 15:33:00 GMT 2010

(Most of description is copy pasted from the similar C parser patch I
just posted)

Variables of types lambda_trans_matrix, lambda_matrix, lambda_loop,
struct access_matrix
are allocated by GC while GC machinery in fact knows nothing about
them, since there are no paths from any GC root to any such variable.
This happens to work as a sort of short lifetime scratch allocation
with the current GC implementation: such objects are collected on the
next ggc_collect call. However this is an unsupported GC
implementation detail and a hindrance for any GC changes.

I put those objects in an obstack instead. In some places they were
already used (tree-loop-linear.c:linear_transform_loops). A big part
of the patch is
related to just passing down a pointer to the obstack from the
function which defines life time for these objects
tree-data-ref.c:analyze_subscript_affine_affine) to the functions
which do the actual allocation
lambda-mat.c:lambda_matrix_new, lambda-code.c:build_access_matrix)
with quite a few intermediate
functions. In some places there were obstacks already used.

lambda_loop_new was a macro in lambda.h. Since it was only used in
lambda-code.c, I made it a static function there. Also I have removed
unused static functions in lambda-mat.c: lambda_matrix_get_column and

This patch was in gc-improv branch for a few months and was tested
virtually on all the different architectures compile farm has together
with the rest of the branch.

Now bootstrapped/regtested on x86_64/linux together with the rest of
today's patches.

OK for trunk?

2010-04-21  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* tree-parloops.c (loop_parallel_p): New argument
	parloop_obstack.  Pass it down.
	(parallelize_loops): New variable parloop_obstack.  Initialize it,
	pass it down, free it.

	* tree-loop-linear.c (linear_transform_loops): Pass down

	* tree-data-ref.h (lambda_compute_access_matrices): New argument
	of type struct obstack *.

	* tree-data-ref.c (analyze_subscript_affine_affine): New variable
	scratch_obstack.  Initialize it, pass down, free it.

	* lambda.h (lambda_loop_new): Remove.
	(lambda_matrix_new, lambda_matrix_inverse)
	(lambda_trans_matrix_new, lambda_trans_matrix_inverse): New
	argument of type struct obstack *.

	* lambda-trans.c (lambda_trans_matrix_new): New argument
	lambda_obstack.  Pass it down, use obstack allocation for ret.
	(lambda_trans_matrix_inverse): New argument lambda_obstack.  Pass
	it down.

	* lambda-mat.c (lambda_matrix_get_column)
	(lambda_matrix_project_to_null): Remove.
	(lambda_matrix_new): New argument lambda_obstack.  Use obstack
	allocation for mat.
	(lambda_matrix_inverse_hard, lambda_matrix_inverse): New argument

	* lambda-code.c (lambda_loop_new): New function.
	(lambda_lattice_new, compute_nest_using_fourier_motzkin)
	(lambda_compute_auxillary_space, lambda_compute_target_space)
	(lambda_loopnest_transform, gcc_loop_to_lambda_loop)
	(lambda_loopnest_to_gcc_loopnest): Pass down lambda_obstack.
	(build_access_matrix): New argument lambda_obstack.  Use obstack
	allocation for am.
	(lambda_compute_step_signs, lambda_compute_access_matrices): New
	argument lambda_obstack.  Pass it down.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop-obstack.patch
Type: application/octet-stream
Size: 21153 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100421/6556afad/attachment.obj>

More information about the Gcc-patches mailing list