gcc/gcc/lambda-trans.c
Daniel Berlin f67d92e937 [multiple changes]
2004-09-16  Daniel Berlin  <dberlin@dberlin.org>

	* cfgloop.h (duplicate_loop):  Add prototype.
	* cfgloopmanip.c (duplicate_loop): Make non-static.
	* lambda-code.c (perfect_nestify): Factor out test whether
	we can handle this loop into separate function.
	Call it.
	(can_convert_to_perfect_nest): New function.
	(replace_uses_of_x_with_y): Add modify_stmt call.
	* tree-loop-linear.c (linear_transform_loops): Call
	rewrite_into_loop_closed_ssa and free_df.

2004-09-16  Daniel Berlin  <dberlin@dberlin.org>

	* lambda-code.c (invariant_in_loop): is_gimple_min_invariant is
	loop invariant as well.
	(perfect_nestify): new function.
	(gcc_loop_to_lambda_loop): New parameters to track lower bounds,
	upper bounds, and steps.
	Set outerinductionvar properly.
	(gcc_loopnest_to_lambda_loopnest): Add loops and need_perfect
	parameters.
	Return NULL if we need a perfect loop and can't make one.
	(lambda_loopnest_to_gcc_loopnest): Correct algorithm.
	(not_interesting_stmt): New function.
	(phi_loop_edge_uses_def): Ditto.
	(stmt_uses_phi_result): Ditto.
	(stmt_is_bumper_for_loop): Ditto.
	(perfect_nest_p): Ditto.
	(nestify_update_pending_stmts): Ditto.
	(replace_uses_of_x_with_y): Ditto.
	(stmt_uses_op): Ditto.
	(perfect_nestify): Ditto.
	* lambda-mat.c (lambda_matrix_id_p): New function.
	* lambda-trans.c (lambda_trans_matrix_id_p): Ditto.
	* lambda.h: Update prototypes.
	* tree-loop-linear (linear_transform_loop): Use new
	perfect_nest_p. Detect and ignore identity transform.
	* tree-ssa-loop.c (pass_linear_transform): Use TODO_write_loop_closed.

2004-09-16  Sebastian Pop  <pop@cri.ensmp.fr>

	* tree-loop-linear.c (gather_interchange_stats): Add more comments.
	Gather also strides of accessed data.  Pass in the data references
	array.
	(try_interchange_loops): Add a new heuristic for handling the temporal
	locality.  Pass in the data references array.
	(linear_transform_loops): Pass the data references array to
	try_interchange_loops.

From-SVN: r87607
2004-09-16 16:16:14 +00:00

83 lines
2.2 KiB
C

/* Lambda matrix transformations.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@dberlin.org>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "errors.h"
#include "ggc.h"
#include "tree.h"
#include "target.h"
#include "varray.h"
#include "lambda.h"
/* Allocate a new transformation matrix. */
lambda_trans_matrix
lambda_trans_matrix_new (int colsize, int rowsize)
{
lambda_trans_matrix ret;
ret = ggc_alloc (sizeof (*ret));
LTM_MATRIX (ret) = lambda_matrix_new (rowsize, colsize);
LTM_ROWSIZE (ret) = rowsize;
LTM_COLSIZE (ret) = colsize;
LTM_DENOMINATOR (ret) = 1;
return ret;
}
/* Return true if MAT is an identity matrix. */
bool
lambda_trans_matrix_id_p (lambda_trans_matrix mat)
{
if (LTM_ROWSIZE (mat) != LTM_COLSIZE (mat))
return false;
return lambda_matrix_id_p (LTM_MATRIX (mat), LTM_ROWSIZE (mat));
}
/* Compute the inverse of the transformation matrix MAT. */
lambda_trans_matrix
lambda_trans_matrix_inverse (lambda_trans_matrix mat)
{
lambda_trans_matrix inverse;
int determinant;
inverse = lambda_trans_matrix_new (LTM_ROWSIZE (mat), LTM_COLSIZE (mat));
determinant = lambda_matrix_inverse (LTM_MATRIX (mat), LTM_MATRIX (inverse),
LTM_ROWSIZE (mat));
LTM_DENOMINATOR (inverse) = determinant;
return inverse;
}
/* Print out a transformation matrix. */
void
print_lambda_trans_matrix (FILE *outfile, lambda_trans_matrix mat)
{
print_lambda_matrix (outfile, LTM_MATRIX (mat), LTM_ROWSIZE (mat),
LTM_COLSIZE (mat));
}