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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2017      Sven Verdoolaege
       3             :  *
       4             :  * Use of this software is governed by the MIT license
       5             :  *
       6             :  * Written by Sven Verdoolaege.
       7             :  */
       8             : 
       9             : /* Initialize the explicit domain of "mpa".
      10             :  *
      11             :  * The explicit domain is initialized to a universe set
      12             :  * in the domain space.
      13             :  */
      14           0 : static __isl_give isl_multi_pw_aff *isl_multi_pw_aff_init_explicit_domain(
      15             :         __isl_take isl_multi_pw_aff *mpa)
      16             : {
      17           0 :         if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
      18           0 :                 return isl_multi_pw_aff_free(mpa);
      19           0 :         mpa->u.dom = isl_set_universe(isl_multi_pw_aff_get_domain_space(mpa));
      20           0 :         if (!mpa->u.dom)
      21           0 :                 return isl_multi_pw_aff_free(mpa);
      22           0 :         return mpa;
      23             : }
      24             : 
      25             : /* Intersect the domain of "dst" with the domain product
      26             :  * of the explicit domains of "src1" and "src2".
      27             :  * This function is only called if at least one of "src1" or "src2"
      28             :  * has an explicit domain.
      29             :  */
      30             : static __isl_give isl_multi_pw_aff *
      31           0 : isl_multi_pw_aff_intersect_explicit_domain_product(
      32             :         __isl_take isl_multi_pw_aff *dst, __isl_keep isl_multi_pw_aff *src1,
      33             :         __isl_keep isl_multi_pw_aff *src2)
      34             : {
      35             :         isl_space *space;
      36             :         isl_set *dom;
      37             :         isl_map *map;
      38             : 
      39           0 :         if (!src1 || !src2)
      40           0 :                 return FN(isl_multi_pw_aff,free)(dst);
      41           0 :         space = isl_multi_pw_aff_get_domain_space(dst);
      42           0 :         dom = isl_set_universe(space);
      43           0 :         map = isl_set_unwrap(dom);
      44           0 :         if (isl_multi_pw_aff_has_explicit_domain(src1)) {
      45           0 :                 dom = isl_set_copy(src1->u.dom);
      46           0 :                 map = isl_map_intersect_domain(map, dom);
      47             :         }
      48           0 :         if (isl_multi_pw_aff_has_explicit_domain(src2)) {
      49           0 :                 dom = isl_set_copy(src2->u.dom);
      50           0 :                 map = isl_map_intersect_range(map, dom);
      51             :         }
      52           0 :         dom = isl_map_wrap(map);
      53           0 :         dst = isl_multi_pw_aff_intersect_domain(dst, dom);
      54           0 :         return dst;
      55             : }
      56             : 
      57             : /* Check whether the explicit domain of "mpa" has non-zero coefficients
      58             :  * for any dimension in the given range or if any of these dimensions appear
      59             :  * with non-zero coefficients in any of the integer divisions involved.
      60             :  */
      61           0 : isl_bool isl_multi_pw_aff_involves_explicit_domain_dims(
      62             :         __isl_keep isl_multi_pw_aff *mpa,
      63             :         enum isl_dim_type type, unsigned pos, unsigned n)
      64             : {
      65           0 :         if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
      66           0 :                 return isl_bool_error;
      67           0 :         if (type == isl_dim_in)
      68           0 :                 type = isl_dim_set;
      69           0 :         return isl_set_involves_dims(mpa->u.dom, type, pos, n);
      70             : }
      71             : 
      72             : /* Insert "n" dimensions of type "type" at position "pos"
      73             :  * of the explicit domain of "mpa".
      74             :  */
      75             : static __isl_give isl_multi_pw_aff *
      76           0 : isl_multi_pw_aff_insert_explicit_domain_dims(__isl_take isl_multi_pw_aff *mpa,
      77             :         enum isl_dim_type type, unsigned pos, unsigned n)
      78             : {
      79           0 :         if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
      80           0 :                 return isl_multi_pw_aff_free(mpa);
      81           0 :         mpa = isl_multi_pw_aff_cow(mpa);
      82           0 :         if (!mpa)
      83           0 :                 return NULL;
      84           0 :         if (type == isl_dim_in)
      85           0 :                 type = isl_dim_set;
      86           0 :         mpa->u.dom = isl_set_insert_dims(mpa->u.dom, type, pos, n);
      87           0 :         if (!mpa->u.dom)
      88           0 :                 return isl_multi_pw_aff_free(mpa);
      89           0 :         return mpa;
      90             : }
      91             : 
      92             : /* Drop the "n" dimensions of type "type" starting at position "pos"
      93             :  * of the explicit domain of "mpa".
      94             :  */
      95             : static __isl_give isl_multi_pw_aff *
      96           0 : isl_multi_pw_aff_drop_explicit_domain_dims(__isl_take isl_multi_pw_aff *mpa,
      97             :         enum isl_dim_type type, unsigned pos, unsigned n)
      98             : {
      99           0 :         if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
     100           0 :                 return isl_multi_pw_aff_free(mpa);
     101           0 :         mpa = isl_multi_pw_aff_cow(mpa);
     102           0 :         if (!mpa)
     103           0 :                 return NULL;
     104           0 :         if (type == isl_dim_in)
     105           0 :                 type = isl_dim_set;
     106           0 :         mpa->u.dom = isl_set_drop(mpa->u.dom, type, pos, n);
     107           0 :         if (!mpa->u.dom)
     108           0 :                 return isl_multi_pw_aff_free(mpa);
     109           0 :         return mpa;
     110             : }
     111             : 
     112             : /* Move the "n" dimensions of "src_type" starting at "src_pos" of
     113             :  * of the explicit domain of "mpa" to dimensions of "dst_type" at "dst_pos".
     114             :  */
     115           0 : static __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_explicit_domain_dims(
     116             :         __isl_take isl_multi_pw_aff *mpa,
     117             :         enum isl_dim_type dst_type, unsigned dst_pos,
     118             :         enum isl_dim_type src_type, unsigned src_pos, unsigned n)
     119             : {
     120           0 :         if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
     121           0 :                 return isl_multi_pw_aff_free(mpa);
     122           0 :         mpa = isl_multi_pw_aff_cow(mpa);
     123           0 :         if (!mpa)
     124           0 :                 return NULL;
     125           0 :         if (dst_type == isl_dim_in)
     126           0 :                 dst_type = isl_dim_set;
     127           0 :         if (src_type == isl_dim_in)
     128           0 :                 src_type = isl_dim_set;
     129           0 :         mpa->u.dom = isl_set_move_dims(mpa->u.dom, dst_type, dst_pos,
     130             :                                 src_type, src_pos, n);
     131           0 :         if (!mpa->u.dom)
     132           0 :                 return isl_multi_pw_aff_free(mpa);
     133           0 :         return mpa;
     134             : }

Generated by: LCOV version 1.12