Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-affine.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Operations with affine combinations of trees. | 1 /* Operations with affine combinations of trees. |
2 Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. | 2 Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it | 6 GCC is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by the | 7 under the terms of the GNU General Public License as published by the |
8 Free Software Foundation; either version 3, or (at your option) any | 8 Free Software Foundation; either version 3, or (at your option) any |
9 later version. | 9 later version. |
10 | 10 |
11 GCC is distributed in the hope that it will be useful, but WITHOUT | 11 GCC is distributed in the hope that it will be useful, but WITHOUT |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 for more details. | 14 for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with GCC; see the file COPYING3. If not see | 17 along with GCC; see the file COPYING3. If not see |
18 <http://www.gnu.org/licenses/>. */ | 18 <http://www.gnu.org/licenses/>. */ |
19 | 19 |
20 #include "config.h" | 20 #include "config.h" |
120 comb->elts[comb->n].val = comb->rest; | 120 comb->elts[comb->n].val = comb->rest; |
121 comb->rest = NULL_TREE; | 121 comb->rest = NULL_TREE; |
122 comb->n++; | 122 comb->n++; |
123 } | 123 } |
124 else | 124 else |
125 comb->rest = fold_build2 (MULT_EXPR, type, comb->rest, | 125 comb->rest = fold_build2 (MULT_EXPR, type, comb->rest, |
126 double_int_to_tree (type, scale)); | 126 double_int_to_tree (type, scale)); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 /* Adds ELT * SCALE to COMB. */ | 130 /* Adds ELT * SCALE to COMB. */ |
180 if (double_int_one_p (scale)) | 180 if (double_int_one_p (scale)) |
181 elt = fold_convert (type, elt); | 181 elt = fold_convert (type, elt); |
182 else | 182 else |
183 elt = fold_build2 (MULT_EXPR, type, | 183 elt = fold_build2 (MULT_EXPR, type, |
184 fold_convert (type, elt), | 184 fold_convert (type, elt), |
185 double_int_to_tree (type, scale)); | 185 double_int_to_tree (type, scale)); |
186 | 186 |
187 if (comb->rest) | 187 if (comb->rest) |
188 comb->rest = fold_build2 (PLUS_EXPR, type, comb->rest, | 188 comb->rest = fold_build2 (PLUS_EXPR, type, comb->rest, |
189 elt); | 189 elt); |
190 else | 190 else |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 /* Adds C * COEF * VAL to R. VAL may be NULL, in that case only | 472 /* Adds C * COEF * VAL to R. VAL may be NULL, in that case only |
473 C * COEF is added to R. */ | 473 C * COEF is added to R. */ |
474 | 474 |
475 | 475 |
476 static void | 476 static void |
477 aff_combination_add_product (aff_tree *c, double_int coef, tree val, | 477 aff_combination_add_product (aff_tree *c, double_int coef, tree val, |
478 aff_tree *r) | 478 aff_tree *r) |
479 { | 479 { |
532 } | 532 } |
533 | 533 |
534 /* Returns the element of COMB whose value is VAL, or NULL if no such | 534 /* Returns the element of COMB whose value is VAL, or NULL if no such |
535 element exists. If IDX is not NULL, it is set to the index of VAL in | 535 element exists. If IDX is not NULL, it is set to the index of VAL in |
536 COMB. */ | 536 COMB. */ |
537 | 537 |
538 static struct aff_comb_elt * | 538 static struct aff_comb_elt * |
539 aff_combination_find_elt (aff_tree *comb, tree val, unsigned *idx) | 539 aff_combination_find_elt (aff_tree *comb, tree val, unsigned *idx) |
540 { | 540 { |
541 unsigned i; | 541 unsigned i; |
542 | 542 |
801 fprintf (file, "\n elements = {\n"); | 801 fprintf (file, "\n elements = {\n"); |
802 for (i = 0; i < val->n; i++) | 802 for (i = 0; i < val->n; i++) |
803 { | 803 { |
804 fprintf (file, " [%d] = ", i); | 804 fprintf (file, " [%d] = ", i); |
805 print_generic_expr (file, val->elts[i].val, TDF_VOPS|TDF_MEMSYMS); | 805 print_generic_expr (file, val->elts[i].val, TDF_VOPS|TDF_MEMSYMS); |
806 | 806 |
807 fprintf (file, " * "); | 807 fprintf (file, " * "); |
808 dump_double_int (file, val->elts[i].coef, uns); | 808 dump_double_int (file, val->elts[i].coef, uns); |
809 if (i != val->n - 1) | 809 if (i != val->n - 1) |
810 fprintf (file, ", \n"); | 810 fprintf (file, ", \n"); |
811 } | 811 } |