Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
stab.h
Go to the documentation of this file.
00001 #ifndef stab_INCLUDED
00002 #define stab_INCLUDED
00003 
00004 #ifdef _NEW_SYMTAB
00005 #ifdef __cplusplus
00006 #include "symtab.h"
00007 #endif /* __cplusplus */
00008 
00009 /* Enter_ST has no effect in new symtab */
00010 
00011 /*
00012 
00013   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00014 
00015   This program is free software; you can redistribute it and/or modify it
00016   under the terms of version 2 of the GNU General Public License as
00017   published by the Free Software Foundation.
00018 
00019   This program is distributed in the hope that it would be useful, but
00020   WITHOUT ANY WARRANTY; without even the implied warranty of
00021   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00022 
00023   Further, this software is distributed without any warranty that it is
00024   free of the rightful claim of any third person regarding infringement 
00025   or the like.  Any license provided herein, whether implied or 
00026   otherwise, applies only to this software file.  Patent licenses, if 
00027   any, provided herein do not apply to combinations of this program with 
00028   other software, or any other product whatsoever.  
00029 
00030   You should have received a copy of the GNU General Public License along
00031   with this program; if not, write the Free Software Foundation, Inc., 59
00032   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00033 
00034   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00035   Mountain View, CA 94043, or:
00036 
00037   http://www.sgi.com
00038 
00039   For further information regarding this notice, see:
00040 
00041   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00042 
00043 */
00044 
00045 
00046 #define Enter_ST(s)
00047 #define ST_can_use_reg_align(s) FALSE
00048 #define Enter_TY(s)
00049 
00050 #else /* _NEW_SYMTAB */
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /* ====================================================================
00057  * ====================================================================
00058  *
00059  *
00060  * Revision history:
00061  *  11-Feb-89 - Original Version
00062  *  12-Jun-91 - Integrated from Josie
00063  *  07-Jun-92 - Removed call utilities to callutil.h
00064  *  30-Apr-93 - Removed constant table utilities to const.h
00065  *     Oct-94 - Redo for Mongoose
00066  *
00067  * Description:
00068  *
00069  * Definitions of the symbol table data structures, access functions,
00070  * and associated constants, including type identifiers.
00071  *
00072  * ====================================================================
00073  * ====================================================================
00074  */
00075 
00076 /* ====================================================================
00077  *
00078  * Symbol Table Structure
00079  *
00080  * The Symbol Table consists of a list of SYMTAB structures, 
00081  * one for each PU (procedure), plus one for the global symbols.
00082  * Under each SYMTAB there is a list of symbols (ST), labels (ST),
00083  * and types (TY) that are defined in that PU.
00084  *
00085  * The constant symbols (both literals and symbolic constants
00086  * like relocations) are kept in a separate constant table because
00087  * they are hashed to avoid duplicate copies.  See const.{h,c} for
00088  * information on the constant table.
00089  *
00090  * ====================================================================
00091  */
00092 
00093 /* Dummy declarations of structs for prototypes: */
00094 struct wn;
00095 struct tcon;
00096 struct einfo;
00097 struct symexpr;         /* Symbolic expression node from symconst.h */
00098 struct inito;
00099 
00100 #include "mtypes.h"     /* for supported MTYPEs (machine types) */
00101 
00102 /* Forward definitions of the various structure typedefs: */
00103 typedef struct st    ST;        /* Symbol table entry */
00104 typedef ST* ST_IDX;
00105 typedef UINT32 LABEL_IDX;
00106 typedef struct stch  STCH;      /* Symbol table entry list (of STs) */
00107 typedef struct sblk  SBLK;      /* Symbol table block info */
00108 typedef struct ty    TY;        /* Type descriptor */
00109 typedef TY         * TY_IDX;    /* Type descriptor index */
00110 typedef struct tylist TYLIST;   /* Type descriptor list */
00111 typedef TYLIST* TYLIST_IDX;     /* Type descriptor list */
00112 typedef struct fld   FLD;       /* Structured type field descriptor */
00113 typedef struct fld * FLD_IDX;   /* Structured type field descriptor */
00114 typedef struct ari   ARI;       /* Array information */
00115 typedef struct arb   ARB;       /* Array bounds */
00116 typedef struct arb * ARB_IDX;
00117 typedef struct symtab SYMTAB;   /* Symbol table */
00118 typedef SYMTAB* SYMTAB_IDX;
00119 typedef struct enum_const ENUM_CONST;   /* Enumerated type constant */
00120 typedef struct fti FTI;         /* Function Type Information */
00121 typedef struct tcon *TCON_IDX;  /* TCON index */
00122 
00123 /* for compatibilty with new symtab */
00124 /*REFERENCED*/
00125 inline TY_IDX
00126 Get_TY (TY_IDX x)       { return x; }    
00127 #define Get_ST(x)       (x)    
00128 #define ST_st_idx(x)    (x)
00129 #define Get_ARB(x)      (x)
00130 #define Get_FLD(x)      (x)
00131 
00132 #include "aux_stab.h"
00133 
00134 /* ====================================================================
00135  *
00136  * Checking macros
00137  *
00138  * The macros below may be ignored for purposes of understanding the
00139  * structure definitions in this file.  They are separated out here
00140  * to make the rest of the file easier to read.  They follow the basic
00141  * rule that they all take the struct pointer to be checked as one (or
00142  * the only) operand, check it, and return it as the result, so they
00143  * may be viewed as noops.
00144  *
00145  * ====================================================================
00146  */
00147 
00148 /* --------------------------------------------------------------------
00149  * These macros are meant for miscellaneous pointer checking.  If
00150  * needed, they must be defined in aux_stab.h. The definitions below
00151  * are the default definitions if there are no previous definitions.
00152  *
00153  * Non-default versions will be used in Cfe for checking that things in
00154  * local scope are not used afer that scope is closed and deallocated.
00155  *
00156  * Theoretically, with these macros, one can have extremely complicated
00157  * checking mechanisms in which each pointer is checked for validity
00158  * before it is used.
00159  * --------------------------------------------------------------------
00160  */
00161 
00162 #ifndef CAN_USE_ARB
00163 #define CAN_USE_ARB(a) (a)
00164 #endif
00165 
00166 #ifndef  CAN_USE_STCH
00167 #define CAN_USE_STCH(a) (a)
00168 #endif
00169 
00170 #ifndef CAN_USE_TY
00171 #define CAN_USE_TY(a) (a)
00172 #endif
00173 
00174 #ifndef  CAN_USE_TYLIST
00175 #define CAN_USE_TYLIST(a) (a)
00176 #endif
00177 
00178 #ifndef CAN_USE_FLD
00179 #define CAN_USE_FLD(a) (a)
00180 #endif
00181 
00182 #ifndef CAN_USE_MBR
00183 #define CAN_USE_MBR(a) (a)
00184 #endif
00185 
00186 #ifndef CAN_USE_ENUM_CONST
00187 #define CAN_USE_ENUM_CONST(a) (a)
00188 #endif
00189 
00190 #ifndef CAN_USE_ST
00191 #define CAN_USE_ST(a) (a)
00192 #endif
00193 
00194 /* --------------------------------------------------------------------
00195  * TY checking
00196  * --------------------------------------------------------------------
00197  */
00198 
00199 /* Validate the dimension number of an array: */
00200 #if defined(Is_True_On) && !(defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS))
00201 extern INT16 Is_Valid_Dim ( const TY *ty, INT16 i);
00202 #define IS_VALID_DIM(ty, i) Is_Valid_Dim(ty,i)
00203 #else
00204 #define IS_VALID_DIM(ty, i) (i)
00205 #endif
00206 
00207 /* Validate the type kind for a kind-specific access: */
00208 #ifdef Is_True_On
00209   extern void CHECK_KIND_func(const TY *,UINT16);
00210   extern void CHECK_KIND2_func(const TY *,UINT16,UINT16);
00211 # define CHECK_KIND(s,k)        (CHECK_KIND_func(s,k),s)
00212 # define CHECK_KIND2(s,k,kk)    (CHECK_KIND2_func(s,k,kk),s)
00213 #else
00214 # define CHECK_KIND(s,k)        (s)
00215 # define CHECK_KIND2(s,k,kk)    (s)
00216 #endif
00217 
00218 #define KIND_IS_SCALAR(s)       CHECK_KIND(s,KIND_SCALAR)
00219 #define KIND_IS_ARRAY(s)        CHECK_KIND(s,KIND_ARRAY)
00220 #define KIND_IS_STRUCT(s)       CHECK_KIND(s,KIND_STRUCT)
00221 #define KIND_IS_ENUM(s)         CHECK_KIND(s,KIND_ENUM)
00222 #define KIND_IS_POINTER(s)      CHECK_KIND(s,KIND_POINTER)
00223 #define KIND_IS_FUNCTION(s)     CHECK_KIND(s,KIND_FUNCTION)
00224 #define KIND_IS_CLASS(s)        CHECK_KIND(s,KIND_CLASS)
00225 #define KIND_IS_STRUCT_CLASS(s) CHECK_KIND2(s,KIND_STRUCT,KIND_CLASS)
00226 #define KIND_IS_SCALAR_OR_POINTER(s) CHECK_KIND2(s,KIND_SCALAR,KIND_POINTER)
00227 
00228 /* ---------------------------------------------------------------------
00229  * ST checking:  Validate the variant-specific accesses.
00230  * ---------------------------------------------------------------------
00231  */
00232 
00233 #ifdef Is_True_On
00234 
00235   extern ST *CHECK_SCLASS_func (ST *, INT16 );
00236   extern ST *CHECK_CLASS2_func (ST *, INT16, INT16 );
00237   extern ST *CHECK_CLASS3_func (ST *, INT16, INT16, INT16 );
00238   extern ST *CHECK_CLASS_func ( const ST *, INT16 );
00239 
00240 # define CHECK_SCLASS(s,c)      CHECK_SCLASS_func(s,c)
00241 # define CHECK_CLASS2(s,c1,c2)  CHECK_CLASS2_func(s,c1,c2)
00242 # define CHECK_CLASS3(s,c1,c2,c3)       CHECK_CLASS3_func(s,c1,c2,c3)
00243 # define CHECK_CLASS(s,c)       CHECK_CLASS_func(s,c)
00244 
00245 #else
00246 
00247 # define CHECK_SCLASS(s,c)      (s)
00248 # define CHECK_CLASS2(s,c1,c2)  (s)
00249 # define CHECK_CLASS3(s,c1,c2,c3)       (s)
00250 # define CHECK_CLASS(s,c)       (s)
00251 
00252 #endif
00253 
00254 #define SCLASS_IS_LOCAL(s)      CHECK_SCLASS(s,SCLASS_LOCAL)
00255 #define SCLASS_IS_SAVED(s)      CHECK_SCLASS(s,SCLASS_SAVED)
00256 #define SCLASS_IS_COMMON(s)     CHECK_SCLASS(s,SCLASS_COMMON)
00257 #define SCLASS_IS_EXTERN(s)     CHECK_SCLASS(s,SCLASS_EXTERN)
00258 #define SCLASS_IS_STATIC (s)    CHECK_SCLASS(s,SCLASS_STATIC)
00259 #define SCLASS_IS_DEFINED(s)    CHECK_SCLASS(s,SCLASS_DEFINED)
00260 
00261 #define CLASS_IS_VAR(s)         CHECK_CLASS(s,CLASS_VAR)
00262 #define CLASS_IS_FUNC(s)        CHECK_CLASS(s,CLASS_FUNC)
00263 #define CLASS_IS_CONST(s)       CHECK_CLASS(s,CLASS_CONST)
00264 #define CLASS_IS_LABEL(s)       CHECK_CLASS(s,CLASS_LABEL)
00265 #define CLASS_IS_SYM_CONST(s)   CHECK_CLASS(s,CLASS_SYM_CONST)
00266 #define CLASS_IS_INTR(s)        CHECK_CLASS(s,CLASS_INTR)
00267 #define CLASS_IS_PREG(s)        CHECK_CLASS(s,CLASS_PREG)
00268 #define CLASS_IS_BLOCK(s)       CHECK_CLASS(s,CLASS_BLOCK)
00269 #define CLASS_IS_VAR_UNK(s)     CHECK_CLASS2(s,CLASS_VAR,CLASS_UNK)
00270 #define CLASS_IS_FUNC_UNK(s)    CHECK_CLASS2(s,CLASS_FUNC,CLASS_UNK)
00271 #define CLASS_IS_VAR_FUNC(s)    CHECK_CLASS2(s,CLASS_VAR,CLASS_FUNC)
00272 #define CLASS_IS_VAR_CONST(s)   \
00273         CHECK_CLASS3(s,CLASS_VAR,CLASS_CONST,CLASS_SYM_CONST)
00274 #define CLASS_IS_VAR_BLOCK(s)   CHECK_CLASS2(s,CLASS_VAR,CLASS_BLOCK)
00275 #define CLASS_IS_CONST_SYM(s)   CHECK_CLASS2(s,CLASS_CONST,CLASS_SYM_CONST)
00276 
00277 
00278 /* ====================================================================
00279  *
00280  * FLD: structure/union fields
00281  *
00282  * Structure field information is represented by a list of FLD elements
00283  * attached to the type descriptor for the structure type.  There is
00284  * one such list for each structure type, pointed to from any TY
00285  * record that has TY_kind==KIND_STRUCT.
00286  *
00287  * The fields represented by a FLD list may or may not overlap each 
00288  * other in memory, determined strictly by their given byte addresses
00289  * and sizes.  Both Fortran equivalence and C union are mapped into
00290  * structures with overlapping fields.
00291  *
00292  * ====================================================================
00293  */
00294 
00295 struct fld {
00296   char          *name;  /* pointer to field name */
00297   struct ty     *type;  /* pointer to field type */
00298   mINT64        ofst;   /* byte offset of first data byte wrt parent */
00299   mUINT8        bsize;  /* bit field: size in bits */
00300   mUINT8        bofst;  /* bit field: bit offset in byte specified by ofst */
00301   mUINT16       flags;  /* Attribute flags */
00302   FLD           *next;  /* next FLD in list */
00303 };
00304 
00305 #define FLD_name(fld)   ((CAN_USE_FLD(fld))->name)
00306 #define FLD_type(fld)   ((CAN_USE_FLD(fld))->type) 
00307 #define FLD_ofst(fld)   ((CAN_USE_FLD(fld))->ofst)
00308 #define FLD_bsize(fld)  ((CAN_USE_FLD(fld))->bsize)
00309 #define FLD_bofst(fld)  ((CAN_USE_FLD(fld))->bofst)
00310 #define FLD_flags(fld)  ((CAN_USE_FLD(fld))->flags)
00311 #define FLD_next(fld)   ((CAN_USE_FLD(fld))->next)
00312 
00313 #define FLD_SET_ONCE    0x0010          /* is set only once */
00314 #define FLD_EQUIVALENCE 0x0020          /* is equivalence */
00315                                 /* in C we have nested structs for unions,
00316                                  * but in fortran we can flatten it out
00317                                  * so mark that a union is starting. */
00318 #define FLD_BEGIN_UNION 0x0040          /* begin a union */
00319 #define FLD_END_UNION   0x0080          /* end a union */
00320 #define FLD_BEGIN_MAP   0x0100          /* begin a map (fortran) */
00321 #define FLD_END_MAP     0x0200          /* end a map */
00322 #define FLD_BIT_FIELD   0x0400          /* is bit field */
00323 
00324 #define       FLD_is_set_once(m)        ((FLD_flags(m)) & FLD_SET_ONCE)
00325 #define   Set_FLD_is_set_once(m)        ((FLD_flags(m)) |= FLD_SET_ONCE)
00326 #define Reset_FLD_is_set_once(m)        ((FLD_flags(m)) &= ~FLD_SET_ONCE)
00327 #define       FLD_is_equivalence(m)     ((FLD_flags(m)) & FLD_EQUIVALENCE)
00328 #define   Set_FLD_is_equivalence(m)     ((FLD_flags(m)) |= FLD_EQUIVALENCE)
00329 #define Reset_FLD_is_equivalence(m)     ((FLD_flags(m)) &= ~FLD_EQUIVALENCE)
00330 #define       FLD_is_begin_union(m)     ((FLD_flags(m)) & FLD_BEGIN_UNION)
00331 #define   Set_FLD_is_begin_union(m)     ((FLD_flags(m)) |= FLD_BEGIN_UNION)
00332 #define Reset_FLD_is_begin_union(m)     ((FLD_flags(m)) &= ~FLD_BEGIN_UNION)
00333 #define       FLD_is_end_union(m)       ((FLD_flags(m)) & FLD_END_UNION)
00334 #define   Set_FLD_is_end_union(m)       ((FLD_flags(m)) |= FLD_END_UNION)
00335 #define Reset_FLD_is_end_union(m)       ((FLD_flags(m)) &= ~FLD_END_UNION)
00336 #define       FLD_is_begin_map(m)       ((FLD_flags(m)) & FLD_BEGIN_MAP)
00337 #define   Set_FLD_is_begin_map(m)       ((FLD_flags(m)) |= FLD_BEGIN_MAP)
00338 #define Reset_FLD_is_begin_map(m)       ((FLD_flags(m)) &= ~FLD_BEGIN_MAP)
00339 #define       FLD_is_end_map(m) ((FLD_flags(m)) & FLD_END_MAP)
00340 #define   Set_FLD_is_end_map(m) ((FLD_flags(m)) |= FLD_END_MAP)
00341 #define Reset_FLD_is_end_map(m) ((FLD_flags(m)) &= ~FLD_END_MAP)
00342 #define       FLD_is_bit_field(m)       ((FLD_flags(m)) & FLD_BIT_FIELD)
00343 #define   Set_FLD_is_bit_field(m)       ((FLD_flags(m)) |= FLD_BIT_FIELD)
00344 #define Reset_FLD_is_bit_field(m)       ((FLD_flags(m)) &= ~FLD_BIT_FIELD)
00345 
00346 /* ====================================================================
00347  *
00348  * MBR: C++ class members
00349  *
00350  * Class member information is represented by a list of MBR elements
00351  * attached to the type descriptor for the class type.  There is one
00352  * such list for each class type, pointed to from any TY record that
00353  * has TY_kind==KIND_CLASS.
00354  *
00355  * The members represented by a MBR list may or may not overlap each 
00356  * other in memory, determined strictly by their given byte addresses
00357  * and sizes.
00358  *
00359  * NOTE:  MBRs now have the same info as struct FLDs, so just use the
00360  * same structure.  This simplifies some things.
00361  * NOTE:  someday we should just remove MBR and use FLD.
00362  *
00363  * ====================================================================
00364  */
00365 
00366 typedef FLD     MBR;    /* Class member descriptor */
00367 
00368 /* Descriptor field access: */
00369 #define MBR_name(mbr)   FLD_name(mbr)
00370 #define MBR_ofst(mbr)   FLD_ofst(mbr)
00371 #define MBR_type(mbr)   FLD_type(mbr)
00372 #define MBR_next(mbr)   FLD_next(mbr)
00373 #define MBR_flags(mbr)  FLD_flags(mbr)
00374 
00375 /* Attribute flags: */
00376 #define MBR_STATIC      0x0001          /* Static member */
00377 #define MBR_VIRTUAL     0x0002          /* Virtual member (function) */
00378 #define MBR_FUNCTION    0x0004          /* Function member */
00379 #define MBR_BASE        0x0008          /* Base class */
00380                                         /* Missing bits are used for FLD */
00381 #define MBR_BIT_FIELD   0x0400          /* Bit field */
00382 
00383 /* Flag field access: */
00384 #define       MBR_static(m)     ((MBR_flags(m)) & MBR_STATIC)
00385 #define   Set_MBR_static(m)     ((MBR_flags(m)) |= MBR_STATIC)
00386 #define Reset_MBR_static(m)     ((MBR_flags(m)) &= ~MBR_STATIC)
00387 #define       MBR_virtual(m)    ((MBR_flags(m)) & MBR_VIRTUAL)
00388 #define   Set_MBR_virtual(m)    ((MBR_flags(m)) |= MBR_VIRTUAL)
00389 #define Reset_MBR_virtual(m)    ((MBR_flags(m)) &= ~MBR_VIRTUAL)
00390 #define       MBR_function(m)   ((MBR_flags(m)) & MBR_FUNCTION)
00391 #define   Set_MBR_function(m)   ((MBR_flags(m)) |= MBR_FUNCTION)
00392 #define Reset_MBR_function(m)   ((MBR_flags(m)) &= ~MBR_FUNCTION)
00393 #define       MBR_base(m)       ((MBR_flags(m)) & MBR_BASE)
00394 #define   Set_MBR_base(m)       ((MBR_flags(m)) |= MBR_BASE)
00395 #define Reset_MBR_base(m)       ((MBR_flags(m)) &= ~MBR_BASE)
00396 #define       MBR_is_bit_field(m)       ((MBR_flags(m)) & MBR_BIT_FIELD)
00397 #define   Set_MBR_is_bit_field(m)       ((MBR_flags(m)) |= MBR_BIT_FIELD)
00398 #define Reset_MBR_is_bit_field(m)       ((MBR_flags(m)) &= ~MBR_BIT_FIELD)
00399 
00400 /* For Delta C++, an offset may be dynamic, i.e. unknown at compile
00401  * time.  We represent this with the minimum negative integer, so that
00402  * it can be loaded with a single lui.  We don't use -1 to allow for
00403  * representing fields at negative offsets.  We also have an offset
00404  * value to represent the case where the offset is undefined (e.g.
00405  * for static members).  MBR_VALID_OFST is the minimum true offset.
00406  */
00407 #define MBR_DYNAMIC_OFST        INT32_MIN
00408 #define MBR_NO_OFST             INT32_MIN+1
00409 #define MBR_VALID_OFST          INT32_MIN+2
00410 
00411 /* ====================================================================
00412  *
00413  * COMP: component (struct field/class member) pointer
00414  *
00415  * A comp is a unioned pointer to allow common treatment of struct
00416  * field and C++ class member lists.
00417  *
00418  * NOTE:  because FLD and MBR are now the same, COMP is just a typedef.
00419  * NOTE:  someday we should just remove COMP and use FLD.
00420  * ====================================================================
00421  */
00422 
00423 typedef FLD     COMP;   /* Component: field or class pointer */
00424 
00425 #define COMP_fld(c)     ((FLD) c)
00426 #define COMP_mbr(c)     ((MBR) c)
00427 
00428 /* ====================================================================
00429  *
00430  * ENUM_CONST: enumerated type constants
00431  *
00432  * For enumerated types, there is one TY record for the basic 
00433  * enumerated type, and this is of KIND_SCALAR (KIND_ENUM is not 
00434  * used!).  If the scalar type is not an enumerated type, then the 
00435  * TY_enum_const_list(ty) is NULL.  If that field is non-NULL, then it 
00436  * contains a pointer to the head of a linked list of ENUM_CONST 
00437  * structures, each of which contains information about one of the 
00438  * members of the enumerated type (i.e., its symbolic name and integer 
00439  * value).  Variables declared to be enumerated types have ST_type 
00440  * fields which point to the main TY record.
00441  *
00442  * ====================================================================
00443  */
00444 
00445 struct enum_const {
00446   char                  *name;  /* Symbolic name of constant  */
00447   mINT64                val;    /* Value of constant */
00448   struct enum_const     *next;  /* Next constant in the list or NULL */
00449 };
00450 
00451 #define ENUM_CONST_name(f)      ((CAN_USE_ENUM_CONST(f))->name)
00452 #define ENUM_CONST_val(f)       ((CAN_USE_ENUM_CONST(f))->val)
00453 #define ENUM_CONST_next(f)      ((CAN_USE_ENUM_CONST(f))->next)
00454 
00455 /* ====================================================================
00456  *
00457  * ARI: Array information
00458  * ARB: Array bounds
00459  *
00460  * Array dimension information is represented by a structure which
00461  * consists of an ARI, whose tail end contains as many instances of
00462  * ARB as there are declared dimensions.
00463  *
00464  * The ARI front part holds info for the whole array, while each
00465  * contained ARB holds info for a single dimension.
00466  *
00467  * There is one such structure for each declared array type, pointed to
00468  * from each TY type record that has TY_kind==KIND_ARRAY.
00469  *
00470  * NOTE:  for unknown historical reasons, the names "fbnd" and "tbnd"
00471  * were chosen.  I've changed them to "lbnd" and "ubnd", but kept the
00472  * old names for compatibility.
00473  * ====================================================================
00474  */
00475 
00476 struct arb {
00477         mBOOL const_lbnd;       /* has constant lower bound */
00478         mBOOL const_ubnd;       /* has constant upper bound */
00479         mBOOL const_stride;     /* has constant stride */
00480         union {
00481                 mINT64 lbnd_val;
00482                 struct wn *lbnd_tree;
00483         } lbnd;                 /* lower bound, as written */
00484         union {
00485                 mINT64 ubnd_val;
00486                 struct wn *ubnd_tree;
00487         } ubnd;                 /* upper bound, as written */
00488         union {
00489                 mINT64 stride_val;
00490                 struct wn *stride_tree;
00491         } stride;               /* stride, as written */
00492 };
00493 
00494 #define ARB_const_lbnd(a)       ((CAN_USE_ARB(a)).const_lbnd)
00495 #define ARB_lbnd_val(a)         ((CAN_USE_ARB(a)).lbnd.lbnd_val)
00496 #define ARB_lbnd_tree(a)        ((CAN_USE_ARB(a)).lbnd.lbnd_tree)
00497 #define ARB_const_ubnd(a)       ((CAN_USE_ARB(a)).const_ubnd)
00498 #define ARB_ubnd_val(a)         ((CAN_USE_ARB(a)).ubnd.ubnd_val)
00499 #define ARB_ubnd_tree(a)        ((CAN_USE_ARB(a)).ubnd.ubnd_tree)
00500 #define ARB_const_stride(a)     ((CAN_USE_ARB(a)).const_stride)
00501 #define ARB_stride_val(a)       ((CAN_USE_ARB(a)).stride.stride_val)
00502 #define ARB_stride_tree(a)      ((CAN_USE_ARB(a)).stride.stride_tree)
00503 
00504 struct ari {
00505   struct ty     *etype;         /* Pointer to element type */
00506   mINT16        ndims;          /* Number of dimensions */
00507   mBOOL const_zofst;            /* has constant zero offset */
00508   union {
00509         mINT64 zofst_val;
00510         struct wn *zofst_tree;
00511   } zofst;                      /* zero offset, as written */
00512   ARB           bnds[1];
00513 };
00514 
00515 #define ARI_etype(a)            ((a)->etype)
00516 #define ARI_ndims(a)            ((a)->ndims)
00517 #define ARI_const_zofst(a)      ((a)->const_zofst)
00518 #define ARI_zofst_val(a)        ((a)->zofst.zofst_val)
00519 #define ARI_zofst_tree(a)       ((a)->zofst.zofst_tree)
00520 #define ARI_bnds(a)             ((a)->bnds)
00521 #define ARI_bnd(a,i)            ((a)->bnds[i])
00522 
00523 struct tylist {
00524   TY                    *item;
00525   struct tylist         *next;
00526 };
00527 
00528 #define TYLIST_item(s)  ((CAN_USE_TYLIST(s))->item)
00529 #define TYLIST_next(s)  ((CAN_USE_TYLIST(s))->next)
00530 
00531 /* ====================================================================
00532  * FTI:  Function Type Info
00533  * KIND_FUNCTION types point to the FTI structure for more information.
00534  * ====================================================================
00535  */
00536 struct fti { 
00537       struct tylist     *parms;         /* parameter type list */
00538       struct ty         *ret_type;      /* returned type */
00539       mINT32            arg_area_size;  /* size of area for args;
00540                                          * used to avoid recomputing the size,
00541                                          * this will be set in back-end. */
00542 };
00543 #define FTI_parms(s)    ((s)->parms)
00544 #define FTI_ret_type(s) ((s)->ret_type)
00545 #define FTI_arg_area_size(s)    ((s)->arg_area_size)
00546 
00547 /* ====================================================================
00548  *
00549  * TY: Type descriptor
00550  *
00551  * Type information is represented by a tree structure with nodes that
00552  * are TY records, with the TY_kind field specifying the nature of
00553  * each level.
00554  *
00555  * If TY_kind==KIND_STRUCT, there is a list of FLD records, with each
00556  * FLD containing field info and a TY pointer giving the field type.
00557  *
00558  * For TY_kind==KIND_CLASS, there is a similar list of MBR records
00559  * with information about class members.  For a Delta C++ dynamic class,
00560  * the size may be TY_DYNAMIC_SIZE, indicating unknown, and the
00561  * alignment may be TY_DYNAMIC_ALIGN, also indicating unknown.
00562  *
00563  * If TY_kind==KIND_ARRAY, there is a pointer to an (ARI,n*ARB)
00564  * structure which gives dimension info, and a pointer to a TY which
00565  * gives the element type. 
00566  *
00567  * If TY_kind==KIND_SCALAR, there are two possibilities:
00568  *   1) if this is a non-enumerated type, then there are no children.
00569  *   2) if this is an enumerated type, then there is a list of 
00570  *      ENUM_CONST structures which give a mapping between the 
00571  *      symbolic names and numeric values.
00572  * The value of the TY_enum_const_list(ty) field distinguishes 
00573  * between the two:  if that field is NULL, then we are in case (1), 
00574  * else we are in case (2).  Either way, TY_btype gives the 
00575  * elementary type (TYPE_ID from mtypes.h).
00576  *
00577  * NOTE: Char strings are represented as arrays of char.
00578  *
00579  * NOTE: const and volatile qualifiers are represented by
00580  * bits in TY records. The TY record for 'volatile <ty>' and '<ty>'
00581  * differ by only one that one bit (and type_tag). In particular if
00582  * <ty> is a struct type, the TY_flist of these two TY records will
00583  * be same pointer; similarly if it is array, the arinfo will be same
00584  * pointer etc. The equality of TY_flist's of two struct typed TYs
00585  * can be used to test test the equality of types ignoring volatile 
00586  * and const bits 
00587  *
00588  * ====================================================================
00589  */
00590 
00591 /* Kinds of types: */
00592 typedef enum {
00593   KIND_INVALID, /*        Invalid type */
00594   KIND_SCALAR,  /* 0x0001 Scalar type (integer/floating point) */
00595   KIND_ARRAY,   /* 0x0002 array type */
00596   KIND_STRUCT,  /* 0x0003 struct/union type */
00597   KIND_ENUM,    /* 0x0004 enumerated type */
00598   KIND_POINTER, /* 0x0005 pointer type */
00599   KIND_FUNCTION,/* 0x0006 function/procedure type */
00600   KIND_VOID,    /* 0x0007 C void type */
00601   KIND_CLASS,   /* 0x0008 C++ class */
00602   KIND_LAST
00603 } TY_KIND;
00604 
00605 /* Kind queries: */
00606 extern BOOL Is_Simple_Type ( TY_IDX );  /* SCALAR, ENUM, PTR, VOID */
00607 extern BOOL Is_Structure_Type ( TY_IDX );       /* STRUCT, CLASS */
00608 extern BOOL Is_Composite_Type ( TY_IDX );       /* STRUCT, CLASS, ARRAY */
00609 
00610 /* Qualified type "kind" for use only by mtob/btom: */
00611 #define KIND_QUALIFIED  0x0080
00612 
00613 /* The type descriptor:  Note that references to "all objects of the
00614  * type" refer to both ST objects and FLDs.
00615  */
00616 struct ty {
00617   mINT64  size;         /* Size, in bytes, incl for structures or
00618                          * arrays all children and all padding.
00619                          * If kind==KIND_POINTER, the size is that of
00620                          * the pointer only, not that of the pointee */
00621   mUINT32 flags;        /* Attributes of the type */
00622   mUINT32 id;           /* A unique ID. */
00623   mUINT8 kind;          /* changed from type  TY_KIND to mUINT16 : PV 357942 */
00624   mUINT8 btype;         /* One of the possible back-end types for TY_kind */
00625   mUINT16 align;        /* Required alignment for this type. 1, 2, 4 or 8 */
00626   char          *name;  /* Name of type (needed for debugger output) */
00627   union {
00628     ENUM_CONST  *ec_list; /* KIND_SCALAR: maybe enum const list */
00629     FLD         *flist;   /* KIND_STRUCT: field list */
00630     MBR         *mlist;   /* KIND_CLASS: member list */
00631     COMP        *clist;   /* field/member pointer union */
00632     ARI         *arinfo;  /* KIND_ARRAY:  array bounds info */
00633     struct ty   *pointed; /* KIND_POINTER: type of pointee */
00634     struct fti  *ftinfo;  /* KIND_FUNCTION:  parameter and return info */
00635   } spec_type_info; 
00636   /* The next two fields are used to speed up type queries that were
00637    * consuming large portions of the compiler's running time. */
00638   struct ty     *pointer;/* type which points to this type */
00639   struct ty     *next;   /* Linked list of TY's for debugging */
00640 };
00641 
00642 #define TY_GLOBAL          0x0001   /* Type is global */
00643 #define TY_CHARACTER       0x0002   /* type is a character (fortran) */
00644 #define TY_DYNAMIC         0x0004   /* type info is dynamic (delta-C++) */
00645 #define TY_RETURN_TO_PARAM 0x0008   /* Return value through first parameter */
00646 #define TY_VARARGS         0x0010   /* Functions of type are varargs */
00647 #define TY_PROTOTYPED      0x0020   /* Function type has prototype */
00648 #define TY_REFERENCED      0x0040   /* BE: Type is referenced */
00649 #define TY_THUNK           0x0080   /* Function is a thunk */
00650 #define TY_VOLATILE        0x0100   /* Objects of type are volatile */
00651 #define TY_CONST           0x0200   /* Objects of this type never
00652                                          * change in value (C semantics) */
00653 #define TY_RESTRICT        0x1000
00654 #define TY_QUALIFIED       0x1300   /* Qualified type (const or volatile) */
00655 #define TY_LOGICAL         0x0400   /* Type is logical (fortran) */
00656 #define TY_UNION           0x0800   /* Struct or class type is union */
00657 #define TY_LONG            0x1000   /* Type is "long" not int or longlong (C) */
00658 #define TY_TRANSLATED_TO_C 0x2000   /* Type has been defined in whirl2c */
00659 #define TY_PACKED          0x4000   /* Struct or class type is packed */
00660 #define TY_PTR_AS_ARRAY    0x8000   /* Treat pointer as array */
00661 #define TY_ANONYMOUS      0x10000   /* Anonymous structs/classes/unions */
00662 #define TY_SPLIT          0x20000   /* Split from a larger common block
00663                                      * equivalence (block_split) */
00664 #define TY_LAST_IN_SPLIT  0x40000   /* Last in the list of items split 
00665                                      * in common/equivalence (block_split) */
00666 #define TY_ENTERED        0x80000   /* TY entered */
00667 #define TY_F90_POINTER   0x100000   /* If the type is an F90 pointer */
00668 #define TY_F90_TARGET    0x200000   /* If the type has the F90 target attribute */
00669 #define TY_NOT_IN_UNION  0x40000    /* If the type cannot be part of a union */
00670 
00671 #define TY_NO_ANSI_ALIAS  TY_VARARGS
00672 
00673 #define TY_kind(s)      (CAN_USE_TY(s)->kind)
00674 #define TY_size(s)      (CAN_USE_TY(s)->size)
00675 #define TY_align(s)     (CAN_USE_TY(s)->align)
00676 #define TY_flags(s)     (CAN_USE_TY(s)->flags)
00677 #define TY_id(s)        (CAN_USE_TY(s)->id)
00678 #define TY_next(s)      (CAN_USE_TY(s)->next)
00679 #define TY_name(s)      (CAN_USE_TY(s)->name)
00680 #define TY_btype(s)     (CAN_USE_TY(s)->btype)
00681 #define TY_mtype(s)     TY_btype(s)
00682 
00683 #define Set_TY_kind(t,v)        (TY_kind(t) = v)
00684 #define Set_TY_size(t,v)        (TY_size(t) = v)
00685 #define Set_TY_align(t,v)       (TY_align(t) = v)
00686 #define Set_TY_name(t,v)        (TY_name(t) = v)
00687 
00688 #define       TY_is_global(s)   (TY_flags(s) & TY_GLOBAL)
00689 #define   Set_TY_is_global(s)   (TY_flags(s) |= TY_GLOBAL)
00690 #define Reset_TY_is_global(s)   (TY_flags(s) &= ~TY_GLOBAL)
00691 #define       TY_is_character(s)        (TY_flags(s) & TY_CHARACTER)
00692 #define   Set_TY_is_character(s)        (TY_flags(s) |= TY_CHARACTER)
00693 #define Reset_TY_is_character(s)        (TY_flags(s) &= ~TY_CHARACTER)
00694 #define       TY_is_dynamic(s)  (TY_flags(s) & TY_DYNAMIC)
00695 #define   Set_TY_is_dynamic(s)  (TY_flags(s) |= TY_DYNAMIC)
00696 #define Reset_TY_is_dynamic(s)  (TY_flags(s) &= ~TY_DYNAMIC)
00697 #define       TY_return_to_param(s)  (TY_flags(s) & TY_RETURN_TO_PARAM)
00698 #define   Set_TY_return_to_param(s)  (TY_flags(s) |= TY_RETURN_TO_PARAM)
00699 #define Reset_TY_return_to_param(s)  (TY_flags(s) &= ~TY_RETURN_TO_PARAM)
00700 #define       TY_is_varargs(s)  (TY_flags(s) & TY_VARARGS)
00701 #define   Set_TY_is_varargs(s)  (TY_flags(s) |= TY_VARARGS)
00702 #define Reset_TY_is_varargs(s)  (TY_flags(s) &= ~TY_VARARGS)
00703 #define       TY_has_prototype(s) (TY_flags(s) & TY_PROTOTYPED)
00704 #define   Set_TY_has_prototype(s) (TY_flags(s) |= TY_PROTOTYPED)
00705 #define Reset_TY_has_prototype(s) (TY_flags(s) &= ~TY_PROTOTYPED)
00706 #define       TY_is_thunk(s)    (TY_flags(s) & TY_THUNK)
00707 #define   Set_TY_is_thunk(s)    (TY_flags(s) |= TY_THUNK)
00708 #define Reset_TY_is_thunk(s)    (TY_flags(s) &= ~TY_THUNK)
00709 #define       TY_is_referenced(s) (TY_flags(s) & TY_REFERENCED)
00710 #define   Set_TY_is_referenced(s) (TY_flags(s) |= TY_REFERENCED)
00711 #define Reset_TY_is_referenced(s) (TY_flags(s) &= ~TY_REFERENCED)
00712 #define       TY_is_volatile(s) (TY_flags(s) & TY_VOLATILE)
00713 #define   Set_TY_is_volatile(s) (TY_flags(s) |= TY_VOLATILE)
00714 #define Reset_TY_is_volatile(s) (TY_flags(s) &= ~TY_VOLATILE)
00715 #define       TY_is_const(s)    (TY_flags(s) & TY_CONST)
00716 #define   Set_TY_is_const(s)    (TY_flags(s) |= TY_CONST)
00717 #define Reset_TY_is_const(s)    (TY_flags(s) &= ~TY_CONST)
00718 #define       TY_is_restrict(s) (TY_flags(s) & TY_RESTRICT)
00719 #define   Set_TY_is_restrict(s) (TY_flags(s) |= TY_RESTRICT)
00720 #define Reset_TY_is_restrict(s) (TY_flags(s) &= ~TY_RESTRICT)
00721 #define       TY_is_qualified(s) (TY_flags(s) & TY_QUALIFIED)
00722 #define       TY_is_logical(s)  (TY_flags(s) & TY_LOGICAL)
00723 #define   Set_TY_is_logical(s)  (TY_flags(s) |= TY_LOGICAL)
00724 #define Reset_TY_is_logical(s)  (TY_flags(s) &= ~TY_LOGICAL)
00725 #define       TY_is_union(s)    (TY_flags(s) & TY_UNION)
00726 #define   Set_TY_is_union(s)    (TY_flags(s) |= TY_UNION)
00727 #define Reset_TY_is_union(s)    (TY_flags(s) &= ~TY_UNION)
00728 #define       TY_is_long(s)     (TY_flags(s) & TY_LONG)
00729 #define   Set_TY_is_long(s)     (TY_flags(s) |= TY_LONG)
00730 #define Reset_TY_is_long(s)     (TY_flags(s) &= ~TY_LONG)
00731 #define       TY_is_translated_to_c(s)  (TY_flags(s) & TY_TRANSLATED_TO_C)
00732 #define   Set_TY_is_translated_to_c(s)  (TY_flags(s) |= TY_TRANSLATED_TO_C)
00733 #define Reset_TY_is_translated_to_c(s)  (TY_flags(s) &= ~TY_TRANSLATED_TO_C)
00734 #define       TY_is_packed(s)   (TY_flags(s) & TY_PACKED)
00735 #define   Set_TY_is_packed(s)   (TY_flags(s) |= TY_PACKED)
00736 #define Reset_TY_is_packed(s)   (TY_flags(s) &= ~TY_PACKED)
00737 #define       TY_ptr_as_array(s)        (TY_flags(s) & TY_PTR_AS_ARRAY)
00738 #define   Set_TY_ptr_as_array(s)        (TY_flags(s) |= TY_PTR_AS_ARRAY)
00739 #define Reset_TY_ptr_as_array(s)        (TY_flags(s) &= ~TY_PTR_AS_ARRAY)
00740 #define       TY_anonymous(s)   (TY_flags(s) & TY_ANONYMOUS)
00741 #define   Set_TY_anonymous(s)   (TY_flags(s) |= TY_ANONYMOUS)
00742 #define Reset_TY_anonymous(s)   (TY_flags(s) &= ~TY_ANONYMOUS)
00743 #define       TY_split(s)       (TY_flags(s) & TY_SPLIT)
00744 #define   Set_TY_split(s)       (TY_flags(s) |= TY_SPLIT)
00745 #define Reset_TY_split(s)       (TY_flags(s) &= ~TY_SPLIT)
00746 #define       TY_last_in_split(s)       (TY_flags(s) & TY_LAST_IN_SPLIT)
00747 #define   Set_TY_last_in_split(s)       (TY_flags(s) |= TY_LAST_IN_SPLIT)
00748 #define Reset_TY_last_in_split(s)       (TY_flags(s) &= ~TY_LAST_IN_SPLIT)
00749 #define       TY_entered(s)     (TY_flags(s) & TY_ENTERED)
00750 #define   Set_TY_entered(s)     (TY_flags(s) |= TY_ENTERED)
00751 #define Reset_TY_entered(s)     (TY_flags(s) &= ~TY_ENTERED)
00752 #define       TY_no_ansi_alias(s)       (TY_flags(s) & TY_NO_ANSI_ALIAS)
00753 #define   Set_TY_no_ansi_alias(s)       (TY_flags(s) |= TY_NO_ANSI_ALIAS)
00754 #define Reset_TY_no_ansi_alias(s)       (TY_flags(s) &= ~TY_NO_ANSI_ALIAS)
00755 #define       TY_is_f90_pointer(s)      (TY_flags(s) & TY_F90_POINTER)
00756 #define   Set_TY_is_f90_pointer(s)      (TY_flags(s) |= TY_F90_POINTER)
00757 #define Reset_TY_is_f90_pointer(s)      (TY_flags(s) &= ~TY_F90_POINTER)
00758 #define       TY_is_f90_target(s)       (TY_flags(s) & TY_F90_TARGET)
00759 #define   Set_TY_is_f90_target(s)       (TY_flags(s) |= TY_F90_TARGET)
00760 #define Reset_TY_is_f90_target(s)       (TY_flags(s) &= ~TY_F90_TARGET)
00761 #define       TY_not_in_union(s)        (TY_flags(s) & TY_NOT_IN_UNION)
00762 #define   Set_TY_not_in_union(s)        (TY_flags(s) |= TY_NOT_IN_UNION)
00763 #define Reset_TY_not_in_union(s)        (TY_flags(s) &= ~TY_NOT_IN_UNION)
00764 
00765 #define TY_enum_const_list(s) (KIND_IS_SCALAR(s)->spec_type_info.ec_list)
00766 #define TY_flist(s)     (KIND_IS_STRUCT(s)->spec_type_info.flist)
00767 #define TY_fld(s)       (KIND_IS_STRUCT(s)->spec_type_info.flist)
00768 #define TY_mlist(s)     (KIND_IS_CLASS(s)->spec_type_info.mlist)
00769 #define TY_clist(s)     (KIND_IS_STRUCT_CLASS(s)->spec_type_info.clist)
00770 #define TY_arinfo(s)    (KIND_IS_ARRAY(s)->spec_type_info.arinfo)
00771 #define TY_pointed(s)   (KIND_IS_POINTER(s)->spec_type_info.pointed)
00772 #define TY_ftinfo(s)    (KIND_IS_FUNCTION(s)->spec_type_info.ftinfo)
00773 #define TY_parms(s)     (FTI_parms(TY_ftinfo(s)))
00774 #define TY_ret_type(s)  (FTI_ret_type(TY_ftinfo(s)))
00775 #define TY_arg_area_size(s)     (FTI_arg_area_size(TY_ftinfo(s)))
00776 
00777 #define TY_AR_etype(s)          (ARI_etype(TY_arinfo(s)))
00778 #define TY_etype(t)             TY_AR_etype(t)
00779 #define TY_AR_ndims(s)          (ARI_ndims(TY_arinfo(s)))
00780 #define TY_AR_const_zofst(s)    (ARI_const_zofst(TY_arinfo(s)))
00781 #define TY_AR_zofst_val(s)      (ARI_zofst_val(TY_arinfo(s)))
00782 #define TY_AR_zofst_tree(s)     (ARI_zofst_tree(TY_arinfo(s)))
00783 #define TY_AR_bnds(s,i)         (ARI_bnd(TY_arinfo(s),IS_VALID_DIM((s),(i))))
00784 #define TY_AR_const_stride(s,i) (ARB_const_stride(TY_AR_bnds(s,i)))
00785 #define TY_AR_stride_val(s,i)   (ARB_stride_val(TY_AR_bnds(s,i)))
00786 #define TY_AR_stride_tree(s,i)  (ARB_stride_tree(TY_AR_bnds(s,i)))
00787 #define TY_AR_const_lbnd(s,i)   (ARB_const_lbnd(TY_AR_bnds(s,i)))
00788 #define TY_AR_lbnd_val(s,i)     (ARB_lbnd_val(TY_AR_bnds(s,i)))
00789 #define TY_AR_lbnd_tree(s,i)    (ARB_lbnd_tree(TY_AR_bnds(s,i)))
00790 #define TY_AR_const_ubnd(s,i)   (ARB_const_ubnd(TY_AR_bnds(s,i)))
00791 #define TY_AR_ubnd_val(s,i)     (ARB_ubnd_val(TY_AR_bnds(s,i)))
00792 #define TY_AR_ubnd_tree(s,i)    (ARB_ubnd_tree(TY_AR_bnds(s,i)))
00793 /* for compatibility: */
00794 #define TY_AR_const_fbnd(s,i)   TY_AR_const_lbnd(s,i)
00795 #define TY_AR_fbnd_val(s,i)     TY_AR_lbnd_val(s,i)
00796 #define TY_AR_fbnd_tree(s,i)    TY_AR_lbnd_tree(s,i)
00797 #define TY_AR_const_tbnd(s,i)   TY_AR_const_ubnd(s,i)
00798 #define TY_AR_tbnd_val(s,i)     TY_AR_ubnd_val(s,i)
00799 #define TY_AR_tbnd_tree(s,i)    TY_AR_ubnd_tree(s,i)
00800 
00801 #define TY_pointer(s)   (CAN_USE_TY(s)->pointer)
00802 
00803 /* For Delta C++, a class size may be dynamic, i.e. unknown at compile
00804  * time.  
00805  */
00806 #define  TY_DYNAMIC_SIZE        -1
00807 #define  TY_DYNAMIC_ALIGN       0
00808 
00809 /* ====================================================================
00810  *
00811  * ST: Symbol table element
00812  *
00813  * There is one ST record for each declared "variable", plus one for
00814  * each formal parm.  "Variable" in this context means a chunk of
00815  * contiguous bytes the compiler allocates, either statically or on
00816  * the stack.  Usually this is just the ordinary (top-level)
00817  * variables. For Fortran however, each common block and each
00818  * equivalence class is a single "variable".
00819  *
00820  * The ST records carry info about the nature of the variable and its
00821  * base address, and point to a TY tree to give the type.
00822  *
00823  * ====================================================================
00824  */
00825 
00826 /* --------------------------------------------------------------------
00827  * Symbol class:
00828  *
00829  * The following enumerate the various classes of symbol which are
00830  * represented by symbol table entries.
00831  * --------------------------------------------------------------------
00832  */
00833 
00834 typedef enum {
00835   CLASS_BAD,    /* 0x00: A mistake */
00836   CLASS_NEW,    /* 0x01: A new name, not yet resolved */
00837   CLASS_UNK,    /* 0x02: Unknown class, e.g. Fortran symbol declared
00838                  * EXTERNAL but never used in context identifying its
00839                  * class. */
00840   CLASS_VAR,    /* 0x03: A variable, i.e. data */
00841   CLASS_FUNC,   /* 0x04: A function, i.e. address of a function */
00842   CLASS_CONST,  /* 0x05: A constant value, possibly in memory */
00843   CLASS_LABEL,  /* 0x06: A label, i.e. address within a function */
00844   CLASS_SYM_CONST, /* 0x07: A symbolic constant, i.e. linker resolved */
00845   CLASS_PREG,   /* 0x08: A pseudo-register */
00846   CLASS_BLOCK,  /* 0x09: A base to a block of data */
00847   CLASS_COUNT   /* For checking purposes */
00848 } ST_CLASS;
00849 
00850 /* The following must satisfy CLASS_MASK+1 >= CLASS_COUNT: */
00851 #define CLASS_MASK      0x0f
00852 
00853 /* --------------------------------------------------------------------
00854  * Symbol Export Class:
00855  *
00856  * The following enumerate the various possible scopes relevant to
00857  * symbols exported from a file (i.e. linker globals).  Except for the
00858  * first two, they are only relevant to DSO-related compilation.
00859  * --------------------------------------------------------------------
00860  */
00861 
00862 typedef enum {
00863   EXPORT_LOCAL,         /* Not exported, e.g. C static */
00864   EXPORT_INTERNAL,      /* Exported, only visible and used within the
00865                          * containing DSO/executable, i.e. not even
00866                          * passed outside using a pointer. */
00867   EXPORT_HIDDEN,        /* Exported, but name is hidden within the
00868                          * containing DSO/executable.  However, the
00869                          * address may be exported from the DSO via a
00870                          * pointer. */
00871   EXPORT_PROTECTED,     /* Exported from DSO, but non-preemptible. */
00872   EXPORT_PREEMPTIBLE,   /* Exported and preemptible. */
00873   EXPORT_OPTIONAL,      /* STO_OPTIONAL case in "sys/elf.h" */
00874   EXPORT_COUNT          /* Must be last for consistency checking */
00875 } ST_EXPORT;
00876 
00877 /* NOTE: Only an EXPORT_LOCAL symbol must be defined in the current
00878  * file.  All but EXPORT_PREEMPTIBLE must be defined in the current
00879  * DSO/executable.
00880  */
00881 
00882 /* The following must satisfy EXPORT_MASK+1 >= EXPORT_COUNT: */
00883 #define EXPORT_MASK     0x07
00884 
00885 /* optional symbols are also preemptible */
00886 #define ST_is_preemptible(s)    \
00887   (ST_export(s) == EXPORT_PREEMPTIBLE || ST_export(s) == EXPORT_OPTIONAL)
00888 
00889 /* --------------------------------------------------------------------
00890  * Storage Class:
00891  *
00892  * The following enumerate the various possible storage classes in
00893  * which front ends may place objects.  The front end should be able
00894  * to choose one of these classes based strictly on source semantics,
00895  * and memmodel.c's Allocate_Object should be able to allocate the
00896  * object to a target segment based on that choice and current target
00897  * and compilation options.  (WARNING: We are not there yet.)
00898  *
00899  * Some of the less obvious classes mean the following:
00900  *
00901  *  SCLASS_EXTERN:
00902  *      Any C or Fortran symbol declared external.  Note that the
00903  *      export classes above may refine how external it is.  Such
00904  *      symbols MUST be defined by another module (unless they're
00905  *      weak, in which case they could remain undefined).  Therefore,
00906  *      size is irrelevant for them.
00907  *
00908  *  SCLASS_FSTATIC:             C static data
00909  *  SCLASS_UGLOBAL:
00910  *  SCLASS_DGLOBAL:
00911  *      C static (i.e. non-stack), non-extern data falls in one of
00912  *      these classes.  If it is declared "static," either at file
00913  *      scope or within a function, it is SCLASS_FSTATIC, and its
00914  *      export class is EXPORT_LOCAL.  Initialization is irrelevant.
00915  *      If it is exported (not declared "static") but is definitely to
00916  *      be allocated in this module, it is SCLASS_DGLOBAL.  This will
00917  *      occur if an initial value is provided, or without an initial
00918  *      value if it is not declared "extern" and the strict ref-def
00919  *      linkage model is being used.  (See the ANSI C Rationale,
00920  *      3.1.2.2.)  If it is not extern and not initialized, and the
00921  *      relaxed ref-def model is being used (-common), it is
00922  *      SCLASS_UGLOBAL.
00923  *
00924  *      Note that for all of these, the object size is required for
00925  *      allocation -- it is obtained from the type.  If the type's
00926  *      size is TY_DYNAMIC_SIZE, however, it is a Delta C++ object of
00927  *      unknown size and special treatment will be required.
00928  *
00929  *  SCLASS_FSTATIC:             FORTRAN static data
00930  *  SCLASS_COMMON:
00931  *      FORTRAN static data has either PU scope (SCLASS_FSTATIC) or is
00932  *      in a common block (SCLASS_COMMON).  Note that any external
00933  *      symbols (SCLASS_EXTERN) in FORTRAN will be subprograms.
00934  *
00935  *  SCLASS_THREAD:              Multiprocessing support
00936  *      Multiprocessing sometimes requires that each thread have its
00937  *      own copy of a data block.  Such data is SCLASS_THREAD.  It is
00938  *      allocated in the current module and not exported.
00939  *
00940  *  SCLASS_BASED:               Aggregating symbol
00941  *      A symbol that associates a group of symbols, to provide data
00942  *      layout mechanism in Mongoose.  Hence, the ST_base of the
00943  *      ST* cannot be a program variable.
00944  *
00945  *  SCLASS_FORMAL_REF:          Fortran formal reference parameter
00946  *      In Fortran parameters are usually passed by reference.
00947  *      Marking an ST as having storage class SCLASS_FORMAL_REF
00948  *      permits the compiler to avoid explicitly generating a dereference
00949  *      operator while accessing this data except during the final
00950  *      lowering phase.  This is currently supported for scalars and
00951  *      pointers.
00952  *
00953  * WARNING: These values share a field with ST_AFORM, so they must not
00954  * have overlapping values with the address form.
00955  * --------------------------------------------------------------------
00956  */
00957 
00958 /* Define storage classes: */
00959 typedef enum {
00960   SCLASS_UNKNOWN,       /* Unknown, not yet defined */
00961   SCLASS_AUTO,          /* Local stack user variable */
00962   SCLASS_TEMP_OBSOLETE, /* Obsolete */
00963   SCLASS_ACTUAL,        /* Obsolete */
00964   SCLASS_FORMAL,        /* Formal parameter */
00965   SCLASS_PSTATIC,       /* Statically-allocated data with PU scope */
00966   SCLASS_FSTATIC,       /* Statically-allocated data with file scope,
00967                          * i.e. Fortran SAVE, C static */
00968   SCLASS_THREAD,        /* Fortran per-thread local data block */
00969   SCLASS_COMMON,        /* Fortran common block */
00970   SCLASS_EXTERN,        /* Unallocated C external data or text */
00971   SCLASS_UGLOBAL,       /* Uninitialized C global data: provisionally
00972                          * allocated but allocation may be preempted
00973                          * by another module -- equivalent to Fortran
00974                          * uninitialized COMMON */
00975   SCLASS_DGLOBAL,       /* Defined (initialized) C global data:
00976                          * allocated in this module */
00977   SCLASS_TEXT,          /* Executable code */
00978   SCLASS_BASED,         /* Data pointed to by another datum */
00979   SCLASS_REG,           /* Register variable (PREG) */
00980   SCLASS_FORMAL_REF,    /* Fortran formal reference parameter */
00981   SCLASS_LAST           /* Marker -- must be last */
00982 } ST_SCLASS;
00983 
00984 #define SCLASS_MASK     0x0f
00985 #define SCLASS_LOCAL    SCLASS_AUTO     /* Obsolete */
00986 #define SCLASS_SAVED    SCLASS_FSTATIC  /* Obsolete */
00987 #define SCLASS_STATIC   SCLASS_UGLOBAL  /* Obsolete */
00988 #define SCLASS_DEFINED  SCLASS_DGLOBAL  /* Obsolete */
00989 #define SCLASS_TEMP     SCLASS_AUTO     /* Obsolete */
00990 
00991 /* --------------------------------------------------------------------
00992  *
00993  * Addressing formats:
00994  *
00995  * The following enumerate the options for treating the addressing of
00996  * symbols.
00997  *
00998  * AFORM_MEM:  This is the normal memory addressing case.  It indicates
00999  * an object allocated to memory, where the memory address is the sum
01000  * of a base and an offset.  The base is represented as a pointer to
01001  * another ST, where the value of the base for this purpose is the
01002  * value of the object described, NOT ITS ADDRESS.  In general terms,
01003  * the address of an object is obtained at runtime by loading its base,
01004  * and adding the offset.  Note that there are special symbols created
01005  * as base symbols for static sections, which are considered to have
01006  * values equal to their addresses -- these are indicated by the flag
01007  * ST_is_base_sym.
01008  *
01009  * AFORM_REG:  This is a formal parameter passed in a register.
01010  *
01011  * AFORM_RADICAL:  This is an object allocated to a register, either a
01012  * user variable or a compiler temporary.  It has an associated "home"
01013  * TN given by its STV_copy_TN.  The model used for assignments to such
01014  * objects (called radicals) is that the assigned value is copied to
01015  * the home TN.
01016  *
01017  * WARNING: These values share a field with ST_SCLASS, so they must not
01018  * have overlapping values with the storage class.
01019  *
01020  * --------------------------------------------------------------------
01021  */
01022 
01023 typedef enum {
01024   AFORM_MEM     = 0x00, /* Memory: ST_base+ST_ofst */
01025   AFORM_UNUSED  = 0x02, /* */
01026   AFORM_REG     = 0x04, /* Formal in reg: dedicated reg ST_reg_tnnum */
01027   AFORM_RADICAL = 0x06, /* Radical: STV_copy_TN contains value */
01028   AFORM_MASK    = 0x06  /* Must mask all values in field */
01029 } ST_AFORM;
01030 
01031 /* Fortran multiple entrypoints require copying formals on entry from
01032  * the location where they are passed to their "home" locations, which
01033  * are consistent for all entries.  In this case, a clone of the formal
01034  * (or of its base address symbol for a reference parameter) is made to
01035  * represent what is passed, and the formal symbol itself represents
01036  * the homed value.  The copied formal may have either address format
01037  * appropriate for formals (i.e. AFORM_MEM or AFORM_REG).  Its
01038  * STV_cform field points to the formal copied (or the base for
01039  * reference parameters), and its STV_copy_TN field points to a TN
01040  * used for copying it on entry.  Note that the copied formal ST should
01041  * never be referenced except in the entry code.
01042  */
01043 #define STFL_CFORM      0x10
01044 
01045 /* --------------------------------------------------------------------
01046  * SBLK:
01047  *
01048  * This structure exists for CLASS_BLOCK ST's.  It contains extra information
01049  * used for the data layout.
01050  * --------------------------------------------------------------------
01051  */
01052 
01053 struct sblk {
01054         mINT64 size;            /* size of the block */
01055         mUINT16 align;          /* alignment of the block: 1,2,4,8 */
01056         mINT16 temp;            /* temp field */
01057         mUINT8 gp_group;        /* gp_group of block */
01058         mUINT64 section_idx;    /* idx to section table */
01059 };
01060 struct stch {
01061   ST                    *item;
01062   struct stch           *next;
01063 };
01064 #define STCH_item(s)    ((CAN_USE_STCH(s))->item)
01065 #define STCH_next(s)    ((CAN_USE_STCH(s))->next)
01066 
01067 /* --------------------------------------------------------------------
01068  * Symbol table element:
01069  * --------------------------------------------------------------------
01070  */
01071 
01072 /* Define a symbol table element: */
01073 struct st {
01074   mINT64        ofst;           /* Offset from base (bytes) */
01075   union {
01076     struct tcon *tcon;          /* CLASS_CONST: value */
01077     char        *name;          /* Other: Name */
01078   } id;
01079   ST_CLASS      symclass :8;    /* Class of symbol */
01080   ST_SCLASS     sclass :8;      /* Storage class */
01081   mUINT8        level;          /* Display level (global = 0; max 7 bits) */
01082   mUINT8        scope_id;       /* Scope in which declared (non-{SYM_}CONST) */
01083   union {
01084     mINT32      hashval;        /* CLASS_CONST, SYM_CONST */
01085     mUINT32     index;          /* non-{SYM_}CONST (only 24 bits used) */
01086   } uindex;
01087   mUINT32       symtab_id;      /* Symtab in which declared */
01088   mUINT32       flags;          /* Miscellaneous attributes */
01089   TY            *type;          /* Declared type of symbol */
01090   ST            *base;          /* Base of address, e.g. .DATA, $sp */
01091   void*         temp;           /* dummy field for use within a phase */
01092   union {
01093     ST          *common;        /* ST for full common */
01094     ST          *strong;        /* ST for strong alias */
01095     ST          *formalBase;    /* ST for SCLASS_FORMAL_REF base */
01096     mPREG_NUM   preg;           /* Preg no for formal */
01097   } full;
01098   union {               /* per class: */
01099     struct {                /* CLASS_VAR: */
01100       mUINT32   flags2;         /* extra flag space */
01101       void      *address_taken_field_bv;        /* structures: address of a field taken (bitvector) */
01102                 /* the above void* to be replaced by BV* when the
01103                    implementation is done */
01104     } vs;
01105     struct {                /* CLASS_FUNC: */
01106       mUINT32   flags2;         /* extra flag space */
01107       mUINT16   int_reg_used;   /* bit mask for mips_registers_used pragma */
01108       mUINT16   float_reg_used; /* bit mask for mips_registers_used pragma */
01109     } fs;
01110     struct {                /* CLASS_LABEL: */
01111       mUINT32   label_number;   /* whirl number of LABEL */
01112       void*     ltemp;          /* temp field */
01113     } ls;
01114     mINT32      ct_idx;     /* CLASS_CONST: const table index */
01115     struct {                /* CLASS_SYM_CONST: */
01116       INTSC     disp;           /* Displacement */
01117       union {                   /* Form depends on ST_sym_simple */
01118         ST*     refsym;         /* Simple: Referenced symbol */
01119         struct symexpr *expr;   /* General: Value tree */
01120       } scu;
01121     } scs;
01122     SBLK        *block_info;  /* CLASS_BLOCK: extra info */
01123   } uc;                 /* end per-class union */
01124   ST            *next;
01125 };
01126 
01127 /* --------------------------------------------------------------------
01128  * Symbol table base field access:
01129  * --------------------------------------------------------------------
01130  */
01131 
01132 /* Define the access functions for the base fields: */
01133 #define ST_name(s)      (CAN_USE_ST(s)->id.name)
01134 #define Set_ST_name(s,n)        (ST_name(s) = n)
01135 #define STC_tcon(s)     (CAN_USE_ST(s)->id.tcon)
01136 #define ST_tcon(s)      (STC_tcon(s)) /* for compatibility */
01137 #define STC_val(s)      (*STC_tcon(s))
01138 
01139 #define ST_class(s)     (CAN_USE_ST(s)->symclass)    /* for compatibility */
01140 #define ST_symclass(s)  (CAN_USE_ST(s)->symclass)
01141 #define ST_sclass(s)    (CAN_USE_ST(s)->sclass)
01142 #define Set_ST_sclass(s,c)      (ST_sclass(s) = c)
01143 #define Set_ST_classes(s,c,sc)  (ST_class(s) = c, ST_sclass(s) = sc)
01144 #define ST_flags(s)     (CAN_USE_ST(s)->flags)
01145 #define ST_scope_id(s)  (CAN_USE_ST(s)->scope_id)
01146 #define ST_level(s)     (CAN_USE_ST(s)->level)
01147 #define ST_index(s)     (CAN_USE_ST(s)->uindex.index)
01148 #define ST_hashval(s)   (CLASS_IS_CONST_SYM(s)->uindex.hashval)
01149 #define ST_symtab_id(s) (CAN_USE_ST(s)->symtab_id)
01150 #define ST_type(s)      (CAN_USE_ST(s)->type)
01151 #define Set_ST_type(s,t)        (ST_type(s) = t)
01152 #define ST_btype(s)     (TY_btype(ST_type(s)))
01153 #define ST_base(s)      (CAN_USE_ST(s)->base)
01154 /* by default, ST_base points to self, will point to block if allocated */
01155 #define Has_Base_Block(st)      (ST_base(st) != st)
01156 #define Set_ST_base(s,b)        (ST_base(s) = b)
01157 #define ST_ofst(s)      (CAN_USE_ST(s)->ofst)
01158 #define Set_ST_ofst(s,o)        (ST_ofst(s) = o)
01159 #define ST_size(s)      (TY_size(ST_type(s)))
01160 #define ST_full(s)      (CAN_USE_ST(s)->full.common)
01161 #define ST_strong(s)    (CAN_USE_ST(s)->full.strong)    /* ST_strong is alias to ST_full */
01162 #define ST_formal_ref_base(s)   (CAN_USE_ST(s)->full.formalBase) /* Formal Ref points to base */
01163 #define ST_formal_preg_no(s)    ((s)->full.preg) /* Formal may contain preg number */
01164 #define ST_temp(s)      (CAN_USE_ST(s)->temp)
01165 #define Set_ST_temp(s,v)        (ST_temp(s) = (void*)v)
01166 /* ST_flags2 is for when it can be either VAR or FUNC */
01167 #define ST_flags2(s)    (CLASS_IS_VAR_FUNC(s)->uc.vs.flags2)
01168 #define STV_flags2(s)   (CLASS_IS_VAR(s)->uc.vs.flags2)
01169 #define STV_address_taken_field_bv(s)   (CLASS_IS_VAR(s)->uc.vs.address_taken_field_bv)
01170 #define STF_flags2(s)   (CLASS_IS_FUNC(s)->uc.fs.flags2)
01171 #define STF_int_reg_used(s)     (CLASS_IS_FUNC(s)->uc.fs.int_reg_used)
01172 #define STF_float_reg_used(s)   (CLASS_IS_FUNC(s)->uc.fs.float_reg_used)
01173 #define STL_label_number(s)     (CLASS_IS_LABEL(s)->uc.ls.label_number)
01174 #define STL_ltemp(s)    (CLASS_IS_LABEL(s)->uc.ls.ltemp)
01175 #define Set_STL_ltemp(s,v)      (STL_ltemp(s) = (void*)v)
01176 #define STC_ct_idx(s)   (CLASS_IS_CONST(s)->uc.ct_idx)
01177 #define STSC_refsym(s)  (CLASS_IS_SYM_CONST(s)->uc.scs.scu.refsym)
01178 #define STSC_expr(s)    (CLASS_IS_SYM_CONST(s)->uc.scs.scu.expr)
01179 #define STSC_disp(s)    (CLASS_IS_SYM_CONST(s)->uc.scs.disp)
01180 #define STB_block_info(s)       (CLASS_IS_BLOCK(s)->uc.block_info)
01181 #define STB_size(s)     (STB_block_info(s)->size)
01182 #define Set_STB_size(s,v)       (STB_block_info(s)->size = v)
01183 #define STB_align(s)    (STB_block_info(s)->align)
01184 #define Set_STB_align(s,v)      (STB_block_info(s)->align = v)
01185 #define STB_temp(s)     (STB_block_info(s)->temp)
01186 #define STB_gp_group(s) (STB_block_info(s)->gp_group)
01187 #define STB_section_idx(s)      (STB_block_info(s)->section_idx)
01188 #define Set_STB_section_idx(s,v)        (STB_block_info(s)->section_idx = v)
01189 #define ST_next(s)      (CAN_USE_ST(s)->next)
01190 
01191 /* Return a unique identifier for an ST.  The most significant bit of
01192  * the result must always be zero (negative values are reserved for
01193  * constant symbols).  The next 7 bits specify the nesting level of the
01194  * SYMTAB where the ST is defined.  This assumes that STs are never
01195  * referenced outside the scopes where they are visible, and it requires
01196  * the current SYMTAB to identify the ST.  The final 24 bits are the
01197  * ST_index field. */
01198 
01199 #define ST_id(s) \
01200         ((ST_index(s) & 0xffffff) | ((ST_level(s) & 0x7f) << 24))
01201 
01202 /* is full-split COMMON symbol */
01203 #define Is_Full_Split_Common(st) \
01204         (ST_sclass(st) == SCLASS_COMMON && ST_full(st) != NULL)
01205 #define ST_is_split_common(st)  Is_Full_Split_Common(st)
01206 
01207 #define Is_Formal_Preg(st) \
01208         (ST_sclass(st) == SCLASS_FORMAL && ST_formal_preg_no(st) != 0)
01209 
01210 /* --------------------------------------------------------------------
01211  * Symbol table flag/subfield access -- ST_flags masks:
01212  * --------------------------------------------------------------------
01213  */
01214 
01215 /* Low-order is EXPORT_MASK, defined above as 0x07. */
01216 #define STFL_WEAK_SYMBOL        0x00000008 /* Weak external name */
01217 #define STFL_WEAK_ALIAS         0x00000010 /* Weak external is aliased
01218                                             * to its ST_base */
01219 #define STFL_REFERENCED         0x00000020 
01220             /* Symbol is referenced.  Any setting of this flag only
01221              * applies locally to a particular algorithm in a 
01222              * particular compiler-phase, and should not be relied 
01223              * upon across such algorithms/phases. */
01224 #define STFL_NOT_USED           0x00000040 /* Symbol is not referenced; 
01225                                         this flag is preserved across phases. */
01226 
01227 #define STFL_GLOBAL             0x00000080 /* Symbol in global symtab */
01228 #define STFL_INITIALIZED        0x00000100 /* Symbol is initialized     */
01229 
01230 #define STFL_ADDR_TAKEN_SAVED   0x00000200 /* Addr taken and saved */
01231 #define STFL_ADDR_USED_LOCALLY  0x00000400 /* Addr taken but not saved */
01232         /* CLASS_VAR or CLASS_FUNC: address of object is taken */
01233 #define STFL_STATIC_MBR         0x00000800      
01234         /* CLASS_VAR or CLASS_FUNC: static class member */
01235 
01236 #define STFL_IS_CONST_VAR       0x00001000 /* CLASS_VAR, CBLK: const */
01237 #define STFL_USE_REG_ALIGN      0x00002000 /* use register alignment */
01238                                    /* for temps that don't want ty alignment */
01239 #define STFL_IS_PADDED          0x00004000
01240         /* CLASS_VAR or CLASS_CONST: Object padded at end */
01241 #define STFL_IS_RETURN_VAR      0x00008000 /* CLASS_VAR: Return value */
01242 #define STFL_IS_VALUE_PARM      0x00010000 /* CLASS_VAR: Value parm */
01243 #define STFL_PROMOTE_PARM       0x00020000 /* CLASS_VAR: Promote C formal */
01244 #define STFL_IS_NOT_ALIASED     0x00040000 /* CLASS_VAR: not aliased */
01245         /* This flag implies that the marked object is not aliased to
01246          * any other object accessible in the current scope, and if it
01247          * is a pointer (including C arrays) the same applies to the
01248          * pointee.  It should be set by default for FORTRAN formals.
01249          */
01250 #define STFL_GPREL              0x00080000 /* CLASS_VAR/BLOCK: data is GP-relative */
01251 #define STFL_FORMAL_REF         0x00100000 /* CLASS_VAR: Reference to formal */
01252 #define STFL_TEMP_VAR           0x00200000 /* CLASS_VAR: compiler temp */
01253         /* This flag means the value of the object is its address */
01254 #define STFL_USE_CPLINIT        0x00400000 /* CLASS_VAR: alloc in cplinit */
01255 #define STFL_IS_RESTRICT        0x00800000 /* CLASS_VAR, CBLK: */
01256                                            /* restrict */
01257 /* The following flag means that every reference to memory pointed to
01258  * by the symbol in question must use the symbol in question as a
01259  * pointer. In particular, if this flag is set on the ST for x, it is
01260  * not allowed to write:
01261  *   y = x;
01262  *   *y     <---- illegal access to memory pointed to by x, because
01263  *                the access does not dereference x.
01264  */
01265 #define STFL_PT_TO_UNIQUE_MEM   0x01000000 /* CLASS_VAR: every */
01266                                            /* reference to memory */
01267                                            /* pointed to by this */
01268                                            /* symbol must be a */
01269                                            /* dereference of this */
01270                                            /* symbol */
01271 #define STFL_ADDR_TAKEN_PASSED  0x02000000
01272 #define STFL_KEEP_NAME_W2F      0x04000000 /* CLASS_VAR: don't mangle name */
01273 #define STFL_IS_DATAPOOL        0x08000000 /* CLASS_VAR: represents datapool */
01274 #define STFL_USE_EH_REGION      0x10000000 /* CLASS_VAR: allocate in eh_region */
01275 #define STFL_USE_EH_REGION_SUPP 0x20000000 /* CLASS_VAR: allocate in eh_region_supp */
01276 #define STFL_USE_DISTR_ARRAY    0x40000000 /* CLASS_VAR: alloc in distr_array */
01277 #define STFL_MAY_NOT_BE_ADDR_TAKEN      0x80000000 /* CLASS_VAR: may be possible to remove addr_taken bits after inlining */
01278 
01279         /* CLASS_VAR or CLASS_FUNC: address of object is taken and passed */
01280 
01281 /* Flags for CLASS_CONST objects: */
01282 #define STFL_ADD_NULL           0x00008000 /* F77 add null to this char literal */
01283 
01284 /* Flags for CLASS_SYM_CONST objects: */
01285 #define STFL_SYM_SIMPLE         0x00008000 /* Simple address form */
01286 #define STFL_SYM_UNIQUE         0x00010000 /* Unique -- no reuse */
01287 
01288 /* Flags for CLASS_BLOCK objects: */
01289 #define STFL_DECREMENT          0x00000200 /* grow block by decrementing */
01290 #define STFL_WRITE              0x00000400 /* (ELF) writable section */
01291 #define STFL_EXEC               0x00000800 /* (ELF) executable instructions */
01292 #define STFL_NOBITS             0x00001000 /* (ELF) occupies no space in file */
01293 #define STFL_MERGE              0x00002000 /* (ELF) merge duplicates in ld */
01294 #define STFL_ADDR               0x00004000 /* (ELF) addresses only */
01295 #define STFL_NAMES              0x00008000 /* (ELF) section with SHF_MIPS_NAMES
01296                                                 attribute (cplinit section) */
01297 #define STFL_STATIC             0x00010000 /* Segment contains data allocated
01298                                                 statically (not on stack) */
01299 #define STFL_SECTION            0x00020000 /* block symbol for elf section */
01300 #define STFL_ROOT_BASE          0x00040000 /* block symbol should not be merged */
01301 /* STFL_GPREL is also for blocks */
01302 #define STFL_IS_BASEREG         0x00100000 /* block symbol that maps into reg*/
01303 #define STFL_NOSTRIP            0x00200000 /* (ELF) nostrip section */
01304 
01305 /* Flags for CLASS_LABEL objects: */
01306 #define STFL_LABEL_ASSIGNED     0x00000200 /* In ASSIGN statement */
01307 #define STFL_IN_COMPGOTO_LST    0x00000400 /* In computed GOTO list */
01308 #define STFL_LKIND              0x00003000 /* Kind of label: */
01309 #define     LKIND_UNK           0x00000000 /*   Unknown kind */ 
01310 #define     LKIND_FMT           0x00001000 /*   FORTRAN format */ 
01311 #define     LKIND_EXEC          0x00002000 /*   Executable */ 
01312 #define     LKIND_SPEC          0x00003000 /*   Label on spec statement */ 
01313 #define     LKIND_SHIFT         12         /* To shift into place (f90) */ 
01314 #define STFL_BEGIN_EH_RANGE     0x00010000
01315 #define STFL_END_EH_RANGE       0x00020000
01316 #define STFL_BEGIN_HANDLER      0x00040000
01317 #define STFL_END_HANDLER        0x00080000
01318 
01319 /* Flags for CLASS_FUNC objects: */
01320 /*      STFL_ADDR_USED_LOCALLY  0x00000400      above   */
01321 /*      STFL_ADDR_TAKEN_PASSED  0x02000000      above   */
01322 /*      STFL_STATIC_MBR         0x00000800      above   */
01323 #define STFL_PU_IS_LEAF         0x00001000 /* PU: is a leaf PU */
01324         /* is_leaf is never used? */
01325 #define STFL_PU_IS_MAINPU       0x00002000 /* PU: is the MAIN__ PU */
01326 #define STFL_PU_NO_SIDE_EFFECTS 0x00004000 /* PU: has no side effects */
01327         /* no_se is never used? */
01328 #define STFL_PU_IS_PURE         0x00008000 /* PU: is is pure */
01329 #define STFL_PU_RECURSIVE       0x00010000 /* PU: f90/f77 PU is recursive */
01330 #define STFL_PU_IS_INLINE_FUNCTION 0x00020000 /* PU: inline keyword specified */
01331 #define STFL_PU_NEEDS_T9        0x00040000 /* PU: needs T9 */
01332 #define STFL_PU_IS_BLOCKDATA    0x00080000 /* PU: is blockdata */
01333 #define STFL_PU_NO_INLINE       0x00100000 /* PU: noinline pragma specified */
01334 #define STFL_PU_NO_DELETE       0x00200000 /* PU: nodelete pragma specified */
01335 #define STFL_PU_HAS_EXC_SCOPES  0x00400000 /* PU: PU has eh regions, or would
01336                                             * have if exceptions were enabled */
01337 #define STFL_PU_NO_THROWS       0x00800000 /* PU: PU should not throw an
01338                                             * exception.  Set by the frontend
01339                                             * if function has an empty
01340                                             * exception specification, and
01341                                             * possibly propagated by ipa or
01342                                             * inlining */
01343 #define STFL_PU_THROWS          0x01000000 /* PU: PU should be assumed to throw
01344                                             * exceptions.  Set by the frontend
01345                                             * if the function contains a throw
01346                                             * expression, and possibly
01347                                             * propagated by ipa or inlining */
01348 #define STFL_PU_IS_NESTED_FUNC  0x04000000 /* PU: PU is a nested function */
01349 #define STFL_PU_HAS_NON_MANGLED_CALL 0x08000000 /* PU has a call in which *
01350                                                  * no reshaped arrays are *
01351                                                  * passed                 */
01352 #define STFL_PU_IS_CONSTRUCTOR  0x10000000 /* PU: is a constructor */
01353 #define STFL_PU_IS_DESTRUCTOR   0x20000000 /* PU: is a destructor */
01354 #define STFL_PU_ARGS_ALIASED    0x40000000 /* PU: f77 arguments are aliased */
01355 #define STFL_PU_IN_ELF_SECTION  0x80000000 /* This function should go into 
01356                                             * it own text section. */
01357 
01358 /*
01359  *  The following flags must be variable flags that go into flags2.
01360  */
01361 #define STFL_IS_RESHAPED        0x00000001 /* lno may reshape the ST */
01362 #define STFL_EMIT_SYMBOL        0x00000002 /* emit the empty dummy symbol */
01363 #define STFL_HAS_NESTED_REF     0x00000004 /* has ref in nested pu */
01364 #define STFL_INIT_VALUE_ZERO    0x00000008 /* has initial value of zero */
01365 #define STFL_FORCE_GPREL        0x00000010 /* force object to be gp-relative */
01366 #define STFL_FORCE_NOT_GPREL    0x00000020 /* force object to not be gp-relative */
01367 #define STFL_IS_NAMELIST        0x00000040 /* namelist table */
01368 #define STFL_IS_F90_POINTER     0x00000080 /* F90 pointer */
01369 #define STFL_IS_F90_TARGET      0x00000100 /* F90 target */
01370 #define STFL_DECLARED_STATIC    0x00000200 /* VMS formals declared static */
01371 #define STFL_IS_EQUIVALENCED    0x00000400 /* is part of an equivalence */
01372 #define STFL_IS_THIS_POINTER    0x00000800 /* C++ this pointer */
01373 #define STFL_IS_AUTO_OR_CPOINTER  0x00001000 /* F90 Automatic or Cray Pointer */
01374 #define STFL_IS_NON_CONTIGUOUS    0x00002000 /* F90 non-contiguous array */
01375 #define STFL_IS_FILL_ALIGN        0x00004000 /* This symbol came with a
01376                                               * fill/align pragma.
01377                                               */
01378 #define STFL_IS_OPTIONAL_ARGUMENT 0x00008000 /* F90 OPTIONAL arguments */
01379 #define STFL_IS_THREAD_PRIVATE  0x00010000 /* LCOMMON */
01380 
01381 /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
01382  *
01383  * Cannot use bits 0xff000000 as they are reserved for gp_group.
01384  *
01385  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
01386  */
01387 
01388 #define STFL_PU_NEEDS_F90_LOWERING 0x00000001 /* PU: needs F90 Lowering */
01389 #define STFL_PU_HAS_SINGLE_RETURN  0x00000002 /* PU: has a single return */
01390 #define STFL_PU_NO_GP_PROLOG       0x00000004 /* PU: doesn't need GP prolog */
01391 #define STFL_PU_MUST_INLINE        0x00000008 /* PU: must inline */
01392 #define STFL_PU_CALLS_SETJMP       0x00000010 /* PU: has a call to setjmp */
01393 #define STFL_PU_CALLS_LONGJMP      0x00000020 /* PU: has a call to longjmp */
01394 #define STFL_PU_NEEDS_FILL_ALIGN_LOWERING   0x00004000 /* This PU needs
01395                                                         * fill/align lowering
01396                                                         */
01397 
01398 /*
01399  *  The following flags must be function flags that go into flags2.
01400  */
01401 
01402 /* gp_group is 8 bits at msb of flags2, for both vars and funcs */
01403 #define DEFAULT_GP_GROUP 0
01404 #define MAX_GP_GROUP    0xff
01405 #define GPGROUP_MASK    0xff000000
01406 #define GPGROUP_SHIFT   24
01407 
01408 /* Definitions:
01409  *
01410  * A leaf PU does not call any other routines.
01411  *
01412  * A PU has no side effects if it does no I/O, does not modify
01413  * global data, and does not affect global machine state.  Therefore,
01414  * a call to such a PU which does not use its function result may be
01415  * optimized away.  Such a PU may not reference volatile data.  It may,
01416  * however, reference global data, which is what distinguishes it from
01417  * a pure function.
01418  *
01419  * A function is pure if it has no side effects and its result depends
01420  * only on its operand values.  If the operands of such a function are
01421  * loop-invariant, its result will be too, and the call may be moved
01422  * out of the loop.
01423  */
01424 
01425 /* --------------------------------------------------------------------
01426  * Symbol table flag/subfield access -- ST_flags access macros:
01427  * --------------------------------------------------------------------
01428  */
01429 
01430 /* Export class: */
01431 #define     ST_export(s)        (ST_flags(s) & EXPORT_MASK)
01432 #define Set_ST_export(s,c)      (ST_flags(s)=(ST_flags(s)&(~EXPORT_MASK))|(c))
01433 
01434 /* Flags for CLASS_VAR objects: */
01435 #define ST_CVF_flags(s)         ST_flags(CLASS_IS_VAR_FUNC(s))
01436 #define ST_CVC_flags(s)         ST_flags(CLASS_IS_VAR_CONST(s))
01437 #define ST_CVB_flags(s)         ST_flags(CLASS_IS_VAR_BLOCK(s))
01438 #define ST_CV_flags(s)          ST_flags(CLASS_IS_VAR(s))
01439 #define ST_CV_flags2(s)         STV_flags2(CLASS_IS_VAR(s))
01440 #define ST_CVF_flags2(s)        ST_flags2(CLASS_IS_VAR_FUNC(s))
01441 #define ST_SC_flags(s)          ST_flags(CLASS_IS_SYM_CONST(s))
01442 
01443 /* Flags for all symbols: */
01444 #define     ST_is_weak_symbol(s) (ST_flags(s) & STFL_WEAK_SYMBOL)
01445 #define Set_ST_is_weak_symbol(s) (ST_flags(s) |= STFL_WEAK_SYMBOL)
01446 #define     ST_is_weak_alias(s)  (ST_flags(s) & STFL_WEAK_ALIAS)
01447 #define Set_ST_is_weak_alias(s)  (ST_flags(s) |= STFL_WEAK_ALIAS)
01448 #define       ST_is_referenced(s)        (ST_flags(s) & STFL_REFERENCED)
01449 #define   Set_ST_is_referenced(s)        (ST_flags(s) |= STFL_REFERENCED)
01450 #define Reset_ST_is_referenced(s)        (ST_flags(s) &= ~STFL_REFERENCED)
01451 #define       ST_is_not_used(s)  (ST_flags(s) & STFL_NOT_USED)
01452 #define   Set_ST_is_not_used(s)  (ST_flags(s) |= STFL_NOT_USED)
01453 #define Reset_ST_is_not_used(s)  (ST_flags(s) &= ~STFL_NOT_USED)
01454 #define     ST_is_global(s)      (ST_flags(s) & STFL_GLOBAL)
01455 #define Set_ST_is_global(s)      (ST_flags(s) |= STFL_GLOBAL)
01456 #define Reset_ST_is_global(s)    (ST_flags(s) &= ~STFL_GLOBAL)
01457 
01458 #define       ST_is_initialized(s)      (ST_flags(s) &  STFL_INITIALIZED)
01459 #define   Set_ST_is_initialized(s)      (ST_flags(s) |= STFL_INITIALIZED)
01460 #define Reset_ST_is_initialized(s)      (ST_flags(s) &= ~STFL_INITIALIZED)
01461 
01462 /* ST_is_formal_ref   "replaces" ST_seg_formal_ref */
01463 #define       ST_is_formal_ref(s)       (ST_flags(s) &  STFL_FORMAL_REF)
01464 #define   Set_ST_is_formal_ref(s)       (ST_flags(s) |= STFL_FORMAL_REF)
01465 #define Reset_ST_is_formal_ref(s)       (ST_flags(s) &= ~STFL_FORMAL_REF)
01466 
01467 /* ST_is_temp_var       "replaces" ST_seg_temp_var */
01468 #define       ST_is_temp_var(s)         (ST_flags(s) &  STFL_TEMP_VAR)
01469 #define   Set_ST_is_temp_var(s)         (ST_flags(s) |= STFL_TEMP_VAR)
01470 #define Reset_ST_is_temp_var(s)         (ST_flags(s) &= ~STFL_TEMP_VAR)
01471 
01472 #define       ST_addr_taken_saved(s) (ST_CVF_flags(s) & STFL_ADDR_TAKEN_SAVED)
01473 #define   Set_ST_addr_taken_saved(s) (ST_CVF_flags(s) |= STFL_ADDR_TAKEN_SAVED)
01474 #define Reset_ST_addr_taken_saved(s) (ST_CVF_flags(s) &= ~STFL_ADDR_TAKEN_SAVED)
01475 #define       ST_addr_used_locally(s) (ST_CVF_flags(s) & STFL_ADDR_USED_LOCALLY)
01476 #define   Set_ST_addr_used_locally(s) (ST_CVF_flags(s) |= STFL_ADDR_USED_LOCALLY)
01477 #define Reset_ST_addr_used_locally(s) (ST_CVF_flags(s) &= ~STFL_ADDR_USED_LOCALLY)
01478 #define       ST_addr_taken_passed(s) \
01479                                 (ST_CVF_flags(s) & STFL_ADDR_TAKEN_PASSED)
01480 #define   Set_ST_addr_taken_passed(s) \
01481                                 (ST_CVF_flags(s) |= STFL_ADDR_TAKEN_PASSED)
01482 #define Reset_ST_addr_taken_passed(s) \
01483                                 (ST_CVF_flags(s) &= (~STFL_ADDR_TAKEN_PASSED))
01484 #define ST_addr_taken(s) \
01485  (ST_addr_taken_saved(s) || ST_addr_taken_passed(s) || ST_addr_used_locally(s))
01486 
01487 /* CG needs to know if a symbol is visible outside the DSO. This is used to
01488  *  a) check if we need to convert OPR_CALL to OPR_PICCALL.
01489  *  b) check if we need to setup a new GP on entry to a procedure.
01490  *
01491  * "bogus_" added because ST_pu_no_gp_prolog() has nothing to do with
01492  * whether the symbol is visible outside the DSO, and people might
01493  * otherwise assume this macro does what it claims to do. Let's name
01494  * things right, please, rather than assume existing uses will be the
01495  * only ones ever.   -- RK 970929
01496  * change name to back to ST_visible_outside_dso(),
01497  * because no_gp_prolog replaced in new symtab with export-local-internal,
01498  * and thus no longer pu-dependent.     -- mpm
01499  */
01500 #define ST_visible_outside_dso(s) \
01501  ((ST_export(s) > EXPORT_INTERNAL) || \
01502   ((ST_export(s) == EXPORT_LOCAL) && \
01503    (ST_addr_taken_saved(s) || ST_addr_taken_passed(s)) && \
01504    (!ST_pu_no_gp_prolog(s))))
01505 #define bogus_ST_visible_outside_dso(s) ST_visible_outside_dso(s)
01506 
01507 #define       ST_may_not_be_addr_taken(s) \
01508                                 (ST_CVF_flags(s) & STFL_MAY_NOT_BE_ADDR_TAKEN)
01509 #define   Set_ST_may_not_be_addr_taken(s) \
01510                                 (ST_CVF_flags(s) |= STFL_MAY_NOT_BE_ADDR_TAKEN)
01511 #define Reset_ST_may_not_be_addr_taken(s) \
01512                                 (ST_CVF_flags(s) &= (~STFL_MAY_NOT_BE_ADDR_TAKEN))
01513 #define       ST_static_mbr(s)  (ST_CVF_flags(s) & STFL_STATIC_MBR)
01514 #define   Set_ST_static_mbr(s)  (ST_CVF_flags(s) |= STFL_STATIC_MBR)
01515 #define Reset_ST_static_mbr(s)  (ST_CVF_flags(s) &= ~STFL_STATIC_MBR)
01516 
01517 #define     ST_is_const_var(s)  (ST_CV_flags(s) & STFL_IS_CONST_VAR)
01518 #define Set_ST_is_const_var(s)  (ST_CV_flags(s) |= STFL_IS_CONST_VAR)
01519 #define     ST_use_reg_align(s) (ST_CV_flags(s) & STFL_USE_REG_ALIGN)
01520 #define Set_ST_use_reg_align(s) (ST_CV_flags(s) |= STFL_USE_REG_ALIGN)
01521 #define     ST_is_restrict(s)   (ST_CV_flags(s) & STFL_IS_RESTRICT)
01522 #define Set_ST_is_restrict(s)   (ST_CV_flags(s) |= STFL_IS_RESTRICT)
01523 #define     ST_is_padded(s)     (ST_CVC_flags(s) & STFL_IS_PADDED)
01524 #define Set_ST_is_padded(s)     (ST_CVC_flags(s) |= STFL_IS_PADDED)
01525 #define     ST_is_return_var(s) (ST_CV_flags(s) & STFL_IS_RETURN_VAR)
01526 #define Set_ST_is_return_var(s) (ST_CV_flags(s) |= STFL_IS_RETURN_VAR)
01527 #define Reset_ST_is_return_var(s) (ST_CV_flags(s) &= (~STFL_IS_RETURN_VAR))
01528 #define     ST_is_value_parm(s) (ST_CV_flags(s) & STFL_IS_VALUE_PARM)
01529 #define Set_ST_is_value_parm(s) (ST_CV_flags(s) |= STFL_IS_VALUE_PARM)
01530 #define Reset_ST_is_value_parm(s) (ST_CV_flags(s) &= (~STFL_IS_VALUE_PARM))
01531 
01532 #define     ST_promote_parm(s)  (ST_CV_flags(s) & STFL_PROMOTE_PARM)
01533 #define Set_ST_promote_parm(s)  (ST_CV_flags(s) |= STFL_PROMOTE_PARM)
01534 #define Clear_ST_promote_parm(s)  (ST_CV_flags(s) &= (~STFL_PROMOTE_PARM))
01535 
01536 #define     ST_pt_to_unique_mem(s) (ST_CV_flags(s) & STFL_PT_TO_UNIQUE_MEM)
01537 #define Set_ST_pt_to_unique_mem(s) (ST_CV_flags(s) |= STFL_PT_TO_UNIQUE_MEM)
01538 #define     ST_use_cplinit(s) (ST_CV_flags(s) & STFL_USE_CPLINIT)
01539 #define Set_ST_use_cplinit(s) (ST_CV_flags(s) |= STFL_USE_CPLINIT)
01540 #define     ST_use_eh_region(s) (ST_CV_flags(s) & STFL_USE_EH_REGION)
01541 #define Set_ST_use_eh_region(s) (ST_CV_flags(s) |= STFL_USE_EH_REGION)
01542 #define     ST_use_eh_region_supp(s) (ST_CV_flags(s) & STFL_USE_EH_REGION_SUPP)
01543 #define Set_ST_use_eh_region_supp(s) (ST_CV_flags(s) |= STFL_USE_EH_REGION_SUPP)
01544 #define     ST_use_distr_array(s) (ST_CV_flags(s) & STFL_USE_DISTR_ARRAY)
01545 #define Set_ST_use_distr_array(s) (ST_CV_flags(s) |= STFL_USE_DISTR_ARRAY)
01546 #define     ST_is_not_aliased(s) (ST_CV_flags(s) & STFL_IS_NOT_ALIASED)
01547 #define Set_ST_is_not_aliased(s) (ST_CV_flags(s) |= STFL_IS_NOT_ALIASED)
01548 #define       ST_gprel(s)       (ST_CVB_flags(s) & STFL_GPREL)
01549 #define   Set_ST_gprel(s)       (ST_CVB_flags(s) |= STFL_GPREL)
01550 #define Reset_ST_gprel(s)       (ST_CVB_flags(s) &= (~STFL_GPREL))
01551 #define       ST_keep_name_w2f(s)  (ST_CV_flags(s) & STFL_KEEP_NAME_W2F)
01552 #define   Set_ST_keep_name_w2f(s)  (ST_CV_flags(s) |= STFL_KEEP_NAME_W2F)
01553 #define Reset_ST_keep_name_w2f(s)  (ST_CV_flags(s) &= (~STFL_KEEP_NAME_W2F))
01554 #define       ST_is_datapool(s)  (ST_CV_flags(s) & STFL_IS_DATAPOOL)
01555 #define   Set_ST_is_datapool(s)  (ST_CV_flags(s) |= STFL_IS_DATAPOOL)
01556 
01557 /* for compatibility: */
01558 #define STB_gprel(s)            ST_gprel(s)
01559 #define Set_STB_gprel(s)        Set_ST_gprel(s)
01560 
01561 /* Flags for CLASS_CONST objects: */
01562 #define ST_CC_flags(s)          ST_flags(CLASS_IS_CONST(s))
01563 #define     STC_add_null(s)   (ST_CC_flags(s) & STFL_ADD_NULL)
01564 #define Set_STC_add_null(s)   (ST_CC_flags(s) |= STFL_ADD_NULL)
01565 
01566 /* Flags for CLASS_SYM_CONST objects: */
01567 #define       STSC_sym_simple(s) (ST_SC_flags(s) & STFL_SYM_SIMPLE)
01568 #define   Set_STSC_sym_simple(s) (ST_SC_flags(s) |= STFL_SYM_SIMPLE)
01569 #define Reset_STSC_sym_simple(s) (ST_SC_flags(s) &= (~STFL_SYM_SIMPLE))
01570 #define       STSC_sym_unique(s) (ST_SC_flags(s) & STFL_SYM_UNIQUE)
01571 #define   Set_STSC_sym_unique(s) (ST_SC_flags(s) |= STFL_SYM_UNIQUE)
01572 #define Reset_STSC_sym_unique(s) (ST_SC_flags(s) &= (~STFL_SYM_UNIQUE))
01573 
01574 /* Flags for CLASS_BLOCK objects: */
01575 #define ST_BL_flags(s)          ST_flags(CLASS_IS_BLOCK(s))
01576 #define       STB_decrement(s)  (ST_BL_flags(s) & STFL_DECREMENT)
01577 #define   Set_STB_decrement(s)  (ST_BL_flags(s) |= STFL_DECREMENT)
01578 #define Reset_STB_decrement(s)  (ST_BL_flags(s) &= (~STFL_DECREMENT))
01579 #define       STB_exec(s)       (ST_BL_flags(s) & STFL_EXEC)
01580 #define   Set_STB_exec(s)       (ST_BL_flags(s) |= STFL_EXEC)
01581 #define Reset_STB_exec(s)       (ST_BL_flags(s) &= (~STFL_EXEC))
01582 #define       STB_nobits(s)     (ST_BL_flags(s) & STFL_NOBITS)
01583 #define   Set_STB_nobits(s)     (ST_BL_flags(s) |= STFL_NOBITS)
01584 #define Reset_STB_nobits(s)     (ST_BL_flags(s) &= (~STFL_NOBITS))
01585 #define       STB_merge(s)      (ST_BL_flags(s) & STFL_MERGE)
01586 #define   Set_STB_merge(s)      (ST_BL_flags(s) |= STFL_MERGE)
01587 #define Reset_STB_merge(s)      (ST_BL_flags(s) &= (~STFL_MERGE))
01588 #define       STB_section(s)    (ST_BL_flags(s) & STFL_SECTION)
01589 #define   Set_STB_section(s)    (ST_BL_flags(s) |= STFL_SECTION)
01590 #define Reset_STB_section(s)    (ST_BL_flags(s) &= (~STFL_SECTION))
01591 #define       STB_root_base(s)  (ST_BL_flags(s) & STFL_ROOT_BASE)
01592 #define   Set_STB_root_base(s)  (ST_BL_flags(s) |= STFL_ROOT_BASE)
01593 #define Reset_STB_root_base(s)  (ST_BL_flags(s) &= (~STFL_ROOT_BASE))
01594 #define       STB_is_basereg(s) (ST_BL_flags(s) & STFL_IS_BASEREG)
01595 #define   Set_STB_is_basereg(s) (ST_BL_flags(s) |= STFL_IS_BASEREG)
01596 #define Reset_STB_is_basereg(s) (ST_BL_flags(s) &= (~STFL_IS_BASEREG))
01597 
01598 /* Flags for CLASS_LABEL objects: */
01599 #define ST_CL_flags(s)          ST_flags(CLASS_IS_LABEL(s))
01600 #define     STL_is_assigned(s)  (ST_CL_flags(s) & STFL_LABEL_ASSIGNED)
01601 #define Set_STL_is_assigned(s)  (ST_CL_flags(s) |= STFL_LABEL_ASSIGNED)
01602 #define     STL_in_compgoto_lst(s)    (ST_CL_flags(s) & STFL_IN_COMPGOTO_LST)
01603 #define Set_STL_in_compgoto_lst(s)    (ST_CL_flags(s) |= STFL_IN_COMPGOTO_LST)
01604 #define     STL_lkind(s)        (ST_CL_flags(s) & STFL_LKIND) 
01605 #define Set_STL_lkind(s,k)      (ST_flags(s)=(ST_CL_flags(s)&(~STFL_LKIND))|(k))
01606 #define     STL_begin_eh_range(s)     (ST_CL_flags(s) & STFL_BEGIN_EH_RANGE)
01607 #define Set_STL_begin_eh_range(s)     (ST_CL_flags(s) |= STFL_BEGIN_EH_RANGE)
01608 #define Reset_STL_begin_eh_range(s)   (ST_CL_flags(s) &= ~STFL_BEGIN_EH_RANGE)
01609 #define     STL_end_eh_range(s)     (ST_CL_flags(s) & STFL_END_EH_RANGE)
01610 #define Set_STL_end_eh_range(s)     (ST_CL_flags(s) |= STFL_END_EH_RANGE)
01611 #define Reset_STL_end_eh_range(s)   (ST_CL_flags(s) &= ~STFL_END_EH_RANGE)
01612 #define     STL_begin_handler(s)       (ST_CL_flags(s) & STFL_BEGIN_HANDLER)
01613 #define Set_STL_begin_handler(s)       (ST_CL_flags(s) |= STFL_BEGIN_HANDLER)
01614 #define     STL_end_handler(s)       (ST_CL_flags(s) & STFL_END_HANDLER)
01615 #define Set_STL_end_handler(s)       (ST_CL_flags(s) |= STFL_END_HANDLER)
01616 #define     STL_switch_fallthru(s)    (ST_CL_flags(s) & STFL_SWITCH_FALLTHRU)
01617 #define Set_STL_switch_fallthru(s)    (ST_CL_flags(s) |= STFL_SWITCH_FALLTHRU)
01618 
01619 /* Flags for CLASS_FUNC objects: */
01620 #define ST_CF_flags(s)          ST_flags(CLASS_IS_FUNC(s))
01621 #define     ST_pu_is_leaf(s)    (ST_CF_flags(s) & STFL_PU_IS_LEAF)
01622 #define Set_ST_pu_is_leaf(s)    (ST_CF_flags(s) |= STFL_PU_IS_LEAF)
01623 #define Reset_ST_pu_is_leaf(s)  (ST_CF_flags(s) &= (~STFL_PU_IS_LEAF))
01624 #define     ST_is_mainPU(s)     (ST_CF_flags(s) & STFL_PU_IS_MAINPU)
01625 #define Set_ST_is_mainPU(s)     (ST_CF_flags(s) |= STFL_PU_IS_MAINPU)
01626 #define     ST_pu_no_se(s)      (ST_CF_flags(s) & STFL_PU_NO_SIDE_EFFECTS)
01627 #define Set_ST_pu_no_se(s)      (ST_CF_flags(s) |= STFL_PU_NO_SIDE_EFFECTS)
01628 #define     ST_pu_is_pure(s)    (ST_CF_flags(s) & STFL_PU_IS_PURE)
01629 #define Set_ST_pu_is_pure(s)    (ST_CF_flags(s) |= STFL_PU_IS_PURE)
01630 #define     ST_pu_is_inline_function(s) (ST_CF_flags(s) & STFL_PU_IS_INLINE_FUNCTION)
01631 #define Set_ST_pu_is_inline_function(s) (ST_CF_flags(s) |= STFL_PU_IS_INLINE_FUNCTION)
01632 #define     ST_pu_needs_t9(s)   (ST_CF_flags(s) & STFL_PU_NEEDS_T9)
01633 #define Set_ST_pu_needs_t9(s)   (ST_CF_flags(s) |= STFL_PU_NEEDS_T9)
01634 #define     ST_pu_is_blockdata(s) (ST_CF_flags(s) & STFL_PU_IS_BLOCKDATA)
01635 #define Set_ST_pu_is_blockdata(s) (ST_CF_flags(s) |= STFL_PU_IS_BLOCKDATA)
01636 #define     ST_pu_no_inline(s)  (ST_CF_flags(s) & STFL_PU_NO_INLINE)
01637 #define Set_ST_pu_no_inline(s)  (ST_CF_flags(s) |= STFL_PU_NO_INLINE)
01638 #define     ST_pu_no_delete(s)  (ST_CF_flags(s) & STFL_PU_NO_DELETE)
01639 #define Set_ST_pu_no_delete(s)  (ST_CF_flags(s) |= STFL_PU_NO_DELETE)
01640 #define     ST_pu_has_exc_scopes(s) (ST_CF_flags(s) & STFL_PU_HAS_EXC_SCOPES)
01641 #define Set_ST_pu_has_exc_scopes(s) (ST_CF_flags(s) |= STFL_PU_HAS_EXC_SCOPES)
01642 #define     ST_pu_no_throws(s)  (ST_CF_flags(s) & STFL_PU_NO_THROWS)
01643 #define Set_ST_pu_no_throws(s)  (ST_CF_flags(s) |= STFL_PU_NO_THROWS)
01644 #define     ST_pu_throws(s)     (ST_CF_flags(s) & STFL_PU_THROWS)
01645 #define Set_ST_pu_throws(s)     (ST_CF_flags(s) |= STFL_PU_THROWS)
01646 #define     ST_pu_is_nested_func(s)  (ST_CF_flags(s) & STFL_PU_IS_NESTED_FUNC)
01647 #define Set_ST_pu_is_nested_func(s)  (ST_CF_flags(s) |= STFL_PU_IS_NESTED_FUNC)
01648 #define       ST_pu_has_non_mangled_call(s) (ST_CF_flags(s) & STFL_PU_HAS_NON_MANGLED_CALL)
01649 #define   Set_ST_pu_has_non_mangled_call(s) (ST_CF_flags(s) |= STFL_PU_HAS_NON_MANGLED_CALL)
01650 #define     ST_pu_is_constructor(s)     (ST_CF_flags(s) & STFL_PU_IS_CONSTRUCTOR)
01651 #define Set_ST_pu_is_constructor(s)     (ST_CF_flags(s) |= STFL_PU_IS_CONSTRUCTOR)
01652 #define     ST_pu_is_destructor(s)      (ST_CF_flags(s) & STFL_PU_IS_DESTRUCTOR)
01653 #define Set_ST_pu_is_destructor(s)      (ST_CF_flags(s) |= STFL_PU_IS_DESTRUCTOR)
01654 #define     ST_pu_args_aliased(s)       (ST_CF_flags(s) & STFL_PU_ARGS_ALIASED)
01655 #define Set_ST_pu_args_aliased(s)       (ST_CF_flags(s) |= STFL_PU_ARGS_ALIASED)
01656 #define Reset_ST_pu_args_aliased(s)     (ST_CF_flags(s) &= (~STFL_PU_ARGS_ALIASED))
01657 #define     ST_pu_is_recursive(s)       (ST_CF_flags(s) & STFL_PU_RECURSIVE)
01658 #define Set_ST_pu_is_recursive(s)       (ST_CF_flags(s) |= STFL_PU_RECURSIVE)
01659 
01660 #define     ST_pu_in_elf_section(s)     (ST_CF_flags(s) & STFL_PU_IN_ELF_SECTION)
01661 #define Set_ST_pu_in_elf_section(s)     (ST_CF_flags(s) |= STFL_PU_IN_ELF_SECTION)
01662 #define Reset_ST_pu_in_elf_section(s)   (ST_CF_flags(s) &= (~STFL_PU_IN_ELF_SECTION))
01663 
01664 /* flags2 CLASS_VAR flags */
01665 #define     ST_is_reshaped(s)   (ST_CV_flags2(s) & STFL_IS_RESHAPED)
01666 #define Set_ST_is_reshaped(s)   (ST_CV_flags2(s) |= STFL_IS_RESHAPED)
01667 #define     ST_emit_symbol(s)   (ST_CV_flags2(s) & STFL_EMIT_SYMBOL)
01668 #define Set_ST_emit_symbol(s)   (ST_CV_flags2(s) |= STFL_EMIT_SYMBOL)
01669 #define     ST_has_nested_ref(s) (ST_CV_flags2(s) & STFL_HAS_NESTED_REF)
01670 #define Set_ST_has_nested_ref(s) (ST_CV_flags2(s) |= STFL_HAS_NESTED_REF)
01671 #define     ST_init_value_zero(s) (ST_CV_flags2(s) & STFL_INIT_VALUE_ZERO)
01672 #define Set_ST_init_value_zero(s) (ST_CV_flags2(s) |= STFL_INIT_VALUE_ZERO)
01673 #define     ST_force_gprel(s) (ST_CV_flags2(s) & STFL_FORCE_GPREL)
01674 #define Set_ST_force_gprel(s) (ST_CV_flags2(s) |= STFL_FORCE_GPREL)
01675 #define     ST_force_not_gprel(s) (ST_CV_flags2(s) & STFL_FORCE_NOT_GPREL)
01676 #define Set_ST_force_not_gprel(s) (ST_CV_flags2(s) |= STFL_FORCE_NOT_GPREL)
01677 #define     ST_is_namelist(s)   (ST_CV_flags2(s) & STFL_IS_NAMELIST)
01678 #define Set_ST_is_namelist(s)   (ST_CV_flags2(s) |= STFL_IS_NAMELIST)
01679 #define     ST_is_f90_pointer(s)        (ST_CV_flags2(s) & STFL_IS_F90_POINTER)
01680 #define Set_ST_is_f90_pointer(s)        (ST_CV_flags2(s) |= STFL_IS_F90_POINTER)
01681 #define     ST_is_f90_target(s) (ST_CV_flags2(s) & STFL_IS_F90_TARGET)
01682 #define Set_ST_is_f90_target(s) (ST_CV_flags2(s) |= STFL_IS_F90_TARGET)
01683 #define     ST_declared_static(s)       (ST_CV_flags2(s) & STFL_DECLARED_STATIC)
01684 #define Set_ST_declared_static(s)       (ST_CV_flags2(s) |= STFL_DECLARED_STATIC)
01685 #define     ST_is_equivalenced(s)       (ST_CV_flags2(s) & STFL_IS_EQUIVALENCED)
01686 #define Set_ST_is_equivalenced(s)       (ST_CV_flags2(s) |= STFL_IS_EQUIVALENCED)
01687 #define     ST_is_this_pointer(s)       (ST_CV_flags2(s) & STFL_IS_THIS_POINTER)
01688 #define Set_ST_is_this_pointer(s)       (ST_CV_flags2(s) |= STFL_IS_THIS_POINTER)
01689 #define     ST_is_auto_or_cpointer(s)   (ST_CV_flags2(s) & STFL_IS_AUTO_OR_CPOINTER)
01690 #define Set_ST_is_auto_or_cpointer(s)   (ST_CV_flags2(s) |= STFL_IS_AUTO_OR_CPOINTER)
01691 #define Reset_ST_is_auto_or_cpointer(s) (ST_CV_flags2(s) &= (~STFL_IS_AUTO_OR_CPOINTER))
01692 #define     ST_is_non_contiguous(s)     (ST_CV_flags2(s) & STFL_IS_NON_CONTIGUOUS)
01693 #define Set_ST_is_non_contiguous(s)     (ST_CV_flags2(s) |= STFL_IS_NON_CONTIGUOUS)
01694 #define Reset_ST_is_non_contiguous(s)   (ST_CV_flags2(s) &= (~STFL_IS_NON_CONTIGUOUS))
01695 #define     ST_is_optional_argument(s)  (ST_CV_flags2(s) & STFL_IS_OPTIONAL_ARGUMENT)
01696 #define Set_ST_is_optional_argument(s)  (ST_CV_flags2(s) |= STFL_IS_OPTIONAL_ARGUMENT)
01697 #define Reset_ST_is_optional_argument(s)        (ST_CV_flags2(s) &= (~STFL_IS_OPTIONAL_ARGUMENT))
01698 #define     ST_is_thread_private(s)     (ST_CV_flags2(s) & STFL_IS_THREAD_PRIVATE)
01699 #define Set_ST_is_thread_private(s)     (ST_CV_flags2(s) |= STFL_IS_THREAD_PRIVATE)
01700 #define Reset_ST_is_thread_private(s)   (ST_CV_flags2(s) &= (~STFL_IS_THREAD_PRIVATE))
01701 #define     ST_is_fill_align(s) (ST_CV_flags2(s) & STFL_IS_FILL_ALIGN)
01702 #define Set_ST_is_fill_align(s) (ST_CV_flags2(s) |= STFL_IS_FILL_ALIGN)
01703 
01704 
01705 #define     ST_pu_needs_f90_lowering(s) (ST_CVF_flags2(s) & STFL_PU_NEEDS_F90_LOWERING)
01706 #define Set_ST_pu_needs_f90_lowering(s) (ST_CVF_flags2(s) |= STFL_PU_NEEDS_F90_LOWERING)
01707 #define     ST_pu_has_single_return(s)  (ST_CVF_flags2(s) & STFL_PU_HAS_SINGLE_RETURN)
01708 #define Set_ST_pu_has_single_return(s)  (ST_CVF_flags2(s) |= STFL_PU_HAS_SINGLE_RETURN)
01709 #define Reset_ST_pu_has_single_return(s)        (ST_CVF_flags2(s) &= (~STFL_PU_HAS_SINGLE_RETURN))
01710 #define     ST_pu_no_gp_prolog(s)       (ST_CVF_flags2(s) & STFL_PU_NO_GP_PROLOG)
01711 #define Set_ST_pu_no_gp_prolog(s)       (ST_CVF_flags2(s) |= STFL_PU_NO_GP_PROLOG)
01712 #define Reset_ST_pu_no_gp_prolog(s)     (ST_CVF_flags2(s) &= (~STFL_PU_NO_GP_PROLOG))
01713 #define     ST_pu_must_inline(s)        (ST_CVF_flags2(s) & STFL_PU_MUST_INLINE)
01714 #define Set_ST_pu_must_inline(s)        (ST_CVF_flags2(s) |= STFL_PU_MUST_INLINE)
01715 #define Reset_ST_pu_must_inline(s)      (ST_CVF_flags2(s) &= (~STFL_PU_MUST_INLINE))
01716 #define     ST_pu_calls_setjmp(s)       (ST_CVF_flags2(s) & STFL_PU_CALLS_SETJMP)
01717 #define Set_ST_pu_calls_setjmp(s)       (ST_CVF_flags2(s) |= STFL_PU_CALLS_SETJMP)
01718 #define Reset_ST_pu_calls_setjmp(s)     (ST_CVF_flags2(s) &= (~STFL_PU_CALLS_SETJMP))
01719 #define     ST_pu_calls_longjmp(s)      (ST_CVF_flags2(s) & STFL_PU_CALLS_LONGJMP)
01720 #define Set_ST_pu_calls_longjmp(s)      (ST_CVF_flags2(s) |= STFL_PU_CALLS_LONGJMP)
01721 #define Reset_ST_pu_calls_longjmp(s)    (ST_CVF_flags2(s) &= (~STFL_PU_CALLS_LONGJMP))
01722 #define     ST_pu_needs_fill_align_lowering(s)  (ST_CVF_flags2(s) & STFL_PU_NEEDS_FILL_ALIGN_LOWERING)
01723 #define Set_ST_pu_needs_fill_align_lowering(s)  (ST_CVF_flags2(s) |= STFL_PU_NEEDS_FILL_ALIGN_LOWERING)
01724 
01725 #define     ST_gp_group(s)      ((ST_CVF_flags2(s) & GPGROUP_MASK)>>GPGROUP_SHIFT)
01726 #define Set_ST_gp_group(s,v)    (ST_CVF_flags2(s)=((ST_CVF_flags2(s)&(~GPGROUP_MASK))|(v<<GPGROUP_SHIFT)))
01727 
01728 
01729 /* 
01730  * PREG_DEBUG_INFO contains the name and variable ST associated with a preg.
01731  * We store indexes rather than the pointer itself to make read/write
01732  * quicker, at the cost of making debugging/dumps slower. 
01733  */
01734 typedef struct {
01735         INT32 name_index;       /* strtab index */
01736         struct wn *home;        /* home wn associated with this preg */
01737 } PREG_DEBUG_INFO;
01738 
01739 /* ====================================================================
01740  *
01741  * SYMTAB: Symbol Table Descriptor
01742  *
01743  * A program will, in general, have a global and a local symbol table
01744  * visible at any time.  Programs with nested subroutines may have 
01745  * multiple (nested) symbol tables live at once.  The SYMTAB structure 
01746  * contains the essential information about the various symbol tables 
01747  * which have been constructed.
01748  *
01749  * The full set of symbol table descriptors will be kept in a linked
01750  * list starting at Global_Symtab, which must be the unique global
01751  * symbol table.  The Current_Symtab variable points at the SYMTAB
01752  * for the current PU.
01753  *
01754  * SYMTAB_parent() points to the enclosing SYMTAB (usually the Global_Symtab).
01755  * SYMTAB_stack_model() gives the stack model of the PU (see memmodel.h)
01756  * SYMTAB_symbols() is the list of ST symbols.
01757  * SYMTAB_labels() is the list of ST labels.
01758  * SYMTAB_types() is the list of TY types.
01759  * SYMTAB_last_preg() is the number of the last preg in the PU.
01760  * SYMTAB_last_label() is the number of the last label in the PU.
01761  * ====================================================================
01762  */
01763 
01764 struct symtab {
01765   struct symtab *parent;        /* Enclosing symbol table */
01766   mUINT32       id;             /* Unique id */
01767   mUINT8        level;          /* Display level (0=>global; max 7 bits) */
01768   mUINT8        stack_model;    /* Stack model */
01769   mUINT16       flags;          /* Symbol table flags */
01770   ST            *symbols;       /* List of symbols */
01771   ST            *last_symbol;   /* Point to last symbol for fast appending */
01772   ST            *labels;        /* Labels (FE: local only) */
01773   TY            *types;         /* List of types */
01774   TY            *last_type;     /* Point to last type for fast appending */
01775   ST            *slink_sym;     /* Static link symbol */
01776   ST            *gp_sym;        /* Global pointer (.sdata and/or .got) */
01777   ST            *ra_sym;        /* Return address symbol */
01778   mINT64        actual_size;    /* Actual parameter area size */
01779   PREG_DEBUG_INFO *preg_dinfo;  /* array of preg debug_info, indexed by offset */
01780   mUINT32       last_st_id;     /* Last ST index in PU (only 24 bits used) */
01781   mUINT32       last_symtab_id; /* Last SYMTAB_id in file (global only) */
01782   mUINT8        last_scope_id;  /* Last scope id */
01783   mUINT8        gp_group;       /* default gp_group of file (global only) */
01784   mUINT16       last_preg;      /* Number of last pseudo-reg in PU */
01785   union {
01786     /* last_label applies to local symtabs, last_type_id to the global symtab */
01787     mUINT16     last_label;     /* Number of last label in PU (local) */
01788     mUINT16     last_type_id;   /* Number of last type_id in file (global) */
01789   } ulast;
01790   ST            **st_map;       /* Map from indices to STs */
01791   SYMTAB        **symtab_map;   /* Map from IDs (global) or levels (local) */
01792   TY            **ty_map;       /* Map from IDs to TYs (global only) */
01793   struct inito *initdata;       /* initialized data */
01794 };
01795 
01796 /* Access macros: */
01797 #define SYMTAB_parent(s)        ((s)->parent)
01798 #define SYMTAB_id(s)            ((s)->id)
01799 #define SYMTAB_flags(s)         ((s)->flags)
01800 #define SYMTAB_level(s)         ((s)->level)
01801 #define SYMTAB_stack_model(s)   ((s)->stack_model)
01802 #define SYMTAB_last_scope_id(s) ((s)->last_scope_id)
01803 #define SYMTAB_gp_group(s)      ((s)->gp_group)
01804 #define SYMTAB_symbols(s)       ((s)->symbols)
01805 #define SYMTAB_last_symbol(s)   ((s)->last_symbol)
01806 #define SYMTAB_labels(s)        ((s)->labels)
01807 #define SYMTAB_types(s)         ((s)->types)
01808 #define SYMTAB_last_type(s)     ((s)->last_type)
01809 #define SYMTAB_slink_sym(s)     ((s)->slink_sym)
01810 #define SYMTAB_gp_sym(s)        ((s)->gp_sym)
01811 #define SYMTAB_ra_sym(s)        ((s)->ra_sym)
01812 #define SYMTAB_actual_size(s)   ((s)->actual_size)
01813 #define SYMTAB_preg_dinfo(s)    ((s)->preg_dinfo)
01814 /* define that 0 offset has size of preg_dinfo array */
01815 #define SYMTAB_preg_dinfo_size(s)       SYMTAB_preg_dinfo(s)[0].name_index
01816 #define SYMTAB_last_preg(s)     ((s)->last_preg)
01817 #define SYMTAB_last_st_id(s)    ((s)->last_st_id)
01818 #define SYMTAB_last_symtab_id(s) ((s)->last_symtab_id)
01819 #define SYMTAB_last_label(s)    ((s)->ulast.last_label)
01820 #define SYMTAB_last_type_id(s)  ((s)->ulast.last_type_id)
01821 #define SYMTAB_st_map(s)        ((s)->st_map)
01822 #define SYMTAB_symtab_map(s)    ((s)->symtab_map)
01823 #define SYMTAB_level_map(s)     ((s)->symtab_map)
01824 #define SYMTAB_ty_map(s)        ((s)->ty_map)
01825 #define SYMTAB_initdata(s)      ((s)->initdata)
01826 
01827 /* Flags access: */
01828 #define SYMTAB_UPLEVEL  0x0001  /* Other symtab nested in this one */
01829 #define SYMTAB_MP_NEEDS_LNO  0x0002  /* PU needs LNO processing */
01830 #define SYMTAB_ALLOCA   0x0004  /* Symtab has alloca in it */
01831 #define SYMTAB_IPA      0x0008  /* IPA has been run on program, global symtab*/
01832 #define SYMTAB_HASMP    0x0010  /* Symtab has MP region/do within it */
01833 #define SYMTAB_MP       0x0020  /* Symtab is an MP region/do */
01834 #define SYMTAB_HAS_NAMELIST     0x0040  /* PU has namelist */
01835 #define SYMTAB_ADDR_TAKEN 0x0080 /* addr_saved and addr_passed bits should
01836                                     be handled separately, global symtab */
01837 #define SYMTAB_HAS_RGN  0x0100  /* PU has regions (of any type) in it */
01838 #define SYMTAB_HAS_INL  0x0200  /* PU has inlined code in it */
01839 #define SYMTAB_HAS_VERY_HIGH_WHIRL 0x0400 /* PU has very high whirl in it */
01840 #define SYMTAB_HAS_ALTENTRY     0x0800  /* PU has alternate entries */
01841 
01842 /* source language flags: */
01843 #define SYMTAB_SRC_LANG 0xF000  /* Symtab source language mask */
01844 #define SYMTAB_C_LANG   0x1000  /* Symtab source language is C */
01845 #define SYMTAB_CXX_LANG 0x2000  /* Symtab source language is C++ */
01846 #define SYMTAB_F77_LANG 0x4000  /* Symtab source language is F77 */
01847 #define SYMTAB_F90_LANG 0x8000  /* Symtab source language is F90 */
01848 
01849 #define       SYMTAB_uplevel(s) (SYMTAB_flags(s) & SYMTAB_UPLEVEL)
01850 #define   Set_SYMTAB_uplevel(s) (SYMTAB_flags(s) |= SYMTAB_UPLEVEL)
01851 #define Reset_SYMTAB_uplevel(s) (SYMTAB_flags(s) &= ~SYMTAB_UPLEVEL)
01852 #define       SYMTAB_has_alloca(s)      (SYMTAB_flags(s) & SYMTAB_ALLOCA)
01853 #define   Set_SYMTAB_has_alloca(s)      (SYMTAB_flags(s) |= SYMTAB_ALLOCA)
01854 #define Reset_SYMTAB_has_alloca(s)      (SYMTAB_flags(s) &= ~SYMTAB_ALLOCA)
01855 #define       SYMTAB_IPA_on(s)  (SYMTAB_flags(s) & SYMTAB_IPA)
01856 #define   Set_SYMTAB_IPA_on(s)  (SYMTAB_flags(s) |= SYMTAB_IPA)
01857 #define Reset_SYMTAB_IPA_on(s)  (SYMTAB_flags(s) &= ~SYMTAB_IPA)
01858 #define       SYMTAB_has_mp(s)  (SYMTAB_flags(s) & SYMTAB_HASMP)
01859 #define   Set_SYMTAB_has_mp(s)  (SYMTAB_flags(s) |= SYMTAB_HASMP)
01860 #define Reset_SYMTAB_has_mp(s)  (SYMTAB_flags(s) &= ~SYMTAB_HASMP)
01861 #define       SYMTAB_mp(s)      (SYMTAB_flags(s) & SYMTAB_MP)
01862 #define   Set_SYMTAB_mp(s)      (SYMTAB_flags(s) |= SYMTAB_MP)
01863 #define Reset_SYMTAB_mp(s)      (SYMTAB_flags(s) &= ~SYMTAB_MP)
01864 #define       SYMTAB_has_nested(s)      (SYMTAB_uplevel(s) || SYMTAB_has_mp(s))
01865 #define       SYMTAB_has_namelist(s)    (SYMTAB_flags(s) & SYMTAB_HAS_NAMELIST)
01866 #define   Set_SYMTAB_has_namelist(s)    (SYMTAB_flags(s) |= SYMTAB_HAS_NAMELIST)
01867 #define Reset_SYMTAB_has_namelist(s)    (SYMTAB_flags(s) &= ~SYMTAB_HAS_NAMELIST
01868 #define       SYMTAB_addr_taken(s)      (SYMTAB_flags(s) & SYMTAB_ADDR_TAKEN)
01869 #define   Set_SYMTAB_addr_taken(s)      (SYMTAB_flags(s) |= SYMTAB_ADDR_TAKEN)
01870 #define Reset_SYMTAB_addr_taken(s)      (SYMTAB_flags(s) &= ~SYMTAB_ADDR_TAKEN)
01871 #define       SYMTAB_has_rgn(s) (SYMTAB_flags(s) & SYMTAB_HAS_RGN)
01872 #define   Set_SYMTAB_has_rgn(s) (SYMTAB_flags(s) |= SYMTAB_HAS_RGN)
01873 #define Reset_SYMTAB_has_rgn(s) (SYMTAB_flags(s) &= ~SYMTAB_HAS_RGN)
01874 #define       SYMTAB_has_inlines(s)     (SYMTAB_flags(s) & SYMTAB_HAS_INL)
01875 #define   Set_SYMTAB_has_inlines(s)     (SYMTAB_flags(s) |= SYMTAB_HAS_INL)
01876 #define Reset_SYMTAB_has_inlines(s)     (SYMTAB_flags(s) &= ~SYMTAB_HAS_INL)
01877 #define       SYMTAB_has_very_high_whirl(s)     \
01878                         (SYMTAB_flags(s) & SYMTAB_HAS_VERY_HIGH_WHIRL)
01879 #define   Set_SYMTAB_has_very_high_whirl(s)     \
01880                         (SYMTAB_flags(s) |= SYMTAB_HAS_VERY_HIGH_WHIRL)
01881 #define Reset_SYMTAB_has_very_high_whirl(s)     \
01882                         (SYMTAB_flags(s) &= ~SYMTAB_HAS_VERY_HIGH_WHIRL)
01883 #define       SYMTAB_has_altentry(s)    (SYMTAB_flags(s) & SYMTAB_HAS_ALTENTRY)
01884 #define   Set_SYMTAB_has_altentry(s)    (SYMTAB_flags(s) |= SYMTAB_HAS_ALTENTRY)
01885 #define Reset_SYMTAB_has_altentry(s)    (SYMTAB_flags(s) &= ~SYMTAB_HAS_ALTENTRY)
01886 #define     SYMTAB_mp_needs_lno(s)      (SYMTAB_flags(s)&SYMTAB_MP_NEEDS_LNO)
01887 #define Set_SYMTAB_mp_needs_lno(s)      (SYMTAB_flags(s)|=SYMTAB_MP_NEEDS_LNO)
01888 #define Reset_SYMTAB_mp_needs_lno(s)    (SYMTAB_flags(s)&=~SYMTAB_MP_NEEDS_LNO)
01889 
01890 #define       SYMTAB_src_lang(s)        (SYMTAB_flags(s) & SYMTAB_SRC_LANG)
01891 #define   Set_SYMTAB_src_lang(s,v)      (SYMTAB_flags(s) |= v)
01892 
01893 /* Special symbol tables: */
01894 extern SYMTAB_IDX Global_Symtab;        /* The global symbol table */
01895 extern SYMTAB_IDX Current_Symtab;       /* The last symbol table defined */
01896 extern SYMTAB_IDX *Display_Symtab;      /* Static display of symbol tables */
01897 #define Display(n)      Display_Symtab[n]
01898 
01899 /* References to SYMTABs, STs, and TYs are written to the binary WHIRL
01900  * files using ID numbers.  The following macros convert from ID
01901  * numbers to pointers using the mappings stored in the symbol tables.
01902  * Note: ir_bread.c defines functions to replace these macros when
01903  * debugging; they must be kept in sync with these macros. */
01904 
01905 #define Convert_Symtab_Id(id) \
01906         SYMTAB_symtab_map(Global_Symtab)[(id)]
01907 #define Convert_Symtab_Level(id, current) \
01908         SYMTAB_level_map(current)[(id)]
01909 #define Convert_TY_Id(id) \
01910         SYMTAB_ty_map(Global_Symtab)[(id)]
01911 #define Convert_ST_Id(id) \
01912         SYMTAB_st_map(Convert_Symtab_Level((id) >> 24, Current_Symtab)) \
01913         [(id) & 0xffffff]
01914 
01915 /* symbol is in global symbol table? */
01916 #define Is_Global_Symbol(s)     (ST_symtab_id(s) == SYMTAB_id(Global_Symtab))
01917 /* note that Local does not mean local uplevel */
01918 #define Is_Local_Symbol(s)      (ST_symtab_id(s) == SYMTAB_id(Current_Symtab))
01919 
01920 
01921 /* ====================================================================
01922  *
01923  * Symbol table data
01924  *
01925  * ====================================================================
01926  */
01927  
01928 /* Map MTYPES to TY records: */
01929 /* We use a malloc'ed pointer rather than a fixed array 
01930  * so IPA can easily have multiple tables available. */
01931 extern TY_IDX *MTYPE_To_TY_array;
01932 
01933 #ifdef STAB_DOT_C
01934   char *BTT_Message = "Bad MTYPE index %1d to TY array";
01935 #endif
01936 
01937 #ifdef Is_True_On
01938   extern char *BTT_Message;
01939 # define MTYPE_To_TY(k) (MTYPE_To_TY_array[Is_True((k)<=MTYPE_LAST, \
01940                                                 (BTT_Message,(k))),(k)])
01941 #else /* ! Is_True_On */
01942 
01943 # define MTYPE_To_TY(k) (MTYPE_To_TY_array[k])
01944 
01945 #endif /* Is_True_On */
01946 #define Be_Type_Tbl(k)  MTYPE_To_TY(k)
01947 
01948 /* These must be passed to the back end to handle function results: */
01949 extern TY_IDX Quad_Type;
01950 extern TY *Complex_Type, *Double_Complex_Type, *Quad_Complex_Type;
01951 extern TY *Complex_Type_Split, *Complex_Type_Inverted;
01952 
01953 /* Keep track of the PU currently being processed: */
01954 extern ST_IDX Current_PU;
01955  
01956 #define GLOBAL_SCOPE_ID 0       /* scope_id of globals */
01957 
01958 /* --------------------------------------------------------------------
01959  * The following are iterators for the various kinds of symbol table entities.
01960  * FOR_ALL_*(stab,x)    iterates over the given symtab.
01961  * FOR_ALL_GLOBAL_*(x)  iterates over the Global_Symtab.
01962  * FOR_ALL_LOCAL_*(x)   iterates over the Current_Symtab.
01963  * FOR_ALL_VISIBLE_*(x) iterates over the Current_Symtab and its parents.
01964  * --------------------------------------------------------------------
01965  */
01966 
01967 #ifndef FOR_ALL_TYPES
01968 /* t is a TY pointer, and may not be changed during the iteration */
01969 #define FOR_ALL_TYPES(stab,t)   \
01970         for ( t = SYMTAB_types(stab); t != NULL; t = TY_next(t) )
01971 #define FOR_ALL_GLOBAL_TYPES(t)         FOR_ALL_TYPES(Global_Symtab,t)
01972 #define FOR_ALL_LOCAL_TYPES(t)          FOR_ALL_TYPES(Current_Symtab,t)
01973 /* FOR_ALL_VISIBLE_TYPES walks all visible types in current and parent symtabs */
01974 #define FOR_ALL_VISIBLE_TYPES(t)        \
01975         for ( t = Get_Next_Type(NULL); t != NULL; t = Get_Next_Type(t) )
01976 extern TY_IDX Get_Next_Type ( TY_IDX ty );      /* internal routine for FOR_ALL_TYPES */
01977 #endif /* !defined FOR_ALL_TYPES */
01978 
01979 #ifndef FOR_ALL_SYMBOLS
01980 /* s is a ST pointer, and may not be changed during the iteration */
01981 #define FOR_ALL_SYMBOLS(stab,s) \
01982         for (s = SYMTAB_symbols(stab); s != NULL; s = ST_next(s))
01983 #define FOR_ALL_GLOBAL_SYMBOLS(s)       FOR_ALL_SYMBOLS(Global_Symtab,s)
01984 #define FOR_ALL_LOCAL_SYMBOLS(s)        FOR_ALL_SYMBOLS(Current_Symtab,s)
01985 /* FOR_ALL_VISIBLE_SYMBOLS walks all visible symbols in current and parent symtabs */
01986 #define FOR_ALL_VISIBLE_SYMBOLS(s)      \
01987         for ( s = Get_Next_Symbol(NULL); s != NULL; s = Get_Next_Symbol(s) )
01988 extern ST_IDX Get_Next_Symbol ( ST_IDX st );    /* internal routine for FOR_ALL_SYMBOLS */
01989 #endif /* !defined FOR_ALL_SYMBOLS */
01990 
01991 #ifndef FOR_ALL_LABELS
01992 /* l is a ST pointer, and may not be changed during the iteration */
01993 #define FOR_ALL_LABELS(stab,l)  \
01994         for (l = SYMTAB_labels(stab); l != NULL; l = ST_next(l))
01995 #define FOR_ALL_LOCAL_LABELS(l)         FOR_ALL_LABELS(Current_Symtab,l)
01996 #endif /* !defined FOR_ALL_LABELS */
01997 
01998 #define FOR_ALL_SYMTABS_IN_LIST(init,stab)      \
01999         for (stab = init; stab != NULL; stab = SYMTAB_next(stab))
02000 #define FOR_ALL_SYMTABS(stab)   \
02001         for (stab = Global_Symtab; stab != NULL; stab = ((stab == Global_Symtab) ? SYMTAB_child(stab) : SYMTAB_next(stab)) )
02002 
02003 /* The TY record which represents the type of comparisons (OP_JLES
02004  * etc.).  This has MTYPE determined in config_targ.h.
02005  */
02006 extern TY_IDX Comparison_Result_Type;
02007 
02008 extern TY       *Void_Type;
02009 extern TY       *FE_int_Type;   /* C FE's "int" type or NULL */
02010 extern TY       *FE_double_Type;/* C FE's "double" type or NULL */
02011 extern TY       *Spill_Int_Type, *Spill_Float_Type;
02012 extern TY       *LL_Struct_Type,        /* long long structure */
02013                 *LLV_Struct_Type,       /* volatile long long */
02014                 *ULL_Struct_Type,       /* unsigned long long */
02015                 *ULLV_Struct_Type,      /* volatile unsigned long long*/
02016                 *LD_Struct_Type,        /* long double */
02017                 *LDV_Struct_Type;       /* volatile long double */
02018 extern INT64    Actual_Arg_Size, Formal_Size,
02019                 Stack_Size, Frame_Len;
02020 
02021 /*
02022  * PREGs:
02023  * Temporaries are allocated as pseudo-registers (PREGs).
02024  * In order to save space, we don't use a separate ST for PREGS,
02025  * but instead we have a unique offset (PREG_NUM) and then there
02026  * are common PREG STs for each base type.  The PREG_NUM becomes
02027  * the offset in WHIRL ld/stid.  The PREG_NUMs are unique across a PU.
02028  */
02029 /*
02030  * predefined PREG symbols, one for each mtype
02031  * (actually only have pregs for the register-size mtypes and simulated mtypes;
02032  * in particular, the I1/I2/U1/U2 mtypes point to the 4-byte PREG.
02033  */
02034 extern ST** MTYPE_To_PREG_array;
02035 #define MTYPE_To_PREG(t)        MTYPE_To_PREG_array[t]
02036 #define Int32_Preg      MTYPE_To_PREG (MTYPE_I4)
02037 #define Int64_Preg      MTYPE_To_PREG (MTYPE_I8)
02038 #define Float32_Preg    MTYPE_To_PREG (MTYPE_F4)
02039 #define Float64_Preg    MTYPE_To_PREG (MTYPE_F8)
02040 /* preferred preg symbols for physical registers 
02041  * (point to one of above pregs, depending on ABI). */
02042 extern ST       *Int_Preg, *Float_Preg; /* for pseudo-registers */
02043 
02044 /* some definitions for the dedicated hardware pregs: */
02045 #define Int_Preg_Min_Offset             1
02046 #define Int_Preg_Max_Offset             31
02047 #define Float_Preg_Min_Offset           32
02048 #define Float_Preg_Max_Offset           63
02049 #define Fcc_Preg_Min_Offset             64
02050 #define Fcc_Preg_Max_Offset             71
02051 #define Last_Dedicated_Preg_Offset      Fcc_Preg_Max_Offset
02052 #define Preg_Offset_Is_Int(n) \
02053         ((n) >= Int_Preg_Min_Offset && (n) <= Int_Preg_Max_Offset)
02054 #define Preg_Offset_Is_Float(n) \
02055         ((n) >= Float_Preg_Min_Offset && (n) <= Float_Preg_Max_Offset)
02056 #define Preg_Offset_Is_Fcc(n) \
02057         ((n) >= Fcc_Preg_Min_Offset && (n) <= Fcc_Preg_Max_Offset)
02058 #define Preg_Is_Dedicated(n) (n <= Last_Dedicated_Preg_Offset)
02059 
02060 /*
02061  * Create_Preg creates a new preg (new PREG_NUM).  
02062  * We associate a name and home ST with the preg for debugging purposes.
02063  * Don't bother with names for physical registers.
02064  * For pregs of simulated types, that will later get lowered into
02065  * multiple pregs, reserve space for the multiple pregs.
02066  */
02067 /* create a preg of the given type with the associated name */
02068 extern INT32 Preg_Increment(TYPE_ID mtype);
02069 extern PREG_NUM Create_Preg (TYPE_ID mtype, char *name, struct wn *home);
02070 extern void Reset_Last_Preg (PREG_NUM i);       /* cut-back the preg array */
02071 extern char* Preg_Name (PREG_NUM i);            /* get name of preg */
02072 extern void Set_Preg_Name (PREG_NUM i, char *name);  /* set name of preg */
02073 extern struct wn* Preg_Home (PREG_NUM i);       /* get home of preg */
02074 
02075 
02076 /* ====================================================================
02077  *
02078  * Utility function prototypes.
02079  *
02080  * ====================================================================
02081  */
02082 
02083 /* --------------------------------------------------------------------
02084  * Basic symbol table facilities.
02085  * --------------------------------------------------------------------
02086  */
02087 
02088 /* Initialize the symbol table for a new compilation.
02089  * If stab == NULL, then create a global symtab, 
02090  * else use the parameter as the global symtab. */
02091 extern void Stab_Initialize ( SYMTAB *global);
02092 /* Create a new symtab for a new PU, underneath its parent
02093  * (put under Global_Symtab for top-level PUs). */
02094 extern void Stab_Begin_PU ( SYMTAB *parent );
02095 /* Setup the symbol table to use the "current" symtab. */
02096 extern void Stab_Set_Current_PU (SYMTAB *current);
02097 
02098 extern void Stab_Begin_File(void);      /* when a new file begins */
02099 
02100 /* Construct a new scope descriptor: */
02101 extern void New_Scope ( BOOL new_pu );
02102 
02103 /* Construct ASCII names for tracing: */
02104 extern char *Aux_Class_Name ( INT16 );
02105 extern char *Class_Name ( INT16 );
02106 extern char *Sclass_Name ( INT32 );
02107 extern char *Kind_Name ( INT16 );
02108 
02109 /* Given a formal parameter, find the type to which it is promoted for
02110  * passing.  For most formals, this is simply ST_type(st).  However, if
02111  * ST_promote_parm(st) is set, we must check the promotion rules for C:
02112  */
02113 extern TY_IDX Promoted_Parm_Type ( ST_IDX formal_parm );
02114 
02115 /* Determine if the ST represents a constant or read-only memory location. */
02116 extern BOOL ST_is_constant (ST_IDX st);
02117 
02118 /* Determine if the ST represents a constant. */
02119 extern BOOL ST_is_const_initialized( const ST *st );
02120 
02121 /* Determine if the ST represents a constant scalar variable that has
02122  * a known initialized value.  If true, stores the value in 'tc'.
02123  */
02124 extern BOOL ST_is_const_initialized_scalar( const ST *st, struct tcon *tc );
02125 
02126 /* Determine if the ST represents a constant scalar variable that has
02127  * a known initialized value.  If true, returns its initv.
02128  */
02129 extern struct initv *ST_is_const_and_has_initv( const ST *st );
02130 
02131 /* --------------------------------------------------------------------
02132  * Type and symbol creation utilities.
02133  *
02134  * The is_global parameter in the following routines specifies whether to 
02135  * use a file-scope memory pool or a pu-scope memory pool.
02136  * --------------------------------------------------------------------
02137  */
02138 /* Allocate symbol table space: */
02139 extern void *Symtab_Alloc ( size_t bytes, BOOL is_global );
02140 
02141 extern ST_IDX New_ST ( BOOL is_global );        /* allocate a new ST record */
02142 extern SBLK *New_SBLK (BOOL is_global); /* allocate a new SBLK record */
02143 
02144 /* Generate new type structures: */
02145 extern TY_IDX New_TY ( BOOL is_global );
02146 /* The following routines take a "num" parameter which says how many
02147  * records to allocate in a linked list.  These routines will set the
02148  * next field for the records in the linked list. */
02149 extern FLD *New_FLD (INT nfields, BOOL is_global );
02150 extern MBR *New_MBR (INT nfields, BOOL is_global );
02151 extern ARI *New_ARI (INT ndims, BOOL is_global);
02152 extern FTI *New_FTI (INT nparms, BOOL is_global);
02153 extern ENUM_CONST *New_ENUM_CONST (INT num, BOOL is_global);
02154 extern TYLIST *New_TYLIST (INT num, BOOL is_global);
02155 
02156 /* The copy routines will make complete copies of the record and all
02157  * other records that it points to, with the following exceptions:
02158  * If the TY is a predefined type (and always_copy=FALSE), then it 
02159  * will re-use the ty.
02160  * If the old and new ST are in the same file, then we reuse things
02161  * like the name string. */
02162 extern ST_IDX Copy_ST (ST_IDX, BOOL same_file);
02163 extern TY_IDX Copy_TY (TY_IDX, BOOL always_copy);
02164 
02165 /* Add st to the stab chain stch. */
02166 extern STCH *Append_To_STCH ( STCH *stch, ST *st, BOOL is_global );
02167 
02168 extern TY_IDX Make_Pointer_Type ( TY_IDX pointee, BOOL is_global );
02169 extern TY_IDX Make_Global_Pointer_As_Array_Type ( TY_IDX ty);
02170 
02171 extern TY_IDX Make_Function_Type ( TY_IDX rtype, BOOL is_global );
02172 extern TY_IDX Make_Array_Type (TYPE_ID element, INT32 ndim, INT64 len, BOOL is_global);
02173 
02174 
02175 /* find (if one exists) or create a TY that matches the given one in
02176  * all respects, except the new one will be "volatile."
02177  * NOTE: "is_global" simply refers to where we will put the type when
02178  * creating a new one.  If it may be used simply for the current PU,
02179  * should say "is_global=FALSE" which is more efficient memory-wise.
02180  */
02181 extern TY *Make_Volatile_Type ( TY *base_type, BOOL is_global );
02182 extern TY *Make_Align_Type ( TY *rtype, INT32 align, BOOL is_global );
02183 
02184 /* Routines to create a new temporary: */
02185 extern struct st *Gen_Read_Only_Symbol ( TY * ty, char *rootname );
02186 extern struct st *Gen_Temp_Symbol ( TY *ty, char *rootname );
02187 extern struct st *Gen_Intrinsic_Function( TY *, char *);
02188 
02189 /* Generate a new "user" label (internal if name == NULL): */
02190 extern ST *Gen_Label ( char *name );
02191 /* Generate a label given a number */
02192 extern ST *Gen_Number_Label ( INT32 num );
02193 extern ST *Gen_Local_Number_Label ( INT32 num );
02194 
02195 extern ST *Gen_GP_Sym (void);
02196 
02197 /* Get the base symbol and the offset from a ST */
02198 extern void  Base_Symbol_And_Offset (
02199   ST *st,                       /* Symbol to analyze */
02200   ST **base_symbol,             /* Result: root base of st */
02201   INT64 *offset_from_base       /* Result: offset from primary base */
02202 );
02203 
02204 /* fill the display level in a SYMTAB after creation */
02205 extern void Fill_Symtab(SYMTAB *stab, INT16 level);
02206 
02207 /* --------------------------------------------------------------------
02208  * Symbol table listing and tracing utilities.
02209  * --------------------------------------------------------------------
02210  */
02211 
02212 extern void Enter_Label_In_Symtab ( ST *, SYMTAB *, INT32 );
02213 extern void Enter_ST ( ST_IDX);
02214 extern void Enter_ST_In_Symtab ( ST_IDX, SYMTAB *);
02215 extern void Enter_TY ( TY_IDX);
02216 extern void Enter_TY_In_Symtab ( TY_IDX, SYMTAB *);
02217 extern void Print_ST ( FILE *f, ST_IDX st, BOOL verbose );
02218 #pragma mips_frequency_hint NEVER Print_ST
02219 extern void Print_TY ( FILE *f, const TY *ty, BOOL verbose );
02220 #pragma mips_frequency_hint NEVER Print_TY
02221 extern void Print_Symbol_Table ( FILE *f, SYMTAB *stab, BOOL verbose );
02222 #pragma mips_frequency_hint NEVER Print_Symbol_Table
02223 extern void Trace_SYMTAB ( FILE *f, SYMTAB *stab, BOOL verbose );
02224 #pragma mips_frequency_hint NEVER Trace_SYMTAB
02225 extern void Print_Symtab_Stats ( FILE *f);
02226 #pragma mips_frequency_hint NEVER Print_Symtab_Stats
02227 
02228 /* for debugging:  doesn't use trace file */
02229 extern void dump_st (ST_IDX);
02230 extern void dump_ty (TY_IDX);
02231 extern void dump_symtab (SYMTAB *);
02232 extern void dump_constants (void);
02233 
02234 extern SYMTAB * Get_Symtab_At_Id (INT32 id);
02235 
02236 /* get unique id of ST, return kind as 'S|L|C' for symbol/label/const */
02237 extern char Get_ST_Id (ST_IDX st, INT *level, INT *index);
02238 /* Given a symtab level and the symbol index, return the ST */
02239 extern ST_IDX Get_ST_At_Id (INT32 level, INT32 index, char kind);
02240 extern ST_IDX Get_Symbol_At_Id (INT32 level, INT32 index);
02241 extern ST * Get_Label_At_Id (INT32 level, INT32 index);
02242 extern TY_IDX Get_TY_At_Id (INT32 id);
02243 
02244 extern BOOL ST_is_private_local(const ST *st);
02245 
02246 #ifdef __cplusplus
02247 }
02248 
02249 class SYMBOL_TABLE {
02250 public:
02251   ST &operator[](ST *idx) {
02252     return *idx;
02253   }
02254 };
02255 
02256 class TYPE_TABLE {
02257  public:
02258   TY *operator[](TY *idx) {
02259     return idx;
02260   }
02261 };
02262 
02263 class FIELD_TABLE {
02264  public:
02265   FLD *operator[](FLD *idx) {
02266     return idx;
02267   }
02268 };
02269 
02270 class ARB_TABLE {
02271  public:
02272   ARB *operator[](ARB *idx) {
02273     return idx;
02274   }
02275 };
02276 
02277 extern "C" SYMBOL_TABLE St_Table;
02278 extern "C" TYPE_TABLE   Ty_Table;
02279 extern "C" FIELD_TABLE  Fld_Table;
02280 extern "C" ARB_TABLE    Arb_Table;
02281 #endif
02282 
02283 /* The following are macros to make the new symtab code compileable
02284  * as old symtab code too (avoids unnecessary use of #ifdef NEW_SYMTAB)
02285  */
02286 #define PU_has_mp(p)            SYMTAB_has_mp(p)
02287 #define PU_has_altentry(p)      SYMTAB_has_altentry(p)
02288 #define PU_has_nested(p)        SYMTAB_has_nested(p)
02289 #define PU_has_alloca(p)        SYMTAB_has_alloca(p)
02290 #define PU_uplevel(p)           SYMTAB_uplevel(p)
02291 #define PU_has_region(p)        SYMTAB_has_rgn(p)
02292 #define Set_PU_has_region(p)    Set_SYMTAB_has_rgn(p)
02293 #define PU_has_namelist(p)      SYMTAB_has_namelist(p)
02294 #define PU_IPA_on(p)            SYMTAB_IPA_on(p)
02295 #define PU_has_return_address(p) SYMTAB_ra_sym(p)
02296 #define Get_Current_PU()        Current_Symtab
02297 #define Get_Current_PU_ST()     Current_PU
02298 #define PU_lexical_level(p)     ST_scope_id(p)
02299 #define Clear_ST_is_not_used(s) Reset_ST_is_not_used(s)
02300 #define LABEL_name(s)           ST_name(s)
02301 #define FILE_INFO_has_inlines(s)        SYMTAB_has_inlines(s)
02302 #define PU_has_inlines(s)               SYMTAB_has_inlines(s)
02303 #define LABEL_begin_eh_range(s) STL_begin_eh_range(s)
02304 #define Set_LABEL_begin_eh_range(s)     Set_STL_begin_eh_range(s)
02305 #define LABEL_end_eh_range(s)   STL_end_eh_range(s)
02306 #define Set_LABEL_end_eh_range(s)       Set_STL_end_eh_range(s)
02307 #define ST_pu_type(s)           ST_type(s)
02308 
02309 #define PU_C_LANG               SYMTAB_C_LANG
02310 #define PU_CXX_LANG             SYMTAB_CXX_LANG
02311 #define PU_F77_LANG             SYMTAB_F77_LANG
02312 #define PU_F90_LANG             SYMTAB_F90_LANG
02313 #define PU_src_lang(p)          SYMTAB_src_lang(p)
02314 #define FOREACH_SYMBOL(t,s,i)   FOR_ALL_SYMBOLS(t,s)
02315 #define FOREACH_LABEL(t,s,i)    FOR_ALL_LABELS(t,s)
02316 #define FOREACH_TYPE(t,s,i)     FOR_ALL_TYPES(t,s)
02317 #define CURRENT_SYMTAB          Current_Symtab
02318 #define GLOBAL_SYMTAB           Global_Symtab
02319 #define File_info               Global_Symtab
02320 
02321 #endif /* _NEW_SYMTAB */
02322 
02323 #endif /* stab_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines