From dd222cb37fe0ef186a449c981008bb0d66560480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9otime=20DONNENFELD?= <theotime.donnenfeld@ensiie.fr> Date: Sun, 21 Oct 2018 20:41:07 +0200 Subject: [PATCH] Petites corrections - dont le passage du check pragma dans la premiere passe --- TODOLIST | 2 +- functions/pragma.c | 2 +- plugin.cpp | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/TODOLIST b/TODOLIST index 7868552..2234957 100644 --- a/TODOLIST +++ b/TODOLIST @@ -10,7 +10,7 @@ Si on utilise pas les pragmas -> passer dans toutes les fonctions : Oui Reconnaitre les noms de fonctions et filtrer dans la gate : Oui -Ne pas mettre deux fois la meme fonction via les pragmas : Non +Ne pas mettre deux fois la meme fonction via les pragmas : Oui Pas de pragma dans les fonctions : Oui diff --git a/functions/pragma.c b/functions/pragma.c index 3d716af..164607e 100644 --- a/functions/pragma.c +++ b/functions/pragma.c @@ -5,7 +5,7 @@ vec<const char*> pragma_func_names_temp; static void my_pragma_action(cpp_reader *ARG_UNUSED(dummy)) { - printf("****** Pragam detected: ******\n"); + printf("****** Pragma detected: ******\n"); enum cpp_ttype token; tree x; const char* elt; diff --git a/plugin.cpp b/plugin.cpp index 06c12cb..19dd67a 100755 --- a/plugin.cpp +++ b/plugin.cpp @@ -73,9 +73,20 @@ class split_count_pass : public gimple_opt_pass /* Gate function (shall we apply this pass?) */ bool gate (function * fun) { + bool func_to_be_analyzed = true; + printf("=> plugin: split_count_pass... \n"); printf("=> plugin: gate... \n"); - return true; + if((pragma_func_names.length() == 0)){ + printf("\nNOT USING PRAGMAS - ANALYSING ALL FUNCS\n\n"); + return true; + } + + const char *elt; + for(int ix = 0; pragma_func_names.iterate (ix, &elt); ix++) + func_to_be_analyzed = (strcmp(elt,function_name(fun))==0) && func_to_be_analyzed; + printf("USING PRAGMAS - FUNC IS : %s", function_name(fun)); + return func_to_be_analyzed; } @@ -122,16 +133,7 @@ class cleanup_pass : public gimple_opt_pass bool func_to_be_analyzed = true; printf("=> plugin: cleanup_pass... \n"); printf("=> plugin: gate... \n"); - if((pragma_func_names.length() == 0)){ - printf("\nNOT USING PRAGMAS - ANALYSING ALL FUNCS\n\n"); - return true; - } - - const char *elt; - for(int ix = 0; pragma_func_names.iterate (ix, &elt); ix++) - func_to_be_analyzed = (strcmp(elt,function_name(fun))==0) && func_to_be_analyzed; - printf("USING PRAGMAS - FUNC IS : %s", function_name(fun)); - return func_to_be_analyzed; + return true; } -- GitLab