Home | History | Annotate | Line # | Download | only in gcc
graphite.h revision 1.2.10.1
      1  1.2.10.1  pgoyette /* Graphite polyhedral representation.
      2  1.2.10.1  pgoyette    Copyright (C) 2009-2016 Free Software Foundation, Inc.
      3  1.2.10.1  pgoyette    Contributed by Sebastian Pop <sebastian.pop (at) amd.com> and
      4  1.2.10.1  pgoyette    Tobias Grosser <grosser (at) fim.uni-passau.de>.
      5       1.1       mrg 
      6       1.1       mrg This file is part of GCC.
      7       1.1       mrg 
      8       1.1       mrg GCC is free software; you can redistribute it and/or modify
      9       1.1       mrg it under the terms of the GNU General Public License as published by
     10       1.1       mrg the Free Software Foundation; either version 3, or (at your option)
     11       1.1       mrg any later version.
     12       1.1       mrg 
     13       1.1       mrg GCC is distributed in the hope that it will be useful,
     14       1.1       mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
     15       1.1       mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16       1.1       mrg GNU General Public License for more details.
     17       1.1       mrg 
     18       1.1       mrg You should have received a copy of the GNU General Public License
     19       1.1       mrg along with GCC; see the file COPYING3.  If not see
     20       1.1       mrg <http://www.gnu.org/licenses/>.  */
     21       1.1       mrg 
     22  1.2.10.1  pgoyette #ifndef GCC_GRAPHITE_POLY_H
     23  1.2.10.1  pgoyette #define GCC_GRAPHITE_POLY_H
     24       1.1       mrg 
     25  1.2.10.1  pgoyette #include "sese.h"
     26  1.2.10.1  pgoyette #include <isl/options.h>
     27  1.2.10.1  pgoyette #include <isl/ctx.h>
     28  1.2.10.1  pgoyette #include <isl/val_gmp.h>
     29  1.2.10.1  pgoyette #include <isl/set.h>
     30  1.2.10.1  pgoyette #include <isl/union_set.h>
     31  1.2.10.1  pgoyette #include <isl/map.h>
     32  1.2.10.1  pgoyette #include <isl/union_map.h>
     33  1.2.10.1  pgoyette #include <isl/aff.h>
     34  1.2.10.1  pgoyette #include <isl/constraint.h>
     35  1.2.10.1  pgoyette #include <isl/flow.h>
     36  1.2.10.1  pgoyette #include <isl/ilp.h>
     37  1.2.10.1  pgoyette #include <isl/schedule.h>
     38  1.2.10.1  pgoyette #include <isl/ast_build.h>
     39  1.2.10.1  pgoyette 
     40  1.2.10.1  pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
     41  1.2.10.1  pgoyette /* isl 0.15 or later.  */
     42  1.2.10.1  pgoyette #include <isl/schedule_node.h>
     43  1.2.10.1  pgoyette 
     44  1.2.10.1  pgoyette #else
     45  1.2.10.1  pgoyette /* isl 0.14 or 0.13.  */
     46  1.2.10.1  pgoyette # define isl_stat int
     47  1.2.10.1  pgoyette # define isl_stat_ok 0
     48  1.2.10.1  pgoyette #endif
     49  1.2.10.1  pgoyette 
     50  1.2.10.1  pgoyette typedef struct poly_dr *poly_dr_p;
     51  1.2.10.1  pgoyette 
     52  1.2.10.1  pgoyette typedef struct poly_bb *poly_bb_p;
     53  1.2.10.1  pgoyette 
     54  1.2.10.1  pgoyette typedef struct scop *scop_p;
     55  1.2.10.1  pgoyette 
     56  1.2.10.1  pgoyette typedef unsigned graphite_dim_t;
     57  1.2.10.1  pgoyette 
     58  1.2.10.1  pgoyette static inline graphite_dim_t scop_nb_params (scop_p);
     59  1.2.10.1  pgoyette 
     60  1.2.10.1  pgoyette /* A data reference can write or read some memory or we
     61  1.2.10.1  pgoyette    just know it may write some memory.  */
     62  1.2.10.1  pgoyette enum poly_dr_type
     63  1.2.10.1  pgoyette {
     64  1.2.10.1  pgoyette   PDR_READ,
     65  1.2.10.1  pgoyette   /* PDR_MAY_READs are represented using PDR_READS.  This does not
     66  1.2.10.1  pgoyette      limit the expressiveness.  */
     67  1.2.10.1  pgoyette   PDR_WRITE,
     68  1.2.10.1  pgoyette   PDR_MAY_WRITE
     69  1.2.10.1  pgoyette };
     70  1.2.10.1  pgoyette 
     71  1.2.10.1  pgoyette struct poly_dr
     72  1.2.10.1  pgoyette {
     73  1.2.10.1  pgoyette   /* An identifier for this PDR.  */
     74  1.2.10.1  pgoyette   int id;
     75  1.2.10.1  pgoyette 
     76  1.2.10.1  pgoyette   /* The number of data refs identical to this one in the PBB.  */
     77  1.2.10.1  pgoyette   int nb_refs;
     78  1.2.10.1  pgoyette 
     79  1.2.10.1  pgoyette   /* A pointer to the gimple stmt containing this reference.  */
     80  1.2.10.1  pgoyette   gimple *stmt;
     81  1.2.10.1  pgoyette 
     82  1.2.10.1  pgoyette   /* A pointer to the PBB that contains this data reference.  */
     83  1.2.10.1  pgoyette   poly_bb_p pbb;
     84  1.2.10.1  pgoyette 
     85  1.2.10.1  pgoyette   enum poly_dr_type type;
     86  1.2.10.1  pgoyette 
     87  1.2.10.1  pgoyette   /* The access polyhedron contains the polyhedral space this data
     88  1.2.10.1  pgoyette      reference will access.
     89  1.2.10.1  pgoyette 
     90  1.2.10.1  pgoyette      The polyhedron contains these dimensions:
     91  1.2.10.1  pgoyette 
     92  1.2.10.1  pgoyette      - The alias set (a):
     93  1.2.10.1  pgoyette      Every memory access is classified in at least one alias set.
     94  1.2.10.1  pgoyette 
     95  1.2.10.1  pgoyette      - The subscripts (s_0, ..., s_n):
     96  1.2.10.1  pgoyette      The memory is accessed using zero or more subscript dimensions.
     97  1.2.10.1  pgoyette 
     98  1.2.10.1  pgoyette      - The iteration domain (variables and parameters)
     99  1.2.10.1  pgoyette 
    100  1.2.10.1  pgoyette      Do not hardcode the dimensions.  Use the following accessor functions:
    101  1.2.10.1  pgoyette      - pdr_alias_set_dim
    102  1.2.10.1  pgoyette      - pdr_subscript_dim
    103  1.2.10.1  pgoyette      - pdr_iterator_dim
    104  1.2.10.1  pgoyette      - pdr_parameter_dim
    105  1.2.10.1  pgoyette 
    106  1.2.10.1  pgoyette      Example:
    107  1.2.10.1  pgoyette 
    108  1.2.10.1  pgoyette      | int A[1335][123];
    109  1.2.10.1  pgoyette      | int *p = malloc ();
    110  1.2.10.1  pgoyette      |
    111  1.2.10.1  pgoyette      | k = ...
    112  1.2.10.1  pgoyette      | for i
    113  1.2.10.1  pgoyette      |   {
    114  1.2.10.1  pgoyette      |     if (unknown_function ())
    115  1.2.10.1  pgoyette      |       p = A;
    116  1.2.10.1  pgoyette      |       ... = p[?][?];
    117  1.2.10.1  pgoyette      | 	   for j
    118  1.2.10.1  pgoyette      |       A[i][j+k] = m;
    119  1.2.10.1  pgoyette      |   }
    120  1.2.10.1  pgoyette 
    121  1.2.10.1  pgoyette      The data access A[i][j+k] in alias set "5" is described like this:
    122  1.2.10.1  pgoyette 
    123  1.2.10.1  pgoyette      | i   j   k   a  s0  s1   1
    124  1.2.10.1  pgoyette      | 0   0   0   1   0   0  -5     =  0
    125  1.2.10.1  pgoyette      |-1   0   0   0   1   0   0     =  0
    126  1.2.10.1  pgoyette      | 0  -1  -1   0   0   1   0     =  0
    127  1.2.10.1  pgoyette      | 0   0   0   0   1   0   0     >= 0  # The last four lines describe the
    128  1.2.10.1  pgoyette      | 0   0   0   0   0   1   0     >= 0  # array size.
    129  1.2.10.1  pgoyette      | 0   0   0   0  -1   0 1335    >= 0
    130  1.2.10.1  pgoyette      | 0   0   0   0   0  -1 123     >= 0
    131  1.2.10.1  pgoyette 
    132  1.2.10.1  pgoyette      The pointer "*p" in alias set "5" and "7" is described as a union of
    133  1.2.10.1  pgoyette      polyhedron:
    134  1.2.10.1  pgoyette 
    135  1.2.10.1  pgoyette 
    136  1.2.10.1  pgoyette      | i   k   a  s0   1
    137  1.2.10.1  pgoyette      | 0   0   1   0  -5   =  0
    138  1.2.10.1  pgoyette      | 0   0   0   1   0   >= 0
    139  1.2.10.1  pgoyette 
    140  1.2.10.1  pgoyette      "or"
    141  1.2.10.1  pgoyette 
    142  1.2.10.1  pgoyette      | i   k   a  s0   1
    143  1.2.10.1  pgoyette      | 0   0   1   0  -7   =  0
    144  1.2.10.1  pgoyette      | 0   0   0   1   0   >= 0
    145  1.2.10.1  pgoyette 
    146  1.2.10.1  pgoyette      "*p" accesses all of the object allocated with 'malloc'.
    147  1.2.10.1  pgoyette 
    148  1.2.10.1  pgoyette      The scalar data access "m" is represented as an array with zero subscript
    149  1.2.10.1  pgoyette      dimensions.
    150  1.2.10.1  pgoyette 
    151  1.2.10.1  pgoyette      | i   j   k   a   1
    152  1.2.10.1  pgoyette      | 0   0   0  -1   15  = 0
    153  1.2.10.1  pgoyette 
    154  1.2.10.1  pgoyette      The difference between the graphite internal format for access data and
    155  1.2.10.1  pgoyette      the OpenSop format is in the order of columns.
    156  1.2.10.1  pgoyette      Instead of having:
    157  1.2.10.1  pgoyette 
    158  1.2.10.1  pgoyette      | i   j   k   a  s0  s1   1
    159  1.2.10.1  pgoyette      | 0   0   0   1   0   0  -5     =  0
    160  1.2.10.1  pgoyette      |-1   0   0   0   1   0   0     =  0
    161  1.2.10.1  pgoyette      | 0  -1  -1   0   0   1   0     =  0
    162  1.2.10.1  pgoyette      | 0   0   0   0   1   0   0     >= 0  # The last four lines describe the
    163  1.2.10.1  pgoyette      | 0   0   0   0   0   1   0     >= 0  # array size.
    164  1.2.10.1  pgoyette      | 0   0   0   0  -1   0 1335    >= 0
    165  1.2.10.1  pgoyette      | 0   0   0   0   0  -1 123     >= 0
    166  1.2.10.1  pgoyette 
    167  1.2.10.1  pgoyette      In OpenScop we have:
    168  1.2.10.1  pgoyette 
    169  1.2.10.1  pgoyette      | a  s0  s1   i   j   k   1
    170  1.2.10.1  pgoyette      | 1   0   0   0   0   0  -5     =  0
    171  1.2.10.1  pgoyette      | 0   1   0  -1   0   0   0     =  0
    172  1.2.10.1  pgoyette      | 0   0   1   0  -1  -1   0     =  0
    173  1.2.10.1  pgoyette      | 0   1   0   0   0   0   0     >= 0  # The last four lines describe the
    174  1.2.10.1  pgoyette      | 0   0   1   0   0   0   0     >= 0  # array size.
    175  1.2.10.1  pgoyette      | 0  -1   0   0   0   0 1335    >= 0
    176  1.2.10.1  pgoyette      | 0   0  -1   0   0   0 123     >= 0
    177  1.2.10.1  pgoyette 
    178  1.2.10.1  pgoyette      The OpenScop access function is printed as follows:
    179  1.2.10.1  pgoyette 
    180  1.2.10.1  pgoyette      | 1  # The number of disjunct components in a union of access functions.
    181  1.2.10.1  pgoyette      | R C O I L P  # Described bellow.
    182  1.2.10.1  pgoyette      | a  s0  s1   i   j   k   1
    183  1.2.10.1  pgoyette      | 1   0   0   0   0   0  -5     =  0
    184  1.2.10.1  pgoyette      | 0   1   0  -1   0   0   0     =  0
    185  1.2.10.1  pgoyette      | 0   0   1   0  -1  -1   0     =  0
    186  1.2.10.1  pgoyette      | 0   1   0   0   0   0   0     >= 0  # The last four lines describe the
    187  1.2.10.1  pgoyette      | 0   0   1   0   0   0   0     >= 0  # array size.
    188  1.2.10.1  pgoyette      | 0  -1   0   0   0   0 1335    >= 0
    189  1.2.10.1  pgoyette      | 0   0  -1   0   0   0 123     >= 0
    190  1.2.10.1  pgoyette 
    191  1.2.10.1  pgoyette      Where:
    192  1.2.10.1  pgoyette      - R: Number of rows.
    193  1.2.10.1  pgoyette      - C: Number of columns.
    194  1.2.10.1  pgoyette      - O: Number of output dimensions = alias set + number of subscripts.
    195  1.2.10.1  pgoyette      - I: Number of input dimensions (iterators).
    196  1.2.10.1  pgoyette      - L: Number of local (existentially quantified) dimensions.
    197  1.2.10.1  pgoyette      - P: Number of parameters.
    198  1.2.10.1  pgoyette 
    199  1.2.10.1  pgoyette      In the example, the vector "R C O I L P" is "7 7 3 2 0 1".  */
    200  1.2.10.1  pgoyette   isl_map *accesses;
    201  1.2.10.1  pgoyette   isl_set *subscript_sizes;
    202  1.2.10.1  pgoyette };
    203  1.2.10.1  pgoyette 
    204  1.2.10.1  pgoyette #define PDR_ID(PDR) (PDR->id)
    205  1.2.10.1  pgoyette #define PDR_NB_REFS(PDR) (PDR->nb_refs)
    206  1.2.10.1  pgoyette #define PDR_PBB(PDR) (PDR->pbb)
    207  1.2.10.1  pgoyette #define PDR_TYPE(PDR) (PDR->type)
    208  1.2.10.1  pgoyette #define PDR_ACCESSES(PDR) (NULL)
    209  1.2.10.1  pgoyette 
    210  1.2.10.1  pgoyette void new_poly_dr (poly_bb_p, gimple *, enum poly_dr_type,
    211  1.2.10.1  pgoyette 		  isl_map *, isl_set *);
    212  1.2.10.1  pgoyette void debug_pdr (poly_dr_p);
    213  1.2.10.1  pgoyette void print_pdr (FILE *, poly_dr_p);
    214  1.2.10.1  pgoyette 
    215  1.2.10.1  pgoyette static inline bool
    216  1.2.10.1  pgoyette pdr_read_p (poly_dr_p pdr)
    217  1.2.10.1  pgoyette {
    218  1.2.10.1  pgoyette   return PDR_TYPE (pdr) == PDR_READ;
    219  1.2.10.1  pgoyette }
    220  1.2.10.1  pgoyette 
    221  1.2.10.1  pgoyette /* Returns true when PDR is a "write".  */
    222  1.2.10.1  pgoyette 
    223  1.2.10.1  pgoyette static inline bool
    224  1.2.10.1  pgoyette pdr_write_p (poly_dr_p pdr)
    225  1.2.10.1  pgoyette {
    226  1.2.10.1  pgoyette   return PDR_TYPE (pdr) == PDR_WRITE;
    227  1.2.10.1  pgoyette }
    228  1.2.10.1  pgoyette 
    229  1.2.10.1  pgoyette /* Returns true when PDR is a "may write".  */
    230  1.2.10.1  pgoyette 
    231  1.2.10.1  pgoyette static inline bool
    232  1.2.10.1  pgoyette pdr_may_write_p (poly_dr_p pdr)
    233  1.2.10.1  pgoyette {
    234  1.2.10.1  pgoyette   return PDR_TYPE (pdr) == PDR_MAY_WRITE;
    235  1.2.10.1  pgoyette }
    236  1.2.10.1  pgoyette 
    237  1.2.10.1  pgoyette /* POLY_BB represents a blackbox in the polyhedral model.  */
    238  1.2.10.1  pgoyette 
    239  1.2.10.1  pgoyette struct poly_bb
    240  1.2.10.1  pgoyette {
    241  1.2.10.1  pgoyette   /* Pointer to a basic block or a statement in the compiler.  */
    242  1.2.10.1  pgoyette   gimple_poly_bb_p black_box;
    243  1.2.10.1  pgoyette 
    244  1.2.10.1  pgoyette   /* Pointer to the SCOP containing this PBB.  */
    245  1.2.10.1  pgoyette   scop_p scop;
    246  1.2.10.1  pgoyette 
    247  1.2.10.1  pgoyette   /* The iteration domain of this bb.  The layout of this polyhedron
    248  1.2.10.1  pgoyette      is I|G with I the iteration domain, G the context parameters.
    249  1.2.10.1  pgoyette 
    250  1.2.10.1  pgoyette      Example:
    251  1.2.10.1  pgoyette 
    252  1.2.10.1  pgoyette      for (i = a - 7*b + 8; i <= 3*a + 13*b + 20; i++)
    253  1.2.10.1  pgoyette        for (j = 2; j <= 2*i + 5; j++)
    254  1.2.10.1  pgoyette          for (k = 0; k <= 5; k++)
    255  1.2.10.1  pgoyette            S (i,j,k)
    256  1.2.10.1  pgoyette 
    257  1.2.10.1  pgoyette      Loop iterators: i, j, k
    258  1.2.10.1  pgoyette      Parameters: a, b
    259  1.2.10.1  pgoyette 
    260  1.2.10.1  pgoyette      | i >=  a -  7b +  8
    261  1.2.10.1  pgoyette      | i <= 3a + 13b + 20
    262  1.2.10.1  pgoyette      | j >= 2
    263  1.2.10.1  pgoyette      | j <= 2i + 5
    264  1.2.10.1  pgoyette      | k >= 0
    265  1.2.10.1  pgoyette      | k <= 5
    266  1.2.10.1  pgoyette 
    267  1.2.10.1  pgoyette      The number of variables in the DOMAIN may change and is not
    268  1.2.10.1  pgoyette      related to the number of loops in the original code.  */
    269  1.2.10.1  pgoyette   isl_set *domain;
    270  1.2.10.1  pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
    271  1.2.10.1  pgoyette   isl_set *iterators;
    272  1.2.10.1  pgoyette #else
    273  1.2.10.1  pgoyette   /* The original scattering.  */
    274  1.2.10.1  pgoyette   isl_map *schedule;
    275  1.2.10.1  pgoyette 
    276  1.2.10.1  pgoyette   /* The transformed scattering.  */
    277  1.2.10.1  pgoyette   isl_map *transformed;
    278  1.2.10.1  pgoyette 
    279  1.2.10.1  pgoyette   /* A copy of the transformed scattering.  */
    280  1.2.10.1  pgoyette   isl_map *saved;
    281  1.2.10.1  pgoyette #endif
    282  1.2.10.1  pgoyette 
    283  1.2.10.1  pgoyette   /* The data references we access.  */
    284  1.2.10.1  pgoyette   vec<poly_dr_p> drs;
    285  1.2.10.1  pgoyette 
    286  1.2.10.1  pgoyette   /* The last basic block generated for this pbb.  */
    287  1.2.10.1  pgoyette   basic_block new_bb;
    288  1.2.10.1  pgoyette };
    289  1.2.10.1  pgoyette 
    290  1.2.10.1  pgoyette #define PBB_BLACK_BOX(PBB) ((gimple_poly_bb_p) PBB->black_box)
    291  1.2.10.1  pgoyette #define PBB_SCOP(PBB) (PBB->scop)
    292  1.2.10.1  pgoyette #define PBB_DRS(PBB) (PBB->drs)
    293  1.2.10.1  pgoyette 
    294  1.2.10.1  pgoyette extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
    295  1.2.10.1  pgoyette extern void print_pbb_domain (FILE *, poly_bb_p);
    296  1.2.10.1  pgoyette extern void print_pbb (FILE *, poly_bb_p);
    297  1.2.10.1  pgoyette extern void print_scop_context (FILE *, scop_p);
    298  1.2.10.1  pgoyette extern void print_scop (FILE *, scop_p);
    299  1.2.10.1  pgoyette extern void debug_pbb_domain (poly_bb_p);
    300  1.2.10.1  pgoyette extern void debug_pbb (poly_bb_p);
    301  1.2.10.1  pgoyette extern void print_pdrs (FILE *, poly_bb_p);
    302  1.2.10.1  pgoyette extern void debug_pdrs (poly_bb_p);
    303  1.2.10.1  pgoyette extern void debug_scop_context (scop_p);
    304  1.2.10.1  pgoyette extern void debug_scop (scop_p);
    305  1.2.10.1  pgoyette extern void print_scop_params (FILE *, scop_p);
    306  1.2.10.1  pgoyette extern void debug_scop_params (scop_p);
    307  1.2.10.1  pgoyette extern void print_iteration_domain (FILE *, poly_bb_p);
    308  1.2.10.1  pgoyette extern void print_iteration_domains (FILE *, scop_p);
    309  1.2.10.1  pgoyette extern void debug_iteration_domain (poly_bb_p);
    310  1.2.10.1  pgoyette extern void debug_iteration_domains (scop_p);
    311  1.2.10.1  pgoyette extern void print_isl_set (FILE *, isl_set *);
    312  1.2.10.1  pgoyette extern void print_isl_map (FILE *, isl_map *);
    313  1.2.10.1  pgoyette extern void print_isl_union_map (FILE *, isl_union_map *);
    314  1.2.10.1  pgoyette extern void print_isl_aff (FILE *, isl_aff *);
    315  1.2.10.1  pgoyette extern void print_isl_constraint (FILE *, isl_constraint *);
    316  1.2.10.1  pgoyette extern void print_isl_schedule (FILE *, isl_schedule *);
    317  1.2.10.1  pgoyette extern void debug_isl_schedule (isl_schedule *);
    318  1.2.10.1  pgoyette extern void print_isl_ast (FILE *, isl_ast_node *);
    319  1.2.10.1  pgoyette extern void debug_isl_ast (isl_ast_node *);
    320  1.2.10.1  pgoyette extern void debug_isl_set (isl_set *);
    321  1.2.10.1  pgoyette extern void debug_isl_map (isl_map *);
    322  1.2.10.1  pgoyette extern void debug_isl_union_map (isl_union_map *);
    323  1.2.10.1  pgoyette extern void debug_isl_aff (isl_aff *);
    324  1.2.10.1  pgoyette extern void debug_isl_constraint (isl_constraint *);
    325  1.2.10.1  pgoyette extern void debug_gmp_value (mpz_t);
    326  1.2.10.1  pgoyette extern void debug_scop_pbb (scop_p scop, int i);
    327  1.2.10.1  pgoyette extern void print_schedule_ast (FILE *, __isl_keep isl_schedule *, scop_p);
    328  1.2.10.1  pgoyette extern void debug_schedule_ast (__isl_keep isl_schedule *, scop_p);
    329  1.2.10.1  pgoyette 
    330  1.2.10.1  pgoyette /* The basic block of the PBB.  */
    331  1.2.10.1  pgoyette 
    332  1.2.10.1  pgoyette static inline basic_block
    333  1.2.10.1  pgoyette pbb_bb (poly_bb_p pbb)
    334  1.2.10.1  pgoyette {
    335  1.2.10.1  pgoyette   return GBB_BB (PBB_BLACK_BOX (pbb));
    336  1.2.10.1  pgoyette }
    337  1.2.10.1  pgoyette 
    338  1.2.10.1  pgoyette static inline int
    339  1.2.10.1  pgoyette pbb_index (poly_bb_p pbb)
    340  1.2.10.1  pgoyette {
    341  1.2.10.1  pgoyette   return pbb_bb (pbb)->index;
    342  1.2.10.1  pgoyette }
    343  1.2.10.1  pgoyette 
    344  1.2.10.1  pgoyette /* The loop of the PBB.  */
    345  1.2.10.1  pgoyette 
    346  1.2.10.1  pgoyette static inline loop_p
    347  1.2.10.1  pgoyette pbb_loop (poly_bb_p pbb)
    348  1.2.10.1  pgoyette {
    349  1.2.10.1  pgoyette   return gbb_loop (PBB_BLACK_BOX (pbb));
    350  1.2.10.1  pgoyette }
    351  1.2.10.1  pgoyette 
    352  1.2.10.1  pgoyette /* The scop that contains the PDR.  */
    353  1.2.10.1  pgoyette 
    354  1.2.10.1  pgoyette static inline scop_p
    355  1.2.10.1  pgoyette pdr_scop (poly_dr_p pdr)
    356  1.2.10.1  pgoyette {
    357  1.2.10.1  pgoyette   return PBB_SCOP (PDR_PBB (pdr));
    358  1.2.10.1  pgoyette }
    359  1.2.10.1  pgoyette 
    360  1.2.10.1  pgoyette /* Set black box of PBB to BLACKBOX.  */
    361  1.2.10.1  pgoyette 
    362  1.2.10.1  pgoyette static inline void
    363  1.2.10.1  pgoyette pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box)
    364  1.2.10.1  pgoyette {
    365  1.2.10.1  pgoyette   pbb->black_box = black_box;
    366  1.2.10.1  pgoyette }
    367  1.2.10.1  pgoyette 
    368  1.2.10.1  pgoyette /* A helper structure to keep track of data references, polyhedral BBs, and
    369  1.2.10.1  pgoyette    alias sets.  */
    370  1.2.10.1  pgoyette 
    371  1.2.10.1  pgoyette struct dr_info
    372  1.2.10.1  pgoyette {
    373  1.2.10.1  pgoyette   enum {
    374  1.2.10.1  pgoyette     invalid_alias_set = -1
    375  1.2.10.1  pgoyette   };
    376  1.2.10.1  pgoyette   /* The data reference.  */
    377  1.2.10.1  pgoyette   data_reference_p dr;
    378  1.2.10.1  pgoyette 
    379  1.2.10.1  pgoyette   /* The polyhedral BB containing this DR.  */
    380  1.2.10.1  pgoyette   poly_bb_p pbb;
    381  1.2.10.1  pgoyette 
    382  1.2.10.1  pgoyette   /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph.
    383  1.2.10.1  pgoyette      -1 is an invalid alias set.  */
    384  1.2.10.1  pgoyette   int alias_set;
    385  1.2.10.1  pgoyette 
    386  1.2.10.1  pgoyette   /* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB.  */
    387  1.2.10.1  pgoyette   dr_info (data_reference_p dr, poly_bb_p pbb,
    388  1.2.10.1  pgoyette 	   int alias_set = invalid_alias_set)
    389  1.2.10.1  pgoyette     : dr (dr), pbb (pbb), alias_set (alias_set) {}
    390  1.2.10.1  pgoyette };
    391  1.2.10.1  pgoyette 
    392  1.2.10.1  pgoyette /* A SCOP is a Static Control Part of the program, simple enough to be
    393  1.2.10.1  pgoyette    represented in polyhedral form.  */
    394  1.2.10.1  pgoyette struct scop
    395  1.2.10.1  pgoyette {
    396  1.2.10.1  pgoyette   /* A SCOP is defined as a SESE region.  */
    397  1.2.10.1  pgoyette   sese_info_p scop_info;
    398  1.2.10.1  pgoyette 
    399  1.2.10.1  pgoyette   /* Number of parameters in SCoP.  */
    400  1.2.10.1  pgoyette   graphite_dim_t nb_params;
    401  1.2.10.1  pgoyette 
    402  1.2.10.1  pgoyette   /* All the basic blocks in this scop that contain memory references
    403  1.2.10.1  pgoyette      and that will be represented as statements in the polyhedral
    404  1.2.10.1  pgoyette      representation.  */
    405  1.2.10.1  pgoyette   vec<poly_bb_p> pbbs;
    406  1.2.10.1  pgoyette 
    407  1.2.10.1  pgoyette   /* All the data references in this scop.  */
    408  1.2.10.1  pgoyette   vec<dr_info> drs;
    409  1.2.10.1  pgoyette 
    410  1.2.10.1  pgoyette   /* The context describes known restrictions concerning the parameters
    411  1.2.10.1  pgoyette      and relations in between the parameters.
    412  1.2.10.1  pgoyette 
    413  1.2.10.1  pgoyette   void f (int8_t a, uint_16_t b) {
    414  1.2.10.1  pgoyette     c = 2 a + b;
    415  1.2.10.1  pgoyette     ...
    416  1.2.10.1  pgoyette   }
    417  1.2.10.1  pgoyette 
    418  1.2.10.1  pgoyette   Here we can add these restrictions to the context:
    419  1.2.10.1  pgoyette 
    420  1.2.10.1  pgoyette   -128 >= a >= 127
    421  1.2.10.1  pgoyette      0 >= b >= 65,535
    422  1.2.10.1  pgoyette      c = 2a + b  */
    423  1.2.10.1  pgoyette   isl_set *param_context;
    424  1.2.10.1  pgoyette 
    425  1.2.10.1  pgoyette   /* The context used internally by isl.  */
    426  1.2.10.1  pgoyette   isl_ctx *isl_context;
    427  1.2.10.1  pgoyette 
    428  1.2.10.1  pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
    429  1.2.10.1  pgoyette   /* SCoP original schedule.  */
    430  1.2.10.1  pgoyette   isl_schedule *original_schedule;
    431  1.2.10.1  pgoyette 
    432  1.2.10.1  pgoyette   /* SCoP transformed schedule.  */
    433  1.2.10.1  pgoyette   isl_schedule *transformed_schedule;
    434  1.2.10.1  pgoyette #else
    435  1.2.10.1  pgoyette   /* SCoP final schedule.  */
    436  1.2.10.1  pgoyette   isl_schedule *schedule;
    437  1.2.10.1  pgoyette #endif
    438  1.2.10.1  pgoyette 
    439  1.2.10.1  pgoyette   /* The data dependence relation among the data references in this scop.  */
    440  1.2.10.1  pgoyette   isl_union_map *dependence;
    441  1.2.10.1  pgoyette };
    442  1.2.10.1  pgoyette 
    443  1.2.10.1  pgoyette extern scop_p new_scop (edge, edge);
    444  1.2.10.1  pgoyette extern void free_scop (scop_p);
    445  1.2.10.1  pgoyette extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>,
    446  1.2.10.1  pgoyette 					    vec<scalar_use>, vec<tree>);
    447  1.2.10.1  pgoyette extern bool apply_poly_transforms (scop_p);
    448  1.2.10.1  pgoyette 
    449  1.2.10.1  pgoyette /* Set the region of SCOP to REGION.  */
    450  1.2.10.1  pgoyette 
    451  1.2.10.1  pgoyette static inline void
    452  1.2.10.1  pgoyette scop_set_region (scop_p scop, sese_info_p region)
    453  1.2.10.1  pgoyette {
    454  1.2.10.1  pgoyette   scop->scop_info = region;
    455  1.2.10.1  pgoyette }
    456  1.2.10.1  pgoyette 
    457  1.2.10.1  pgoyette /* Returns the number of parameters for SCOP.  */
    458  1.2.10.1  pgoyette 
    459  1.2.10.1  pgoyette static inline graphite_dim_t
    460  1.2.10.1  pgoyette scop_nb_params (scop_p scop)
    461  1.2.10.1  pgoyette {
    462  1.2.10.1  pgoyette   return scop->nb_params;
    463  1.2.10.1  pgoyette }
    464  1.2.10.1  pgoyette 
    465  1.2.10.1  pgoyette /* Set the number of params of SCOP to NB_PARAMS.  */
    466  1.2.10.1  pgoyette 
    467  1.2.10.1  pgoyette static inline void
    468  1.2.10.1  pgoyette scop_set_nb_params (scop_p scop, graphite_dim_t nb_params)
    469  1.2.10.1  pgoyette {
    470  1.2.10.1  pgoyette   scop->nb_params = nb_params;
    471  1.2.10.1  pgoyette }
    472  1.2.10.1  pgoyette 
    473  1.2.10.1  pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
    474  1.2.10.1  pgoyette extern void scop_get_dependences (scop_p scop);
    475  1.2.10.1  pgoyette #else
    476  1.2.10.1  pgoyette extern isl_union_map *scop_get_dependences (scop_p scop);
    477  1.2.10.1  pgoyette #endif
    478  1.2.10.1  pgoyette 
    479  1.2.10.1  pgoyette bool
    480  1.2.10.1  pgoyette carries_deps (__isl_keep isl_union_map *schedule,
    481  1.2.10.1  pgoyette 	      __isl_keep isl_union_map *deps,
    482  1.2.10.1  pgoyette 	      int depth);
    483  1.2.10.1  pgoyette 
    484  1.2.10.1  pgoyette extern bool build_poly_scop (scop_p);
    485  1.2.10.1  pgoyette extern bool graphite_regenerate_ast_isl (scop_p);
    486  1.2.10.1  pgoyette extern void build_scops (vec<scop_p> *);
    487  1.2.10.1  pgoyette extern void dot_all_sese (FILE *, vec<sese_l> &);
    488  1.2.10.1  pgoyette extern void dot_sese (sese_l &);
    489  1.2.10.1  pgoyette extern void dot_cfg ();
    490  1.2.10.1  pgoyette 
    491  1.2.10.1  pgoyette #endif
    492