7 #define CHECK_DATA_DEPENDENT 1
9 #define CHECK_DATA_DEPENDENT 0
12 /* Check that the dependence(s) between "from" and "to" are parametric
13 * (if controlled is true) or not parametric (if controlled is false).
15 static void check_controlled(PDG
*pdg
, const char *from
, const char *to
,
18 for (int i
= 0; i
< pdg
->dependences
.size(); ++i
) {
19 pdg::dependence
*dep
= pdg
->dependences
[i
];
21 if (dep
->from
->name
->s
!= from
)
23 if (dep
->to
->name
->s
!= to
)
26 assert(dep
->controlled_relation
);
28 assert(!dep
->controlled_relation
);
32 /* Check the results of parametric dataflow analysis
33 * on a variation of example E1 from Barthou's PhD text, page 100.
35 * We expect the dependences between S1 and S2 to be non-parametric,
36 * while those with R as sink should be parametric.
38 static void check_barthou_E1(isl_ctx
*ctx
)
42 construct_pdg("barthou_E1");
43 pdg
= get_da(ctx
, "barthou_E1");
45 assert(pdg
->nodes
.size() == 4);
46 assert(pdg
->dependences
.size() == 6);
48 check_controlled(pdg
, "S1", "S2", false);
49 check_controlled(pdg
, "S2", "S2", false);
50 check_controlled(pdg
, "S1", "R", true);
51 check_controlled(pdg
, "S2", "R", true);
57 int main(int argc
, char *argv
[])
59 isl_ctx
*ctx
= isl_ctx_alloc();
60 construct_pdg("testindex2");
61 PDG
*pdg
= get_da(ctx
, "testindex2", "-t flow,anti");
63 assert(pdg
->nodes
.size() == 3);
64 assert(pdg
->dependences
.size() == 3);
69 if (CHECK_DATA_DEPENDENT
)
70 check_barthou_E1(ctx
);