Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
config_ipa.cxx
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /* ====================================================================
00037  * ====================================================================
00038  *
00039  *
00040  * Revision history:
00041  *  11-Apr-96 - Original Version, extracted from ipa_option.c.
00042  *
00043  * Description:
00044  *
00045  * Configure the -IPA and -INLINE groups (included in config.c).
00046  * Used from ipl, inline, and ipa (ld).
00047  *
00048  * ====================================================================
00049  * ====================================================================
00050  */
00051 
00052 /* This file is included in config.c, so it doesn't need its own set of
00053  * standard includes -- only the following:
00054  */
00055 #include "config_ipa.h"
00056 
00057 /* IPA file variables declared in glob.h: */
00058 char *Ipa_File_Name = NULL;     /* IPAA summary file name */
00059 FILE *Ipa_File = NULL;          /* IPAA summary file (if open) */
00060 
00061 /* Skiplist support from config.h: */
00062 typedef struct skiplist SKIPLIST;
00063 SKIPLIST *Build_Skiplist ( OPTION_LIST *olist );
00064 
00065 /* ====================================================================
00066  * List of global variables that are set by the -IPA option group
00067  * ====================================================================
00068  */
00069 
00070 #define DEFAULT_BLOAT_FACTOR    100
00071 #define DEFAULT_PU_LIMIT        2500
00072 #define DEFAULT_HARD_LIMIT      (2500 + (2500 >> 2))
00073 #define DEFAULT_SMALL_PU        30
00074 #define DEFAULT_SMALL_CALLEE    500
00075 #define DEFAULT_MIN_FREQ        100
00076 #define DEFAULT_MIN_HOTNESS     100
00077 #define DEFAULT_RELA_FREQ       50
00078 #define DEFAULT_INLINE_Max_Pu_Size 5000
00079 #define DEFAULT_CLONE_BLOAT_FACTOR 100
00080 #define DEFAULT_EXTGOT_FACTOR   200     /* 2 times the estimated EXTGOT entries */
00081 #define DEFAULT_NUM_FORTRAN_INTR 100    /* Arbitary estimate */
00082 #define DEFAULT_MAP_LIMIT       0x1fff0000   /* total size in bytes we
00083                                                 allow input objects to be
00084                                                 mapped in at the same time
00085                                                 without turning into the
00086                                                 SAVE_SPACE option  
00087                                               */
00088 #define DEFAULT_OUTPUT_FILE_SIZE        10000
00089 
00090 
00091 /* #define DEFAULT_GSPACE       65535   -- from config.c */
00092 
00093 /* Feature enable flags: */
00094 BOOL IPA_Enable_DFE = TRUE;             /* Dead Function Elimination */
00095 BOOL IPA_Enable_DFE_Set = FALSE;        /* ... explicitly set? */
00096 BOOL IPA_Enable_Inline = TRUE;          /* Inlining */
00097 BOOL IPA_Enable_Picopt = TRUE;          /* PIC optimization */
00098 BOOL IPA_Enable_AutoGnum = TRUE;        /* AutoGnum optimization */
00099 BOOL IPA_Enable_Opt_Alias =FALSE;       /* WOPT uses alias/mod/ref */
00100 BOOL IPA_Enable_Simple_Alias = TRUE;    /* Simple alias/mod/ref */
00101 BOOL IPA_Enable_Addressing = TRUE;      /* Addr_taken analysis */
00102 BOOL IPA_Enable_BarrierFarg = FALSE;    /* Barrier for aliased Fortran actual */
00103 BOOL IPA_Enable_Alias_Class = TRUE;     /* Alias classification */
00104 BOOL IPA_Debug_AC_Temp_Files = FALSE;   /* save alias class temps til done? */
00105 BOOL IPA_Enable_Readonly_Ref = TRUE;    /* find out readonly ref parameter */
00106 BOOL IPA_Enable_Cprop = TRUE;           /* Constant Propagation */
00107 BOOL IPA_Enable_Cprop2 = TRUE;          /* Aggressive constant propagation */
00108 BOOL IPA_Enable_Assert = FALSE;         // generate assert statement for
00109                                         // cprop debugging
00110 BOOL IPA_Enable_daVinci = FALSE;        /* Graphical display of call graph */
00111 BOOL IPA_Enable_ipacom = TRUE;          /* Call ipacom after IPA */
00112 BOOL IPA_Enable_final_link = TRUE;      /* Final link step */
00113 BOOL IPA_Enable_Memtrace = FALSE;       /* Memory trace */
00114 BOOL IPA_Enable_DST = TRUE;             /* Generate DST */
00115 BOOL IPA_Enable_DCE = TRUE;             /* Enable Dead Call Elimination */
00116 BOOL IPA_Enable_Exc = TRUE;             /* Enable exception handling */
00117 BOOL IPA_Enable_Recycle = TRUE;         /* Enable recycling of variables */
00118 BOOL IPA_Enable_DVE = TRUE;             /* Enable Dead Variable Elimination */
00119 BOOL IPA_Enable_CGI = TRUE;             /* Enable Constant Global Variable
00120                                          * Identification */
00121 BOOL IPA_Enable_Copy_Prop = TRUE;       /* Copy propagation during inlining */
00122 BOOL IPA_Enable_Padding = TRUE;         /* Intra-Dimension padding 
00123                                          * of common block variables */
00124 UINT32 IPA_Common_Pad_Size = 0;         /* Amount by which to pad commons */
00125 
00126 BOOL IPA_Enable_Cloning = TRUE;         /* Enable Cloning in conjunction */
00127                                         /* with constant propagation     */
00128 BOOL IPA_Enable_Lang = FALSE;           /* support inlining across language */
00129 BOOL IPA_Enable_Relocatable_Opt = FALSE;/* support -call_shared optimizations of relocatable objects */
00130 BOOL IPA_Enable_Split_Common = TRUE;    /* Enable split common inside IPA */
00131 BOOL IPA_Enable_Array_Sections = TRUE;  /* Array section analysis in IPA */
00132 BOOL IPA_Enable_Array_Summary = FALSE;  /* Array section summary in IPL */
00133 
00134 BOOL IPA_Enable_Scalar_Euse = FALSE;   /* enable scalar euse  */
00135 BOOL IPA_Enable_Scalar_Kill = FALSE;   /* enable scalar kill   */
00136 BOOL IPA_Enable_Common_Const = TRUE; /* enable cprop of common block vars */
00137 BOOL IPA_Enable_Feedback = FALSE;       /* create pragma files, etc.      */
00138 
00139 /* Echo back end command lines: */
00140 BOOL    IPA_Echo_Commands = FALSE;
00141 
00142 /* max. bloat % of the entire program */
00143 UINT32  IPA_Bloat_Factor = DEFAULT_BLOAT_FACTOR;
00144 BOOL    IPA_Bloat_Factor_Set = FALSE;
00145 
00146 UINT32  IPA_PU_Limit = DEFAULT_PU_LIMIT;/* Max nodes per PU after inlining */
00147 BOOL    IPA_PU_Limit_Set = FALSE;       /* if IPA_PU_Limit is set by user */
00148 
00149 /* absolute max. # of nodes per PU after inlining (1.25 * IPA_PU_Limit) */
00150 UINT32  IPA_PU_Hard_Limit = DEFAULT_HARD_LIMIT;
00151 BOOL    IPA_PU_Hard_Limit_Set = FALSE;
00152 
00153 /* Size of small PU that's always inlined */
00154 UINT32  IPA_PU_Minimum_Size = DEFAULT_SMALL_PU;
00155 
00156 /* Callees larger than this size are not inlined, except ...  */
00157 UINT32  IPA_Small_Callee_Limit = DEFAULT_SMALL_CALLEE; 
00158 
00159 UINT32  IPA_Max_Depth = UINT32_MAX;     /* maximum depth to inline */
00160 UINT32  IPA_Force_Depth = 0;            /* force inlining to depth n
00161                                          * regardless of size */
00162 BOOL    IPA_Force_Depth_Set = FALSE;
00163 BOOL    IPA_Enable_Merge_ty = TRUE;     /* merge types across files */
00164 UINT32  IPA_Max_Jobs = 0;       /* concurrent backend compilations */
00165 BOOL    IPA_Max_Jobs_Set = FALSE;
00166 
00167 /* 100th% of call freq lower than which will not inlined */
00168 UINT32  IPA_Min_Freq = DEFAULT_MIN_FREQ;        
00169 
00170 /* % of time that an inlined callee is called by its caller */
00171 UINT32  IPA_Rela_Freq = DEFAULT_RELA_FREQ;      
00172 
00173 /* only routines "hotter" than this will be inlined */
00174 UINT32  IPA_Min_Hotness = DEFAULT_MIN_HOTNESS;
00175 
00176 /* ignore zero-freq. statements when estimating size of a PU */
00177 BOOL IPA_Use_Effective_Size = TRUE;
00178 
00179 /* max. gp-relative space available for auto Gnum */
00180 UINT32  IPA_Gspace = DEFAULT_GSPACE - 72;// Kluge to get around gcc problem
00181 
00182 /* % of estimtated external got size used for estimating the whole .got size */
00183 UINT32  IPA_Extgot_Factor = 0;
00184 
00185 /* number of FORTRAN instrinsics functions existed in this executable,
00186    used for estimating the number of GOTs */
00187 UINT32  IPA_Num_Fortran_Intrinsics = DEFAULT_NUM_FORTRAN_INTR;
00188 BOOL    IPA_Has_Fortran = FALSE;
00189 
00190 /* user specified -G num */
00191 UINT32  IPA_user_gnum = 0;      
00192 
00193 OPTION_LIST *IPA_Skip = NULL;           /* List of skip options */
00194 BOOL    IPA_Skip_Report = FALSE;        /* Report skip count */
00195 
00196 BOOL IPA_Enable_Preempt = FALSE;  /* allow the user to specify that
00197                                      functions are not preemptible */
00198 
00199 BOOL IPA_Enable_Flow_Analysis = TRUE;   /* flow-sensitive analysis */
00200 
00201 /* Maximum limit IPA allows the whole program input to be mapped into
00202  * the address space without converting into the SAVE_SPACE mode
00203  */
00204 UINT32  IPA_Map_Limit = DEFAULT_MAP_LIMIT;
00205 
00206 BOOL IPA_Enable_SP_Partition = FALSE;   /* Enable IPA to partition its
00207                                          * call-graph so as to allow
00208                                          * address space conversation
00209                                          */
00210 BOOL IPA_Enable_GP_Partition = FALSE;   /* Enable IPA to partition its
00211                                          * call-graph so as to allow
00212                                          * picopt even if multigot
00213                                          */
00214 BOOL IPA_Space_Access_Mode = DEFAULT_ACCESS_MODE;
00215 
00216 BOOL IPA_Enable_Keeplight = TRUE;  /* allow the user to ONLY keep the .I
00217                                      * and .o in the .ipakeep directory
00218                                      */
00219 
00220 BOOL IPA_Enable_Cord = FALSE;           /* Enable procedure reordering. */
00221 BOOL IPA_Enable_Linearization = FALSE;  /* Enable linearization of array */
00222 BOOL IPA_Use_Intrinsic = FALSE;         /* load intrinsic libraries */
00223 
00224 BOOL IPA_Enable_Inline_Nested_PU = TRUE;  /* enable inlining of nested PU, for f90 */
00225 
00226 BOOL IPA_Enable_Reshape = TRUE;         // reshape analysis for arrays 
00227 BOOL IPA_Enable_Inline_Struct = TRUE;  /* enable inlining of STRUCT for f90 */
00228 BOOL IPA_Enable_Inline_Char_Array = TRUE;  /* enable inlining of Character Array for f90 */
00229 BOOL IPA_Enable_Inline_Optional_Arg = TRUE;  /* enable inlining of functions with optional arguments */
00230 BOOL IPA_Enable_Inline_Struct_Array_Actual = TRUE;  /* enable inlining of STRUCT for f90 when the actual is an array type */
00231 BOOL IPA_Enable_Inline_Var_Dim_Array = TRUE;  /* enable inlining of variable-dimensioned array */
00232 
00233 // call preopt during IPA
00234 BOOL IPA_Enable_Preopt = FALSE;          
00235 BOOL IPA_Enable_Preopt_Set = FALSE;
00236 
00237 // maximum number of clones for a call graph node
00238 UINT32 IPA_Max_Node_Clones = 0;
00239 BOOL   IPA_Max_Node_Clones_Set = FALSE;
00240 
00241 // maximum % increase of the call graph size through node cloning
00242 UINT32 IPA_Max_Clone_Bloat = DEFAULT_CLONE_BLOAT_FACTOR;
00243 
00244 /* Max. "size" of each output file */
00245 UINT32 IPA_Max_Output_File_Size = DEFAULT_OUTPUT_FILE_SIZE;
00246 
00247 /* percentage change of the max. output file size */
00248 INT32 IPA_Output_File_Size = 0;
00249  
00250 
00251 static OPTION_DESC Options_IPA[] = {
00252     { OVK_BOOL, OV_VISIBLE,     FALSE, "addressing",    "",
00253           0, 0, 0,              &IPA_Enable_Addressing, NULL,
00254           "Enable address-taken analysis" },
00255     { OVK_BOOL, OV_VISIBLE,     FALSE, "readonly_parameter",    "",
00256           0, 0, 0,              &IPA_Enable_Readonly_Ref, NULL,
00257           "Enable identification of read-only reference parameters" }, 
00258     { OVK_BOOL, OV_VISIBLE,     FALSE, "aggr_cprop",            "",
00259           0, 0, 0,              &IPA_Enable_Cprop2,     NULL,
00260           "Enable aggressive constant propagation" },
00261     { OVK_BOOL, OV_VISIBLE,     FALSE, "alias", "",
00262           0, 0, 0,              &IPA_Enable_Simple_Alias,NULL,
00263           "Enable variable mod, use, and alias analysis" },
00264     { OVK_BOOL, OV_INTERNAL,    FALSE, "array_section", "",
00265           0, 0, 0,              &IPA_Enable_Array_Sections, NULL,
00266           "Enable interprocedural array section analysis " },
00267     { OVK_BOOL, OV_INTERNAL,    FALSE, "array_summary", "",
00268           0, 0, 0,              &IPA_Enable_Array_Summary, NULL,
00269           "Enable local array section summary" },
00270     { OVK_BOOL, OV_INTERNAL,    FALSE, "scalar_kill",   "",
00271           0, 0, 0,              &IPA_Enable_Scalar_Kill, NULL,
00272           "Enable scalar kill analysis" },
00273     { OVK_BOOL, OV_INTERNAL,    FALSE, "scalar_euse",   "",
00274           0, 0, 0,              &IPA_Enable_Scalar_Euse, NULL,
00275           "Enable scalar euse analysis" },
00276     { OVK_BOOL, OV_VISIBLE,     FALSE, "common_cprop",  "",
00277           0, 0, 0,              &IPA_Enable_Common_Const, NULL,
00278           "Enable common constant propagation" },
00279     { OVK_BOOL, OV_VISIBLE,     FALSE, "autognum",      "",
00280           0, 0, 0,              &IPA_Enable_AutoGnum,   NULL,
00281           "Enable automatic gp-relative data allocation" },
00282     { OVK_BOOL, OV_INTERNAL,    FALSE, "barrier_aliasfarg",     "",
00283           0, 0, 0,              &IPA_Enable_BarrierFarg,        NULL,
00284 /*
00285           "Enable barrier generation for inlined Fortran aliased actual arg." },
00286           "Enable barrier gen. for inlined aliased Fortran actual" },
00287 */
00288           "Enable barrier gen. " },
00289     { OVK_BOOL, OV_VISIBLE,     FALSE, "cgi",           "",
00290           0, 0, 0,              &IPA_Enable_CGI,        NULL,
00291           "Enable constant global variable identification" },
00292     { OVK_BOOL, OV_SHY,         FALSE, "compile",       "",
00293           0, 0, 0,              &IPA_Enable_ipacom,     NULL,
00294           "Enable final back-end compilation" }, 
00295     { OVK_BOOL, OV_SHY,         FALSE, "link",          "",
00296           0, 0, 0,              &IPA_Enable_final_link, NULL,
00297           "Enable final link step" },
00298     { OVK_BOOL, OV_VISIBLE,     FALSE, "copy_prop",     "",
00299           0, 0, 0,              &IPA_Enable_Copy_Prop,  NULL,
00300           "Enable interprocedural copy propagation" },
00301     { OVK_BOOL, OV_VISIBLE,     FALSE, "cprop", "",
00302           0, 0, 0,              &IPA_Enable_Cprop,      NULL,
00303           "Enable constant propagation" },
00304     { OVK_BOOL, OV_INTERNAL,    FALSE, "assert", "",
00305           0, 0, 0,              &IPA_Enable_Assert,     NULL,
00306           "Enable assertion for constant propagation" },
00307     { OVK_BOOL, OV_VISIBLE,     FALSE, "clone", "",
00308           0, 0, 0,              &IPA_Enable_Cloning,    NULL,
00309           "Enable subprogram cloning" },
00310     { OVK_UINT32, OV_INTERNAL,  FALSE, "multi_clone",   "",
00311            0, 0, UINT32_MAX, &IPA_Max_Node_Clones, &IPA_Max_Node_Clones_Set,
00312           "Maximum clones per call graph node" },
00313     { OVK_UINT32, OV_INTERNAL,  FALSE, "node_bloat",   "",
00314           DEFAULT_CLONE_BLOAT_FACTOR, 0, UINT32_MAX, &IPA_Max_Clone_Bloat,NULL,
00315           "Maximum call graph bloat with cloning" },
00316     { OVK_BOOL, OV_VISIBLE,     FALSE, "dce",           "",
00317           0, 0, 0,              &IPA_Enable_DCE,        NULL,
00318           "Enable dead code elimination" },
00319     { OVK_BOOL, OV_VISIBLE,     FALSE, "dve",           "",
00320           0, 0, 0,              &IPA_Enable_DVE,        NULL,
00321           "Enable dead variable elimination" },
00322     { OVK_UINT32,OV_VISIBLE,    FALSE, "depth", "",
00323           UINT32_MAX, 0, UINT32_MAX,&IPA_Max_Depth,     NULL,
00324           "Limit inlining depth" },
00325     { OVK_UINT32,OV_VISIBLE,    FALSE, "maxdepth",      "",
00326           UINT32_MAX, 0, UINT32_MAX,&IPA_Max_Depth,     NULL,
00327           "Limit inlining depth" },
00328     { OVK_UINT32,OV_VISIBLE,    FALSE, "forcedepth",    "",
00329           UINT32_MAX, 0, UINT32_MAX, &IPA_Force_Depth,  &IPA_Force_Depth_Set,
00330           "Inline to at least this depth" },
00331     { OVK_BOOL, OV_VISIBLE,     FALSE, "dfe",           "",
00332           0, 0, 0,              &IPA_Enable_DFE,        &IPA_Enable_DFE_Set,
00333           "Enable dead function elimination" },
00334     { OVK_BOOL, OV_INTERNAL,    FALSE, "dst",           "",
00335           0, 0, 0,              &IPA_Enable_DST,        NULL},
00336     { OVK_BOOL, OV_VISIBLE,     FALSE, "echo_commands", "",
00337           0, 0, 0,              &IPA_Echo_Commands,     NULL,
00338           "Echo back end compilation commands" },
00339     { OVK_BOOL, OV_INTERNAL,    FALSE, "exc",           "",
00340           0, 0, 0,              &IPA_Enable_Exc,        NULL},
00341     { OVK_BOOL, OV_INTERNAL,    FALSE, "flow_analysis", "",
00342           0, 0, 0,              &IPA_Enable_Flow_Analysis,      NULL},
00343     { OVK_BOOL, OV_INTERNAL,    FALSE, "gp_partition",  "",
00344           0, 0, 0,              &IPA_Enable_GP_Partition,       NULL},
00345     { OVK_BOOL, OV_INTERNAL,    FALSE, "graph", "",
00346           0, 0, 0,              &IPA_Enable_daVinci,    NULL,
00347           "Generate call-graph display" },
00348     { OVK_UINT32,OV_VISIBLE,    FALSE, "Gspace",        "",
00349           DEFAULT_GSPACE, 0, DEFAULT_GSPACE, &IPA_Gspace, NULL},
00350     { OVK_UINT32,OV_VISIBLE,    FALSE, "Gnum",  "",
00351           DEFAULT_GSPACE, 0, DEFAULT_GSPACE, &IPA_user_gnum, NULL,
00352           "Specific size limit for data in gp-relative space" },
00353     { OVK_UINT32,OV_INTERNAL,   FALSE, "Gfactor",   "",
00354           DEFAULT_EXTGOT_FACTOR, 0, UINT32_MAX, &IPA_Extgot_Factor, NULL,
00355           "Percentage used to multiply the number of External GOTs, for AutoGnum purpose" },
00356     { OVK_UINT32,OV_VISIBLE,    FALSE, "hard_plimit",   "",
00357           DEFAULT_HARD_LIMIT, 0, UINT32_MAX,
00358           &IPA_PU_Hard_Limit, &IPA_PU_Hard_Limit_Set }, 
00359     { OVK_BOOL, OV_SHY,         FALSE, "ignore_lang",   "",
00360           0, 0, 0,              &IPA_Enable_Lang,       NULL},
00361     { OVK_BOOL, OV_VISIBLE,     FALSE, "inline",        "",
00362           0, 0, 0,              &IPA_Enable_Inline,     NULL,
00363           "Enable subprogram inlining" },
00364     { OVK_NAME, OV_INTERNAL,    FALSE, "ipaa_summary_file",     "",
00365           0, 0, 0,              &Ipa_File_Name,         NULL,
00366           "File name for IP alias analysis summary" },
00367     { OVK_UINT32,OV_INTERNAL,   FALSE, "intrinsics",   "intr",
00368           DEFAULT_NUM_FORTRAN_INTR, 0, UINT32_MAX,
00369           &IPA_Num_Fortran_Intrinsics, NULL,
00370           "Number of FORTRAN intrinsics used" },
00371     { OVK_BOOL, OV_INTERNAL,    FALSE, "keeplight",     "",
00372           0, 0, 0,              &IPA_Enable_Keeplight,  NULL},
00373     { OVK_UINT32,OV_INTERNAL,   FALSE, "map_limit",   "",
00374           DEFAULT_MAP_LIMIT, 0, UINT32_MAX, &IPA_Map_Limit, NULL},
00375     { OVK_UINT32,OV_VISIBLE,    FALSE, "max_jobs",      "",
00376           0, 0, UINT32_MAX,     &IPA_Max_Jobs,          &IPA_Max_Jobs_Set,
00377           "Maximum number of concurrent back-end jobs" },
00378     { OVK_BOOL, OV_INTERNAL,    FALSE, "merge_ty",      "",
00379           0, 0, 0,              &IPA_Enable_Merge_ty,   NULL},
00380     { OVK_BOOL, OV_INTERNAL,    FALSE, "use_effective_size", "",
00381           0, 0, 0,              &IPA_Use_Effective_Size, NULL},
00382     { OVK_OBSOLETE,OV_INTERNAL, FALSE, "min_freq",      "",
00383           DEFAULT_MIN_FREQ, 0, 10000, &IPA_Min_Freq,    NULL},
00384     { OVK_UINT32,OV_SHY,        FALSE, "min_hotness",   "",
00385           DEFAULT_MIN_HOTNESS, 0, UINT32_MAX, &IPA_Min_Hotness, NULL},
00386     { OVK_BOOL, OV_INTERNAL,    FALSE, "reshape",       "",
00387           0, 0, 0,              &IPA_Enable_Reshape,    NULL,
00388           "Reshape analysis for IPA" },
00389     { OVK_BOOL, OV_INTERNAL,    FALSE, "opt_alias",     "",
00390           0, 0, 0,              &IPA_Enable_Opt_Alias,  NULL,
00391           "Use IPA alias information in WOPT" },
00392     { OVK_BOOL, OV_INTERNAL,    FALSE,  "pad",          "",
00393           0, 0, 0,              &IPA_Enable_Padding,    NULL,
00394           "Enable padding of common block arrays"},
00395     { OVK_UINT32, OV_INTERNAL,  FALSE, "common_pad_size",       "",
00396           0, 1, 1000,           &IPA_Common_Pad_Size,   NULL,
00397           "Amount by which to pad common block array dimensions" },
00398     { OVK_LIST, OV_SHY,         FALSE, "partition_group",       "",
00399           0, 0, 0,              &IPA_Group_Names,       NULL },
00400     { OVK_LIST, OV_VISIBLE,     FALSE, "specfile",      "spec",
00401           0, 0, 0,              &IPA_Spec_Files,        NULL,
00402           "Identify IPA specification filename" },
00403     { OVK_BOOL, OV_SHY,         FALSE, "sp_partition",  "",
00404           0, 0, 0,              &IPA_Enable_SP_Partition,       NULL},
00405     { OVK_BOOL, OV_VISIBLE,     FALSE, "picopt",        "",
00406           0, 0, 0,              &IPA_Enable_Picopt,     NULL,
00407           "Enable shared code optimizations" },
00408     { OVK_BOOL, OV_VISIBLE,     FALSE, "preempt",       "",
00409           0, 0, 0,              &IPA_Enable_Preempt,    NULL},
00410     { OVK_UINT32, OV_VISIBLE,   FALSE, "plimit",        "",
00411           DEFAULT_PU_LIMIT, 0, UINT32_MAX, &IPA_PU_Limit, &IPA_PU_Limit_Set},
00412     { OVK_UINT32, OV_SHY,       FALSE, "callee_limit", "",
00413           DEFAULT_SMALL_CALLEE, 0, UINT32_MAX, &IPA_Small_Callee_Limit, NULL},
00414     { OVK_BOOL, OV_INTERNAL,    FALSE, "recycle",       "",
00415           0, 0, 0,              &IPA_Enable_Recycle,    NULL},
00416     { OVK_BOOL, OV_SHY,         FALSE, "relopt",        "",
00417           0, 0, 0,              &IPA_Enable_Relocatable_Opt,    NULL},
00418     { OVK_OBSOLETE, OV_VISIBLE, FALSE, "rela_freq",     "",
00419           DEFAULT_RELA_FREQ, 0, 100, &IPA_Rela_Freq,    NULL},
00420     { OVK_LIST, OV_VISIBLE,             FALSE, "skip_after",    "",
00421           0, 0, 0,              &IPA_Skip,              NULL},
00422     { OVK_LIST, OV_VISIBLE,     FALSE, "skip_before",   "",
00423           0, 0, 0,              &IPA_Skip,              NULL},
00424     { OVK_LIST, OV_VISIBLE,     FALSE, "skip_equal",    "",
00425           0, 0, 0,              &IPA_Skip,              NULL},
00426     { OVK_BOOL, OV_INTERNAL,    FALSE, "skip_report",   "",
00427           0, 0, 0,              &IPA_Skip_Report,       NULL,
00428           "Report PU numbers for skip control" },
00429     { OVK_UINT32, OV_VISIBLE,   FALSE, "small_pu",      "",
00430           DEFAULT_SMALL_PU, 1, UINT32_MAX, &IPA_PU_Minimum_Size, NULL },
00431     { OVK_UINT32, OV_VISIBLE,   FALSE, "space", "",
00432           DEFAULT_BLOAT_FACTOR, 0, UINT32_MAX, &IPA_Bloat_Factor,
00433           &IPA_Bloat_Factor_Set}, 
00434     { OVK_BOOL, OV_INTERNAL,    FALSE, "split", "",
00435           0, 0, 0,              &IPA_Enable_Split_Common,       NULL,
00436           "Enable IPA split common optimization" },
00437     { OVK_BOOL, OV_INTERNAL,    FALSE, "cord",          "",
00438           0, 0, 0,              &IPA_Enable_Cord,       NULL,
00439           "Enable procedure reordering" },
00440     { OVK_BOOL, OV_VISIBLE,     FALSE, "linear",                "",
00441           0, 0, 0,              &IPA_Enable_Linearization,      NULL,
00442           "Enable linearization of array subscripts" },
00443     { OVK_BOOL, OV_VISIBLE,     FALSE, "use_intrinsic", "",
00444           0, 0, 0,              &IPA_Use_Intrinsic,     NULL,
00445           "Load Intrinsic Libraries" },
00446     { OVK_BOOL, OV_VISIBLE,     FALSE, "feedback",             "",
00447           0, 0, 0,              &IPA_Enable_Feedback,   NULL,
00448           "Create .pragma, .dfe, .dve  files, " },
00449     { OVK_BOOL, OV_VISIBLE,     FALSE, "class", "",
00450           0, 0, 0,              &IPA_Enable_Alias_Class, NULL,
00451          "Enable interprocedural alias classification" },
00452     { OVK_BOOL, OV_VISIBLE,     FALSE, "ac_temp", "",
00453           0, 0, 0,              &IPA_Debug_AC_Temp_Files, NULL,
00454          "Save files from before alias classification" },
00455     { OVK_BOOL, OV_INTERNAL,    FALSE, "nested",             "",
00456           0, 0, 0,              &IPA_Enable_Inline_Nested_PU,   NULL,
00457           "Enable inlining of nested PU " },
00458     { OVK_BOOL, OV_INTERNAL,    FALSE, "preopt",             "",
00459           0, 0, 0,              &IPA_Enable_Preopt, &IPA_Enable_Preopt_Set,
00460           "Enable calling the preopt" },
00461     { OVK_BOOL, OV_INTERNAL,    FALSE, "struct",             "",
00462           0, 0, 0,              &IPA_Enable_Inline_Struct,   NULL,
00463           "Enable inlining of PU with F90 structures " },
00464     { OVK_BOOL, OV_INTERNAL,    FALSE, "char",             "",
00465           0, 0, 0,              &IPA_Enable_Inline_Char_Array,   NULL,
00466           "Enable inlining of PU with char arrays " },
00467     { OVK_BOOL, OV_INTERNAL,    FALSE, "optional",             "",
00468           0, 0, 0,              &IPA_Enable_Inline_Optional_Arg,   NULL,
00469           "Enable inlining of PU with optional arguments " },
00470     { OVK_BOOL, OV_INTERNAL,    FALSE, "array_struct",             "",
00471           0, 0, 0,              &IPA_Enable_Inline_Struct_Array_Actual,   NULL,
00472           "Enable inlining of PU with F90 structures when actuals are of ARRAY type " },
00473     { OVK_INT32, OV_INTERNAL,   FALSE, "output_file_size", "",
00474           0, -100, INT32_MAX,   &IPA_Output_File_Size, NULL},
00475     { OVK_BOOL, OV_INTERNAL,    FALSE, "var_dim_array",             "",
00476           0, 0, 0,              &IPA_Enable_Inline_Var_Dim_Array,   NULL,
00477           "Enable inlining of PU with param that is variable-dim array " },
00478     { OVK_COUNT }           /* List terminator -- must be last */
00479 };
00480 
00481 /* ====================================================================
00482  * List of global variables that are set by the -INLINE option group.
00483  * ====================================================================
00484  */
00485 
00486 /* What is the default inlining behavior? */
00487 BOOL    INLINE_Enable = TRUE;   /* If FALSE, disable inliner? */
00488 BOOL    INLINE_All = FALSE;     /* Inline everything possible? */
00489 BOOL    INLINE_Optimize_Alloca = TRUE; /* when inlining calls with alloca fix the stack and pop */
00490 BOOL    INLINE_Enable_Copy_Prop = TRUE; /* Copy Propogation during stand-alone inlining? */
00491 BOOL    INLINE_Enable_Subst_Copy_Prop = FALSE; /* Aggressive substitution of actual for formal and hence copy propogation during stand-alone inlining */
00492 BOOL    INLINE_F90 = TRUE;  /* Enable recognition of F90 in parameter type compatibility */
00493 BOOL    INLINE_None = FALSE;    /* Inline nothing? */
00494 BOOL    INLINE_Exceptions = TRUE;       /* Inline exception code? */
00495 BOOL    INLINE_Keep_PU_Order = FALSE;   /* Retain input PU order? */
00496 BOOL    INLINE_List_Actions = FALSE;    /* List inline actions? */
00497 UINT32  INLINE_Max_Pu_Size = DEFAULT_INLINE_Max_Pu_Size;
00498                                         /* Max size of pu : default 5000 */
00499 BOOL    INLINE_Preemptible = FALSE;     /* Inline preemptible PUs? */
00500 BOOL    INLINE_Static = FALSE;          /* Inline static fns? */
00501 BOOL    INLINE_Static_Set = FALSE;      /* ... explicitly set? */
00502 BOOL    INLINE_Aggressive = FALSE; /* inline even non-leaf, out-of-loop calls */
00503 BOOL    INLINE_Enable_Split_Common = TRUE;  /* Enable split common: inliner */
00504 BOOL    INLINE_Enable_Auto_Inlining = TRUE; /* Enable automatic inlining analysis */
00505 BOOL    INLINE_Enable_Restrict_Pointers = FALSE; // Allow restrict pointers
00506                                         // as formal parameter
00507 
00508 OPTION_LIST *INLINE_List_Names = NULL;  /* Must/never/file options */
00509 OPTION_LIST *INLINE_Spec_Files = NULL;  /* Specification files */
00510 OPTION_LIST *IPA_Group_Names = NULL;    /* groupings, e.g. partition groupings */
00511 OPTION_LIST *IPA_Spec_Files = NULL;     /* Specification files for IPA options, particularly used for partition groupings */
00512 UINT32  INLINE_Skip_After = UINT32_MAX;
00513 UINT32  INLINE_Skip_Before = 0;
00514 BOOL    INLINE_Array_Bounds = FALSE;    /* "conforming" array bounds */
00515 BOOL    INLINE_Use_Malloc_Mempool = FALSE;    /* Use the malloc mempool for */
00516 BOOL    INLINE_Free_Malloc_Mempool = FALSE;   /* Use the malloc mempool for
00517                                                  cloning tree */
00518 BOOL    INLINE_Inlined_Pu_Call_Graph = FALSE; /* impl. 2 of lightweight inliner -- build a call graph with only the PU tagged inline */
00519 BOOL    INLINE_Inlined_Pu_Call_Graph2 = FALSE; /* impl. 3 of lightweight inliner -- build a call graph with only the PU tagged inline and its callers */
00520 BOOL    INLINE_Get_Time_Info = FALSE;          /* Generate timing info for different phases of the inliner */
00521 
00522 static OPTION_DESC Options_INLINE[] = {
00523     { OVK_BOOL, OV_VISIBLE,     FALSE, "",      NULL,
00524           0, 0, 0,      &INLINE_Enable, NULL,
00525           "Enable subprogram inlining" },
00526     { OVK_BOOL, OV_SHY,         FALSE, "aggressive",    "",
00527           0, 0, 0,      &INLINE_Aggressive,     NULL },
00528     { OVK_BOOL, OV_VISIBLE,     FALSE, "all",   "a",
00529           0, 0, 0,      &INLINE_All,    NULL,
00530           "Attempt to inline all subprograms" },
00531     { OVK_BOOL, OV_SHY,         FALSE, "alloca",        "alloca",
00532           0, 0, 0,      &INLINE_Optimize_Alloca,        NULL,
00533           "Enable save/restore of stack when inlining calls with alloca" },
00534     {OVK_BOOL, OV_VISIBLE,      FALSE, "copy_prop_inline",      "copy", 
00535           0, 0, 0,      &INLINE_Enable_Copy_Prop, NULL,
00536           "Enable inliner copy propagation" },
00537     { OVK_BOOL, OV_VISIBLE,     FALSE, "dfe",   "df",
00538           0, 0, 0,      &IPA_Enable_DFE,        &IPA_Enable_DFE_Set,
00539           "Enable dead function elimination" },
00540     { OVK_BOOL, OV_INTERNAL,    FALSE, "exceptions",    "exc",
00541           0, 0, 0,      &INLINE_Exceptions,     NULL },
00542     { OVK_LIST, OV_VISIBLE,     FALSE, "file",  "f",
00543           0, 0, 0,      &INLINE_List_Names,     NULL,
00544           "Identify files where inliner should search for subprograms" },
00545     { OVK_BOOL, OV_VISIBLE,     FALSE, "keep_pu_order", "keep_pu",
00546           0, 0, 0,      &INLINE_Keep_PU_Order,  NULL,
00547           "Preserve source subprogram ordering" },
00548     { OVK_LIST, OV_VISIBLE,     FALSE, "library", "lib",
00549           0, 0, 0,      &INLINE_List_Names,     NULL,
00550          "Identify archive libraries where inliner should search for subprograms" },
00551     { OVK_BOOL, OV_VISIBLE,     FALSE, "list",  "l",
00552           0, 0, 0,      &INLINE_List_Actions,   NULL,
00553           "Report inliner actions" },
00554     { OVK_UINT32, OV_VISIBLE,   FALSE, "max_pu_size_inline", "max_pu_size",
00555           DEFAULT_INLINE_Max_Pu_Size, 0, UINT32_MAX,
00556           &INLINE_Max_Pu_Size, NULL,
00557           "Limit size of inlined subprograms" },
00558     { OVK_LIST, OV_VISIBLE,     FALSE, "must",  "m",
00559           0, 0, 0,      &INLINE_List_Names,     NULL,
00560           "Identify subprograms to be inlined" },
00561     { OVK_LIST, OV_VISIBLE,     FALSE, "never", "ne",
00562           0, 0, 0,      &INLINE_List_Names,     NULL,
00563           "Identify subprograms not to inline" },
00564     { OVK_BOOL, OV_VISIBLE,     FALSE, "none",  "no",
00565           0, 0, 0,      &INLINE_None,   NULL,
00566           "Disable default inlining" },
00567     { OVK_BOOL, OV_SHY,         FALSE, "preemptible",   "preempt",
00568           0, 0, 0,      &INLINE_Preemptible,    NULL },
00569     { OVK_BOOL, OV_INTERNAL,    FALSE, "recycle_symbols",       "recycle",
00570           0, 0, 0,      &IPA_Enable_Recycle,    NULL },
00571     { OVK_LIST, OV_VISIBLE,     FALSE, "specfile",      "sp",
00572           0, 0, 0,      &INLINE_Spec_Files,     NULL,
00573           "Identify IPA specification filename" },
00574     { OVK_BOOL, OV_INTERNAL,    FALSE, "split", "",
00575           0, 0, 0,              &INLINE_Enable_Split_Common,    NULL,
00576           "Enable inliner split common optimization" },
00577     { OVK_BOOL, OV_SHY,         FALSE, "static",        "",
00578           0, 0, 0,              &INLINE_Static, &INLINE_Static_Set,
00579           "Enable inlining of static functions" },
00580     { OVK_BOOL, OV_INTERNAL,    FALSE, "subst_copy_prop_inline",        "subst", 
00581           0, 0, 0,      &INLINE_Enable_Subst_Copy_Prop, NULL,
00582           "Enable inliner copy propagation" },
00583     { OVK_BOOL, OV_INTERNAL,    FALSE, "f90param",      "", 
00584          0, 0, 0,      &INLINE_F90, NULL,
00585          "Enable parameter type checking for F90" },
00586     { OVK_BOOL, OV_INTERNAL,    FALSE, "auto",  "",
00587           0, 0, 0,              &INLINE_Enable_Auto_Inlining,   NULL,
00588           "Enable inliner automatic inline analysis" },
00589     { OVK_BOOL, OV_INTERNAL,    FALSE,  "restrict",     "",
00590           0, 0, 0,              &INLINE_Enable_Restrict_Pointers, NULL,
00591           "Allow inlining of PUs with restrict pointer as formal parameters" },
00592     { OVK_LIST, OV_VISIBLE,     FALSE, "skip",  "s",
00593           0, 0, 0,      &INLINE_List_Names,     NULL,
00594           "Skip requested CG edges to avoid doing inlining" },
00595     { OVK_BOOL, OV_INTERNAL,    FALSE, "nested",             "",
00596           0, 0, 0,              &IPA_Enable_Inline_Nested_PU,   NULL,
00597           "Enable inlining of nested PU " },
00598     { OVK_BOOL, OV_INTERNAL,    FALSE, "struct",             "",
00599           0, 0, 0,              &IPA_Enable_Inline_Struct,   NULL,
00600           "Enable inlining of PU with F90 structures " },
00601     { OVK_BOOL, OV_INTERNAL,    FALSE, "char",             "",
00602           0, 0, 0,              &IPA_Enable_Inline_Char_Array,   NULL,
00603           "Enable inlining of PU with char arrays " },
00604     { OVK_BOOL, OV_INTERNAL,    FALSE, "optional",             "opt",
00605           0, 0, 0,              &IPA_Enable_Inline_Optional_Arg,   NULL,
00606           "Enable inlining of PU with optional arguments " },
00607     { OVK_LIST, OV_VISIBLE,     FALSE, "edge",  "e",
00608           0, 0, 0,      &INLINE_List_Names,     NULL,
00609           "Inline requested CG edges ONLY" },
00610     { OVK_BOOL, OV_INTERNAL,    FALSE, "array_struct",             "",
00611           0, 0, 0,              &IPA_Enable_Inline_Struct_Array_Actual,   NULL,
00612           "Enable inlining of PU with F90 structures when actuals are of ARRAY type" },
00613     { OVK_UINT32, OV_VISIBLE,   FALSE, "skip_after", "",
00614           UINT32_MAX, 0, UINT32_MAX, &INLINE_Skip_After, NULL,
00615           "Edge number to skip if larger than the specified" },
00616     { OVK_UINT32, OV_VISIBLE,   FALSE, "skip_before", "",
00617           0, 0, UINT32_MAX, &INLINE_Skip_Before, NULL,
00618           "Edge number to skip if smaller than the specified" },
00619     { OVK_BOOL, OV_INTERNAL,    FALSE, "var_dim_array",             "",
00620           0, 0, 0,              &IPA_Enable_Inline_Var_Dim_Array,   NULL,
00621           "Enable inlining of PU with param that is variable-dim array " },
00622     { OVK_LIST, OV_VISIBLE,     FALSE, "in",    "",
00623           0, 0, 0,      &INLINE_List_Names,     NULL,
00624           "Inline requested CG edges " },
00625     { OVK_BOOL, OV_INTERNAL,    FALSE, "array_bounds",             "",
00626           0, 0, 0,              &INLINE_Array_Bounds,   NULL,
00627           "Is it safe to inline a PU with an array parameter whose outermost dimension size is unknown" },
00628     { OVK_BOOL, OV_INTERNAL,    FALSE, "malloc",             "",
00629           0, 0, 0,              &INLINE_Use_Malloc_Mempool,   NULL,
00630           "Use malloc mempool instead of private mempool to clone trees" },
00631     { OVK_BOOL, OV_INTERNAL,    FALSE, "free",             "",
00632           0, 0, 0,              &INLINE_Free_Malloc_Mempool,   NULL,
00633           "Free memory malloc'ed by the malloc mempool used in clone trees" },
00634     { OVK_BOOL, OV_INTERNAL,    FALSE, "inlined_pu",             "",
00635           0, 0, 0,              &INLINE_Inlined_Pu_Call_Graph,   NULL,
00636           "Lightweight inliner impl 2 -- build a call graph with only PU tagged inline" },
00637     { OVK_BOOL, OV_INTERNAL,    FALSE, "pu_need_inline",          "",
00638           0, 0, 0,              &INLINE_Inlined_Pu_Call_Graph2,   NULL,
00639           "Lightweight inliner impl 2 -- build a call graph with only PU tagged inline and callers that call these PUs" },
00640     { OVK_BOOL, OV_INTERNAL,    FALSE, "time",          "",
00641           0, 0, 0,              &INLINE_Get_Time_Info,   NULL,
00642           "Generate timing info for different phase of the inliner" },
00643     { OVK_COUNT }           /* List terminator -- must be last */
00644 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines