Mercurial > hg > CbC > CbC_gcc
annotate gcc/lambda-trans.c @ 63:b7f97abdc517 gcc-4.6-20100522
update gcc from gcc-4.5.0 to gcc-4.6
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 May 2010 12:47:05 +0900 |
parents | 77e2b8dfacca |
children |
rev | line source |
---|---|
0 | 1 /* Lambda matrix transformations. |
2 Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc. | |
3 Contributed by Daniel Berlin <dberlin@dberlin.org>. | |
4 | |
5 This file is part of GCC. | |
6 | |
7 GCC is free software; you can redistribute it and/or modify it under | |
8 the terms of the GNU General Public License as published by the Free | |
9 Software Foundation; either version 3, or (at your option) any later | |
10 version. | |
11 | |
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GCC; see the file COPYING3. If not see | |
19 <http://www.gnu.org/licenses/>. */ | |
20 | |
21 #include "config.h" | |
22 #include "system.h" | |
23 #include "coretypes.h" | |
24 #include "tm.h" | |
25 #include "ggc.h" | |
26 #include "tree.h" | |
27 #include "target.h" | |
28 #include "tree-flow.h" | |
29 #include "lambda.h" | |
30 | |
31 /* Allocate a new transformation matrix. */ | |
32 | |
33 lambda_trans_matrix | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
34 lambda_trans_matrix_new (int colsize, int rowsize, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
35 struct obstack * lambda_obstack) |
0 | 36 { |
37 lambda_trans_matrix ret; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
38 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
39 ret = (lambda_trans_matrix) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
40 obstack_alloc (lambda_obstack, sizeof (struct lambda_trans_matrix_s)); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
41 LTM_MATRIX (ret) = lambda_matrix_new (rowsize, colsize, lambda_obstack); |
0 | 42 LTM_ROWSIZE (ret) = rowsize; |
43 LTM_COLSIZE (ret) = colsize; | |
44 LTM_DENOMINATOR (ret) = 1; | |
45 return ret; | |
46 } | |
47 | |
48 /* Return true if MAT is an identity matrix. */ | |
49 | |
50 bool | |
51 lambda_trans_matrix_id_p (lambda_trans_matrix mat) | |
52 { | |
53 if (LTM_ROWSIZE (mat) != LTM_COLSIZE (mat)) | |
54 return false; | |
55 return lambda_matrix_id_p (LTM_MATRIX (mat), LTM_ROWSIZE (mat)); | |
56 } | |
57 | |
58 | |
59 /* Compute the inverse of the transformation matrix MAT. */ | |
60 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
61 lambda_trans_matrix |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
62 lambda_trans_matrix_inverse (lambda_trans_matrix mat, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
63 struct obstack * lambda_obstack) |
0 | 64 { |
65 lambda_trans_matrix inverse; | |
66 int determinant; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
67 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
68 inverse = lambda_trans_matrix_new (LTM_ROWSIZE (mat), LTM_COLSIZE (mat), |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
69 lambda_obstack); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
70 determinant = lambda_matrix_inverse (LTM_MATRIX (mat), LTM_MATRIX (inverse), |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
71 LTM_ROWSIZE (mat), lambda_obstack); |
0 | 72 LTM_DENOMINATOR (inverse) = determinant; |
73 return inverse; | |
74 } | |
75 | |
76 | |
77 /* Print out a transformation matrix. */ | |
78 | |
79 void | |
80 print_lambda_trans_matrix (FILE *outfile, lambda_trans_matrix mat) | |
81 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
82 print_lambda_matrix (outfile, LTM_MATRIX (mat), LTM_ROWSIZE (mat), |
0 | 83 LTM_COLSIZE (mat)); |
84 } |