From 27dea056e1547b2b884dedac07e9cd62ddc1522b Mon Sep 17 00:00:00 2001
From: "nicolas.marie" <nicolas.marie@ensiie.eu>
Date: Mon, 9 Oct 2023 19:25:06 +0200
Subject: [PATCH] apply style and reformat headers

---
 include/pass_mpi_collective.hpp | 10 ++++------
 src/pass_mpi_collective.cpp     | 15 ---------------
 src/plugin.cpp                  | 12 ++++--------
 3 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/include/pass_mpi_collective.hpp b/include/pass_mpi_collective.hpp
index 79b3c97..32a24bc 100644
--- a/include/pass_mpi_collective.hpp
+++ b/include/pass_mpi_collective.hpp
@@ -3,25 +3,23 @@
 // declare opt_pass
 #include <tree-pass.h>
 
-
 /* Enum to represent the collective operations */
+#define DEFMPICOLLECTIVES(CODE, NAME) CODE,
 enum mpi_collective_code
 {
-#define DEFMPICOLLECTIVES( CODE, NAME ) CODE,
 #include "mpi_collectives.def"
 	LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
+};
 #undef DEFMPICOLLECTIVES
-} ;
 
 /* Name of each MPI collective operations */
-#define DEFMPICOLLECTIVES( CODE, NAME ) NAME,
+#define DEFMPICOLLECTIVES(CODE, NAME) NAME,
 const char *const mpi_collective_name[] =
 {
 #include "mpi_collectives.def"
-} ;
+};
 #undef DEFMPICOLLECTIVES
 
-
 class pass_mpi_collective : public opt_pass
 {
 
diff --git a/src/pass_mpi_collective.cpp b/src/pass_mpi_collective.cpp
index 636be5d..713adc7 100644
--- a/src/pass_mpi_collective.cpp
+++ b/src/pass_mpi_collective.cpp
@@ -12,8 +12,6 @@
 // our pass
 #include "pass_mpi_collective.hpp"
 
-
-
 // Definitions
 const pass_data my_pass_data =
 {
@@ -28,16 +26,13 @@ const pass_data my_pass_data =
 	0, /* todo_flags_finish */
 };
 
-
 // Class functions
 pass_mpi_collective::pass_mpi_collective(gcc::context *ctxt)
 	: opt_pass(my_pass_data, ctxt) {}
 
-
 pass_mpi_collective *pass_mpi_collective::clone()
 {return new pass_mpi_collective(g);}
 
-
 bool pass_mpi_collective::gate(function *fun)
 {
 	//printf("In gate of: %s\n", fndecl_name(fun->decl));
@@ -46,7 +41,6 @@ bool pass_mpi_collective::gate(function *fun)
 	return true;
 }
 
-
 unsigned int pass_mpi_collective::execute(function *fun)
 {
 	printf("In execute of: %s\n", function_name(fun));
@@ -58,7 +52,6 @@ unsigned int pass_mpi_collective::execute(function *fun)
 	return 0;
 }
 
-
 void pass_mpi_collective::print_tree(function *fun)
 {
 	basic_block bb;
@@ -96,14 +89,12 @@ void pass_mpi_collective::print_tree(function *fun)
 bool pass_mpi_collective::is_func(gimple *stmt)
 {return is_gimple_call(stmt);}
 
-
 bool pass_mpi_collective::__is_mpi_func(gimple *stmt)
 {return strncmp(fndecl_name(gimple_call_fndecl(stmt)), "MPI_", 4) == 0;}
 
 bool pass_mpi_collective::is_mpi_func(gimple *stmt)
 {return is_func(stmt) && __is_mpi_func(stmt);}
 
-
 mpi_collective_code pass_mpi_collective::__is_mpi_collec(gimple *stmt)
 {
 	size_t i;
@@ -128,7 +119,6 @@ mpi_collective_code pass_mpi_collective::is_mpi_collec(gimple *stmt)
 	return __is_mpi_collec(stmt);
 }
 
-
 // TODO tag blocks and set bb->data
 //void pass_mpi_collective::tag_blocks(){
 
@@ -160,8 +150,6 @@ void pass_mpi_collective::split_blocks(function *fun)
 	}
 }
 
-
-
 /* Build a filename (as a string) based on function name */
 char *pass_mpi_collective::cfgviz_generate_filename(function *fun,
     const char *suffix)
@@ -235,6 +223,3 @@ void pass_mpi_collective::cfgviz_dump(function *fun,
 	fclose(out);
 	free(target_filename);
 }
-
-
-
diff --git a/src/plugin.cpp b/src/plugin.cpp
index 481a9eb..29cc8aa 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -10,7 +10,6 @@
 // our pass
 #include "pass_mpi_collective.hpp"
 
-
 /* Global variable required for plugin to execute */
 int plugin_is_GPL_compatible;
 
@@ -35,8 +34,6 @@ plugin_init(struct plugin_name_args *plugin_info,
 	printf("\thelp = %s\n", plugin_info->help);
 	printf("\n\n");
 
-
-
 	pass_mpi_collective p(g);
 
 	struct register_pass_info pass_info;
@@ -46,11 +43,10 @@ plugin_init(struct plugin_name_args *plugin_info,
 	pass_info.ref_pass_instance_number = 0;
 	pass_info.pos_op = PASS_POS_INSERT_AFTER;
 
-	register_callback(	plugin_info->base_name,
-	                    PLUGIN_PASS_MANAGER_SETUP,
-	                    NULL,
-	                    &pass_info);
+	register_callback(plugin_info->base_name,
+	                  PLUGIN_PASS_MANAGER_SETUP,
+	                  NULL,
+	                  &pass_info);
 
 	return 0;
 }
-
-- 
GitLab