update pet for support for recent versions of clang
[ppn.git] / dump_sizes.cc
blob1fa4792c7fd805c45bebc6a1a887a3bf1bdf1d57
1 #include <iostream>
3 #include <isa/yaml.h>
4 #include <isa/pdg.h>
6 using namespace std;
7 using namespace pdg;
9 int main(int argc, char * argv[])
11 PDG *pdg;
12 isl_ctx *ctx = isl_ctx_alloc();
13 pdg = PDG::Load(stdin, ctx);
15 for (int i = 0; i < pdg->dependences.size(); ++i) {
16 pdg::dependence *dep = pdg->dependences[i];
17 if (dep->type == pdg::dependence::uninitialized)
18 continue;
19 pdg::node* from = dep->from;
20 pdg::node* to = dep->to;
21 int from_access = dep->from_access ? dep->from_access->nr : -1;
22 int to_access = dep->to_access ? dep->to_access->nr : -1;
23 const char *from_f = from->statement->top_function ?
24 from->statement->top_function->name->s.c_str() :
25 "(none)";
26 const char *to_f = to->statement->top_function ?
27 to->statement->top_function->name->s.c_str() : "(none)";
28 printf("%d,%d (%s,line %d) --(%s)--> %d,%d (%s,line %d): %s\n",
29 from->nr, from_access, from_f, from->statement->line,
30 dep->array->name->s.c_str(),
31 to->nr, to_access, to_f, to->statement->line,
32 dep->size ? dep->size->s->c_str() : "(unknown)"
36 pdg->free();
37 delete pdg;
38 isl_ctx_free(ctx);
40 return 0;