Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • d348b4e33eb4ec6d1ebbda103335bb6ba4705b86
  • master par défaut
  • 1-baka-export
  • meson
  • assdraw
  • old-master
  • v3.2.2
  • v3.2.1
  • v3.2.0
  • v3.1.3
  • v3.1.2
  • v3.1.1
  • v3.1.0
  • v3.0.4
  • v3.0.3
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.1.3
  • v2.1.4
  • v2.1.5
  • v2.1.6
  • v2.1.0
  • v2.1.1
  • v2.1.2
  • v2.1.7
26 résultats

auto4_lua_dialog.cpp

Blame
    • Amar Takhar's avatar
      d348b4e3
      · d348b4e3
      Amar Takhar a rédigé
      Fix all the headers in *.cpp, this includes:
       * Wrapping all headers that are in agi_pre.h with AGI_PRE.
       * Sorting alphabetically.
      
      Originally committed to SVN as r3515.
      d348b4e3
      Historique
      Amar Takhar a rédigé
      Fix all the headers in *.cpp, this includes:
       * Wrapping all headers that are in agi_pre.h with AGI_PRE.
       * Sorting alphabetically.
      
      Originally committed to SVN as r3515.
    plugin.cpp 6,69 Kio
    #include <gcc-plugin.h>                                                          
    #include <plugin-version.h>                                                      
    #include <tree.h>                                                                
    #include <basic-block.h>                                                         
    #include <gimple.h>                                                              
    #include <tree-pass.h>                                                           
    #include <context.h>                                                             
    #include <function.h>                                                            
    #include <gimple-iterator.h>                                                     
    #include <c-family/c-pragma.h>
    #include "system.h"
    #include "vec.h"
    #include <string.h>
    
    // Project headers
    #include "./functions/MPI_types.h"
    #include "./functions/aux_values.h"
    #include "./functions/aux_values.c"
    #include "./functions/dominance.h"
    #include "./functions/dominance.c"
    #include "./functions/graph.h"
    #include "./functions/graph.c"
    #include "./functions/MPI_functions.h"
    #include "./functions/MPI_functions.c"
    #include "./functions/pragma.h"
    #include "./functions/pragma.c"
    
    int plugin_is_GPL_compatible;
    
    // First pass data corresponding to 
    const pass_data split_count_pass_data =
    {
            GIMPLE_PASS, /* type */
            "DDPASS1", /* 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 */
    };
    
    const pass_data cleanup_pass_data =
    {
            GIMPLE_PASS, /* type */
            "DDPASS2", /* 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 split_count_pass : public gimple_opt_pass
    {
            public:
                    split_count_pass (gcc::context *ctxt)
                            : gimple_opt_pass (split_count_pass_data, ctxt)
                    {}
    
                    /* opt_pass methods: */
                    split_count_pass *clone ()
                    {
                            return new split_count_pass(g);
                    }
    
    
    
                    /* Gate function (shall we apply this pass?) */
                    bool gate (function * fun)
                    {
    			bool func_to_be_analyzed = true;
    			
    			add_function_to_analyzed_funcs(fun);
    
                            printf("=> plugin: split_count_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;
                    }
    
    
    
                    /* Execute function */
                    unsigned int execute (function *fun)
                    {
                            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
    			edit_all_aux_value(fun,(int*)NULL);
    			write_mpi_code(fun);
    			//print_bb_aux(fun);
    			/* Skip system header functions */
                            if ( !in_system_header_at( fun->function_start_locus ) ) 
                                  cfgviz_dump( fun, function_name(fun), 1 ) ;
    		
    			return 0;
                    }
    };
    
    class cleanup_pass : public gimple_opt_pass
    {
            public:
                    cleanup_pass (gcc::context *ctxt)
                            : gimple_opt_pass (cleanup_pass_data, ctxt)
                    {}
    
                    /* opt_pass methods: */
                    cleanup_pass *clone ()
                    {
                            return new cleanup_pass(g);
                    }
    
    
    
                    /* Gate function (shall we apply this pass?) */
                    bool gate (function * fun)
                    {
    		        printf("=> plugin: cleanup_pass... \n");
                            printf("=> plugin: gate... \n");
    			return true;
                    }
    
    
    
                    /* Execute function */
                    unsigned int execute (function *fun)
                    {
    			const char *elt;
                            printf("=> plugin: cleanup_pass... \n");
                            printf("=> plugin: execute...\n");
    			
    			printf("... in function %s\n\n", function_name(fun));
    			printf("State of vec analyzed :\n");
    			for (int ix = 0; analyzed_functions.iterate (ix, &elt); ix++){
                                    printf("- %s\n", elt);
                            }
    			compare_pragma_funcs_analyzed_funcs();
    			edit_all_aux_value(fun,(int*)NULL);
    			return 0;
                    }
    };
    
    int plugin_init(struct plugin_name_args * plugin_info, struct plugin_gcc_version * version)
    {
    
    	fprintf(stderr, "\n*********************************\n");
    	fprintf(stderr, "init - plugin dilasser/donnenfeld\n");
    	fprintf(stderr, "*********************************\n\n\n");
    
    	if(!plugin_default_version_check(version, &gcc_version)) return 1;
    
    	struct register_pass_info split_count_info;
    	struct register_pass_info cleanup_info;
    	
            split_count_pass first_pass(g);
    
            split_count_info.pass = &first_pass;
            split_count_info.reference_pass_name = "cfg";
            split_count_info.ref_pass_instance_number = 0;
            split_count_info.pos_op = PASS_POS_INSERT_AFTER;
    
    
    
    	//REGISTER PASS
            register_callback(plugin_info->base_name,
                            PLUGIN_PASS_MANAGER_SETUP,
                            NULL,
                            &split_count_info);
    
    	
            cleanup_pass second_pass(g);
    
            cleanup_info.pass = &second_pass;
            cleanup_info.reference_pass_name = "DDPASS1";
            cleanup_info.ref_pass_instance_number = 0;
            cleanup_info.pos_op = PASS_POS_INSERT_AFTER;
    
    
    
    	//REGISTER PASS
            register_callback(plugin_info->base_name,
                            PLUGIN_PASS_MANAGER_SETUP,
                            NULL,
                            &cleanup_info);
    
    	// REGISTER PRAGMA
    	register_callback("plugin_name", PLUGIN_PRAGMAS, register_my_pragma, NULL );
    
    
    	return 0;
    }