Polly 20.0.0git
isl_opt_mpa_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2018 Cerebras Systems
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8 */
9
10#undef TYPE
11#define TYPE CAT(isl_,BASE)
12#define xFN(TYPE,NAME) TYPE ## _ ## NAME
13#define FN(TYPE,NAME) xFN(TYPE,NAME)
14
15/* Compute the optima of the set or output dimensions as a function of the
16 * parameters (and input dimensions), but independently of
17 * the other set or output dimensions,
18 * given a function "opt" that computes this optimum
19 * for a single dimension.
20 *
21 * If the resulting multi piecewise affine expression has
22 * an explicit domain, then assign it the (parameter) domain of the input.
23 * In other cases, the (parameter) domain is stored in the individual elements.
24 */
27{
28 int i;
29 isl_size n;
31
32 mpa = isl_multi_pw_aff_alloc(FN(TYPE,get_space)(obj));
33 n = isl_multi_pw_aff_size(mpa);
34 if (n < 0)
35 mpa = isl_multi_pw_aff_free(mpa);
36 for (i = 0; i < n; ++i) {
37 isl_pw_aff *pa;
38
39 pa = opt(FN(TYPE,copy)(obj), i);
40 mpa = isl_multi_pw_aff_set_pw_aff(mpa, i, pa);
41 }
42 if (isl_multi_pw_aff_has_explicit_domain(mpa)) {
43 isl_set *dom;
44
45 dom = FN(TYPE,domain)(FN(TYPE,copy)(obj));
47 }
48 FN(TYPE,free)(obj);
49
50 return mpa;
51}
__isl_export __isl_give isl_multi_pw_aff * isl_multi_pw_aff_intersect_domain(__isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *domain)
struct isl_multi_pw_aff isl_multi_pw_aff
Definition: aff_type.h:43
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
int isl_size
Definition: ctx.h:96
#define BASE
Definition: flow_cmp.c:49
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
#define TYPE
#define FN(TYPE, NAME)
const char * obj
Definition: isl_test.c:3316
struct isl_set isl_set
Definition: map_type.h:26
static Signature domain
n
Definition: youcefn.c:8