Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
controls.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  *  12-Sep-90 - Original Version
00042  *  17-Jun-91 - Integrated Josie version.
00043  *
00044  * Description:
00045  *
00046  * A general package for uniform access to compiler controls which may
00047  * be set via command line flags or pragmas.  It is separate from
00048  * flags.c to allow linking with the driver (or other processes)
00049  * without getting all of the stuff in flags.c.
00050  *
00051  * TODO:  This file has not gotten much attention during integration.
00052  * We need to go over the option list and other stuff to determine
00053  * what is really useful for Muse.
00054  *
00055  * TODO: 
00056  * - Check that routine scope controls aren't modified within routines.
00057  *      WORKS for f77. Not for C
00058  * - Pop once loop level controls in C and f77
00059  * - Pop once routine level controls in edgcfe
00060  *
00061  * ====================================================================
00062  * ====================================================================
00063  */
00064 
00065 
00066 #include "defs.h"
00067 #include "controls.h"
00068 #include "config.h"
00069 #include "erglob.h"
00070 #include "glob.h"
00071 #include "tracing.h"
00072 
00073 /* To loop over all controls: */
00074 #define FOR_ALL_CONTROLS(i) for (i=CONTROL_FIRST; i<CONTROL_LAST; i++)
00075 
00076 typedef struct str_list {
00077   char* item;
00078   struct str_list *next;
00079 } STR_LIST;
00080 
00081 #define STRLIST_item(x) (x)->item
00082 
00083 #include "targ_ctrl.h"
00084 
00085 /* Define a structure describing the supported controls: */
00086 typedef struct {
00087   char    *name;
00088   CONTROL index;   /* used to verify that the table is in order */
00089   INT16   flags;
00090   INTPS first_def; /* first default */
00091   INTPS sec_def;   /* second default */
00092   INTPS min_val,   /* minimum value for int_values controls. */
00093         max_val;   /* max value */
00094   INTPS cur_val;   /* current value */
00095   INTPS prev_val;  /* previous value. To be popped after one application */
00096 } CONTROL_INFO;
00097 
00098 #define CI_HAS_AA_VAL           0x0001 /* has val that can not be changed  */
00099 #define CI_HAS_ONCE_VAL         0x0002 /* has val that expires in one use.
00100                                         * Replace by prev_val after one use */
00101 #define CI_USER_SPECIFIED_IMPL  0x0004 /* Implicitly specified by user,
00102                                         * by -O flag, for example */
00103 #define CI_USER_SPECIFIED_EXPL  0x0008 /* Explicitly specified by user,
00104                                         * by -Asched=0, for example */
00105 #define CI_USER_SPECIFIED (CI_USER_SPECIFIED_IMPL|CI_USER_SPECIFIED_EXPL)
00106 #define CI_NAMELIST_TYPE        0x0010 /* Control type is namelist
00107                                         * (as opposed to integer valued) */
00108 #define CI_CAN_CHANGE           0x0020 /* Can be respecified in cor */
00109 #define CI_SCOPE                0x0f00 /* Scope of this control. One of: */
00110 # define CI_SCOPE_LINE          0x0100 /*       per source line */
00111 # define CI_SCOPE_LOOP          0x0200 /*       per loop        */
00112 # define CI_SCOPE_ROUTINE       0x0300 /*       per routine     */
00113 # define CI_SCOPE_FILE          0x0400 /*       per source file */
00114 # define CI_SCOPE_COMPILATION   0x0500 /*       per compilation */
00115 #define CI_HAS_CHANGED          0x1000 /* Changed by a pragma */
00116 
00117 char *ci_int_type_message = "Control %s expects integer values";
00118 char *ci_nlist_type_message = "Control %s expects namelist values";
00119 
00120 #define IS_INT_TYPED(ci) (Is_True(((ci)->flags&CI_NAMELIST_TYPE)==0,\
00121                          (ci_int_type_message, ci->name)),(ci))
00122 #define IS_NLIST_TYPED(ci) (Is_True(((ci)->flags&CI_NAMELIST_TYPE),\
00123                            (ci_nlist_type_message, ci->name)),(ci))
00124 
00125 #define CI_int(ci,f)   (IS_INT_TYPED(ci))->f
00126 #define CI_nlist(ci,f) ((STR_LIST*)(IS_NLIST_TYPED(ci))->f)
00127 #define Set_CI_int(ci,f,v)   (IS_INT_TYPED(ci))->f=(v)
00128 #define Set_CI_nlist(ci,f,v) (IS_NLIST_TYPED(ci)->f)=((INTPS)(v))
00129 
00130 #define CI_can_change(ci)               ((ci)->flags & CI_CAN_CHANGE)
00131 #define CI_scope(ci)                    ((ci)->flags & CI_SCOPE)
00132 
00133 #define CI_has_changed(ci)              ((ci)->flags & CI_HAS_CHANGED)
00134 #define Set_CI_has_changed(ci)          ((ci)->flags |= CI_HAS_CHANGED)
00135 
00136 #define CI_has_AA_val(ci)               ((ci)->flags & CI_HAS_AA_VAL)
00137 #define Set_CI_has_AA_val(ci)           ((ci)->flags |= CI_HAS_AA_VAL)
00138 #define Reset_CI_has_AA_val(ci)         ((ci)->flags &= ~CI_HAS_AA_VAL)
00139 
00140 #define CI_has_once_val(ci)             ((ci)->flags & CI_HAS_ONCE_VAL)
00141 #define Set_CI_has_once_val(ci)         ((ci)->flags |= CI_HAS_ONCE_VAL)
00142 #define Reset_CI_has_once_val(ci)       ((ci)->flags &= ~CI_HAS_ONCE_VAL)
00143 
00144 #define CI_user_specified(ci)           ((ci)->flags & CI_USER_SPECIFIED)
00145 #define Set_CI_user_specified(ci)       ((ci)->flags |= CI_USER_SPECIFIED)
00146 #define Reset_CI_user_specified(ci)     ((ci)->flags &= ~CI_USER_SPECIFIED)
00147 
00148 #define CI_user_specified_impl(ci)       ((ci)->flags & CI_USER_SPECIFIED_IMPL)
00149 #define Set_CI_user_specified_impl(ci)   ((ci)->flags |= CI_USER_SPECIFIED_IMPL)
00150 #define Reset_CI_user_specified_impl(ci) ((ci)->flags &= ~CI_USER_SPECIFIED_IMPL)
00151 
00152 #define CI_user_specified_expl(ci)       ((ci)->flags & CI_USER_SPECIFIED_EXPL)
00153 #define Set_CI_user_specified_expl(ci)   ((ci)->flags |= CI_USER_SPECIFIED_EXPL)
00154 #define Reset_CI_user_specified_expl(ci) ((ci)->flags &= ~CI_USER_SPECIFIED_EXPL)
00155 
00156 #define CI_is_int_type(ci)              (((ci)->flags & CI_NAMELIST_TYPE) == 0)
00157 #define CI_is_nlist_type(ci)            ((ci)->flags & CI_NAMELIST_TYPE)
00158 
00159 
00160 /* TRUE when inside a routine. Used to check that routine scope
00161  * controls are not modified inside routines.
00162  */
00163 static BOOL Inside_A_Routine = FALSE;
00164 
00165 /* ====================================================================
00166  *
00167  * Control error reporting
00168  *
00169  * ====================================================================
00170  */
00171 
00172 /* Should we report pragma errors?  Yes in FE, maybe in BE: */
00173 BOOL Diag_On_Pragmas 
00174 #ifdef FRONT_END
00175                         = TRUE
00176 #else /* ! FRONT_END */
00177                         = TRUE
00178 #endif
00179 ;
00180 
00181 /* Should we report control errors?
00182  * Yes initially; later Diag_On_Pragmas:
00183  */
00184 static BOOL Diag_Controls = TRUE;
00185 #define Report_Error    if (Diag_Controls) ErrMsg
00186 
00187 /* ====================================================================
00188  *
00189  *              Beginning of section on control names
00190  *
00191  * ====================================================================
00192  */
00193 
00194 static STR_LIST ccv0 = {"cckr",     NULL};
00195 static STR_LIST ccv1 = {"xansi",   &ccv0};
00196 static STR_LIST ccv2 = {"cplus",   &ccv1};
00197 static STR_LIST ccv  = {"ansi",    &ccv2};
00198 
00199 static STR_LIST icv0 = {"signed",  NULL};
00200 static STR_LIST icv  = {"unsigned",&icv0};
00201 
00202 static STR_LIST ocv0 = {"svr4", NULL};
00203 static STR_LIST ocv  = {"svr3", &ocv0};
00204 
00205 #define N CI_NAMELIST_TYPE
00206 #define MI 0x7fffffff
00207 #define H CI_CAN_CHANGE
00208 #define P CI_SCOPE_LOOP
00209 #define L CI_SCOPE_LINE         
00210 #define R CI_SCOPE_ROUTINE
00211 #define F CI_SCOPE_FILE 
00212 #define C CI_SCOPE_COMPILATION
00213 
00214 CONTROL_INFO Aflag_Tbl[] = {
00215 /* name          idx            flags fdef sdef min max */
00216   {NULL        , CONTROL_MIN_CONTROL},
00217   {"acir"      , CONTROL_ACIR       , F, 1,   2, 0, 63},
00218   {"alias"     , CONTROL_ALIAS      , R, 1,   4, 0,  4},
00219   {"alndcl"    , CONTROL_ALNDCL     , R, 0,   1, 1, -1}, /* not decided yet. */
00220   {"alnref"    , CONTROL_ALNREF     , R, 0, 128, 0,255},
00221   {"alnstd"    , CONTROL_ALNSTD     , R, 0,   1, 0,  1},
00222   {"argoverlap", CONTROL_ARGOVERLAP ,N|R,0,   0, 0,  0},
00223   {"c"         , CONTROL_C          ,N|F,0,   0, (INTPS)&ccv},
00224   {"callmod"   , CONTROL_CALLMOD    , R, 0,   2, 0,  2},
00225   {"case"      , CONTROL_CASE       , F, 0,   1, 0,  1},
00226   {"char"      , CONTROL_CHAR       ,N|F,0,   0, (INTPS)&icv},
00227   {"chkargs"   , CONTROL_CHKARGS    , R, 0,   1, 0,  1},
00228   {"chkrec"    , CONTROL_CHKREC     , R, 0,   1, 0,  1},
00229   {"chksub"    , CONTROL_CHKSUB     , L, 0,   1, 0,  1},
00230   {"constp"    , CONTROL_CONSTP     ,H|R,0,   2, 0,  2},
00231   {"comname"   , CONTROL_COMNAME    , F, 1,   1, 0,  1},
00232   {"copyp"     , CONTROL_COPYP      ,H|R,0,   2, 0,  2},
00233   {"defargoverlap",CONTROL_DEFARGOVERLAP,L,0, 0, 0,  2},
00234   {"deffunc"   , CONTROL_DEFFUNC    , L, 1,   2, 0,  2},
00235   {"defkeepargs",CONTROL_DEFKEEPARGS, L, 1,   2, 0,  2},
00236   {"deflib"    , CONTROL_DEFLIB     , L, 2,   0, 0,  2},
00237   {"defnewmem" , CONTROL_DEFNEWMEM  , L, 1,   2, 0,  2},
00238   {"defrec"    , CONTROL_DEFREC     , L, 1,   2, 0,  2},
00239   {"defsef"    , CONTROL_DEFSEF     , L, 1,   2, 0,  2},
00240   {"defsrc"    , CONTROL_DEFSRC     , L, 0,   2, 0,  2},
00241   {"defvol"    , CONTROL_DEFVOL     , L, 0,   2, 0,  2},
00242   {"diag"      , CONTROL_DIAG       , L, 1,   2, 0,  2},
00243   {"dline"     , CONTROL_DLINE      , L, 0,   1, 0,  1},
00244   {"domain"    , CONTROL_DOMAIN     , R, 1,   1, 0,  1},
00245   {"exits"     , CONTROL_EXITS      ,N|R,0,   0, 0,  0},
00246   {"fblank"    , CONTROL_FBLANK     , L, 0,   1, 0,  1},
00247   {"fcm"       , CONTROL_FCM        ,H|R,0,   1, 0,  2},
00248   {"fcols"     , CONTROL_FCOLS      , L,72,   0, 0, MI},
00249   {"feral"     , CONTROL_FERAL      ,N|L,0,   0, 0,  0},
00250   {"flow"      , CONTROL_FLOW       , R, 0,   1, 0,  1},
00251   {"fp"        , CONTROL_FP         , R, 0,   2, 0,  2},
00252   {"ftab"      , CONTROL_FTAB       , L, 1,   2, 0,  2},
00253   {"func"      , CONTROL_FUNC       ,N|L,0,   0, 0,  0},
00254   {"g"         , CONTROL_G          , F, 0,   2, 0,  3},
00255   {"inline"    , CONTROL_INLINE     ,N|L,0,   0, 0,  0},
00256   {"keepargs"  , CONTROL_KEEPARGS   ,N|L,0,   0, 0,  0},
00257   {"leaf"      , CONTROL_LEAF       , L, 0,   0, 0,  1},
00258   {"map"       , CONTROL_MAP        , F, 0,   1, 0,  1},
00259   {"memlimit"  , CONTROL_MEMLIMIT   ,H|F,0,   0, 0, MI},
00260   {"newmem"    , CONTROL_NEWMEM     ,N|L,0,   0, 0,  0},
00261   {"noargoverlap",CONTROL_NOARGOVERLAP,N|L,0, 0, 0,  0},
00262   {"nofunc"    , CONTROL_NOFUNC     ,N|L,0,   0, 0,  0},
00263   {"noinline"  , CONTROL_NOINLINE   ,N|L,0,   0, 0,  0},
00264   {"nokeepargs", CONTROL_NOKEEPARGS ,N|L,0,   0, 0,  0},
00265   {"nonewmem"  , CONTROL_NONEWMEM   ,N|L,0,   0, 0,  0},
00266   {"norec"     , CONTROL_NOREC      ,N|L,0,   0, 0,  0},
00267   {"nosef"     , CONTROL_NOSEF      ,N|L,0,   0, 0,  0},
00268   {"novol"     , CONTROL_NOVOL      ,N|L,0,   0, 0,  0},
00269   {"onetrip"   , CONTROL_ONETRIP    , P, 0,   1, 0,  1},
00270   {"oform"     , CONTROL_OFORM      ,N|C,0,   0, (INTPS) &ocv},
00271   {"mopt"      , CONTROL_MOPT       ,H|R,1,   3, 0,  3},
00272   {"prof"      , CONTROL_PROF       , R, 0,   1, 0,  1},
00273   {"ptrvol"    , CONTROL_PTRVOL     ,N|L,0,   0, 0,  0},
00274   {"quit"      , CONTROL_QUIT       , F, 0,   1, 0,  2},
00275   {"real"      , CONTROL_REAL       , F, 0,   0, 0,  8},
00276   {"recursive" , CONTROL_RECURSIVE  ,N|L,0,   0, 0,  0},
00277   {"reg"       , CONTROL_REG        , R, 0,   3, 0,  3},
00278   {"retpts"    , CONTROL_RETPTS     , R, 0,   1, 0,  1},
00279   {"save"      , CONTROL_SAVE       , R, 0,   1, 0,  1},
00280   {"sched"     , CONTROL_SCHED      ,H|R,0,   1, 0,  1},
00281   {"sef"       , CONTROL_SEF        ,N|L,0,   0, 0,  0},
00282   {"stddiag"   , CONTROL_STDDIAG    , L, 0,   1, 0,  2},
00283   {"tame"      , CONTROL_TAME       ,N|L,0,   0, 0,  0},
00284   {"targ"      , CONTROL_TARG       ,N|C,TARG_FIRST_DEF,   TARG_SECOND_DEF, (INTPS) &Possible_Targets},
00285   {"unroll"    , CONTROL_UNROLL     , P, 0,   1, 0, MI},
00286   {"unrollexact",CONTROL_UNROLLEXACT, P, 0,   1, 0,  1},
00287   {"volatile"  , CONTROL_VOLATILE   ,N|L,0,   0, 0,  0},
00288   {"whole"     , CONTROL_WHOLE      , C, 0,   1, 0,  1},
00289   {"wild"      , CONTROL_WILD       ,N|L,0,   0, 0,  0},
00290   {"xref"      , CONTROL_XREF       , F, 0,   1, 0,  1},
00291 
00292   /* New Josie/92 controls: */
00293   {"ivrep"     , CONTROL_IVREP      ,H|R,0,   1, 0,  1},
00294   {"xopt"      , CONTROL_XOPT       , R, 0,   4, 0,  5},
00295 
00296   {NULL        , CONTROL_MAX_CONTROL}
00297 };
00298 #undef H 
00299 #undef P 
00300 #undef L 
00301 #undef R 
00302 #undef F 
00303 #undef C 
00304 #undef MI
00305 #undef N
00306 
00307 /* TO CHECK: 1) integer valued have NULL as possible vals.
00308  *           2) integer valued have max_val > min_val,
00309  *              except when max_val=0 and min_val= -1.
00310  *           3) Non integer valued have "*" or a list of comma separated names.
00311  *           4) that first and sec def are in range.
00312  *           4) index is in order
00313  */
00314 
00315 /* ====================================================================
00316  *
00317  * Control group table:  We keep the name, min and max values, the
00318  * second defaults (there are no first defaults of groups) and an array
00319  * of char strings, whose members represent the expansion of that group
00320  * in terms of controls.  When we get a group specification, we index
00321  * into this array and pass the corresponding string back to the
00322  * routine that handles controls.
00323  *
00324  * ====================================================================
00325  */
00326 
00327 typedef struct o_gr_exp {
00328   char *name;
00329   char *val;
00330 } O_GR_EXP;
00331 
00332 typedef struct {
00333   char    *name;
00334   INT16   flags, sec_def, min_val, max_val;
00335   O_GR_EXP   *expansion;
00336 } CONTROL_GROUP_INFO;
00337 
00338 #define CGI_IS_INT_TYPE       0x0001
00339 #define CGI_is_int_type(c)              ((c)->flags & CGI_IS_INT_TYPE != 0)
00340 
00341 static O_GR_EXP o_group_expansion[] = {
00342   /*0*/ { "no-opt",
00343           "callmod=0,constp=0,copyp=0,domain=1,flow=0,fcm=0,"
00344           "alias=0,mopt=0,reg=0,sched=0,unroll=0,whole=0" },
00345   /*1*/ { "local-opt",
00346           "callmod=0,constp=0,copyp=0,domain=1,flow=0,fcm=0,"
00347           "alias=1,mopt=1,reg=0,sched=0,unroll=0,whole=0" },
00348   /*2*/ { "global-opt",
00349           "callmod=1,constp=2,copyp=2,domain=1,flow=1,fcm=1,"
00350           "alias=3,mopt=3,reg=1,sched=1,unroll=0,whole=0" },
00351   /*3*/ { "swp-opt",
00352           "callmod=1,constp=2,copyp=2,domain=1,flow=1,fcm=1,"
00353           "alias=3,mopt=3,reg=1,sched=1,unroll=0,whole=0" },
00354 };
00355 
00356 static O_GR_EXP f_group_expansion[] = {
00357 /* 0 */ {"classic", "fcols=72,ftab=0,fblank=1" },
00358 /* 1 */ {"svs72"  , "fcols=72,ftab=0,fblank=0" },
00359 /* 2 */ {"svs120" , "fcols=120,ftab=0,fblank=1" },
00360 /* 3 */ {"normal" , "fcols=72,ftab=1,fblank=0" },
00361 /* 4 */ {"vax72"  , "fcols=72,ftab=1,fblank=1" },
00362 /* 5 */ {"vax132" , "fcols=132,ftab=1,fblank=1" },
00363 /* 6 */ {"mips72" , "fcols=72,ftab=2,fblank=0" },
00364 /* 7 */ {"unix72" , "fcols=72,ftab=2,fblank=1" },
00365 /* 8 */ {"unix"   , "fcols=0,ftab=2,fblank=1" }
00366 };
00367 
00368 static CONTROL_GROUP_INFO Control_Group_Tbl[] = {
00369   {"OPT",  CGI_IS_INT_TYPE,     2, 0, 3, o_group_expansion},
00370   {"FORT", 0,                   8, 0, 0, f_group_expansion},
00371   { NULL,  0,                   0, 0, 0, 0,            }
00372 };
00373 
00374 static STR_LIST *make_nlist(char *name, STR_LIST *next)
00375 {
00376   STR_LIST *r = (STR_LIST *) Src_Alloc(sizeof(STR_LIST));
00377   r->item = strcpy((char *)Src_Alloc(strlen(name)+1),name);
00378   r->next = next;
00379   return r;
00380 }
00381 
00382 #define IS_ID_CHAR(c) (((c)>='0'&&(c)<='9')||((c)=='-')||(nlist_ctrl&&\
00383         (((c)>='a'&&(c)<='z')||((c)=='_')||((c)>='A'&&(c)<='Z')||((c)=='$'))))
00384 
00385 #define ERRORS_FOUND    1
00386 #define NO_ERRORS_FOUND 0
00387 
00388 static INT store_ctrl(char *, STR_LIST *, INT);
00389 
00390 /* ====================================================================
00391  *
00392  * Given a name return TRUE if it is the name of an int typed control
00393  * or group.  Return FALSE if it is not name of any control or group.
00394  * The return value is used during parsing to determine whether to look
00395  * for a digit sequence or an arbitrary string as value.  As
00396  * implemented, the name given by user is searched twice, once in this 
00397  * routine and once later in store_ctrl.  Fixing this will require
00398  * maintaining and passing more info between this routine,
00399  * Process_Ctrl_Opt and store_ctrl.
00400  *
00401  * ====================================================================
00402  */
00403 
00404 static BOOL
00405 is_nlist_typed ( char *name )
00406 {
00407   if (name[0] >= 'A' && name[0] <= 'Z') {
00408     CONTROL_GROUP_INFO *cgi;
00409     for (cgi = Control_Group_Tbl; cgi->name; cgi++) 
00410       if (name[0] == cgi->name[0]) 
00411         return !(CGI_is_int_type(cgi));
00412   } else {
00413     CONTROL_INFO *a;
00414     INT i;
00415     for ( i=CONTROL_FIRST,a=Aflag_Tbl+(INT)i; i<CONTROL_LAST; i++,a++) 
00416       if (a->name && strcmp(name, a->name) == 0)
00417         return CI_is_nlist_type(a);
00418   }
00419   return FALSE;
00420 }
00421 
00422 /* ====================================================================
00423  *
00424  * Process_Control_Opt
00425  *
00426  * Process a control spec save_a, and store in current value of
00427  * controls.  "flags" is a mask of HCO values defined above.  Return 1
00428  * if errors were found, 0 if no errors were found.
00429  *
00430  * ====================================================================
00431  */
00432 
00433 INT
00434 Process_Control_Opt ( char *save_a, INT flags )
00435 {
00436   char *name, ch, *s, *a;
00437   INT nlist_ctrl, found_lpar;
00438   STR_LIST *nl;
00439 
00440   a = strcpy((char *)Src_Alloc(strlen(save_a)+1), save_a);
00441   while (1) {
00442     name = a;
00443     ch = a[0];
00444     if (ch >= 'A' && ch <= 'Z') {
00445       /* ctrl group name */
00446       a++;
00447     } else if (ch >= 'a' && ch <= 'z') {
00448       a++;
00449       while ((ch = a[0]) && ch >= 'a' && ch <= 'z')
00450         a++;
00451     } else {
00452       Report_Error ( EC_Ctrl_Syntax, save_a );
00453       return ERRORS_FOUND;
00454     }
00455     name = strncpy((char *)Src_Alloc(a-name+1), name, a-name);
00456     if (a[0] == '\0') {
00457       /* last ctrl with no val */
00458       return store_ctrl(name, NULL, flags);
00459     }
00460     /* search_ctrl: return CONTROL_MIN_CONTROL if search failed.
00461      * We treat it as a namelist control in order to avoid spurious
00462      * syntax error messages. We do give unknown control error later.
00463      */
00464     nlist_ctrl = is_nlist_typed(name);
00465     if (a[0] != '=') {
00466       if (a[0] == ',') {
00467         *a = '\0'; 
00468         /* non-last ctrl with no val */
00469         if (store_ctrl(name, NULL, flags))
00470           return ERRORS_FOUND;
00471         a++;
00472         continue;
00473       }
00474     } else {
00475       a[0] = '\0';
00476       a++;
00477     }
00478     /* now we expect a value. It can be parenthesised or not */
00479     if (a[0] == '(' /*)*/) {
00480       a[0] = '\0';
00481       found_lpar = 1;
00482       a++;
00483     } else
00484       found_lpar = 0;
00485     nl = NULL;
00486     while (1) {
00487       INT ef;
00488       s = a;
00489       if (!IS_ID_CHAR(a[0])) {
00490         Report_Error ( EC_Ctrl_Syntax, save_a );
00491         return ERRORS_FOUND;
00492       }
00493       while ((ch = a[0]) && IS_ID_CHAR(ch)) a++;
00494       if (ch == '\0') {
00495         return store_ctrl(name, make_nlist(s, nl), flags);
00496       }
00497       if (found_lpar && ch == ',') {
00498         a[0] = '\0';
00499         a++;
00500         nl = make_nlist(s, nl);
00501         continue;
00502       }
00503       ch = a[0]; a[0] = '\0'; 
00504       ef = store_ctrl(name, make_nlist(s, nl), flags); 
00505       a[0] = ch;
00506       if (ef) return ERRORS_FOUND;
00507       break;
00508     }
00509     if ((a[0] == /*(*/')') != found_lpar) {
00510       Report_Error ( EC_Ctrl_Paren, save_a );
00511       return ERRORS_FOUND;
00512     }
00513     if (a[0] == /*(*/')')
00514       *a++ = '\0';
00515     if (a[0] == ',')
00516       *a++ = '\0';
00517     if (a[0] == '\0')
00518       break;
00519   }
00520   return NO_ERRORS_FOUND;
00521 }
00522 
00523 /* ====================================================================
00524  *
00525  * same_name_lists
00526  *
00527  * Determine whether two name-lists are identical.
00528  *
00529  * ====================================================================
00530  */
00531 
00532 static BOOL
00533 same_name_lists ( STR_LIST *a, STR_LIST *b )
00534 {
00535   STR_LIST *p;
00536   INT16 ac, bc;
00537   for (ac =0 , p = a; p; p = p->next) ac++;
00538   for (bc =0 , p = b; p; p = p->next) bc++;
00539   if (ac != bc)
00540     return FALSE;
00541   while (a) {
00542     BOOL found = FALSE;
00543     char *ai = a->item;
00544     for (p = b; p; p = p->next) 
00545       if (strcmp(p->item, ai) == 0) {
00546         found = TRUE;
00547         break;
00548       }
00549     if (!found)
00550       return FALSE;
00551     a = a->next;
00552   }
00553   return TRUE;
00554 }
00555 
00556 /* ====================================================================
00557  *
00558  * push_cur_val
00559  *
00560  * Save current value as prev_val.  Set once flag.
00561  *
00562  * ====================================================================
00563  */
00564 
00565 static void
00566 push_cur_val ( CONTROL_INFO *a )
00567 {
00568   Set_CI_has_once_val(a);
00569   a->prev_val = a->cur_val;
00570 }
00571 
00572 /* ====================================================================
00573  *
00574  * store_ctrl
00575  *
00576  * Store a new value for a control in the current value field.
00577  *
00578  * ====================================================================
00579  */
00580 
00581 #define CI_name(a) ((a)->name)
00582 
00583 #define debugging FALSE
00584 #define dprintf if (debugging) printf
00585 
00586 static INT
00587 store_ctrl ( char *name, STR_LIST *name_list, INT flags )
00588 {
00589   CONTROL_INFO *a;
00590   BOOL ok_int;
00591   INT32 int_val;
00592 
00593   if ( debugging ) {
00594     STR_LIST *nl = name_list;
00595     printf("store_ctrl: %s ", name);
00596       while (nl) {
00597         printf("%s,", nl->item);
00598         nl = nl->next;
00599       }
00600     printf("\n");
00601   }
00602 
00603   /* various possibilities for values of name_list are:
00604    *  NULL: can be value of int typed or namelist typed.
00605    *        Use second default value.
00606    *  single, a valid integer number: can be value of int typed or
00607    *        namelist typed.
00608    *  single, but not valid number: can be namelist only.
00609    *  multiple: can be namelist only.
00610    */
00611   int_val = 0;  /* unnecessary except to avoid warning msg */
00612   if (name_list == NULL) {
00613     ok_int = TRUE;
00614   } else if (name_list->next == NULL) {
00615     char *v = name_list->item;
00616     if (*v == '-') v++;
00617     else if (*v == '+') v++;
00618     while (v[0] >= '0' && v[0] <= '9') v++;
00619     ok_int = v[0] == '\0';
00620     if (ok_int) int_val = atoi(name_list->item);
00621   } else {
00622     ok_int = FALSE;
00623   }
00624   
00625 
00626   if (name[0] >= 'A' && name[0] <= 'Z') {
00627     CONTROL_GROUP_INFO *cgi;
00628     Is_True(name[1] == '\0', ("Multiple character group name ?"));
00629     for (cgi = Control_Group_Tbl; cgi->name; cgi++) {
00630       if (name[0] == cgi->name[0]) {
00631         INT v;
00632         if (CGI_is_int_type(cgi)) {
00633           if (!ok_int) {
00634             Report_Error ( EC_Ctrl_Integer, cgi->name );
00635             return ERRORS_FOUND;
00636           }
00637           v = name_list ? int_val : cgi->sec_def;
00638           if (v < cgi->min_val || v > cgi->max_val) {
00639             Report_Error ( EC_Group_Range, v, cgi->name,
00640                            cgi->min_val, cgi->max_val);
00641             return ERRORS_FOUND;
00642           }
00643         } else {
00644           /* namelist value is always present. Even if user types
00645            * number, it could be a single valued namelist
00646            */
00647           if (name_list == NULL)
00648             v = cgi->sec_def;
00649           else {
00650             O_GR_EXP *o;
00651             if (name_list->next) {
00652               Report_Error ( EC_Group_Mult, cgi->name );
00653               return ERRORS_FOUND;
00654             }
00655             v = 0;
00656             for (o = cgi->expansion; o->val; o++,v++)
00657               if (strcmp(name_list->item, o->name) == 0) 
00658                 break;
00659             if (o == NULL) {
00660               Report_Error (EC_Inv_Ctrl_Val, name_list->item, cgi->name);
00661               return ERRORS_FOUND;
00662             }
00663           }
00664         }
00665         return Process_Control_Opt(cgi->expansion[v].val, flags | HCO_IMPLICIT);
00666       }
00667     }
00668     Report_Error ( EC_Unrec_Group, name );
00669     return ERRORS_FOUND;
00670   }
00671 
00672   for (INT i=CONTROL_FIRST; i<CONTROL_LAST; i++ ) {
00673     a = &Aflag_Tbl[i];
00674 
00675     if (a->name && strcmp(name, a->name) == 0) {
00676       BOOL changed;
00677       if ((flags & HCO_ONCE) && CI_scope(a) == CI_SCOPE_LOOP)
00678         Report_Error ( EC_Unimp_Once, a->name );
00679 
00680       if (CI_is_nlist_type(a)) {
00681         STR_LIST *p;
00682 
00683         dprintf ( "  %s: namelist value\n", a->name );
00684         p = CI_nlist(a,min_val);
00685         if (name_list == NULL)
00686           name_list = CI_nlist(a, sec_def);
00687         if (p) {
00688           /* control takes a singleton, and only one of few possible values. 
00689              like CONTROL_C CONTROL_TARG, etc  */
00690           while (p) {
00691             if (strcmp(p->item,name_list->item) == 0)
00692               break;
00693             p = p->next;
00694           }
00695           if (p == NULL) {
00696             Report_Error ( EC_Inv_Ctrl_Val, name_list->item, a->name );
00697             return ERRORS_FOUND;
00698           }
00699         }
00700         if (same_name_lists(name_list, CI_nlist(a, cur_val)))
00701           changed = FALSE;
00702         else {
00703           if (CI_has_AA_val(a)) {
00704             Report_Error ( EC_Change_AA, CI_name(a) );
00705           }
00706           else {
00707             if (flags & HCO_ONCE) 
00708               push_cur_val(a);
00709             Set_CI_nlist(a, cur_val, name_list);
00710             changed = TRUE;
00711           }
00712         }
00713 
00714       } else /* CI_is_int_type(a) */ {
00715         INT v;
00716         if (!ok_int) {
00717           Report_Error ( EC_Ctrl_Numeric, a->name );
00718           return ERRORS_FOUND;
00719         }
00720         v = (name_list) ? int_val : CI_int(a, sec_def);
00721         dprintf ( "  %s: integer value %d (current %d)\n",
00722                   a->name, v, a->cur_val );
00723         if (v < CI_int(a, min_val) || v > CI_int(a, max_val)) {
00724           Report_Error ( EC_Ctrl_Range, v, a->name,
00725                          CI_int(a,min_val), CI_int(a,max_val));
00726           return ERRORS_FOUND;
00727         }
00728         if ( v != a->cur_val ) {
00729           if (CI_has_AA_val(a)) {
00730             Report_Error ( EC_Change_AA, CI_name(a) );
00731           } else {
00732             if (flags & HCO_ONCE) push_cur_val(a);
00733             changed = TRUE;
00734             dprintf ( "  %s: %d (was %d)\n", a->name, v, a->cur_val );
00735             Set_CI_int (a, cur_val, v);
00736           }
00737         } else {
00738           changed = FALSE;
00739           dprintf ( "  %s: unchanged\n", a->name );
00740         }
00741       }
00742       /* has changed flag is set whenever a control is changed via a
00743        * pragma.  This tells that the new value needs to be written to
00744        * .B file.
00745        */
00746       if (changed && (flags & HCO_PRAGMA)) {
00747         if (CI_scope(a) >= CI_SCOPE_FILE) {
00748           Report_Error ( EC_File_Scope, CI_name(a) );
00749           return ERRORS_FOUND;
00750         } else if (CI_scope(a) == CI_SCOPE_ROUTINE && Inside_A_Routine) {
00751           Report_Error ( EC_Routine_Scope, CI_name(a) );
00752           return ERRORS_FOUND;
00753         }
00754         Set_CI_has_changed(a);
00755       }
00756       if (flags & HCO_AAVAL)
00757         Set_CI_has_AA_val(a);
00758       if (CI_user_specified_expl(a) && changed && (flags & HCO_PRAGMA) == 0)
00759         /* We issue a warning whenever an explicit setting of a flag
00760          * is overridden.  This will catch situations like -Asched=0 -O,
00761          * where -O silently overrides -Asched=0.  However, we do it
00762          * only for command line args, because it is difficult to handle
00763          * in pragma processing.  Pragmas cause changes to settings
00764          * several times, once for each pass, and that can trigger this
00765          * message.  We might later want to give similar warnings for
00766          * pragmas, but that will require more work.
00767          */
00768         Report_Error ( EC_Override, a->name,
00769                        (flags & HCO_IMPLICIT) ? "implicit flag"
00770                                               : "another explicit setting");
00771       if (flags & HCO_IMPLICIT)
00772         Set_CI_user_specified_impl(a);
00773       else
00774         Set_CI_user_specified_expl(a);
00775       return NO_ERRORS_FOUND;
00776     }
00777   }
00778   Report_Error ( EC_Unimp_Actrl, name );
00779   return ERRORS_FOUND;
00780 }
00781 
00782 /* TO CHECK: 1) integer valued have max_val > min_val, 
00783                 except when max_val=0 and min_val= -1
00784              4) index is in order */
00785 #define CI_allowed_vals(a) CI_nlist(a,min_val)
00786 void
00787 Init_Controls_Tbl ( void )
00788 {
00789   CONTROL_INFO *a;
00790   BOOL trace = Get_Trace ( TP_MISC, 1 );
00791 
00792   for (INT i=CONTROL_FIRST; i<CONTROL_LAST; i++ ) {
00793     a = &Aflag_Tbl[i];
00794     if (a->name == NULL)
00795       break;
00796     Is_True(a->index == i,
00797       ("Aflag_Tbl index mismatch: i=%1d a->index=%1d(%s)", i, a->index, a->name));
00798     if (CI_is_int_type(a)) {
00799       if (a->max_val <= a->min_val) {
00800         Is_True(a->max_val == -1 && a->min_val == 1,
00801                 ("inconsistent min_val and max_val of %s: %1d %1d", 
00802                 a->name, a->min_val, a->max_val));
00803       } else {
00804         Is_True(a->first_def >= a->min_val && a->first_def <= a->max_val,
00805           ("inconsistent first_def(%1d) of %s: %1d..%1d", 
00806                 a->first_def,a->name, a->min_val, a->max_val));
00807         Is_True(a->sec_def >= a->min_val && a->sec_def <= a->max_val,
00808           ("inconsistent sec_def(%1d) of %s: %1d..%1d", 
00809                 a->first_def,a->name, a->min_val, a->max_val));
00810       }
00811     } else {
00812       /* In the initialized table first and sec def are given as numbers
00813        * which are indices in the chain of allowed_vals.  Convert that
00814        * to actual STR_LIST:
00815        */
00816       STR_LIST *v, *v1; INT sc;
00817       v = CI_allowed_vals(a); 
00818       if (v) {
00819         sc = a->sec_def;
00820         while (sc-- > 0) v = v->next;
00821         v1 = (STR_LIST *) calloc(1, sizeof(STR_LIST));
00822         v1->item = v->item;
00823         Set_CI_nlist(a, sec_def, v1);
00824         v = CI_allowed_vals(a); 
00825         sc = a->first_def;
00826         while (sc-- > 0) v = v->next;
00827           v1 = (STR_LIST *) calloc(1, sizeof(STR_LIST));
00828         v1->item = v->item;
00829         Set_CI_nlist(a, first_def, v1);
00830       } /* else there are no fixed allowed_vals. */
00831     }
00832     a->cur_val = a->first_def;
00833   }
00834 
00835   if ( trace ) {
00836     fprintf ( TFile, "\nInit_Controls_Tbl:\n" );
00837     Print_Controls ( TFile, "<init>", TRUE );
00838   }
00839 }
00840 
00841 #ifndef DRIVER
00842 
00843 typedef struct {
00844   INT32 value[(INT)CONTROL_MAX_CONTROL];
00845 } CTRL_VAL_SET;
00846 
00847 CTRL_VAL_SET routine_top_values;
00848 /* in cor we need to remember the command line values of controls
00849    because the order of processing of routines is not necessarily
00850    same as that in front end. Hence, at the top of every routine
00851    in cor we restore the cmd_line values and then apply the increments
00852    applicable to that routine, independent of any other routine.
00853    */
00854 CTRL_VAL_SET cmd_line_values;
00855 
00856 static void
00857 save_ctrl_val_set ( CTRL_VAL_SET *s )
00858 {
00859   INT i;
00860   for (i=CONTROL_FIRST; i<CONTROL_MAX_CONTROL; i++)
00861     s->value[i] = Aflag_Tbl[i].cur_val;
00862 }
00863 
00864 static void
00865 restore_ctrl_val_set ( CTRL_VAL_SET *r )
00866 {
00867   INT i;
00868   for (i=CONTROL_FIRST; i<CONTROL_MAX_CONTROL; i++)
00869     Aflag_Tbl[i].cur_val = r->value[i];
00870 }
00871 
00872 
00873 void
00874 Save_Routine_Top_Ctrls ( void )
00875 {
00876   BOOL trace = Get_Trace ( TP_MISC, 1 );
00877 
00878   save_ctrl_val_set(&routine_top_values);
00879   Inside_A_Routine = TRUE;
00880 
00881   if ( trace ) {
00882     fprintf ( TFile, "\nSave_Routine_Top_Ctrls:\n" );
00883     Print_Controls ( TFile, "<SRTC>", TRUE );
00884   }
00885 }
00886 
00887 void
00888 Restore_Routine_Top_Ctrls ( void )
00889 {
00890   BOOL trace = Get_Trace ( TP_MISC, 1 );
00891 
00892   restore_ctrl_val_set(&routine_top_values);
00893   Inside_A_Routine = FALSE;
00894 
00895   if ( trace ) {
00896     fprintf ( TFile, "\nRestore_Routine_Top_Ctrls:\n" );
00897     Print_Controls ( TFile, "<RRTC>", TRUE );
00898   }
00899 }
00900 
00901 void
00902 Restore_Cmd_Line_Ctrls ( void )
00903 {
00904   BOOL trace = Get_Trace ( TP_MISC, 1 );
00905 
00906   restore_ctrl_val_set(&cmd_line_values);
00907 
00908   if ( trace ) {
00909     fprintf ( TFile, "\nRestore_Cmd_Line_Ctrls:\n" );
00910     Print_Controls ( TFile, "<RCLC>", TRUE );
00911   }
00912 }
00913 
00914 void
00915 Apply_Controls ( void )
00916 {
00917   INT i;
00918   CONTROL_INFO *a;
00919   INT32 control_ival;
00920 
00921   save_ctrl_val_set(&cmd_line_values);
00922 
00923   for ( i=CONTROL_FIRST,a=Aflag_Tbl+(INT)i; i<CONTROL_LAST; i++,a++) {
00924     if (CI_user_specified(a)) {
00925       switch (a->index) {
00926         case CONTROL_C:
00927         case CONTROL_CHAR:
00928         case CONTROL_ALIAS:
00929         case CONTROL_CASE:
00930         case CONTROL_CALLMOD:
00931         case CONTROL_DEFVOL:
00932         case CONTROL_DLINE:
00933         case CONTROL_MAP:
00934         case CONTROL_UNROLL:
00935         case CONTROL_UNROLLEXACT:
00936           break;
00937 
00938         case CONTROL_ALNREF:
00939           Allow_Word_Aligned_Doubles = FALSE;
00940           control_ival = Get_Int_Ctrl_Val(CONTROL_ALNREF);
00941           if ( control_ival == 128 ) {
00942             /* allow doubles to be aligned on only 4-byte boundaries */
00943             Allow_Word_Aligned_Doubles = TRUE;
00944           } else {
00945             Report_Error ( EC_Unimp_Align, a->name, control_ival );
00946           }
00947           break;
00948 
00949         case CONTROL_DIAG:
00950           if (a->cur_val == 0)
00951             Min_Error_Severity = ES_ERROR;
00952           break;
00953 
00954         default:
00955           /* Report_Error ( EC_Unimp_Ctrl, a->name ); */
00956           break;
00957       }
00958     }
00959   }
00960 
00961   /* After this, report errors/warnings iff Diag_On_Pragmas is set: */
00962   Diag_Controls = Diag_On_Pragmas;
00963 }
00964 
00965 /*--------------------------------------------------------------
00966  * routine to copy values of routine scope controls to internal
00967  * flags that are used by compiler. TODO: We need to make sure 
00968  * that this routine is called after any pragma's or directives 
00969  * applicable to a routine have been applied.
00970  * TODO: Get rid of this routine. Use control values directly
00971  *------------------------------------------------------------*/
00972 
00973 void
00974 Apply_Routine_Scope_Controls ( void )
00975 {
00976   Symbolic_Debug_Mode = SDM_NONE;
00977   switch (Get_Int_Ctrl_Val(CONTROL_FP)) {
00978     case 2:
00979       Symbolic_Debug_Mode |= SDM_USE_FP;
00980       /* fall through */
00981     case 1:
00982       Symbolic_Debug_Mode |= SDM_GEN_FP;
00983   }
00984   if (Get_Int_Ctrl_Val(CONTROL_G))
00985     Symbolic_Debug_Mode |= (SDM_LINE|SDM_SYMBOL);
00986   Max_Symbolic_Debug_Mode = Symbolic_Debug_Mode;
00987 }
00988 #endif
00989 
00990 INT32
00991 Get_Int_Ctrl_Val ( CONTROL a )
00992 {
00993 #ifdef Is_True_On
00994   Is_True((Aflag_Tbl[a].flags & CI_NAMELIST_TYPE) == 0,
00995           ("Control %s does not have integral value", Aflag_Tbl[a].name));
00996 #endif
00997   return CI_int((Aflag_Tbl+ (INT)a),cur_val);
00998 }
00999 
01000 char *
01001 Get_Name_Ctrl_Val ( CONTROL a )
01002 {
01003 #ifdef Is_True_On
01004   Is_True(Aflag_Tbl[a].flags & CI_NAMELIST_TYPE, 
01005           ("Control %s does not have name-list value", Aflag_Tbl[a].name));
01006 #endif
01007   return STRLIST_item(CI_nlist((Aflag_Tbl+ (INT)a),cur_val));
01008 }
01009 
01010 /* ====================================================================
01011  *
01012  * Pop_Controls / Pop_Once_Line_Controls
01013  *
01014  * Pop ONCE values of any controls of a given level.
01015  *
01016  * The second is a special entry-point for C, to avoid including
01017  * flags.h in lexical.c.  (Josie comment -- OBSOLETE.)
01018  *
01019  * ====================================================================
01020  */
01021 
01022 void
01023 Pop_Controls ( INT32 level )
01024 {
01025   CONTROL_INFO *a;
01026   INT i;
01027   
01028   for ( i=CONTROL_FIRST,a=Aflag_Tbl+(INT)i; i<CONTROL_LAST; i++,a++) 
01029     if (CI_scope(a) == level && CI_has_once_val(a)) {
01030       Reset_CI_has_once_val(a);
01031       Aflag_Tbl[i].cur_val = Aflag_Tbl[i].prev_val;
01032     }
01033 }
01034 
01035 /* ================================================================= */
01036 
01037 void
01038 Pop_Once_Line_Controls ( void )
01039 {
01040   Pop_Controls(CI_SCOPE_LINE);
01041 }
01042 
01043 
01044 
01045 /* ====================================================================
01046  *
01047  * Process_Pragma
01048  *
01049  * Process a pragma, entering it in the control table.
01050  *
01051  * ====================================================================
01052  */
01053 
01054 INT
01055 Process_Pragma ( char *x )
01056 {
01057   INT flags = HCO_PRAGMA;
01058   /*printf("PROCESS PRAGMA: %s\n", x);*/
01059   INT rv = 0;
01060 
01061   while (x[0] == ' ' || x[0] == '\t') x++;
01062   if (x[0] == '%' && (x[1]=='o' || x[1]=='O') && (x[2]=='n' || x[2]=='N') && 
01063      (x[3] == 'c' || x[3] == 'C') && (x[4] == 'e' || x[4] == 'E')) {
01064      flags = HCO_PRAGMA | HCO_ONCE;
01065      x += 5;
01066   } else 
01067      flags = HCO_PRAGMA;
01068 
01069   /* pick substrings and call Process_Control_Opt for them */
01070   while (1) {
01071     char *r, ch;
01072     while (x[0] == ' ' || x[0] == '\t') x++;
01073     if (x[0] == '\0') return rv;
01074     r = x;
01075     while (x[0] != '\0' && x[0] != ' ' && x[0] != '\t') x++;
01076     ch = x[0];
01077     x[0] = '\0';
01078     rv |= Process_Control_Opt(r, flags);
01079     if (ch == '\0') return rv;
01080     x[0] = ch;
01081   }
01082 }
01083 
01084 /* ====================================================================
01085  *
01086  * Print_Controls
01087  *
01088  * Print the current values of the controls to the given file.  Start
01089  * each output line with the given tag string.  Only print controls
01090  * with their default values if "def" is TRUE.
01091  *
01092  * ====================================================================
01093  */
01094 
01095 void
01096 Print_Controls ( FILE *fp, char *tag, BOOL def )
01097 {
01098   CONTROL_INFO *a;
01099   BOOL defaulted;
01100 
01101   for (INT i=CONTROL_FIRST; i<CONTROL_LAST; i++ ) {
01102     a = &Aflag_Tbl[i];
01103     defaulted = (a->cur_val == a->first_def);
01104     if ( def || !defaulted ) {
01105       fprintf(fp, "%s %s%s = ", tag, defaulted ? "*" : " ", a->name);
01106       if ( CI_is_int_type(a) )
01107         fprintf ( fp, "%d\n", a->cur_val );
01108       else {
01109         STR_LIST *s = CI_nlist(a, cur_val);
01110         while (s) {
01111           fprintf ( fp, " %s%s", s->item, s->next ? ",":"" );
01112           s = s->next;
01113         }
01114         fprintf ( fp, "\n" );
01115       }
01116     }
01117   }
01118   
01119 }
01120 
01121 /* handle the interation between -g and -O */
01122 void Fix_g_O( void )
01123 {
01124   if (Debug_Level == 2 || Debug_Level == 1) {
01125     if (Opt_Level > 0) {
01126 #ifdef FRONT_END
01127       ErrMsg(EC_Fix_g_O);
01128 #endif
01129       Opt_Level = 0;
01130     }
01131 
01132     Set_CI_int((Aflag_Tbl+CONTROL_CALLMOD),cur_val, 0);
01133     Set_CI_int((Aflag_Tbl+CONTROL_CONSTP),cur_val, 0);
01134     Set_CI_int((Aflag_Tbl+CONTROL_COPYP),cur_val, 0);
01135     Set_CI_int((Aflag_Tbl+CONTROL_DOMAIN),cur_val, 1);
01136     Set_CI_int((Aflag_Tbl+CONTROL_FLOW),cur_val, 0);
01137     Set_CI_int((Aflag_Tbl+CONTROL_FCM),cur_val, 0);
01138     Set_CI_int((Aflag_Tbl+CONTROL_ALIAS),cur_val, 0);
01139     Set_CI_int((Aflag_Tbl+CONTROL_MOPT),cur_val, 0);
01140     Set_CI_int((Aflag_Tbl+CONTROL_REG),cur_val, 0);
01141     Set_CI_int((Aflag_Tbl+CONTROL_SCHED),cur_val, 0);
01142     Set_CI_int((Aflag_Tbl+CONTROL_XOPT),cur_val, 0);
01143   }
01144 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines