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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [graphite-ppl.h] - Blame information for rev 859

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

Line No. Rev Author Line
1 280 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
CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t);
28
CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t);
29
CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset (
30
  ppl_Pointset_Powerset_C_Polyhedron_t);
31
void new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *, CloogMatrix *);
32
void insert_constraint_into_matrix (CloogMatrix *, int, ppl_const_Constraint_t);
33
ppl_Polyhedron_t ppl_strip_loop (ppl_Polyhedron_t, ppl_dimension_type, int);
34
int ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t,
35
                                           ppl_Linear_Expression_t);
36
 
37
void ppl_print_polyhedron_matrix (FILE *, ppl_const_Polyhedron_t);
38
void ppl_print_powerset_matrix (FILE *, ppl_Pointset_Powerset_C_Polyhedron_t);
39
void debug_ppl_polyhedron_matrix (ppl_Polyhedron_t);
40
void debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t);
41
void ppl_print_linear_expr (FILE *, ppl_Linear_Expression_t);
42
void debug_ppl_linear_expr (ppl_Linear_Expression_t);
43
void ppl_read_polyhedron_matrix (ppl_Polyhedron_t *, FILE *);
44
void ppl_insert_dimensions (ppl_Polyhedron_t, int, int);
45
void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int,
46
                                     int);
47
void ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t, Value);
48
void ppl_set_coef_gmp (ppl_Linear_Expression_t, ppl_dimension_type, Value);
49
void ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t,
50
                              ppl_Linear_Expression_t, Value);
51
void ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t,
52
                              ppl_Linear_Expression_t, Value);
53
ppl_Constraint_t ppl_build_relation (int, int, int, int,
54
                                     enum ppl_enum_Constraint_Type);
55
 
56
/* Assigns to RES the value of the INTEGER_CST T.  */
57
 
58
static inline void
59
tree_int_to_gmp (tree t, Value res)
60
{
61
  double_int di = tree_to_double_int (t);
62
  mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t)));
63
}
64
 
65
/* Converts a GMP constant VAL to a tree and returns it.  */
66
 
67
static inline tree
68
gmp_cst_to_tree (tree type, Value val)
69
{
70
  tree t = type ? type : integer_type_node;
71
  Value tmp;
72
  double_int di;
73
 
74
  value_init (tmp);
75
  value_assign (tmp, val);
76
  di = mpz_get_double_int (t, tmp, true);
77
  value_clear (tmp);
78
 
79
  return double_int_to_tree (t, di);
80
}
81
 
82
/* Set the inhomogeneous term of E to the integer X.  */
83
 
84
static inline void
85
ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x)
86
{
87
  Value v;
88
  value_init (v);
89
  value_set_si (v, x);
90
  ppl_set_inhomogeneous_gmp (e, v);
91
  value_clear (v);
92
}
93
 
94
/* Set the inhomogeneous term of E to the tree X.  */
95
 
96
static inline void
97
ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x)
98
{
99
  Value v;
100
  value_init (v);
101
  tree_int_to_gmp (x, v);
102
  ppl_set_inhomogeneous_gmp (e, v);
103
  value_clear (v);
104
}
105
 
106
/* Set E[I] to integer X.  */
107
 
108
static inline void
109
ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x)
110
{
111
  Value v;
112
  value_init (v);
113
  value_set_si (v, x);
114
  ppl_set_coef_gmp (e, i, v);
115
  value_clear (v);
116
}
117
 
118
/* Set E[I] to tree X.  */
119
 
120
static inline void
121
ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
122
{
123
  Value v;
124
  value_init (v);
125
  tree_int_to_gmp (x, v);
126
  ppl_set_coef_gmp (e, i, v);
127
  value_clear (v);
128
}
129
 
130
/* Sets RES to the max of V1 and V2.  */
131
 
132
static inline void
133
value_max (Value res, Value v1, Value v2)
134
{
135
  if (value_compare (v1, v2) < 0)
136
    value_assign (res, v2);
137
  value_assign (res, v1);
138
}
139
 
140
/* Builds a new identity map for dimension DIM.  */
141
 
142
static inline ppl_dimension_type *
143
ppl_new_id_map (ppl_dimension_type dim)
144
{
145
  ppl_dimension_type *map, i;
146
 
147
  map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim);
148
 
149
  for (i = 0; i < dim; i++)
150
    map[i] = i;
151
 
152
  return map;
153
}
154
 
155
/* Builds an interchange of dimensions A and B in MAP.  */
156
 
157
static inline void
158
ppl_interchange (ppl_dimension_type *map,
159
                 ppl_dimension_type a,
160
                 ppl_dimension_type b)
161
{
162
  map[a] = b;
163
  map[b] = a;
164
}
165
 
166
#endif
167
 

powered by: WebSVN 2.1.0

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