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]

Re: [PATCH]: Matrix and vector math required for linear loop transforms


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


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