LCOV - code coverage report
Current view: top level - metalib_isl - isl_multi_apply_templ.c (source / functions) Hit Total Coverage
Test: 2018-10-31_point_maint_greina16.lcov Lines: 0 34 0.0 %
Date: 2018-11-01 11:27:00 Functions: 0 8 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright 2011      Sven Verdoolaege
       3             :  * Copyright 2012-2013 Ecole Normale Superieure
       4             :  *
       5             :  * Use of this software is governed by the MIT license
       6             :  *
       7             :  * Written by Sven Verdoolaege,
       8             :  * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
       9             :  */
      10             : 
      11             : #include <isl_multi_macro.h>
      12             : 
      13             : /* Transform the elements of "multi" by applying "fn" to them
      14             :  * with extra argument "set".
      15             :  *
      16             :  * The parameters of "multi" and "set" are assumed to have been aligned.
      17             :  */
      18           0 : __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(
      19             :         __isl_take MULTI(BASE) *multi, __isl_take APPLY_DOM *set,
      20             :         __isl_give EL *(*fn)(EL *el, __isl_take APPLY_DOM *set))
      21             : {
      22             :         int i;
      23             : 
      24           0 :         if (!multi || !set)
      25             :                 goto error;
      26             : 
      27           0 :         if (multi->n == 0) {
      28           0 :                 FN(APPLY_DOM,free)(set);
      29           0 :                 return multi;
      30             :         }
      31             : 
      32           0 :         multi = FN(MULTI(BASE),cow)(multi);
      33           0 :         if (!multi)
      34           0 :                 goto error;
      35             : 
      36           0 :         for (i = 0; i < multi->n; ++i) {
      37           0 :                 multi->u.p[i] = fn(multi->u.p[i], FN(APPLY_DOM,copy)(set));
      38           0 :                 if (!multi->u.p[i])
      39           0 :                         goto error;
      40             :         }
      41             : 
      42           0 :         FN(APPLY_DOM,free)(set);
      43           0 :         return multi;
      44             : error:
      45           0 :         FN(APPLY_DOM,free)(set);
      46           0 :         FN(MULTI(BASE),free)(multi);
      47           0 :         return NULL;
      48             : }
      49             : 
      50             : /* Transform the elements of "multi" by applying "fn" to them
      51             :  * with extra argument "set".
      52             :  *
      53             :  * Align the parameters if needed and call apply_set_aligned.
      54             :  */
      55           0 : static __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),apply),APPLY_DOMBASE)(
      56             :         __isl_take MULTI(BASE) *multi, __isl_take APPLY_DOM *set,
      57             :         __isl_give EL *(*fn)(EL *el, __isl_take APPLY_DOM *set))
      58             : {
      59             :         isl_bool aligned;
      60             :         isl_ctx *ctx;
      61             : 
      62           0 :         if (!multi || !set)
      63             :                 goto error;
      64             : 
      65           0 :         aligned = FN(APPLY_DOM,space_has_equal_params)(set, multi->space);
      66           0 :         if (aligned < 0)
      67           0 :                 goto error;
      68           0 :         if (aligned)
      69           0 :                 return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi,
      70             :                                                                     set, fn);
      71           0 :         ctx = FN(MULTI(BASE),get_ctx)(multi);
      72           0 :         if (!isl_space_has_named_params(multi->space) ||
      73           0 :             !isl_space_has_named_params(set->dim))
      74           0 :                 isl_die(ctx, isl_error_invalid,
      75             :                         "unaligned unnamed parameters", goto error);
      76           0 :         multi = FN(MULTI(BASE),align_params)(multi,
      77             :                                                 FN(APPLY_DOM,get_space)(set));
      78           0 :         set = FN(APPLY_DOM,align_params)(set, FN(MULTI(BASE),get_space)(multi));
      79           0 :         return FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(multi, set, fn);
      80             : error:
      81           0 :         FN(MULTI(BASE),free)(multi);
      82           0 :         FN(APPLY_DOM,free)(set);
      83           0 :         return NULL;
      84             : }

Generated by: LCOV version 1.12