diff --git a/info2.cpp b/info2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc8dc98123e9afc69d4a0aec471007740426cf97 --- /dev/null +++ b/info2.cpp @@ -0,0 +1,60 @@ +#include <iostream> +#include <osl/osl.h> + +int main(int argc, char *argv[]) { + if(argc != 2) { + std::cerr << "usage: <SCOP>\n"; + return -1; + } + + auto *fp = fopen(argv[1], "r"); + if(!fp) { + std::cerr << "openscop read failed\n"; + return -1; + } + auto scop = osl_scop_read(fp); + fclose(fp); + +#if 0 + int i = 0; + for(auto s = scop->statement; s; s = s->next, i++) { + for(int j = 0; j < s->domain->nb_output_dims; j++) { + std::cout << i << " " << j << "\n"; + } + } +#endif + + /* want: list of statements to perforate + * scop0 statement0 statement1 statement2 + */ + int i = 0, i_ = 0, j = 0; + auto s = scop->statement; + + auto print_scop = [&s, &i, &i_, &j]() { + std::cout << "scop" << j << ";"; + for(int x = i_; x < i; x++) { + std::cout << " " << x; + } + std::cout << ";" << s->domain->nb_output_dims << "\n"; + }; + + osl_statement_p current_scop = NULL; + while(s) { + if(!current_scop || !osl_relation_equal(current_scop->domain, s->domain)) { + /* new scop */ + if(current_scop) { + print_scop(); + i_ = i; + } + current_scop = s; + j++; + } + i++; + if(!s->next) /* only advance pointer if it is not the last element */ + break; + s = s->next; + } + print_scop(); + + return 0; +}