From 94084be3bc270f2e29c8fc3ef86f05cf8e2fd188 Mon Sep 17 00:00:00 2001 From: Daniel Maier <daniel.maier@tu-berlin.de> Date: Wed, 12 Sep 2018 17:18:07 +0200 Subject: [PATCH] add info tool --- CMakeLists.txt | 6 +++++- info.cpp | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 info.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c414c95..c82497d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required (VERSION 2.6) project (perf) include_directories("../clan-0.8.0/osl/include") link_directories("/home/daniel/polyhedral_perforation/clan-0.8.0/osl/.libs") +set(CMAKE_CXX_FLAGS "-g -Wall") + add_executable(perf main.cpp) target_link_libraries(perf osl) -set(CMAKE_CXX_FLAGS "-g -Wall") + +add_executable(info info.cpp) +target_link_libraries(info osl) diff --git a/info.cpp b/info.cpp new file mode 100644 index 0000000..bcae4c3 --- /dev/null +++ b/info.cpp @@ -0,0 +1,23 @@ +#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); + + for(auto s = scop->statement; s; s = s->next) { + std::cout << s->domain->nb_output_dims << "\n"; + } + + return 0; +} -- GitLab