This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Matrix and vector math required for linear loop transforms
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 05 Aug 2004 19:46:46 -0700
- Subject: Re: [PATCH]: Matrix and vector math required for linear loop transforms
- Organization: CodeSourcery, LLC
- References: <Pine.LNX.4.60.0408031523590.4287@dberlin.org>
Daniel Berlin wrote:
Whee.
Bootstrapped and regtested on i686-pc-linux-gnu and powerpc-darwin
This is OK, with a couple of minor changes.
+/* An integer vector, in the math sense. */
typedef int *lambda_vector;
+/* An integer matrix, in the math sense. */
+typedef lambda_vector *lambda_matrix;
You need to say more than "in the math sense". Give a complete
definition here, or, at the very least, a reference to one.
/* Clear out vector VEC1 of length SIZE. */
Say "Zero" rather than "Clear out".
+ mat = ggc_alloc (m * sizeof (lambda_vector));
Do these really have to be ggc_alloc'd, or could they just be xmalloc'd
or obstack_alloc'd? If these are only going to live during loop
optimization, we might be able to avoid putting them in GC'd memory.
+void
+lambda_matrix_id (lambda_matrix mat, int size)
+{
+ int i, j;
+
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ mat[i][j] = (i == j) ? 1 : 0;
+}
I'd guess that memset, followed by initializing the diagonal to 1, would
be a little quicker. I'm not sure if that matters.
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com