00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #ifdef _KEEP_RCS_ID
00061 static char *rcs_id = "$Source: /proj/osprey/CVS/open64/osprey1.0/ipa/main/analyze/ipa_option.cxx,v $ $Revision: 1.1.1.1 $";
00062 #endif
00063
00064 #define __STDC_LIMIT_MACROS
00065 #include <stdint.h>
00066 #include "linker.h"
00067
00068 #pragma weak outfilename
00069
00070 #define USE_STANDARD_TYPES
00071 #include "defs.h"
00072 #include "config.h"
00073 #include "erglob.h"
00074 #include "file_util.h"
00075 #include "flags.h"
00076 #include "glob.h"
00077 #include "mempool.h"
00078 #include "timing.h"
00079 #include "tracing.h"
00080 #include "strtab.h"
00081 #include "config_lno.h"
00082 #include "ipc_option.h"
00083 #include "ipa_option.h"
00084
00085
00086 #define MAX_OLIMIT INT32_MAX
00087
00088
00089 char *Ipa_File_Name = NULL;
00090 FILE *Ipa_File = NULL;
00091
00092
00093 typedef struct skiplist SKIPLIST;
00094 SKIPLIST *Build_Skiplist ( OPTION_LIST *olist );
00095 SKIPLIST *IPA_Skip_List = NULL;
00096
00097 BOOL Trace_IPA = FALSE;
00098 BOOL Trace_Perf = FALSE;
00099 BOOL Trace_IPALNO = FALSE;
00100
00101
00102 BOOL Verbose = FALSE;
00103 BOOL Demangle = FALSE;
00104
00105 BOOL ProMP_Listing = FALSE;
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 extern "C" void
00119 Process_IPA_Options ( INT argc, char **argv )
00120 {
00121 int i;
00122
00123 for (i = 0; i < argc; i++) {
00124 if (argv[i] != NULL && *(argv[i]) == '-' ) {
00125 if (Process_Command_Line_Group (argv[i]+1, Common_Option_Groups))
00126 continue;
00127
00128 switch (argv[i][1]) {
00129
00130 case 'I':
00131
00132
00133
00134
00135 if ( strcmp ( argv[i], "-IPA" ) != 0 ) {
00136 ErrMsg ( EC_Unknown_Flag, argv[i][0], argv[i] );
00137 }
00138 break;
00139
00140 case 't':
00141 Process_Trace_Option ( argv[i] );
00142 break;
00143
00144 case 'Y':
00145
00146 break;
00147
00148 default:
00149 ErrMsg ( EC_Unknown_Flag, argv[i][0], argv[i] );
00150 break;
00151 }
00152 }
00153 }
00154
00155 if (LNO_Prompl)
00156 ProMP_Listing = TRUE;
00157
00158
00159 if ( Olimit == 0 ) Olimit = MAX_OLIMIT;
00160
00161
00162 Process_Inline_Options ();
00163
00164 #ifndef _STANDALONE_INLINER
00165
00166 Process_IPA_Specfile_Options ();
00167 #endif
00168
00169
00170 if (IPA_PU_Limit_Set) {
00171 if (IPA_PU_Hard_Limit_Set) {
00172 if (IPA_PU_Hard_Limit < IPA_PU_Limit)
00173 IPA_PU_Hard_Limit = IPA_PU_Limit;
00174 } else
00175 IPA_PU_Hard_Limit = IPA_PU_Limit + (IPA_PU_Limit >> 2);
00176 } else if (IPA_PU_Hard_Limit_Set) {
00177 IPA_PU_Limit = IPA_PU_Hard_Limit;
00178 IPA_PU_Limit_Set = TRUE;
00179 }
00180
00181 if (IPA_Force_Depth_Set) {
00182 IPA_PU_Limit = UINT32_MAX;
00183 IPA_Bloat_Factor = UINT32_MAX;
00184 IPA_Max_Depth = IPA_Force_Depth;
00185 }
00186
00187 IPA_Enable_Opt_Alias = FALSE;
00188
00189 if ( IPA_Enable_Opt_Alias ) {
00190 IPA_Enable_Simple_Alias = TRUE;
00191 }
00192
00193 if (IPA_Output_File_Size != 0) {
00194 IPA_Max_Output_File_Size +=
00195 IPA_Max_Output_File_Size / 100 * IPA_Output_File_Size;
00196 }
00197
00198 #if defined(TARG_SL)
00199 if (ld_ipa_opt[LD_IPA_IPISR].flag) {
00200 if (IPA_Enable_PU_Reorder != REORDER_DISABLE)
00201 DevWarn("IPA_Enable_PU_Reorder is overrided by -ipisr option!");
00202 IPA_Enable_PU_Reorder = REORDER_BY_BFS;
00203
00204 if (IPA_Enable_Source_PU_Order)
00205 DevWarn("IPA_Enable_Source_PU_Order is overrided by -ipisr option!");
00206 IPA_Enable_Source_PU_Order = FALSE;
00207 }
00208 #endif
00209
00210 if ( Get_Trace ( TKIND_ALLOC, TP_IPA ) ) {
00211 IPA_Enable_Memtrace = TRUE;
00212 MEM_Tracing_Enable ();
00213 }
00214
00215
00216 if ( Get_Trace ( TP_PTRACE1, 1 ) ) {
00217 Set_Trace ( TP_PTRACE1, 0xffffffff );
00218 Set_Trace ( TP_PTRACE2, 0xffffffff );
00219 }
00220
00221
00222 Trace_Perf = Get_Trace (TP_PTRACE1, TP_PTRACE1_INL|TP_PTRACE1_IPA);
00223 Trace_IPA = Get_Trace ( TP_IPA, IPA_TRACE_IPA );
00224 Verbose = ld_ipa_opt[LD_IPA_SHOW].flag;
00225 Demangle = ld_ipa_opt[LD_IPA_DEMANGLE].flag;
00226
00227 if (ld_ipa_opt[LD_IPA_SHARABLE].flag & F_STATIC) {
00228 IPA_Enable_Picopt = FALSE;
00229 IPA_Enable_AutoGnum = FALSE;
00230 }
00231
00232 if (!outfilename) {
00233 outfilename = (char *)MALLOC(20);
00234 strcat(outfilename,"a.out");
00235 }
00236
00237 IPA_Skip_List = Build_Skiplist ( IPA_Skip );
00238
00239
00240 if ( IPA_Enable_Simple_Alias && Ipa_File_Name == NULL ) {
00241 Ipa_File_Name = concat_names ( outfilename, (const string)".ipaa" );
00242 }
00243
00244
00245 if ( Tracing_Enabled ) {
00246 char * cmd_file_name = concat_names ( outfilename, (const string)".ipa.t" );
00247
00248 Set_Trace_File ( cmd_file_name );
00249
00250
00251 if ( Get_Trace ( TKIND_INFO, TINFO_TFLAGS ) ) {
00252 List_Phase_Numbers ();
00253 }
00254
00255
00256 if ( Get_Trace ( TKIND_INFO, TINFO_TIME ) ) {
00257 Tim_File = TFile;
00258 Initialize_Timing ( TRUE );
00259 }
00260 }
00261
00262
00263 if ( Get_Trace ( TP_PTRACE1, TP_PTRACE1_IPA) ||
00264 Get_Trace ( TP_PTRACE1, TP_PTRACE1_IPA_CPROP) ||
00265 Get_Trace ( TP_PTRACE1, TP_PTRACE1_IPALNO)) {
00266 if ( Tlog_File_Name == NULL ) {
00267
00268 Tlog_File_Name = concat_names ( outfilename, (const string)".tlog" );
00269 }
00270 if ( (Tlog_File = fopen ( Tlog_File_Name, "w" ) ) == NULL ) {
00271 ErrMsg ( EC_Tlog_Open, Tlog_File_Name, errno );
00272 Tlog_File_Name = NULL;
00273 Tlog_File = stdout;
00274 }
00275 }
00276
00277
00278 if ( Get_Trace ( TP_MISC, 128 ) ) {
00279 Trace_Option_Groups ( TFile, Common_Option_Groups, TRUE );
00280 } else if ( Trace_IPA || Trace_Perf
00281 || Get_Trace ( TP_MISC, 32 ) )
00282 {
00283 Trace_Option_Groups ( TFile, Common_Option_Groups, FALSE );
00284 }
00285 }