~ubuntu-branches/ubuntu/trusty/cloog/trusty

« back to all changes in this revision

Viewing changes to osl/source/relation_list.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-10-17 15:54:24 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20131017155424-3q1gw7yhddylfkpj
Tags: 0.18.1-1
* New upstream version.
* Add a comment to build-depend on libpod-latex-perl | perl (<< 5.17.0),
  when the documentation is built. Closes: #711681.
* Use dh_autotools-dev to update config.{sub,guess}. Closes: #719957.

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
 
184
184
 
185
185
/**
 
186
 * osl_relation_list_pprint_access_array_scoplib function:
 
187
 * This function pretty-prints the elements of a osl_relation_list_t structure
 
188
 * into a file (file, possibly stdout) in the SCoPLib format. I.e., it prints
 
189
 * only the elements and not the number of elements. It prints an element of the
 
190
 * list only if it is not NULL.
 
191
 * \param file  File where informations are printed.
 
192
 * \param list  The relation list whose information has to be printed.
 
193
 * \param[in] names Array of constraint columns names. 
 
194
 * \param[in] add_fakeiter True of False
 
195
 */
 
196
void osl_relation_list_pprint_access_array_scoplib(FILE * file,
 
197
              osl_relation_list_p list, osl_names_p names, int add_fakeiter) {
 
198
  int i;
 
199
  int nb_rows_read = 0, nb_columns_read = 0;
 
200
  int nb_rows_write = 0, nb_columns_write = 0;
 
201
  int nb_rows_may_write = 0, nb_columns_may_write = 0;
 
202
  osl_relation_list_p head ;
 
203
 
 
204
  // Count the number of elements in the list with non-NULL content.
 
205
  i = osl_relation_list_count(list);
 
206
  
 
207
  // Print each element of the relation list.
 
208
  if (i > 0) {
 
209
  
 
210
    // Read/Write arrays size
 
211
    head = list;
 
212
    while (head) {
 
213
      if (head->elt != NULL) {
 
214
        if (head->elt->type == OSL_TYPE_READ) {
 
215
          if (head->elt->nb_rows == 1)
 
216
            nb_rows_read++;
 
217
          else
 
218
            nb_rows_read += head->elt->nb_rows - 1; // remove the 'Arr'
 
219
            
 
220
          nb_columns_read = head->elt->nb_columns - head->elt->nb_output_dims;
 
221
          
 
222
        } else if (head->elt->type == OSL_TYPE_WRITE) {
 
223
          if (head->elt->nb_rows == 1)
 
224
            nb_rows_write++;
 
225
          else
 
226
            nb_rows_write += head->elt->nb_rows - 1; // remove the 'Arr'
 
227
            
 
228
          nb_columns_write = head->elt->nb_columns - head->elt->nb_output_dims;
 
229
          
 
230
        } else if (head->elt->type == OSL_TYPE_MAY_WRITE) {
 
231
          if (head->elt->nb_rows == 1)
 
232
            nb_rows_may_write++;
 
233
          else
 
234
            nb_rows_may_write += head->elt->nb_rows - 1; // remove the 'Arr'
 
235
            
 
236
          nb_columns_may_write = head->elt->nb_columns -
 
237
                                 head->elt->nb_output_dims;
 
238
        }
 
239
      }
 
240
      head = head->next;
 
241
    }
 
242
    
 
243
    if (add_fakeiter) {
 
244
      nb_columns_read++;
 
245
      nb_columns_write++;
 
246
      nb_columns_may_write++;
 
247
    }
 
248
    
 
249
    fprintf(file, "# Read access informations\n%d %d\n",
 
250
            nb_rows_read, nb_columns_read);
 
251
    head = list;
 
252
    while (head) {
 
253
      if (head->elt != NULL && head->elt->type == OSL_TYPE_READ) {
 
254
        osl_relation_pprint_scoplib(file, head->elt, names, 0, add_fakeiter);
 
255
      }
 
256
      head = head->next;
 
257
    }
 
258
    
 
259
    fprintf(file, "# Write access informations\n%d %d\n",
 
260
            nb_rows_write, nb_columns_write);
 
261
    head = list;
 
262
    while (head) {
 
263
      if (head->elt != NULL && head->elt->type == OSL_TYPE_WRITE) {
 
264
        osl_relation_pprint_scoplib(file, head->elt, names, 0, add_fakeiter);
 
265
      }
 
266
      head = head->next;
 
267
    }
 
268
    
 
269
    if (nb_rows_may_write > 0) {
 
270
      fprintf(file, "# May Write access informations\n%d %d\n",
 
271
              nb_rows_may_write, nb_columns_may_write);
 
272
      head = list;
 
273
      while (head) {
 
274
        if (head->elt != NULL && head->elt->type == OSL_TYPE_MAY_WRITE) {
 
275
          osl_relation_pprint_scoplib(file, head->elt, names, 0, add_fakeiter);
 
276
        }
 
277
        head = head->next;
 
278
      }
 
279
    }
 
280
  }
 
281
  else {
 
282
    fprintf(file, "# NULL relation list\n");
 
283
  }
 
284
}
 
285
 
 
286
 
 
287
/**
186
288
 * osl_relation_list_pprint function:
187
289
 * This function pretty-prints the content of a osl_relation_list_t structure
188
290
 * into a file (file, possibly stdout) in the OpenScop format. It prints