From 880e6d66b616c776880c31c3531a8649bc0ec60b Mon Sep 17 00:00:00 2001
From: Daniel Maier <daniel.maier@tu-berlin.de>
Date: Thu, 11 Oct 2018 14:22:18 +0200
Subject: [PATCH] perforate.sh: integrate pluto

---
 perforate.sh | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/perforate.sh b/perforate.sh
index ba1fa37..46fcc13 100755
--- a/perforate.sh
+++ b/perforate.sh
@@ -3,6 +3,7 @@
 CLAN=/home/daniel/polyhedral_perforation/clan-0.8.0/clan
 PERF=./build/perf2
 CLOOG=/home/daniel/polyhedral_perforation/pluto/cloog-isl/cloog
+PLUTO=/home/daniel/polyhedral_perforation/pluto/polycc
 
 usage() {
     printf -- "%s: <OPTIONS> <INPUT>\n" "$0"
@@ -14,7 +15,7 @@ usage() {
     printf -- "-g, --generate      generate perforated program\n"
     printf -- "-s, --statement     statement to perforate\n"
     printf -- "-l, --level         level to perforate\n"
-
+    printf -- "-P, --pluto         run pluto\n"
 }
 
 extract_scop() {
@@ -26,7 +27,8 @@ perforate() {
 }
 
 run_pluto() {
-    $PL
+    # FIXME: what pluto options should be used?
+    $PLUTO -o "$2" "$1"
 }
 
 generate() {
@@ -48,6 +50,7 @@ while true; do
             cmd_extract=yes
             cmd_perforate=yes
             cmd_generate=yes
+            cmd_pluto=yes
             ;;
         -e|--extract)
             cmd_extract=yes
@@ -70,6 +73,9 @@ while true; do
             shift
             level="$1"
             ;;
+        -P|--pluto)
+            cmd_pluto=yes
+            ;;
         *)
             break
     esac
@@ -80,6 +86,7 @@ input_src=$1
 
 scop="$input_src.openscop"
 perforated="$input_src.perf.openscop"
+pluto_input="${input_src}_pluto_input.c"
 
 
 if [ "$input_src" = "" ]; then
@@ -107,7 +114,12 @@ if [ "$cmd_perforate" = "yes" ]; then
 fi
 
 if [ "$cmd_generate" = "yes" ]; then
-    generate "$perforated" "$output_src"
+    generate "$perforated" "$pluto_input"
+fi
+
+if [ "$cmd_pluto" = "yes" ]; then
+    printf "running pluto on %s output %s\n" "$pluto_input" "$output_src"
+    run_pluto "$pluto_input" "$output_src"
 fi
 
 printf "input is \"%s\" output is \"%s\"\n" "$input_src" "$output_src"
-- 
GitLab