Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 2b5825271e8578b54a3c4e9635faba055b6024ca
  • master par défaut protégée
2 résultats

mpi_collective_pass.cpp

Blame
  • mpi_collective_pass.cpp 5,17 Kio
    // dependance of context.h
    #include <gcc-plugin.h>
    // 'g' global variable
    #include <context.h>
    // dependance of gimple.h
    #include <tree.h>
    // dependance of gimple-iterator.h
    #include <gimple.h>
    // gsi
    #include <gimple-iterator.h>
    
    // our pass
    #include "mpi_collective.hpp"
    
    // Definitions
    const pass_data my_pass_data =
    {
    	GIMPLE_PASS, /* type */
    	"MPI COLLECTIVE", /* name */
    	OPTGROUP_NONE, /* optinfo_flags */
    	TV_OPTIMIZE, /* tv_id */
    	0, /* properties_required */
    	0, /* properties_provided */
    	0, /* properties_destroyed */
    	0, /* todo_flags_start */
    	0, /* todo_flags_finish */
    };
    
    // Class functions
    pass_mpi_collective::pass_mpi_collective(gcc::context *ctxt)
    	: opt_pass(my_pass_data, ctxt)
    {
    	for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; ++i)
    	{
    		collective_max_rank[i] = 0;
    	}
    }
    
    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));
    	printf("In gate of: %s\n", function_name(fun));
    	//printf("In gate of: %s\n", current_function_name());
    	return true;
    }
    
    unsigned int pass_mpi_collective::execute(function *fun)
    {
    	// need because pass objectis reused
    	for (int i = 0; i < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; ++i)
    	{
    		collective_max_rank[i] = 0;
    	}
    
    	printf("In execute of: %s\n", function_name(fun));
    
    	//print_tree(fun);
    	split_blocks(fun);
    	//printf("\t--------------------------[split]---------------------------\n");
    	//print_tree(fun);
    
    	alloc_bb_aux(fun);
    	alloc_edge_aux(fun);
    	calc_dom_data();