OSDN Git Service

* pa-host.c (MAP_FAILED): Define if not defined.
[pf3gnuchains/gcc-fork.git] / gcc / lambda-mat.c
index 987fa5e..8aa3c12 100644 (file)
@@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "tm.h"
 #include "ggc.h"
 #include "varray.h"
+#include "tree.h"
 #include "lambda.h"
 
 static void lambda_matrix_get_column (lambda_matrix, int, int, 
@@ -69,6 +70,29 @@ lambda_matrix_id (lambda_matrix mat, int size)
       mat[i][j] = (i == j) ? 1 : 0;
 }
 
+/* Return true if MAT is the identity matrix of SIZE */
+
+bool
+lambda_matrix_id_p (lambda_matrix mat, int size)
+{
+  int i, j;
+  for (i = 0; i < size; i++)
+    for (j = 0; j < size; j++)
+      {
+       if (i == j)
+         {
+           if (mat[i][j] != 1)
+             return false;
+         }
+       else
+         {
+           if (mat[i][j] != 0)
+             return false;
+         }
+      }
+  return true;
+}
+
 /* Negate the elements of the M x N matrix MAT1 and store it in MAT2.  */
 
 void
@@ -154,7 +178,7 @@ lambda_matrix_get_column (lambda_matrix mat, int n, int col,
     vec[i] = mat[i][col];
 }
 
-/* Delete rows r1 to r2 (not including r2). */
+/* Delete rows r1 to r2 (not including r2).  */
 
 void
 lambda_matrix_delete_rows (lambda_matrix mat, int rows, int from, int to)
@@ -440,7 +464,7 @@ lambda_matrix_hermite (lambda_matrix mat, int n,
            }
        }
 
-      /* Stop when only the diagonal element is non-zero.  */
+      /* Stop when only the diagonal element is nonzero.  */
       while (lambda_vector_first_nz (row, n, j + 1) < n)
        {
          minimum_col = lambda_vector_min_nz (row, n, j);
@@ -462,7 +486,7 @@ lambda_matrix_hermite (lambda_matrix mat, int n,
    "U.A = S".  This decomposition is also known as "right Hermite".
    
    Ref: Algorithm 2.1 page 33 in "Loop Transformations for
-   Restructuring Compilers" Utpal Banerjee. */
+   Restructuring Compilers" Utpal Banerjee.  */
 
 void
 lambda_matrix_right_hermite (lambda_matrix A, int m, int n,
@@ -507,7 +531,7 @@ lambda_matrix_right_hermite (lambda_matrix A, int m, int n,
    V.S".  This decomposition is also known as "left Hermite".
    
    Ref: Algorithm 2.2 page 36 in "Loop Transformations for
-   Restructuring Compilers" Utpal Banerjee. */
+   Restructuring Compilers" Utpal Banerjee.  */
 
 void
 lambda_matrix_left_hermite (lambda_matrix A, int m, int n,
@@ -547,7 +571,7 @@ lambda_matrix_left_hermite (lambda_matrix A, int m, int n,
     }
 }
 
-/* When it exists, return the first non-zero row in MAT after row
+/* When it exists, return the first nonzero row in MAT after row
    STARTROW.  Otherwise return rowsize.  */
 
 int
@@ -578,9 +602,9 @@ lambda_matrix_project_to_null (lambda_matrix B, int rowsize,
   lambda_matrix M1, M2, M3, I;
   int determinant;
 
-  /* compute c(I-B^T inv(B B^T) B) e sub k   */
+  /* Compute c(I-B^T inv(B B^T) B) e sub k.  */
 
-  /* M1 is the transpose of B */
+  /* M1 is the transpose of B */
   M1 = lambda_matrix_new (colsize, colsize);
   lambda_matrix_transpose (B, M1, rowsize, colsize);