OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [graphite-ppl.h] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 684 jeremybenn
/* Gimple Represented as Polyhedra.
2
   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3
   Contributed by Sebastian Pop <sebastian.pop@inria.fr>
4
   and Tobias Grosser <grosser@fim.uni-passau.de>.
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
#ifndef GCC_GRAPHITE_PPL_H
22
#define GCC_GRAPHITE_PPL_H
23
 
24
#include "double-int.h"
25
#include "tree.h"
26
 
27
ppl_Polyhedron_t ppl_strip_loop (ppl_Polyhedron_t, ppl_dimension_type, int);
28
int ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t,
29
                                           ppl_Linear_Expression_t);
30
 
31
void ppl_print_polyhedron_matrix (FILE *, ppl_const_Polyhedron_t);
32
void ppl_print_powerset_matrix (FILE *, ppl_Pointset_Powerset_C_Polyhedron_t);
33
void debug_ppl_polyhedron_matrix (ppl_Polyhedron_t);
34
void debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t);
35
void ppl_print_linear_expr (FILE *, ppl_Linear_Expression_t);
36
void debug_ppl_linear_expr (ppl_Linear_Expression_t);
37
void ppl_read_polyhedron_matrix (ppl_Polyhedron_t *, FILE *);
38
void ppl_insert_dimensions (ppl_Polyhedron_t, int, int);
39
void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int,
40
                                     int);
41
void ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t, mpz_t);
42
void ppl_set_coef_gmp (ppl_Linear_Expression_t, ppl_dimension_type, mpz_t);
43
void ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t,
44
                              ppl_Linear_Expression_t, mpz_t);
45
void ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t,
46
                              ppl_Linear_Expression_t, mpz_t);
47
ppl_Constraint_t ppl_build_relation (int, int, int, int,
48
                                     enum ppl_enum_Constraint_Type);
49
void debug_gmp_value (mpz_t);
50
bool ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t);
51
 
52
 
53
/* Assigns to RES the value of the INTEGER_CST T.  */
54
 
55
static inline void
56
tree_int_to_gmp (tree t, mpz_t res)
57
{
58
  double_int di = tree_to_double_int (t);
59
  mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t)));
60
}
61
 
62
/* Converts a GMP constant VAL to a tree and returns it.  */
63
 
64
static inline tree
65
gmp_cst_to_tree (tree type, mpz_t val)
66
{
67
  tree t = type ? type : integer_type_node;
68
  mpz_t tmp;
69
  double_int di;
70
 
71
  mpz_init (tmp);
72
  mpz_set (tmp, val);
73
  di = mpz_get_double_int (t, tmp, true);
74
  mpz_clear (tmp);
75
 
76
  return double_int_to_tree (t, di);
77
}
78
 
79
/* Set the inhomogeneous term of E to the integer X.  */
80
 
81
static inline void
82
ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x)
83
{
84
  mpz_t v;
85
  mpz_init (v);
86
  mpz_set_si (v, x);
87
  ppl_set_inhomogeneous_gmp (e, v);
88
  mpz_clear (v);
89
}
90
 
91
/* Set the inhomogeneous term of E to the tree X.  */
92
 
93
static inline void
94
ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x)
95
{
96
  mpz_t v;
97
  mpz_init (v);
98
  tree_int_to_gmp (x, v);
99
  ppl_set_inhomogeneous_gmp (e, v);
100
  mpz_clear (v);
101
}
102
 
103
/* Set E[I] to integer X.  */
104
 
105
static inline void
106
ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x)
107
{
108
  mpz_t v;
109
  mpz_init (v);
110
  mpz_set_si (v, x);
111
  ppl_set_coef_gmp (e, i, v);
112
  mpz_clear (v);
113
}
114
 
115
/* Set E[I] to tree X.  */
116
 
117
static inline void
118
ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
119
{
120
  mpz_t v;
121
  mpz_init (v);
122
  tree_int_to_gmp (x, v);
123
  ppl_set_coef_gmp (e, i, v);
124
  mpz_clear (v);
125
}
126
 
127
/* Sets RES to the min of V1 and V2.  */
128
 
129
static inline void
130
value_min (mpz_t res, mpz_t v1, mpz_t v2)
131
{
132
  if (mpz_cmp (v1, v2) < 0)
133
    mpz_set (res, v1);
134
  else
135
    mpz_set (res, v2);
136
}
137
 
138
/* Sets RES to the max of V1 and V2.  */
139
 
140
static inline void
141
value_max (mpz_t res, mpz_t v1, mpz_t v2)
142
{
143
  if (mpz_cmp (v1, v2) < 0)
144
    mpz_set (res, v2);
145
  else
146
    mpz_set (res, v1);
147
}
148
 
149
/* Builds a new identity map for dimension DIM.  */
150
 
151
static inline ppl_dimension_type *
152
ppl_new_id_map (ppl_dimension_type dim)
153
{
154
  ppl_dimension_type *map, i;
155
 
156
  map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim);
157
 
158
  for (i = 0; i < dim; i++)
159
    map[i] = i;
160
 
161
  return map;
162
}
163
 
164
/* Builds an interchange of dimensions A and B in MAP.  */
165
 
166
static inline void
167
ppl_interchange (ppl_dimension_type *map,
168
                 ppl_dimension_type a,
169
                 ppl_dimension_type b)
170
{
171
  map[a] = b;
172
  map[b] = a;
173
}
174
 
175
#endif
176
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.