19 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a))
21 class struct1
: public structure
{
22 static serialize
*create(void *user
) { return new struct1(); }
25 static void register_type();
26 struct1() : loop(NULL
) {}
29 at_init
register_struct1(struct1::register_type
);
31 void struct1::register_type()
33 static struct_description s1_d
= { create
};
34 YAML_PTR_FIELD(s1_d
, struct1
, loop
, struct1
);
35 structure::register_type("struct1", &typeid(struct1
), &s1_d
.d
);
38 class struct2
: public structure
{
39 static serialize
*create(void *user
) { return new struct2(); }
42 static void register_type();
43 struct2() : test(NULL
) {}
46 at_init
register_struct2(struct2::register_type
);
48 void struct2::register_type()
50 static struct_description s2_d
= { create
};
51 YAML_PTR_FIELD(s2_d
, struct2
, test
, struct1
);
52 structure::register_type("struct2", &typeid(struct2
), &s2_d
.d
);
56 int main(int argc
, char * argv
[])
59 // int fd = open("../PDG/test2_t.yaml", O_RDONLY);
60 FILE *fp
= fopen(argv
[1], "r");
62 int type
= atoi(argv
[2]);
66 struct2
* pdg
= yaml::Load
<struct2
>(fp
);
67 printf("root: %p\n", pdg
);
68 printf("test: %p\n", pdg
->test
);
69 printf("test|loop: %p\n", pdg
->test
->loop
);
78 isl_ctx
*ctx
= isl_ctx_alloc();
79 PDG
*pdg
= PDG::Load(fp
, ctx
);
83 printf("root: %p\n", pdg
);
84 printf("dim: %d\n", pdg
->dimension
);
85 printf("placement: %s\n", pdg
->placement
->s
.c_str());
86 printf("nr nodes: %zd\n", pdg
->nodes
.size());
87 for (int i
= 0; i
< pdg
->nodes
.size(); ++i
) {
88 printf("ptr: %p\n", pdg
->nodes
[i
]);
89 printf("nr: %d\n", pdg
->nodes
[i
]->nr
);
90 printf("source: %p\n", pdg
->nodes
[i
]->source
);
91 printf("dim: %d\n", pdg
->nodes
[i
]->source
->dim());
92 printf("constraints:\n");
93 set
= pdg
->nodes
[i
]->source
->get_isl_set(ctx
);
96 printf("schedule: %p\n", pdg
->nodes
[i
]->schedule
);
97 map
= pdg
->nodes
[i
]->schedule
->get_isl_map(ctx
);
100 printf("stat: %p\n", pdg
->nodes
[i
]->statement
);
101 printf("operation: %d\n", pdg
->nodes
[i
]->statement
->operation
);