diff --git a/Makefile b/Makefile index 498429c003b179282428c4de21ef2c66706b741b..88a942585f3f54e196db0ff74ab48f4f3320d8c3 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -all: TEST1 TEST2 TEST3 TEST4 +.PHONY: all +all: TEST1 TEST2 TEST3 TEST4 dot convert TEST1=./tests/simple_test1.c TEST2=./tests/simple_test2.c @@ -20,21 +21,26 @@ libplugin.so: $(PLUGIN) $(CXX) $(PLUGIN_FLAGS) -o $@ $< TEST1: libplugin.so $(TEST1) - $(MPICC) $(TEST1) $(CFLAGS) -o $@ -fplugin=./$< + $(MAKE) -C tests TEST1 TEST2: libplugin.so $(TEST2) - $(MPICC) $(TEST2) $(CFLAGS) -o $@ -fplugin=./$< + $(MAKE) -C tests TEST2 TEST3: libplugin.so $(TEST3) - $(MPICC) $(TEST3) $(CFLAGS) -o $@ -fplugin=./$< + $(MAKE) -C tests TEST3 TEST4: libplugin.so $(TEST4) - $(MPICC) $(TEST4) $(CFLAGS) -o $@ -fplugin=./$< + $(MAKE) -C tests TEST4 -%.pdf: %.dot - dot -Tpdf $< -o $@ +.PHONY: dot +dot: + $(MAKE) -C tests dot +.PHONY: convert +convert: + $(MAKE) -C graphs convert +.PHONY: clean clean: rm -rf *.pgr *.pdf plugin rm -rf libplugin.so *.dot plugin rm -rf TEST* + $(MAKE) -C tests clean + $(MAKE) -C graphs clean -clean_all: clean - rm -rf libplugin.so *.dot plugin diff --git a/functions/graph.c b/functions/graph.c index d24ab1b55c932794b63c97a9a74e59cd7f43a55a..a18bd4b56d374983a1adc470814120e1a60ee5a2 100644 --- a/functions/graph.c +++ b/functions/graph.c @@ -25,13 +25,6 @@ void cfgviz_internal_dump( function * fun, FILE * out, int td ) fprintf(out, "Digraph G{\n"); - - /******************************/ - /**** TD2 - QUESTION 7 ****/ - /******************************/ - - - FOR_ALL_BB_FN(bb,cfun) { @@ -80,10 +73,6 @@ void cfgviz_internal_dump( function * fun, FILE * out, int td ) } } - /******************************/ - /** TD2 - FIN QUESTION 7 **/ - /******************************/ - // Close the main graph fprintf(out, "}\n"); diff --git a/graphs/Makefile b/graphs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..a8470d4856bf1f61b807e6ee7812c21fe36cbc1b --- /dev/null +++ b/graphs/Makefile @@ -0,0 +1,5 @@ +convert: + ./converter.bash +clean: + rm -rf *.dot + rm -rf *.pdf diff --git a/graphs/converter.bash b/graphs/converter.bash new file mode 100755 index 0000000000000000000000000000000000000000..3459519733774da6150fa931fc0846b933aa4bf2 --- /dev/null +++ b/graphs/converter.bash @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +for file in *.dot +do + dot -Tpdf $file -o "$file".pdf +done diff --git a/plugin.cpp b/plugin.cpp index b91cb4a25afa1fbf4e9567056b2abf1da7e1d593..ae48b078936e2978fd29a1e1b434d52b2b7a868b 100755 --- a/plugin.cpp +++ b/plugin.cpp @@ -97,12 +97,17 @@ class split_count_pass : public gimple_opt_pass printf("=> plugin: split_count_pass... \n"); printf("=> plugin: execute...\n"); printf("... in function %s\n\n", function_name(fun)); + //counter in bb aux mark_number_of_calls(fun); //split bb where we find several MPI calls split_mpi_block(fun); //writing corresponding MPI Call in corresponding basic block write_mpi_code(fun); + /* Skip system header functions */ + if ( !in_system_header_at( fun->function_start_locus ) ) + cfgviz_dump( fun, function_name(fun), 1 ) ; + return 0; } }; diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c5c173cb874246322d38bf52a3f84c5d8ac3b0d1 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,30 @@ +all: TEST1 TEST2 TEST3 TEST4 + +TEST1=simple_test1.c +TEST2=simple_test2.c +TEST3=split_bloc.c +TEST4=pragma_test.c + +PLUGIN=plugin.cpp +CXX=g++_810 +CC=gcc_810 + +MPICC=mpicc + +CFLAGS=-g -O3 + +TEST1: ../libplugin.so $(TEST1) + $(MPICC) $(TEST1) $(CFLAGS) -o $@ -fplugin=$< +TEST2: ../libplugin.so $(TEST2) + $(MPICC) $(TEST2) $(CFLAGS) -o $@ -fplugin=$< +TEST3: ../libplugin.so $(TEST3) + $(MPICC) $(TEST3) $(CFLAGS) -o $@ -fplugin=$< +TEST4: ../libplugin.so $(TEST4) + $(MPICC) $(TEST4) $(CFLAGS) -o $@ -fplugin=$< + +dot: + mv *.dot ../graphs/ +clean: + rm -rf *.pgr *.pdf plugin + rm -rf libplugin.so *.dot plugin + rm -rf TEST*