Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
symtab.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /* -*-Mode: c++;-*- (Tell emacs to use c++ mode) */
00037 
00038 #ifndef symtab_INCLUDED
00039 #define symtab_INCLUDED
00040 
00041 // This file should contain only inlined functions for accessing various
00042 // fields in the symbol table classes.
00043 
00044 #include <list>
00045 using namespace std;
00046 
00047 #ifndef segmented_array_INCLUDED
00048 #include "segmented_array.h"
00049 #endif
00050 
00051 #ifndef cmplr_segmented_array_INCLUDED
00052 #include "cmplr_segmented_array.h"
00053 #endif
00054 
00055 #ifndef symtab_idx_INCLUDED
00056 #include "symtab_idx.h"
00057 #endif
00058 
00059 #ifndef mtypes_INCLUDED
00060 #include "mtypes.h"
00061 #endif
00062 
00063 #ifndef targ_const_INCLUDED
00064 #include "targ_const.h"
00065 #endif
00066 
00067 #ifndef strtab_INCLUDED
00068 #include "strtab.h"
00069 #endif
00070 
00071 #ifndef irbdata_defs_INCLUDED
00072 #include "irbdata_defs.h"
00073 #endif
00074 
00075 #include "symtab_defs.h"                // definitions of each structure
00076 #include "symtab_verify.h"              // verifier
00077 #include "symtab_access.h"              // standard access functions
00078 #include "symtab_utils.h"               // out-of-line utilities
00079 #include "symtab_compatible.h"          // compatibility with old symtab
00080 
00081 // misc. inline functions that are too simple to go into symtab_utils.h
00082 
00083 //----------------------------------------------------------------------
00084 // ST
00085 //----------------------------------------------------------------------
00086 
00087 inline ST*
00088 New_ST (SYMTAB_IDX level)
00089 {
00090     UINT idx;
00091     ST& s = Scope_tab[level].st_tab->New_entry (idx);
00092     Set_ST_st_idx (s, make_ST_IDX (idx, level));
00093     return &s;
00094 }
00095 
00096 inline ST *
00097 New_ST () { return New_ST (CURRENT_SYMTAB); }
00098 
00099 
00100 inline void
00101 ST_Init (ST* st, STR_IDX n, ST_CLASS sc, ST_SCLASS stc, ST_EXPORT exp,
00102          TY_IDX t)
00103 {
00104     st->u1.name_idx = n;
00105     st->sym_class = sc;
00106     st->storage_class = stc;
00107     st->export_class = exp;
00108     st->u2.type = t;
00109     st->base_idx = st->st_idx;
00110     st->offset = 0;
00111     st->flags = 0;
00112     st->flags_ext = 0;
00113 /* fzhao add June */
00114     if (sc == CLASS_VAR || sc == CLASS_PARAMETER)
00115        Set_ST_keep_name_w2f(st);
00116 }
00117 
00118 inline void
00119 Set_ST_classes (ST* s, ST_CLASS c, ST_SCLASS sc)
00120 {
00121 #ifdef Is_True_On
00122     ST_Verify_Class_Sclass (c, sc);
00123 #endif
00124     s->sym_class = c;
00125     s->storage_class = sc;
00126 }
00127 
00128 
00129 inline UINT32
00130 ST_Table_Size (SYMTAB_IDX level) {
00131     return Scope_tab[level].st_tab->Size ();
00132 }
00133 
00134 // overload these access functions for convenience (but slower)
00135 inline char *
00136 ST_name (ST_IDX idx)                    { return ST_name (St_Table[idx]); }
00137 
00138 inline ST_CLASS                         // for compatibility
00139 ST_class (const ST_IDX s)               { return ST_class (St_Table[s]); }
00140 
00141 inline ST_SCLASS
00142 ST_sclass (const ST_IDX s)              { return ST_sclass(St_Table[s]); }
00143 
00144 inline TY_IDX
00145 // ST_type (const ST_IDX s)             { return ST_type(St_Table[s]); }
00146 ST_type (const ST_IDX s)
00147  
00148 {
00149   if (! TY_is_f90_pointer(ST_type(St_Table[s])))
00150      return ST_type(St_Table[s]);
00151   else
00152      return TY_pointed(ST_type(St_Table[s]));
00153 }
00154 
00155 inline TYPE_ID
00156 ST_mtype (const ST* s) {
00157     return TY_mtype (Ty_Table[ST_type (s)]);
00158 }
00159 inline TYPE_ID
00160 ST_btype (const ST* s)                  { return ST_mtype(s); }
00161 
00162 inline void
00163 Set_ST_base (ST& s, ST& base)           { s.base_idx = ST_st_idx(base); }
00164 
00165 inline ST&
00166 ST_base (const ST& s)                   { return St_Table[ST_base_idx (s)]; }
00167 
00168 inline ST&
00169 ST_strong (const ST& s) {
00170     FmtAssert (ST_is_weak_symbol (s), ("Expecting a weak symbol"));
00171     return St_Table[s.base_idx];
00172 }
00173 
00174 inline ST&
00175 ST_full (const ST& s) {
00176     FmtAssert (ST_is_split_common (s), ("Expecting a split common"));
00177     return St_Table[s.base_idx];
00178 }
00179 
00180 inline TCON&
00181 ST_tcon_val (const ST* s)               { return Tcon_Table[ST_tcon (s)]; }
00182 
00183 // optional symbols are also preemptible
00184 inline BOOL
00185 ST_is_preemptible (const ST* s) {
00186     return (ST_export (s) == EXPORT_PREEMPTIBLE ||
00187             ST_export (s) == EXPORT_OPTIONAL);
00188 }
00189 
00190 inline BOOL
00191 ST_is_export_local (const ST *s)
00192 {
00193         // can be local or local_internal
00194         return (ST_export(s) == EXPORT_LOCAL ||
00195                 ST_export(s) == EXPORT_LOCAL_INTERNAL);
00196 }
00197 
00198 inline TY_IDX
00199 ST_pu_type (const ST* s)
00200 {
00201   Is_True (s->sym_class == CLASS_FUNC ||
00202            (ST_sym_class (s) == CLASS_NAME &&
00203             (ST_asm_function_st (*s))),
00204            ("Invalid argument for ST_pu_type"));
00205   return PU_prototype (Pu_Table[ST_pu (s)]);
00206 }
00207 
00208 inline SYMTAB_IDX
00209 ST_level (const ST* s)                  { return ST_IDX_level(ST_st_idx(s)); }
00210 inline UINT32
00211 ST_index (const ST* s)                  { return ST_IDX_index(ST_st_idx(s)); }
00212 
00213 inline BOOL
00214 Has_Base_Block (const ST* s) {
00215     return ST_base_idx (s) != ST_st_idx (s);
00216 }
00217 
00218 inline BOOL
00219 Has_Strong_Symbol (const ST* s) {
00220         return ST_is_weak_symbol(s) && (ST_sclass(s) == SCLASS_EXTERN) 
00221                 && (ST_strong(s) != s);
00222 }
00223 
00224 //----------------------------------------------------------------------
00225 // INITO
00226 //----------------------------------------------------------------------
00227 inline UINT
00228 INITO_Table_Size (SYMTAB_IDX level) {
00229     return Scope_tab[level].inito_tab->Size();
00230 }
00231 
00232 //----------------------------------------------------------------------
00233 // INITV
00234 //----------------------------------------------------------------------
00235 inline UINT
00236 INITV_Table_Size () { return Initv_Table.Size();}
00237 
00238 inline INITV_IDX
00239 INITV_index (SYMTAB_IDX level, ST_IDX st) {
00240  
00241   for (UINT i = 1; i < INITO_Table_Size(level); i++) {
00242     INITO* init = &Inito_Table(level, i);
00243     if (init->st_idx == st) {
00244       return init->val;
00245     } 
00246   }
00247   return INITV_Table_Size()+1;
00248 }
00249   
00250 
00251 
00252 //----------------------------------------------------------------------
00253 // PU
00254 //----------------------------------------------------------------------
00255 
00256 inline PU&
00257 New_PU (PU_IDX& pu)                     { return Pu_Table.New_entry (pu); }
00258 
00259 inline void
00260 PU_Init (PU& pu, TY_IDX prototype, SYMTAB_IDX level)
00261 {
00262     pu.target_idx = TARGET_INFO_IDX_ZERO;
00263     pu.prototype = prototype;
00264     Is_True (level > GLOBAL_SYMTAB, ("lexical level of a PU must be > 1"));
00265     pu.lexical_level = level;
00266     pu.gp_group = 0;
00267     pu.src_lang = PU_UNKNOWN_LANG;
00268     pu.unused = 0;
00269     pu.flags = 0;
00270     Set_PU_need_unparsed(pu);
00271 }
00272 
00273 inline UINT
00274 PU_Table_Size ()                        { return Pu_Table.Size(); }
00275 
00276 inline BOOL
00277 PU_has_nested (const PU& pu)            { return (PU_uplevel(pu) ||
00278                                                   PU_has_mp(pu)); }
00279 
00280 inline BOOL
00281 PU_ftn_lang (const PU& pu)              { return (PU_f90_lang(pu) ||
00282                                                   PU_f77_lang(pu)); }
00283 
00284 inline SYMTAB_IDX
00285 PU_lexical_level (const ST* st)
00286 {
00287     Is_True (ST_sym_class (st) == CLASS_FUNC ||
00288              (ST_sym_class (st) == CLASS_NAME &&
00289               (ST_asm_function_st (*st))),
00290              ("Symbol is not a function"));
00291     return PU_lexical_level (Pu_Table[ST_pu (st)]);
00292 }
00293 
00294 inline ST *
00295 Get_Current_PU_ST ()
00296 {
00297     return Scope_tab[CURRENT_SYMTAB].st;
00298 }
00299 
00300 inline PU &
00301 Get_Current_PU ()
00302 {
00303 #ifdef FRONT_END
00304     return Pu_Table[ST_pu (Scope_tab[CURRENT_SYMTAB].st)];
00305 #else
00306     return *Current_pu;
00307 #endif
00308 }
00309 
00310 // get PU at specified level
00311 inline PU &
00312 Get_Scope_PU (UINT level)
00313 {
00314     return Pu_Table[ST_pu (Scope_tab[level].st)];
00315 }
00316 
00317 //----------------------------------------------------------------------
00318 // TY
00319 //----------------------------------------------------------------------
00320 
00321 inline TY&
00322 New_TY (TY_IDX& ty_idx)
00323 {
00324     UINT idx;
00325     TY& ty = Ty_tab.New_entry (idx);
00326     ty_idx = make_TY_IDX (idx);
00327     return ty;
00328 }
00329 
00330 inline void
00331 TY_Init (TY& ty, UINT64 s, TY_KIND k, TYPE_ID t, STR_IDX n)
00332 {
00333 #ifdef Is_True_On
00334     if (k == KIND_FUNCTION) 
00335       TY_Verify_Kind_Function(k,s,t);
00336 
00337     TY_Verify_Kind_Mtype (k, t);
00338 #endif
00339 
00340     ty.size = s;
00341     ty.kind = k;
00342     ty.mtype = t;
00343     ty.flags = 0;
00344     ty.u1.fld = 0;
00345     ty.name_idx = n;
00346     ty.u2.etype = 0;
00347 } // TY_Init
00348 
00349 inline UINT32
00350 TY_Table_Size ()                        { return Ty_tab.Size (); }
00351 
00352 inline UINT64
00353 TY_size (TY_IDX ty_idx)                 { return TY_size (Ty_Table[ty_idx]); }
00354 
00355 inline TY_KIND
00356 TY_kind (TY_IDX ty_idx)                 { return TY_kind (Ty_Table[ty_idx]); }
00357 
00358 inline TYPE_ID
00359 TY_mtype (TY_IDX ty_idx)                { return Ty_Table[ty_idx].mtype; }
00360 
00361 inline char *
00362 TY_name (TY_IDX ty_idx)                 { return TY_name (Ty_Table[ty_idx]); }
00363  
00364 inline TY_IDX
00365 TY_ret_type (const TY& ty) {
00366     Is_True (TY_kind (ty) == KIND_FUNCTION, ("TY_kind is not KIND_FUNCTION"));
00367     return Tylist_Table[TY_tylist (ty)];
00368 }
00369 inline TY_IDX
00370 TY_ret_type (const TY_IDX ty_idx)       { return TY_ret_type(Ty_Table[ty_idx]);}
00371 
00372 inline TYLIST_IDX
00373 TY_parms (const TY& ty) {
00374     Is_True (TY_kind (ty) == KIND_FUNCTION, ("TY_kind is not KIND_FUNCTION"));
00375     return TY_tylist (ty) + 1;
00376 }
00377 inline TYLIST_IDX
00378 TY_parms (const TY_IDX ty_idx)          { return TY_parms(Ty_Table[ty_idx]); }
00379 
00380 inline BOOL
00381 Is_Simple_Type (const TY& ty)
00382 {
00383     switch (TY_kind (ty)) {
00384     case KIND_SCALAR:
00385     case KIND_POINTER:
00386     case KIND_VOID:
00387         return TRUE;
00388     default:
00389         return FALSE;
00390     }
00391 }
00392 inline BOOL
00393 Is_Simple_Type (TY_IDX ty)      { return Is_Simple_Type (Ty_Table[ty]); }
00394 
00395 
00396 inline BOOL
00397 Is_Structure_Type (const TY& ty)
00398 {
00399     return TY_kind (ty) == KIND_STRUCT;
00400 }
00401 inline BOOL
00402 Is_Structure_Type (TY_IDX ty)   { return Is_Structure_Type (Ty_Table[ty]); }
00403 
00404 
00405 inline BOOL
00406 Is_Composite_Type (const TY& ty)
00407 {
00408     switch (TY_kind (ty)) {
00409     case KIND_STRUCT:
00410     case KIND_ARRAY:
00411         return TRUE;
00412     default:
00413         return FALSE;
00414     }
00415 }
00416 inline BOOL
00417 Is_Composite_Type (TY_IDX ty)   { return Is_Composite_Type (Ty_Table[ty]); }
00418 
00419 //----------------------------------------------------------------------
00420 // FLD
00421 //----------------------------------------------------------------------
00422 inline FLD_HANDLE
00423 New_FLD ()
00424 {
00425     FLD_IDX fld_idx;
00426     FLD& fld = Fld_Table.New_entry (fld_idx);
00427     return FLD_HANDLE (&fld, fld_idx);
00428 }
00429 
00430 inline void
00431 FLD_Init (FLD_HANDLE f, STR_IDX _name, TY_IDX _type, UINT64 _ofst)
00432 {
00433     FLD* fld = f.Entry ();
00434     fld->name_idx = _name;
00435     fld->type = _type;
00436     fld->ofst = _ofst;
00437     fld->flags = 0;
00438     fld->bsize = fld->bofst = 0;
00439     fld->st = 0;
00440 } // FLD::Init
00441 
00442 inline UINT
00443 FLD_Table_Size ()                       { return Fld_Table.Size(); }
00444 
00445 //----------------------------------------------------------------------
00446 // ARB
00447 //----------------------------------------------------------------------
00448 
00449 inline ARB_HANDLE
00450 New_ARB () 
00451 {
00452    ARB_IDX arb_idx;
00453    ARB& arb = Arb_Table.New_entry(arb_idx);
00454    return ARB_HANDLE(&arb,arb_idx);
00455 }
00456 
00457 inline void
00458 ARB_Init (ARB_HANDLE arb_h, INT64 lbnd, INT64 ubnd, INT64 stride)
00459 {
00460    ARB * arb = arb_h.Entry();
00461    arb->flags = ARB_CONST_LBND | ARB_CONST_UBND | ARB_CONST_STRIDE;
00462    arb->dimension = 1;
00463    arb->co_dimension = 0;
00464    arb->unused = 0;
00465    arb->u1.lbnd_val = lbnd;
00466    arb->u2.ubnd_val = ubnd;
00467    arb->u3.stride_val = stride;
00468 }
00469       
00470 inline UINT
00471 ARB_Table_Size ()                       { return Arb_Table.Size(); }
00472 
00473 //----------------------------------------------------------------------
00474 // TYLIST
00475 //----------------------------------------------------------------------
00476 inline TYLIST&
00477 New_TYLIST (TYLIST_IDX& tylist) { return Tylist_Table.New_entry (tylist); }
00478 
00479 inline UINT32
00480 TYLIST_Table_Size ()                    { return Tylist_Table.Size (); }
00481 
00482 //----------------------------------------------------------------------
00483 // access functions for LABEL
00484 //----------------------------------------------------------------------
00485 inline LABEL&
00486 New_LABEL (SYMTAB_IDX scope, LABEL_IDX& label_idx)
00487 {
00488     LABEL& label = Scope_tab[scope].label_tab->New_entry (label_idx);
00489     Set_LABEL_name_idx (label, 0);
00490     Set_LABEL_KIND (label, LKIND_DEFAULT);
00491     label.flags = 0;
00492     return label;
00493 }
00494 
00495 inline void
00496 LABEL_Init (LABEL& label, STR_IDX name_idx, LABEL_KIND kind)
00497 {
00498     label.name_idx = name_idx;
00499     label.kind = kind;
00500     label.flags = 0;
00501 }
00502 
00503 inline UINT32
00504 LABEL_Table_Size (SYMTAB_IDX level)
00505 {
00506     return Scope_tab[level].label_tab->Size ();
00507 }
00508 
00509 
00510 inline char *
00511 LABEL_name (LABEL_IDX idx)              { return LABEL_name(Label_Table[idx]);}
00512 
00513 //----------------------------------------------------------------------
00514 // PREG
00515 //----------------------------------------------------------------------
00516 inline PREG&
00517 New_PREG_explicit (SCOPE *scope_tab, SYMTAB_IDX scope, PREG_IDX& p)
00518 {
00519     return scope_tab[scope].preg_tab->New_entry (p);
00520 }
00521 
00522 inline PREG&
00523 New_PREG (SYMTAB_IDX scope, PREG_IDX& p)
00524 {
00525     return New_PREG_explicit(Scope_tab, scope, p);
00526 }
00527 
00528 inline UINT32
00529 PREG_Table_Size_explicit (SCOPE *scope_tab, SYMTAB_IDX level) {
00530     return scope_tab[level].preg_tab->Size();
00531 }
00532 
00533 inline UINT32
00534 PREG_Table_Size (SYMTAB_IDX level) {
00535     return PREG_Table_Size_explicit(Scope_tab, level);
00536 }
00537 
00538 inline void
00539 Reset_PREG_Table_Size_explicit (SCOPE *scope_tab, SYMTAB_IDX level, UINT32 size)
00540 {
00541     INT32 diff = PREG_Table_Size_explicit (scope_tab, level) - size;
00542     Is_True (diff >= 0, ("Deleting too many entries"));
00543     scope_tab[level].preg_tab->Delete_last (diff);
00544 }
00545 
00546 inline void
00547 Reset_PREG_Table_Size (SYMTAB_IDX level, UINT32 size)
00548 {
00549     Reset_PREG_Table_Size_explicit(Scope_tab, level, size);
00550 }
00551 
00552 //----------------------------------------------------------------------
00553 // ST_ATTR
00554 //----------------------------------------------------------------------
00555 inline ST_ATTR&
00556 New_ST_ATTR_explicit (SCOPE *scope_tab, SYMTAB_IDX scope, ST_ATTR_IDX& p)
00557 {
00558     return scope_tab[scope].st_attr_tab->New_entry (p);
00559 }
00560 
00561 inline ST_ATTR&
00562 New_ST_ATTR (SYMTAB_IDX scope, ST_ATTR_IDX& p)
00563 {
00564     return New_ST_ATTR_explicit(Scope_tab, scope, p);
00565 }
00566 
00567 inline void
00568 ST_ATTR_Init (ST_ATTR& st_attr, ST_IDX st_idx, ST_ATTR_KIND akind, UINT32 val)
00569 {
00570     st_attr.st_idx = st_idx;
00571     st_attr.kind = akind;
00572     st_attr.u.value = val;
00573 }
00574 
00575 inline UINT32
00576 ST_ATTR_Table_Size_explicit (SCOPE *scope_tab, SYMTAB_IDX level) {
00577     return scope_tab[level].st_attr_tab->Size();
00578 }
00579 
00580 inline UINT32
00581 ST_ATTR_Table_Size (SYMTAB_IDX level) {
00582     return ST_ATTR_Table_Size_explicit(Scope_tab, level);
00583 }
00584 
00585 inline void
00586 Reset_ST_ATTR_Table_Size_explicit (SCOPE *scope_tab, SYMTAB_IDX level, UINT32 size)
00587 {
00588     INT32 diff = ST_ATTR_Table_Size_explicit (scope_tab, level) - size;
00589     Is_True (diff >= 0, ("Deleting too many entries"));
00590     scope_tab[level].st_attr_tab->Delete_last (diff);
00591 }
00592 
00593 inline void
00594 Reset_ST_ATTR_Table_Size (SYMTAB_IDX level, UINT32 size)
00595 {
00596     Reset_ST_ATTR_Table_Size_explicit(Scope_tab, level, size);
00597 }
00598 
00599 //----------------------------------------------------------------------
00600 // TCON
00601 //----------------------------------------------------------------------
00602 const UINT32 MAX_PREDEFINED_TCON_IDX = 2;
00603 
00604 TCON_IDX
00605 Enter_tcon (const TCON& tcon);
00606 
00607 void Init_Constab (void);
00608 
00609 inline UINT32
00610 TCON_Table_Size ()                      { return Tcon_Table.Size (); }
00611 
00612 //----------------------------------------------------------------------
00613 // SCOPE
00614 //----------------------------------------------------------------------
00615 
00616 // symbol in global symbol table?
00617 inline BOOL
00618 Is_Global_Symbol (const ST* s)  { return ST_level(s) <= GLOBAL_SYMTAB; }
00619 // local means is in current symtab, does not include uplevel non-globals
00620 inline BOOL
00621 Is_Local_Symbol (const ST* s)   { return ST_level(s) == CURRENT_SYMTAB; }
00622 
00623 
00624 // access functions for BLK
00625 // currently, we always get this info via the ST
00626 
00627 inline BLK&
00628 New_BLK (BLK_IDX& blk_idx)
00629 {
00630     BLK& blk = Blk_Table.New_entry(blk_idx);
00631     blk.Init ();
00632     return blk;
00633 }
00634 
00635 
00636 inline UINT64
00637 STB_size (const ST *s) {
00638     return Blk_Table[ST_blk(s)].Size();
00639 }
00640 inline void
00641 Set_STB_size (ST *s, UINT64 size) {
00642     Blk_Table[ST_blk(s)].Set_size(size);
00643 }
00644 inline UINT
00645 STB_align (const ST *s) {
00646   UINT16 align = Blk_Table[ST_blk(s)].Align();
00647   /* Unpack align into a real value. Must be within 5 bits.
00648    * If all 16 bits are 1 then interpret the alignment as zero.
00649    * This is done because currently data-layout often uses an
00650    * alignment of 0, but there is no way to represent 0-alignment
00651    * with packed alignment. So we simply treat 0xffff as 0.
00652    */
00653   Is_True ((align == 0xffff) ||
00654            ((align & ~TY_ALIGN) == 0),
00655            ("STB_align unacceptably large (%d)\n", align));
00656   if (align == 0xffff) return 0;
00657   return (1 << align);
00658 }
00659 inline void
00660 Set_STB_align (ST *s, UINT align) {
00661   UINT16 packed_align;
00662   extern UINT32 TY_log_base2 (UINT32 align);
00663 
00664   if (align == 0) {
00665     /* store 0xffff to represent an alignment of 0 */
00666     packed_align = 0xffff;
00667   }
00668   else if (align & 0x3f) {
00669     packed_align = (align & 0x7) ? (align >> 1) : 3 + (align >> 4);
00670   }  else {
00671     packed_align = TY_log_base2(align);
00672   }
00673   
00674   Blk_Table[ST_blk(s)].Set_align(packed_align);
00675 }
00676 inline UINT16
00677 STB_section_idx (const ST *s) {
00678     return Blk_Table[ST_blk(s)].Section_idx();
00679 }
00680 inline void
00681 Set_STB_section_idx (ST *s, UINT16 sec) {
00682     Blk_Table[ST_blk(s)].Set_section_idx(sec);
00683 }
00684 inline UINT16
00685 STB_scninfo_idx (const ST *s) {
00686     return Blk_Table[ST_blk(s)].Scninfo_idx();
00687 }
00688 inline void
00689 Set_STB_scninfo_idx (ST *s, UINT16 scn) {
00690     Blk_Table[ST_blk(s)].Set_scninfo_idx(scn);
00691 }
00692 inline UINT16
00693 STB_flags (const ST *s) {
00694         return Blk_Table[ST_blk(s)].Flags();
00695 }
00696 inline BOOL
00697 STB_is_set (const ST* s, UINT16 flags)  { 
00698         return Blk_Table[ST_blk(s)].Is_set (flags); 
00699 }
00700 inline void
00701 Set_STB_flags (ST* s, UINT16 flags)     { 
00702         Blk_Table[ST_blk(s)].Set_flags (flags); 
00703 }
00704 inline void
00705 Reset_STB_flags (ST* s, UINT16 flags)   { 
00706         Blk_Table[ST_blk(s)].Clear_flags (flags); 
00707 }
00708 #define STB_decrement(s)        (STB_is_set (s, BLK_DECREMENT))
00709 #define Set_STB_decrement(s)    (Set_STB_flags (s, BLK_DECREMENT))
00710 #define Reset_STB_decrement(s)  (Reset_STB_flags (s, BLK_DECREMENT))
00711 #define STB_section(s)          (STB_is_set (s, BLK_SECTION))
00712 #define Set_STB_section(s)      (Set_STB_flags (s, BLK_SECTION))
00713 #define Reset_STB_section(s)    (Reset_STB_flags (s, BLK_SECTION))
00714 #define STB_root_base(s)        (STB_is_set (s, BLK_ROOT_BASE))
00715 #define Set_STB_root_base(s)    (Set_STB_flags (s, BLK_ROOT_BASE))
00716 #define Reset_STB_root_base(s)  (Reset_STB_flags (s, BLK_ROOT_BASE))
00717 #define STB_is_basereg(s)       (STB_is_set (s, BLK_IS_BASEREG))
00718 #define Set_STB_is_basereg(s)   (Set_STB_flags (s, BLK_IS_BASEREG))
00719 #define Reset_STB_is_basereg(s) (Reset_STB_flags (s, BLK_IS_BASEREG))
00720 #define STB_exec(s)             (STB_is_set (s, BLK_EXEC))
00721 #define Set_STB_exec(s)         (Set_STB_flags (s, BLK_EXEC))
00722 #define Reset_STB_exec(s)       (Reset_STB_flags (s, BLK_EXEC))
00723 #define STB_nobits(s)           (STB_is_set (s, BLK_NOBITS))
00724 #define Set_STB_nobits(s)       (Set_STB_flags (s, BLK_NOBITS))
00725 #define Reset_STB_nobits(s)     (Reset_STB_flags (s, BLK_NOBITS))
00726 #define STB_merge(s)            (STB_is_set (s, BLK_MERGE))
00727 #define Set_STB_merge(s)        (Set_STB_flags (s, BLK_MERGE))
00728 #define Reset_STB_merge(s)      (Reset_STB_flags (s, BLK_MERGE))
00729 #define STB_compiler_layout(s)          (STB_is_set (s, BLK_COMPILER_LAYOUT))
00730 #define Set_STB_compiler_layout(s)      (Set_STB_flags (s, BLK_COMPILER_LAYOUT))
00731 #define Reset_STB_compiler_layout(s)    (Reset_STB_flags (s, BLK_COMPILER_LAYOUT))
00732 
00733 #endif /* symtab_INCLUDED */
00734 
00735 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines