osprey/driver/phases.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <errno.h>
#include <sys/param.h>
#include <sys/utsname.h>
#include <sys/resource.h>
#include <sys/time.h>
#include "pathscale_defs.h"
#include "phases.h"
#include "options.h"
#include "lang_defs.h"
#include "option_seen.h"
#include "option_names.h"
#include "string_utils.h"
#include "errors.h"
#include "file_names.h"
#include "file_utils.h"
#include "run.h"
#include "objects.h"
#include "opt_actions.h"
#include "profile_type.h"
#include "lib_phase_dir.h"

Include dependency graph for phases.c:

Go to the source code of this file.

Defines

#define MAX_PHASE_ORDER   10
#define EXE   ""
#define DSO   ".so"
#define is_shell_special(c)
#define is_shell_quote_special(c)

Functions/Subroutines

void turn_down_opt_level (int new_olevel, char *msg)
static void convert_saved_command_line_into_string (void)
static char * make_ii_file_name (char *objname)
static char * make_rii_file_name (char *objname)
static int update_instantiation_info_file (char *ii_file_name, char *sourcefile)
static void write_command_string_into_file (FILE *cmdfile, char *sourcefile, int for_ii_file)
static void add_command_line_arg (string_list_t *args, char *sourcefile)
static void do_f90_common_args (string_list_t *args)
static void set_f90_source_form (string_list_t *args, boolean set_line_length)
static phases_t post_fe_phase (void)
static boolean previous_mf_exists (string_list_t *list)
static void remove_previous_mf (string_list_t *list)
static void add_implied_string (string_list_t *list, int iflag, int flag, phases_t phase)
static void copy_phase_options (string_list_t *phase_list, phases_t phase)
static void add_language_option (string_list_t *args)
static void add_targ_options (string_list_t *args)
char * driver_basename (char *const s)
char * dirname (char *const s)
static void add_arg (string_list_t *args, const char *format,...) __attribute__((format(printf
static void set_library_paths (string_list_t *args)
static char * fix_name_by_phase (char *name, phases_t phase)
char * fix_name_by_lang (char *name)
static void add_inc_path (string_list_t *args, const char *fmt,...) __attribute__((format(printf
boolean platform_is_64bit (void)
boolean target_is_native (void)
static void specify_dyn_linker (string_list_t *args)
static void specify_ipa_dyn_linker (string_list_t *args)
static void add_file_args (string_list_t *args, phases_t index)
static void get_libgcc_s_name (char **libgcc_s_std, char **libgcc_s_dir32)
static void add_libgcc_s (string_list_t *args)
static void add_final_ld_args (string_list_t *args, phases_t ld_phase)
static void postprocess_ld_args (string_list_t *args)
static void add_phase (phases_t p)
static void add_inline_option (void)
static void determine_phase_order (void)
static void check_existence_of_phases (void)
static void add_instr_archive (string_list_t *args)
char * get_binutils_lib_path (void)
static char * find_toolroot (char *program_name, char *toolroot)
void init_phase_info (void)
void init_phase_names (void)
 for (i=strlen(prefix)-1;i >=0 &&prefix[i]== '-';i--)
 for (j=i;j >=0;j--)
 if ()
void init_frontend_phase_names (int gnu_major_version, int gnu_minor_version)
void run_dsm_prelink (void)
phases_t determine_ld_phase (boolean run_ipa)
void run_ld (void)
void run_ar (void)
void run_pixie (void)
void run_prof (void)
void run_compiler (int argc, char *argv[])
int quoted_length (char *p, int *quoted)
int quote_shell_arg (char *p, char *buf)
void add_minus_c_option (void)
void save_command_line (int argc, char **argv)
int check_for_saved_option (char *opt)
void set_current_arg_pos (int n)
void cancel_saved_arg (int count)
void skip_old_ii_controls (FILE *f)
static void add_ipl_cmd_string (int iflag)
void save_ipl_commands (void)

Variables

int subverbose
char * outfile = NULL
char * prof_file = NULL
char * fb_file = NULL
char * internal_fb_file = NULL
char * opt_file = NULL
char * fb_xdir = NULL
char * fb_cdir = NULL
char * command_line = NULL
char * fb_phase = NULL
char * fb_type = NULL
char * source_file = NULL
boolean multiple_source_files = FALSE
boolean keep_mp = FALSE
boolean keep_list = FALSE
boolean keep_cif = FALSE
boolean keep_listing = FALSE
boolean auto_parallelize = FALSE
boolean Gen_feedback = FALSE
boolean Use_feedback = FALSE
boolean Disable_open_mp = FALSE
boolean Disable_old_mp = FALSE
boolean O3_flag = FALSE
boolean use_cpp = FALSE
boolean expand_ftpp_macros = FALSE
int fortran_line_length = 72
char roundoff = 0
boolean nocpp_flag = FALSE
char * global_toolroot = NULL
char * ld_library_path = NULL
char * ld_libraryn32_path = NULL
char * orig_program_name = NULL
char * old_ld_library_path = NULL
static string_list_tipl_cmds = 0
static boolean string_md = FALSE
static boolean string_mmd = FALSE
string_list_tfeedback_files
static char basebuf [4096]
static char dirbuf [4096]
static char * input_source
static const char * dynamic_linker
static const char * ipa_dynamic_linker
static phases_t phase_order [MAX_PHASE_ORDER]
static int phase_order_index = 0
static phases_t be_phase = P_be
static char ld_library_path_found [PATH_BUF_LEN]
int saved_argc
char ** saved_argv
static int curr_argc
static int add_c = 0


Define Documentation

#define DSO   ".so"

Definition at line 2581 of file phases.c.

#define EXE   ""

Definition at line 2580 of file phases.c.

Referenced by check_existence_of_phases().

#define is_shell_quote_special ( c   ) 

Value:

( (c) == '"' || \
      (c) == '\\' || \
      (c) == '`' || \
      (c) == '$' )

Definition at line 3343 of file phases.c.

Referenced by quote_shell_arg(), and quoted_length().

#define is_shell_special ( c   ) 

Value:

( (c) == '\'' || \
      (c) == '|' || \
      (c) == '&' || \
      (c) == '*' || \
      (c) == '?' || \
      (c) == '[' || \
      (c) == ']' || \
      (c) == ';' || \
      (c) == '!' || \
      (c) == '(' || \
      (c) == ')' || \
      (c) == '^' || \
      (c) == '<' || \
      (c) == '>' || \
      (c) <= ' ' || \
      (c) == '\t' || \
      is_shell_quote_special(c) )

Definition at line 3312 of file phases.c.

Referenced by quoted_length().

#define MAX_PHASE_ORDER   10

Definition at line 2203 of file phases.c.

Referenced by add_phase().


Function Documentation

static void static void add_arg ( string_list_t args,
const char *  format,
  ... 
) [static]

Definition at line 488 of file phases.c.

References add_string(), free(), va_end, va_start, and vasprintf().

Referenced by add_libgcc_s().

static void add_command_line_arg ( string_list_t args,
char *  sourcefile 
) [static]

static void add_file_args ( string_list_t args,
phases_t  index 
) [static]

Definition at line 755 of file phases.c.

References ABI_N32, add_inc_path(), add_language_option(), add_library_dir(), add_string(), add_targ_options(), ansi, append_libraries_to_list(), append_string_lists(), asprintf(), buf, concat_strings(), construct_file_with_extension(), construct_given_name(), construct_name(), count_files, create_temp_file_name(), current_phase, dashdash_flag, directory_path(), Disable_old_mp, Disable_open_mp, do_f90_common_args(), drop_path(), DSO_SHARED, endian, ENDIAN_LITTLE, error(), expand_ftpp_macros, FALSE, fb_cdir, fb_file, fb_xdir, find_crt_path(), find_obj_path(), fix_name_by_phase(), ftz_crt, get_executable_dir(), get_gcc_version(), get_object_file(), get_suffix(), get_suffix_string(), getenv(), string_list_rec::head, inline_t, input_source, instrumentation_invoked, internal_error(), internal_fb_file, invoked_lang, keep_cif, keep_flag, keep_list, keep_listing, keep_mp, L_as, L_cc, L_CC, L_f77, L_f90, last_phase, ldpath_for_pixie, len, make_rii_file_name(), mark_for_cleanup(), multiple_source_files, string_item_rec::name, string_item_rec::next, NULL, O3_flag, opt_file, optargs, option_was_seen(), outfile, P_any_as, P_any_cpp, P_any_ld, P_as, P_be, P_c_cpp, P_c_gfe, P_collect, P_cord, P_cplus_cpp, P_cplus_gfe, P_cpp, P_cppf90_fe, P_cppf_fe, P_f90_cpp, P_f90_fe, P_f_cpp, P_f_fe, P_gas, P_gcpp, P_gcpp_plus, P_inline, P_ipa_link, P_ipl, P_ld, P_ldplus, P_lister, P_m4, P_mpc, P_NONE, P_pca, P_pfa, P_pixie, P_prof, P_ratfor, perror(), post_fe_phase(), prof_file, program_name, quiet_flag, RELOCATABLE, remember_last_phase, replace_string(), root, roundoff, run_m4, s, S_B, S_I, S_N, S_O, S_S, set_f90_source_form(), set_library_paths(), show_but_not_run, show_version, source_file, source_kind, source_lang, sprintf(), strcmp(), STRICT_ANSI, string_copy(), strlen(), strrchr(), strstr(), target_cpu, TRUE, and uname().

Referenced by run_compiler(), run_ld(), run_pixie(), and run_prof().

static void add_final_ld_args ( string_list_t args,
phases_t  ld_phase 
) [static]

static void add_implied_string ( string_list_t list,
int  iflag,
int  flag,
phases_t  phase 
) [static]

static void static void add_inc_path ( string_list_t args,
const char *  fmt,
  ... 
) [static]

Definition at line 612 of file phases.c.

References add_string(), free(), is_directory(), path, va_end, va_start, and vasprintf().

Referenced by add_file_args().

static void add_inline_option ( void   )  [static]

Definition at line 2253 of file phases.c.

References add_phase_for_option(), FALSE, inline_t, option_was_seen(), P_inline, P_ipa_link, P_ipl, and post_fe_phase().

Referenced by run_compiler(), and run_ld().

static void add_instr_archive ( string_list_t args  )  [static]

static void add_ipl_cmd_string ( int  iflag  )  [static]

static void add_language_option ( string_list_t args  )  [static]

Definition at line 333 of file phases.c.

References add_string(), ansi, invoked_lang, KR_ANSI, L_cc, L_CC, L_f77, and L_f90.

Referenced by add_file_args().

static void add_libgcc_s ( string_list_t args  )  [static]

void add_minus_c_option ( void   ) 

Definition at line 3412 of file phases.c.

static void add_phase ( phases_t  p  )  [static]

Definition at line 2210 of file phases.c.

References internal_error(), and MAX_PHASE_ORDER.

Referenced by determine_phase_order().

static void add_targ_options ( string_list_t args  )  [static]

Definition at line 365 of file phases.c.

References add_string(), buf, NULL, sprintf(), target_cpu, and TRUE.

Referenced by add_file_args(), and save_ipl_commands().

void cancel_saved_arg ( int  count  ) 

Definition at line 3449 of file phases.c.

References free(), and NULL.

Referenced by main().

static void check_existence_of_phases ( void   )  [static]

int check_for_saved_option ( char *  opt  ) 

Definition at line 3432 of file phases.c.

References strcmp().

Referenced by print_file_path(), and print_magic_path().

static void convert_saved_command_line_into_string ( void   )  [static]

Definition at line 3465 of file phases.c.

References command_line, malloc, NULL, quote_shell_arg(), and quoted_length().

Referenced by add_command_line_arg().

static void copy_phase_options ( string_list_t phase_list,
phases_t  phase 
) [static]

phases_t determine_ld_phase ( boolean  run_ipa  ) 

Definition at line 2903 of file phases.c.

References invoked_lang, L_CC, L_cc, P_collect, P_ipa_link, P_ld, and P_ldplus.

Referenced by add_object(), find_crt_path(), and init_stdc_plus_plus_path().

static void determine_phase_order ( void   )  [static]

char* dirname ( char *const   s  ) 

Definition at line 438 of file phases.c.

References dirbuf, is_dir_separator, NULL, p, strcpy, and strlen().

static void do_f90_common_args ( string_list_t args  )  [static]

Definition at line 3828 of file phases.c.

References add_string(), FALSE, and set_f90_source_form().

Referenced by add_file_args().

char* driver_basename ( char *const   s  ) 

Definition at line 412 of file phases.c.

References basebuf, is_dir_separator, NULL, p, strcpy, and strlen().

Referenced by make_ii_file_name(), and make_rii_file_name().

static char* find_toolroot ( char *  program_name,
char *  toolroot 
) [static]

char* fix_name_by_lang ( char *  name  ) 

Definition at line 584 of file phases.c.

References L_as, L_CC, L_f77, L_f90, NULL, source_lang, and strcmp().

Referenced by if(), run_compiler(), and run_ld().

static char* fix_name_by_phase ( char *  name,
phases_t  phase 
) [static]

Definition at line 540 of file phases.c.

References NULL, P_c_cpp, P_cplus_cpp, P_cpp, P_f90_cpp, P_f_cpp, P_gcpp, P_gcpp_plus, P_m4, P_ratfor, S_C, S_c, S_F, S_f, S_F90, S_f90, S_ii, S_S, S_s, source_kind, and strcmp().

Referenced by add_file_args().

for ( = i; j >= 0; j--  ) 

Definition at line 2853 of file phases.c.

for ( i  = strlen(prefix)-1;i >=0 &&prefix[i]== '-';i--  ) 

char* get_binutils_lib_path ( void   ) 

Definition at line 253 of file run.c.

References asprintf(), and get_executable_dir().

Referenced by init_phase_info(), and run_phase().

static void get_libgcc_s_name ( char **  libgcc_s_std,
char **  libgcc_s_dir32 
) [static]

Definition at line 1816 of file phases.c.

References ABI_N32, NULL, and platform_is_64bit().

Referenced by add_libgcc_s().

if (  ) 

Definition at line 2859 of file phases.c.

References concat_strings(), get_phase_name(), phase_name, set_phase_name(), and strcmp().

void init_frontend_phase_names ( int  gnu_major_version,
int  gnu_minor_version 
)

Definition at line 2874 of file phases.c.

References error(), and set_phase_name().

void init_phase_info ( void   ) 

void init_phase_names ( void   ) 

Definition at line 2807 of file phases.c.

References cmd, i, len, MAXPATHLEN, orig_program_name, path, prefix, readlink(), strdup, strlen(), strncpy(), strstr(), and x.

Referenced by main().

static char * make_ii_file_name ( char *  objname  )  [static]

Definition at line 3602 of file phases.c.

References base, concat_strings(), dirname, driver_basename(), strcpy, and strlen().

Referenced by run_compiler().

static char * make_rii_file_name ( char *  objname  )  [static]

Definition at line 3621 of file phases.c.

References base, concat_strings(), dirname, driver_basename(), strcpy, and strlen().

Referenced by add_file_args(), and run_compiler().

boolean platform_is_64bit ( void   ) 

Definition at line 627 of file phases.c.

References FALSE, strcmp(), TRUE, and uname().

Referenced by get_libgcc_s_name(), and target_is_native().

static phases_t post_fe_phase ( void   )  [static]

Definition at line 2230 of file phases.c.

References inline_t, P_inline, P_ipl, TRUE, and UNDEFINED.

Referenced by add_file_args(), add_inline_option(), and determine_phase_order().

static void postprocess_ld_args ( string_list_t args  )  [static]

static boolean previous_mf_exists ( string_list_t list  )  [static]

Definition at line 156 of file phases.c.

References FALSE, string_list_rec::head, string_item_rec::name, string_item_rec::next, NULL, p, strcmp(), and TRUE.

Referenced by add_implied_string().

int quote_shell_arg ( char *  p,
char *  buf 
)

Definition at line 3378 of file phases.c.

References c, is_shell_quote_special, and quoted_length().

Referenced by convert_saved_command_line_into_string(), and save_cpp_output().

int quoted_length ( char *  p,
int *  quoted 
)

Definition at line 3354 of file phases.c.

References c, is_shell_quote_special, and is_shell_special.

Referenced by convert_saved_command_line_into_string(), and quote_shell_arg().

static void remove_previous_mf ( string_list_t list  )  [static]

void run_ar ( void   ) 

void run_compiler ( int  argc,
char *  argv[] 
)

void run_dsm_prelink ( void   ) 

void run_ld ( void   ) 

void run_pixie ( void   ) 

void run_prof ( void   ) 

void save_command_line ( int  argc,
char **  argv 
)

Definition at line 3417 of file phases.c.

References malloc, NULL, and string_copy().

Referenced by main().

void save_ipl_commands ( void   ) 

void set_current_arg_pos ( int  n  ) 

Definition at line 3444 of file phases.c.

Referenced by main().

static void set_f90_source_form ( string_list_t args,
boolean  set_line_length 
) [static]

Definition at line 3798 of file phases.c.

References add_string(), fortran_line_length, S_F90, S_f90, source_kind, and sprintf().

Referenced by add_file_args(), and do_f90_common_args().

static void set_library_paths ( string_list_t args  )  [static]

void skip_old_ii_controls ( FILE f  ) 

Definition at line 3574 of file phases.c.

References c, EOF, getc(), and rewind().

Referenced by update_instantiation_info_file().

static void specify_dyn_linker ( string_list_t args  )  [static]

Definition at line 677 of file phases.c.

References add_string(), CALL_SHARED, and dynamic_linker.

Referenced by run_ld().

static void specify_ipa_dyn_linker ( string_list_t args  )  [static]

Definition at line 695 of file phases.c.

References add_string(), CALL_SHARED, and ipa_dynamic_linker.

Referenced by run_ld().

boolean target_is_native ( void   ) 

Definition at line 649 of file phases.c.

References ABI_N32, platform_is_64bit(), and TRUE.

void turn_down_opt_level ( int  new_olevel,
char *  msg 
)

int update_instantiation_info_file ( char *  ii_file_name,
char *  sourcefile 
) [static]

static void write_command_string_into_file ( FILE cmdfile,
char *  sourcefile,
int  for_ii_file 
) [static]


Variable Documentation

int add_c = 0 [static]

Definition at line 3403 of file phases.c.

Referenced by get_address_cost().

Definition at line 99 of file phases.c.

Referenced by add_special_options(), and parse_W_option().

char basebuf[4096] [static]

Definition at line 410 of file phases.c.

Referenced by driver_basename().

phases_t be_phase = P_be [static]

Definition at line 2207 of file phases.c.

char* command_line = NULL

int curr_argc [static]

Definition at line 3402 of file phases.c.

char dirbuf[4096] [static]

Definition at line 436 of file phases.c.

Referenced by dirname().

Definition at line 103 of file phases.c.

Referenced by add_file_args(), and Process_Mp_Group().

Definition at line 102 of file phases.c.

Referenced by add_file_args(), add_special_options(), and Process_Mp_Group().

const char* dynamic_linker [static]

Definition at line 675 of file phases.c.

Referenced by specify_dyn_linker().

Definition at line 109 of file phases.c.

Referenced by add_file_args().

char* fb_cdir = NULL

Definition at line 84 of file phases.c.

Referenced by add_file_args(), if(), and Process_fb_cdir().

char* fb_file = NULL

Definition at line 80 of file phases.c.

Referenced by add_file_args(), if(), Process_fb_create(), and run_phase().

char* fb_phase = NULL

Definition at line 86 of file phases.c.

Referenced by Process_fb_phase().

char* fb_type = NULL

Definition at line 87 of file phases.c.

Referenced by FB_EDGE_TYPE_fprintf(), and Process_fb_type().

char* fb_xdir = NULL

Definition at line 83 of file phases.c.

Referenced by add_file_args(), Process_fb_xdir(), and run_pixie().

Definition at line 112 of file main.c.

Definition at line 111 of file phases.c.

Referenced by set_f90_source_form().

char* global_toolroot = NULL

Definition at line 115 of file phases.c.

Referenced by init_phase_info(), run_phase(), and set_library_paths().

char* input_source [static]

Definition at line 482 of file phases.c.

Referenced by add_file_args(), and run_compiler().

char* internal_fb_file = NULL

Definition at line 81 of file phases.c.

Referenced by add_file_args().

const char* ipa_dynamic_linker [static]

Definition at line 691 of file phases.c.

Referenced by specify_ipa_dyn_linker().

string_list_t* ipl_cmds = 0 [static]

Definition at line 128 of file phases.c.

boolean keep_cif = FALSE

Definition at line 97 of file phases.c.

Referenced by add_file_args().

boolean keep_list = FALSE

Definition at line 96 of file phases.c.

Referenced by add_file_args().

Definition at line 98 of file phases.c.

Referenced by add_file_args(), determine_phase_order(), and run_phase().

boolean keep_mp = FALSE

Definition at line 95 of file phases.c.

Referenced by add_file_args().

char* ld_library_path = NULL

Definition at line 116 of file phases.c.

Referenced by run_phase().

char ld_library_path_found[PATH_BUF_LEN] [static]

Definition at line 2740 of file phases.c.

char* ld_libraryn32_path = NULL

Definition at line 117 of file phases.c.

Referenced by init_phase_info(), and run_phase().

Definition at line 113 of file phases.c.

boolean O3_flag = FALSE

Definition at line 104 of file phases.c.

Referenced by add_file_args(), and Process_Ofast().

char* old_ld_library_path = NULL

Definition at line 119 of file phases.c.

Referenced by init_phase_info(), and run_ld().

char* opt_file = NULL

Definition at line 82 of file phases.c.

Referenced by add_file_args(), and Process_fb_opt().

char* orig_program_name = NULL

Definition at line 118 of file phases.c.

Referenced by init_phase_info(), init_phase_names(), main(), and write_command_string_into_file().

char* outfile = NULL

phases_t phase_order[MAX_PHASE_ORDER] [static]

Definition at line 2204 of file phases.c.

int phase_order_index = 0 [static]

Definition at line 2205 of file phases.c.

char* prof_file = NULL

Definition at line 79 of file phases.c.

Referenced by add_file_args(), if(), Process_fbexe(), Process_fbuse(), run_phase(), and run_prof().

char roundoff = 0

Definition at line 112 of file phases.c.

Referenced by add_derived_option(), and add_file_args().

Definition at line 3400 of file phases.c.

Referenced by save_cpp_output().

char** saved_argv

Definition at line 3401 of file phases.c.

Referenced by save_cpp_output().

char* source_file = NULL

Definition at line 88 of file phases.c.

boolean string_md = FALSE [static]

Definition at line 130 of file phases.c.

Referenced by add_implied_string(), and run_compiler().

boolean string_mmd = FALSE [static]

Definition at line 131 of file phases.c.

Referenced by add_implied_string(), and run_compiler().

Definition at line 76 of file phases.c.

boolean use_cpp = FALSE

Definition at line 105 of file phases.c.

Definition at line 101 of file phases.c.

Referenced by check_for_driver_controls(), and Process_fbuse().


Generated on Wed Apr 8 15:07:27 2009 for Open64 by  doxygen 1.5.6