PIPS
pips.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "effects.h"
#include "properties.h"
#include "misc.h"
#include "newgen.h"
#include "ri-util.h"
#include "complexity_ri.h"
#include "constants.h"
#include "resources.h"
#include "database.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "top-level.h"
+ Include dependency graph for pips.c:

Go to the source code of this file.

Functions

static void pips_parse_arguments (int argc, char *argv[])
 
static void select_rule (char *rule_name)
 
int pips_main (int argc, char **argv)
 Warning! Do not modify this file that is automatically generated! More...
 

Variables

void(* pips_error_handler )()
 
void(* pips_log_handler )()
 
void(* pips_warning_handler )()
 
char * soft_revisions
 could be shared somewhere? More...
 
char * soft_date
 
char * cc_version
 
static char * usage
 
static char * wspace = NULL
 
static char * module = NULL
 
static char * performed_rule = NULL
 
static list build_resource_names = NIL
 
static gen_array_t source_files = NULL
 
static list selected_rules = NIL
 

Function Documentation

◆ pips_main()

int pips_main ( int  argc,
char **  argv 
)

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/pips/pips-local.h instead, to add your own modifications. header file built by cproto pips-local.h cproto-generated files pips.c

Parameters
argcrgc
argvrgv

Definition at line 160 of file pips.c.

161 {
162  volatile bool success = true;
163  pips_checks();
165 
169 
170  pips_parse_arguments(argc, argv);
171 
172  debug_on("PIPS_DEBUG_LEVEL");
174 
176  {
177  // no need to pop_pips_context() at top-level
178  // FI: are you sure make_close_program() cannot call user_error() ?
179  close_workspace(true);
180  success = false;
181  }
182  TRY
183  {
184  // Initialize workspace
188  }
189  else {
190  user_log("Cannot create workspace %s!\n", wspace);
191  exit(1);
192  }
193  } else {
194  // Workspace must be opened
195  if (!open_workspace(wspace)) {
196  user_log("Cannot open workspace %s!\n", wspace);
197  exit(1);
198  }
199  }
200 
201  // Open module
202  if (module != NULL)
204  else
206 
207  // Activate rules
208  if (success && selected_rules)
209  {
211  }
212 
213  // Perform applies
214  if (success && performed_rule && module)
215  {
217  if (success) {
218  user_log("%s performed for %s.\n", performed_rule, module);
219  }
220  else {
221  user_log("Cannot perform %s for %s.\n", performed_rule, module);
222  }
223  }
224 
225  // Build resources
227  {
228  FOREACH(STRING, build_resource_name, build_resource_names)
229  {
230  success = safe_make(build_resource_name, module);
231  if (!success)
232  {
233  user_log("Cannot build %s for %s.\n", build_resource_name, module);
234  break;
235  }
236  }
237  }
238  // whether success or not...
239  close_workspace(true);
240 
242  }
243 
244  debug_off();
245 
246  return !success;
247 }
void user_log(const char *format,...)
Definition: message.c:234
void set_pips_meta_informations(const char *revs, const char *date, const char *comp)
Definition: message.c:102
#define CATCH(what)
@ any_exception_error
catch all
#define UNCATCH(what)
#define TRY
void set_exception_callbacks(exception_callback_t, exception_callback_t)
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
bool open_module(const char *name)
tpips used to convert lower cases into upper cases for all module names, but this is no longer possib...
Definition: dbm.c:95
bool open_module_if_unique(void)
Open the module of a workspace if there is only one.
Definition: dbm.c:144
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
Definition: dbm.c:180
bool close_workspace(bool is_quit)
Definition: dbm.c:346
bool open_workspace(const char *name)
should be: success (cf wpips.h)
Definition: dbm.c:309
void push_pips_context(char const *file, char const *function, int line)
exception.c
Definition: exception.c:43
void pop_pips_context(char const *file, char const *function, int line)
Definition: exception.c:50
#define STRING(x)
Definition: genC.h:87
bool success
Definition: gpips-local.h:59
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
void pips_checks(void)
add checkings here (FI: why in help.c?) SG : PIPS_ROOT should not be required :)
Definition: help.c:100
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define exit(code)
Definition: misc-local.h:54
void initialize_newgen()
cproto-generated files
Definition: newgen.c:48
static list selected_rules
Definition: pips.c:78
char * soft_revisions
could be shared somewhere?
Definition: revisions.c:33
static list build_resource_names
Definition: pips.c:76
char * cc_version
Definition: revisions.c:41
static void select_rule(char *rule_name)
Definition: pips.c:149
char * soft_date
Definition: revisions.c:39
static char * performed_rule
Definition: pips.c:75
static char * wspace
Definition: pips.c:73
static void pips_parse_arguments(int argc, char *argv[])
Definition: pips.c:80
static char * module
Definition: pips.c:74
static gen_array_t source_files
Definition: pips.c:77
bool db_create_workspace(const char *)
Definition: workspace.c:282
bool safe_make(const char *res_n, const char *module_n)
Definition: pipsmake.c:1717
bool safe_apply(const char *phase_n, const char *module_n)
Definition: pipsmake.c:1723
void initialize_signal_catcher(void)
Definition: signal.c:126
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
void initialize_sc(char *(*var_to_string)(Variable))
Definition: sc_debug.c:253
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References any_exception_error, build_resource_names, CATCH, cc_version, close_workspace(), create_workspace(), db_create_workspace(), debug_off, debug_on, entity_local_name(), exit, FOREACH, gen_array_nitems(), initialize_newgen(), initialize_sc(), initialize_signal_catcher(), module, open_module(), open_module_if_unique(), open_workspace(), performed_rule, pips_checks(), pips_parse_arguments(), pop_pips_context(), push_pips_context(), safe_apply(), safe_make(), select_rule(), selected_rules, set_exception_callbacks(), set_pips_meta_informations(), soft_date, soft_revisions, source_files, STRING, TRY, UNCATCH, user_log(), and wspace.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pips_parse_arguments()

static void pips_parse_arguments ( int  argc,
char *  argv[] 
)
static

next two added to deal with boolean properties directly FC, 27/03/95

Definition at line 80 of file pips.c.

81 {
82  int c;
83  extern char *optarg;
84  extern int optind;
86 
87  while ((c = getopt(argc, argv, "vf:m:s:p:b:1:0:")) != -1)
88  switch (c) {
89  case 'v':
90  fprintf(stdout,
91  "pips: (%s)\n"
92  "ARCH=" STRINGIFY(SOFT_ARCH) "\n"
93  "REVS=\n"
94  "%s"
95  "DATE=%s\n",
96  argv[0], soft_revisions, soft_date);
97  exit(0);
98  break;
99  case 'f':
101  break;
102  case 'm':
103  module= optarg;
104  break;
105  case 's':
108  break;
109  case 'p':
111  break;
112  case 'b':
115  break;
116 
117  /* next two added to deal with boolean properties directly
118  * FC, 27/03/95
119  */
120  case '1':
121  set_bool_property(optarg, true);
122  break;
123  case '0':
124  set_bool_property(optarg, false);
125  break;
126  case '?':
127  fprintf(stderr, usage, argv[0]);
128  exit(1);
129  ;
130  }
131 
132  if (argc < 2) {
133  fprintf(stderr, usage, argv[0]);
134  exit(1);
135  }
136 
137  if (argc != optind + 1) {
138  user_warning("pips_parse_argument",
139  ((argc < (optind + 1)) ?
140  "Too few arguments\n" : "illegal argument: %s\n"),
141  argv[optind + 1]);
142  fprintf(stderr, usage, argv[0]);
143  exit(1);
144  }
145  wspace= argv[argc - 1];
146 }
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void gen_array_append(gen_array_t a, void *what)
Definition: array.c:105
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define STRINGIFY(symbol)
If not using this 2-stage macro evaluation, the generated string is not the value of the macro but th...
Definition: misc-local.h:50
#define user_warning(fn,...)
Definition: misc-local.h:262
static char * usage
Definition: pips.c:63
void set_bool_property(const char *, bool)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int optind
char * optarg

References build_resource_names, CONS, exit, fprintf(), gen_array_append(), gen_array_make(), gen_nconc(), module, NIL, optarg, optind, performed_rule, selected_rules, set_bool_property(), soft_date, soft_revisions, source_files, STRING, STRINGIFY, usage, user_warning, and wspace.

Referenced by pips_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ select_rule()

static void select_rule ( char *  rule_name)
static

Definition at line 149 of file pips.c.

151 {
152  user_log("Selecting rule: %s\n", rule_name);
153 
154  activate(rule_name);
155 
156  ifdebug(5) fprint_activated(stderr);
157 }
const char * activate(const char *phase)
Definition: activate.c:214
void fprint_activated(FILE *fd)
Definition: activate.c:110
#define ifdebug(n)
Definition: sg.c:47

References activate(), fprint_activated(), ifdebug, and user_log().

Referenced by pips_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ build_resource_names

list build_resource_names = NIL
static

Definition at line 76 of file pips.c.

Referenced by pips_main(), and pips_parse_arguments().

◆ cc_version

char* cc_version
extern

Definition at line 41 of file revisions.c.

Referenced by parse_arguments(), pips_main(), tpips_main(), and wpips_main().

◆ module

char* module = NULL
static

Definition at line 74 of file pips.c.

Referenced by __pyps_bench_stop(), actual_symbol_table_dump(), add_bound_arguments(), add_common_variables_to_hash_table(), add_control_counters(), add_counters(), add_new_compilation_unit(), add_new_module(), add_one_bound_argument(), add_parameter_variable_to_module(), add_private_variable_to_module(), AddCommonToModule(), AddEntityToDeclarations(), AddEntityToModule(), AddEntityToModuleCompilationUnit(), AddLocalEntityToDeclarations(), AddLocalEntityToDeclarationsOnly(), alias_classes(), alias_lists(), aliases_text(), argument_bound_entity(), ask_a_missing_file(), atomizer(), attach_head_to_sentence(), bound_generation(), build_call_STEP_AllToAll(), build_new_variable(), build_sc_with_several_uniform_ref(), c_code_string(), c_declarations(), c_head(), c_text_entities(), c_text_entity(), c_text_entity_simple(), c_text_related_entities(), callgraph_module_name(), CCompilationUnitMemoryAllocation(), CCompilationUnitMemoryAllocations(), CCompilationUnitMemoryReallocation(), cell_reference_compare(), check_commons(), check_one_common(), clean_up_points_to_stubs(), clean_up_sequences_rewrite(), clone_variable_with_new_name(), clone_variable_with_unique_name(), CModuleMemoryAllocation(), comEngine_distribute(), common_members_of_module(), compilation_unit_text(), compile_a_pure_function(), compile_a_special_io_function(), compile_module(), compile_this_list(), compute_directive_regions(), compute_distribution_context(), compute_distribution_controlization_context(), controlize_distribution(), conv_make_ctx(), create_bound_entity(), create_counter(), create_init_common_param_for_arrays(), create_integer_parameter_for_new_module(), create_local_index(), create_local_index2(), create_new_common_variable(), create_new_integer_scalar_common_variable(), create_new_scalar_common_variable(), create_parameter_for_new_module(), create_parameter_variable_for_new_module(), create_parameters_h(), create_private_integer_variable_for_new_module(), create_private_variable_for_new_module(), create_state_variable(), dag_dot_dump(), dag_dot_dump_prefix(), db_save_workspace(), declaration_with_overlaps_for_module(), declare_common_variables_in_module(), decorate_trail(), delay_communications(), delay_load_communications(), delay_store_communications(), distribute(), distributer(), do_gpu_qualify_pointers(), do_it(), do_recompile_module(), do_scalar_renaming(), drop_distributed_arguments(), eliminate_original_variables(), ensure_comment_consistency(), entity_clean_declarations(), entity_generate_missing_declarations(), entity_in_module(), entity_local_variable_p(), entity_may_conflict_with_a_formal_parameter_p(), eval_variable_in_statement(), explicit_extern_entity_p(), extern_entity_p(), find_entity(), find_operator(), flatten_code(), flinter(), fprint_statement_complexity(), freia_aipo_compile_calls(), freia_aipo_compiler(), freia_build_dag(), freia_compile(), freia_compiler(), freia_compute_output_images(), freia_mppa_compile_calls(), freia_mppa_compiler(), freia_opencl_compile_calls(), freia_opencl_compiler(), freia_remove_scalar_ww_deps(), freia_sigmac_compiler(), freia_spoc_code_buildup(), freia_spoc_compiler(), freia_spoc_pipeline(), freia_terapix_call(), freia_terapix_compiler(), freia_trpx_compile_one_dag(), freia_unroll_while(), generate_copy_loop_nest(), generate_variable_with_unique_name_to_module(), generic_clone_variable_with_unique_name(), generic_points_to_analysis(), generic_print_xml_application(), GenericAddLocalEntityToDeclarations(), get_any_comp_regions_text(), get_callees(), get_callers(), get_continuation_condition_text(), get_declaration_comments(), get_entity_step_commsize(), get_entity_step_rank(), get_header_comments(), get_text_complexities(), gfc2pips_symbol2entity(), global_parallelization(), gpu_xml_dump(), guard_elimination(), handle_fake_directive(), handle_io_directive(), handle_pure_directive(), hpfc_common_hook(), hpfc_compile(), hpfc_directives_handler(), hpfc_module_suffix(), hpfc_new_variable(), hpfc_parser(), hpfc_print_code(), hpfc_print_common(), html_prettyprint_symbol_table(), init_points_to_analysis(), init_text_statement(), initial_points_to(), initial_precondition(), inline_calls(), instruction_to_wp65_code(), interactive_loop_transformation(), interface_argument_declaration(), interface_code_string(), interface_signature(), internal_make_new_array_variable(), invariant_code_motion(), list_of_distributed_arrays_for_module(), lNewVariableForModule(), local_entity_of_module_p(), local_name_to_top_level_entity(), look_at_the_commons(), loop_nest_movement_generation(), loop_nest_to_wp65_code(), loop_reductions(), lUpdateExpr(), lUpdateExpr_but_distributed(), make_array_communication_statement(), make_communication_statement(), make_compute_block(), make_datum_movement(), make_host_and_node_modules(), make_increment_statement(), make_loop_label(), make_movement_scalar_wp65(), make_movements_loop_body_wp65(), make_mpi_conversion(), make_new_array_variable(), make_new_array_variable_with_prefix(), make_new_derived_entity_with_prefix(), make_new_index_entity(), make_new_label(), make_new_module_variable(), make_new_scalar_variable(), make_new_scalar_variable_with_prefix(), make_return_statement(), make_scanning_over_one_tile(), make_scanning_over_tiles(), make_temporary_pointer_to_array_entity(), make_temporary_pointer_to_array_entity_with_prefix(), module_clean_declarations(), module_in_user_file_p(), module_initial_parameter_pv(), module_to_callgraph(), module_to_wp65_modules(), movement_computation(), mpi_conversion(), mpi_initialize(), mpi_make_ctx(), mpi_task_generation(), mppa_compile_dag(), new_label_local_name(), new_synonym(), NewVariableForModule(), normalize_microcode_parameter_orders(), NormalizeCommonVariables(), old_name(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), outliner_independent_recursively(), parser(), partial_eval(), phrase_comEngine_distributor(), phrase_distributor(), phrase_distributor_control_code(), pips_log_stop(), pips_main(), pips_parse_arguments(), print_code_or_source(), print_code_smalltalk(), print_code_static_control(), print_crough(), print_initial_precondition(), print_interface(), print_module_icfg(), print_parallelization_statistics(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), print_xml_code(), print_xml_code_with_explicit_motif(), proper_reductions(), put_generated_resources_for_module(), put_summary(), read_from_eole(), read_new_entities_from_eole(), recompile_module(), redundant_load_store_elimination(), reference_conversion_statement(), regions_to_loops(), remapping_file_name(), remove_common_variables_from_hash_table(), remove_simple_scalar_pointers(), RemoveLocalEntityFromDeclarations(), replace_indices_region(), replace_indices_region_com(), retrieve_a_missing_file_using_external_resolver(), retrieve_a_missing_file_using_internal_resolver(), rice(), rice_dependence_graph(), sac_make_new_variable(), safescale_distributor(), safescale_module_analysis(), sc_add_new_variable_name(), sc_delimiter(), sc_image_computation(), semantic_to_text(), sentence_area(), sentence_goto(), set_resources_for_module(), simplify_dg(), smalltalk_code_string(), sort_parameters(), spear_log_alist(), st_arguments(), st_declarations(), st_declarations_comment(), st_declarations_init(), st_header(), statement_flatten_declarations(), statement_has_a_module_formal_argument_write_effect_p(), statements_localize_declarations(), static_controlize(), step_add_point_into_effect_path(), step_analyse(), step_compile(), step_compile_analysed_module(), step_compile_generated_module(), step_compute_SENDRECV_regions(), step_init_effect_path(), step_local_loop_index(), step_local_loopSlices(), step_local_regionArray(), step_local_slice_index(), step_parameter(), step_RT_set_local_declarations(), step_summarize_and_map_step_regions(), step_symbolic(), step_symbolic_expression(), step_translate_and_map(), store_new_module(), string_to_entities(), string_to_entity(), string_to_entity_list(), string_to_expression(), string_to_expressions(), strip_mine(), stub_text(), summarize_and_map_step_regions(), task_mapping(), text_area_included(), text_block(), text_block_else(), text_block_elseif(), text_block_if(), text_block_ifthen(), text_common_declaration(), text_declaration(), text_entity_declaration(), text_instruction(), text_io_block_if(), text_logical_if(), text_loop(), text_loop_90(), text_loop_cmf(), text_loop_craft(), text_loop_default(), text_statement_continuation_conditions(), text_summary_complexity(), text_test(), text_trail(), text_unstructured(), text_whileloop(), the_actual_parser(), tiling_sequence(), translate_unary_into_binary_ref(), unsplit_internal(), update_list_for_module(), update_object_for_module(), UpdateExpressionForModule(), UpdateStatementForModule(), variable_declaration_coherency_p(), words_variable_or_function(), wp65(), write_to_eole(), xml_Application(), xml_Boxes(), xml_Call(), xml_Chain_Graph(), xml_Chains(), xml_code(), xml_code_string(), xml_declarations(), xml_declarations_with_explicit_motif(), xml_FormalVariables(), xml_LocalVariables(), xml_Task(), and xml_TaskParameters().

◆ performed_rule

char* performed_rule = NULL
static

Definition at line 75 of file pips.c.

Referenced by pips_main(), and pips_parse_arguments().

◆ pips_error_handler

void(* pips_error_handler) () ( )
extern

◆ pips_log_handler

void(* pips_log_handler) () ( )
extern

◆ pips_warning_handler

void(* pips_warning_handler) () ( )
extern

◆ selected_rules

list selected_rules = NIL
static

Definition at line 78 of file pips.c.

Referenced by pips_main(), and pips_parse_arguments().

◆ soft_date

char* soft_date
extern

Definition at line 39 of file revisions.c.

Referenced by parse_arguments(), pips_main(), pips_parse_arguments(), tpips_main(), and wpips_main().

◆ soft_revisions

char* soft_revisions
extern

could be shared somewhere?

Definition at line 33 of file revisions.c.

Referenced by pips_main(), pips_parse_arguments(), and wpips_main().

◆ source_files

gen_array_t source_files = NULL
static

Definition at line 77 of file pips.c.

Referenced by pips_main(), and pips_parse_arguments().

◆ usage

char* usage
static
Initial value:
=
"Usage: %s [-v] [-f F]* [-m M] [-s S]* [-p P] [-b B] [-(0|1) T]* wspace\n"
"\t-v: pips version (which pips/ARCH)\n"
"\t-f F: source file F\n"
"\t-m M: module M\n"
"\t-s S: select rule S\n"
"\t-p P: perform rule P\n"
"\t-b B: build resource B\n"
"\t-(0|1) T: set boolean property T to FALSE or TRUE\n"

Definition at line 63 of file pips.c.

Referenced by pips_parse_arguments().

◆ wspace

char* wspace = NULL
static

Definition at line 73 of file pips.c.

Referenced by pips_main(), and pips_parse_arguments().