LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - SymbolTable.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 75.0 % 7409 5557
Test Date: 2025-10-18 14:39:06 Functions: 86.9 % 567 493
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* do not edit automatically generated by mc from SymbolTable.  */
       2                 :             : /* SymbolTable.mod provides access to the symbol table.
       3                 :             : 
       4                 :             : Copyright (C) 2001-2025 Free Software Foundation, Inc.
       5                 :             : Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6                 :             : 
       7                 :             : This file is part of GNU Modula-2.
       8                 :             : 
       9                 :             : GNU Modula-2 is free software; you can redistribute it and/or modify
      10                 :             : it under the terms of the GNU General Public License as published by
      11                 :             : the Free Software Foundation; either version 3, or (at your option)
      12                 :             : any later version.
      13                 :             : 
      14                 :             : GNU Modula-2 is distributed in the hope that it will be useful, but
      15                 :             : WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17                 :             : General Public License for more details.
      18                 :             : 
      19                 :             : You should have received a copy of the GNU General Public License
      20                 :             : along with GNU Modula-2; see the file COPYING3.  If not see
      21                 :             : <http://www.gnu.org/licenses/>.  */
      22                 :             : 
      23                 :             : #include "config.h"
      24                 :             : #include "system.h"
      25                 :             : #include "gcc-consolidation.h"
      26                 :             : 
      27                 :             : #include <stdbool.h>
      28                 :             : #   if !defined (PROC_D)
      29                 :             : #      define PROC_D
      30                 :             :        typedef void (*PROC_t) (void);
      31                 :             :        typedef struct { PROC_t proc; } PROC;
      32                 :             : #   endif
      33                 :             : 
      34                 :             : #   if !defined (TRUE)
      35                 :             : #      define TRUE (1==1)
      36                 :             : #   endif
      37                 :             : 
      38                 :             : #   if !defined (FALSE)
      39                 :             : #      define FALSE (1==0)
      40                 :             : #   endif
      41                 :             : 
      42                 :             : #   include "GStorage.h"
      43                 :             : #   include "Gmcrts.h"
      44                 :             : #if defined(__cplusplus)
      45                 :             : #   undef NULL
      46                 :             : #   define NULL 0
      47                 :             : #endif
      48                 :             : #define _SymbolTable_C
      49                 :             : 
      50                 :             : #include "GSymbolTable.h"
      51                 :             : #   include "GSYSTEM.h"
      52                 :             : #   include "GStorage.h"
      53                 :             : #   include "GM2Debug.h"
      54                 :             : #   include "Glibc.h"
      55                 :             : #   include "GASCII.h"
      56                 :             : #   include "GIndexing.h"
      57                 :             : #   include "GSets.h"
      58                 :             : #   include "Ggcctypes.h"
      59                 :             : #   include "GM2Options.h"
      60                 :             : #   include "GM2LexBuf.h"
      61                 :             : #   include "GM2ALU.h"
      62                 :             : #   include "GM2Error.h"
      63                 :             : #   include "GM2MetaError.h"
      64                 :             : #   include "GFormatStrings.h"
      65                 :             : #   include "GM2Printf.h"
      66                 :             : #   include "GDynamicStrings.h"
      67                 :             : #   include "GLists.h"
      68                 :             : #   include "GNameKey.h"
      69                 :             : #   include "GSymbolKey.h"
      70                 :             : #   include "GM2Base.h"
      71                 :             : #   include "GM2System.h"
      72                 :             : #   include "Gm2expr.h"
      73                 :             : #   include "Gm2linemap.h"
      74                 :             : #   include "GStrLib.h"
      75                 :             : #   include "Gm2builtins.h"
      76                 :             : #   include "GM2Comp.h"
      77                 :             : #   include "GM2Scaffold.h"
      78                 :             : #   include "GM2Diagnostic.h"
      79                 :             : #   include "GM2SymInit.h"
      80                 :             : #   include "GM2RTS.h"
      81                 :             : 
      82                 :             : #   define SymbolTable_NulSym 0
      83                 :             : typedef struct SymbolTable_FamilyOperation_p SymbolTable_FamilyOperation;
      84                 :             : 
      85                 :             : #   define DebugUnknowns false
      86                 :             : #   define DebugUnknownToken false
      87                 :             : #   define BreakNew 97
      88                 :             : #   define UnboundedAddressName "_m2_contents"
      89                 :             : #   define UnboundedHighName "_m2_high_%d"
      90                 :             : typedef struct SymbolTable_ProcAnyBoolean_p SymbolTable_ProcAnyBoolean;
      91                 :             : 
      92                 :             : typedef struct SymbolTable_ProcAnyCardinal_p SymbolTable_ProcAnyCardinal;
      93                 :             : 
      94                 :             : typedef struct SymbolTable_LRLists_a SymbolTable_LRLists;
      95                 :             : 
      96                 :             : typedef struct SymbolTable_LRInitDesc_a SymbolTable_LRInitDesc;
      97                 :             : 
      98                 :             : typedef struct SymbolTable_Where_r SymbolTable_Where;
      99                 :             : 
     100                 :             : typedef struct SymbolTable_VarDecl_r SymbolTable_VarDecl;
     101                 :             : 
     102                 :             : typedef struct SymbolTable_PackedInfo_r SymbolTable_PackedInfo;
     103                 :             : 
     104                 :             : typedef struct SymbolTable_ModuleCtor_r SymbolTable_ModuleCtor;
     105                 :             : 
     106                 :             : typedef struct SymbolTable_SymImportStatement_r SymbolTable_SymImportStatement;
     107                 :             : 
     108                 :             : typedef struct SymbolTable_SymImport_r SymbolTable_SymImport;
     109                 :             : 
     110                 :             : typedef struct SymbolTable_SymEquiv_r SymbolTable_SymEquiv;
     111                 :             : 
     112                 :             : typedef struct SymbolTable_SymOAFamily_r SymbolTable_SymOAFamily;
     113                 :             : 
     114                 :             : typedef struct SymbolTable_SymTuple_r SymbolTable_SymTuple;
     115                 :             : 
     116                 :             : typedef struct SymbolTable_SymError_r SymbolTable_SymError;
     117                 :             : 
     118                 :             : typedef struct SymbolTable_SymObject_r SymbolTable_SymObject;
     119                 :             : 
     120                 :             : typedef struct SymbolTable_SymUndefined_r SymbolTable_SymUndefined;
     121                 :             : 
     122                 :             : typedef struct SymbolTable_SymGnuAsm_r SymbolTable_SymGnuAsm;
     123                 :             : 
     124                 :             : typedef struct SymbolTable_SymInterface_r SymbolTable_SymInterface;
     125                 :             : 
     126                 :             : typedef struct SymbolTable_SymVarient_r SymbolTable_SymVarient;
     127                 :             : 
     128                 :             : typedef struct SymbolTable_SymRecord_r SymbolTable_SymRecord;
     129                 :             : 
     130                 :             : typedef struct SymbolTable_SymSubrange_r SymbolTable_SymSubrange;
     131                 :             : 
     132                 :             : typedef struct SymbolTable_SymEnumeration_r SymbolTable_SymEnumeration;
     133                 :             : 
     134                 :             : typedef struct SymbolTable_SymArray_r SymbolTable_SymArray;
     135                 :             : 
     136                 :             : typedef struct SymbolTable_SymSubscript_r SymbolTable_SymSubscript;
     137                 :             : 
     138                 :             : typedef struct SymbolTable_SymUnbounded_r SymbolTable_SymUnbounded;
     139                 :             : 
     140                 :             : typedef struct SymbolTable_SymPartialUnbounded_r SymbolTable_SymPartialUnbounded;
     141                 :             : 
     142                 :             : typedef struct SymbolTable_ProcedureDeclaration_r SymbolTable_ProcedureDeclaration;
     143                 :             : 
     144                 :             : typedef struct SymbolTable_SymProcedure_r SymbolTable_SymProcedure;
     145                 :             : 
     146                 :             : typedef struct SymbolTable_SymProcType_r SymbolTable_SymProcType;
     147                 :             : 
     148                 :             : typedef struct SymbolTable_SymParam_r SymbolTable_SymParam;
     149                 :             : 
     150                 :             : typedef struct SymbolTable_SymVarParam_r SymbolTable_SymVarParam;
     151                 :             : 
     152                 :             : typedef struct SymbolTable_SymConstString_r SymbolTable_SymConstString;
     153                 :             : 
     154                 :             : typedef struct SymbolTable_SymConstLit_r SymbolTable_SymConstLit;
     155                 :             : 
     156                 :             : typedef struct SymbolTable_SymConstVar_r SymbolTable_SymConstVar;
     157                 :             : 
     158                 :             : typedef struct SymbolTable_SymVar_r SymbolTable_SymVar;
     159                 :             : 
     160                 :             : typedef struct SymbolTable_SymType_r SymbolTable_SymType;
     161                 :             : 
     162                 :             : typedef struct SymbolTable_SymPointer_r SymbolTable_SymPointer;
     163                 :             : 
     164                 :             : typedef struct SymbolTable_SymRecordField_r SymbolTable_SymRecordField;
     165                 :             : 
     166                 :             : typedef struct SymbolTable_SymVarientField_r SymbolTable_SymVarientField;
     167                 :             : 
     168                 :             : typedef struct SymbolTable_SymEnumerationField_r SymbolTable_SymEnumerationField;
     169                 :             : 
     170                 :             : typedef struct SymbolTable_SymSet_r SymbolTable_SymSet;
     171                 :             : 
     172                 :             : typedef struct SymbolTable_SymDefImp_r SymbolTable_SymDefImp;
     173                 :             : 
     174                 :             : typedef struct SymbolTable_SymModule_r SymbolTable_SymModule;
     175                 :             : 
     176                 :             : typedef struct SymbolTable_SymDummy_r SymbolTable_SymDummy;
     177                 :             : 
     178                 :             : typedef struct SymbolTable_Symbol_r SymbolTable_Symbol;
     179                 :             : 
     180                 :             : typedef struct SymbolTable_CallFrame_r SymbolTable_CallFrame;
     181                 :             : 
     182                 :             : typedef struct SymbolTable_CheckProcedure_p SymbolTable_CheckProcedure;
     183                 :             : 
     184                 :             : typedef SymbolTable_Symbol *SymbolTable_PtrToSymbol;
     185                 :             : 
     186                 :             : typedef SymbolTable_CallFrame *SymbolTable_PtrToCallFrame;
     187                 :             : 
     188                 :             : typedef struct SymbolTable__T4_r SymbolTable__T4;
     189                 :             : 
     190                 :             : typedef SymbolTable__T4 *SymbolTable_ConstLitPoolEntry;
     191                 :             : 
     192                 :             : typedef struct SymbolTable__T5_r SymbolTable__T5;
     193                 :             : 
     194                 :             : typedef SymbolTable__T5 *SymbolTable_PtrToAsmConstraint;
     195                 :             : 
     196                 :             : typedef struct SymbolTable__T6_a SymbolTable__T6;
     197                 :             : 
     198                 :             : typedef enum {SymbolTable_m2str, SymbolTable_cstr, SymbolTable_m2nulstr, SymbolTable_cnulstr} SymbolTable_ConstStringVariant;
     199                 :             : 
     200                 :             : typedef enum {SymbolTable_RecordSym, SymbolTable_VarientSym, SymbolTable_DummySym, SymbolTable_VarSym, SymbolTable_EnumerationSym, SymbolTable_SubrangeSym, SymbolTable_ArraySym, SymbolTable_ConstStringSym, SymbolTable_ConstVarSym, SymbolTable_ConstLitSym, SymbolTable_VarParamSym, SymbolTable_ParamSym, SymbolTable_PointerSym, SymbolTable_UndefinedSym, SymbolTable_TypeSym, SymbolTable_RecordFieldSym, SymbolTable_VarientFieldSym, SymbolTable_EnumerationFieldSym, SymbolTable_DefImpSym, SymbolTable_ModuleSym, SymbolTable_SetSym, SymbolTable_ProcedureSym, SymbolTable_ProcTypeSym, SymbolTable_SubscriptSym, SymbolTable_UnboundedSym, SymbolTable_GnuAsmSym, SymbolTable_InterfaceSym, SymbolTable_ObjectSym, SymbolTable_PartialUnboundedSym, SymbolTable_TupleSym, SymbolTable_OAFamilySym, SymbolTable_ImportSym, SymbolTable_ImportStatementSym, SymbolTable_EquivSym, SymbolTable_ErrorSym} SymbolTable_TypeOfSymbol;
     201                 :             : 
     202                 :             : typedef bool (*SymbolTable_ProcAnyBoolean_t) (unsigned int, SymbolTable_ProcedureKind);
     203                 :             : struct SymbolTable_ProcAnyBoolean_p { SymbolTable_ProcAnyBoolean_t proc; };
     204                 :             : 
     205                 :             : typedef unsigned int (*SymbolTable_ProcAnyCardinal_t) (unsigned int, SymbolTable_ProcedureKind);
     206                 :             : struct SymbolTable_ProcAnyCardinal_p { SymbolTable_ProcAnyCardinal_t proc; };
     207                 :             : 
     208                 :             : struct SymbolTable_LRLists_a { Lists_List array[SymbolTable_LeftValue-SymbolTable_RightValue+1]; };
     209                 :             : struct SymbolTable_LRInitDesc_a { M2SymInit_InitDesc array[SymbolTable_LeftValue-SymbolTable_RightValue+1]; };
     210                 :             : struct SymbolTable_Where_r {
     211                 :             :                              unsigned int DefDeclared;
     212                 :             :                              unsigned int FirstUsed;
     213                 :             :                              unsigned int ModDeclared;
     214                 :             :                            };
     215                 :             : 
     216                 :             : struct SymbolTable_VarDecl_r {
     217                 :             :                                unsigned int FullTok;
     218                 :             :                                unsigned int VarTok;
     219                 :             :                                unsigned int TypeTok;
     220                 :             :                              };
     221                 :             : 
     222                 :             : struct SymbolTable_PackedInfo_r {
     223                 :             :                                   bool IsPacked;
     224                 :             :                                   unsigned int PackedEquiv;
     225                 :             :                                 };
     226                 :             : 
     227                 :             : struct SymbolTable_ModuleCtor_r {
     228                 :             :                                   unsigned int ctor;
     229                 :             :                                   unsigned int init;
     230                 :             :                                   unsigned int fini;
     231                 :             :                                   unsigned int dep;
     232                 :             :                                 };
     233                 :             : 
     234                 :             : struct SymbolTable_SymOAFamily_r {
     235                 :             :                                    unsigned int MaxDimensions;
     236                 :             :                                    unsigned int SimpleType;
     237                 :             :                                    Indexing_Index Dimensions;
     238                 :             :                                  };
     239                 :             : 
     240                 :             : struct SymbolTable_SymPartialUnbounded_r {
     241                 :             :                                            unsigned int Type;
     242                 :             :                                            unsigned int NDim;
     243                 :             :                                          };
     244                 :             : 
     245                 :             : struct SymbolTable_ProcedureDeclaration_r {
     246                 :             :                                             Lists_List ListOfParam;
     247                 :             :                                             bool Defined;
     248                 :             :                                             bool ParamDefined;
     249                 :             :                                             bool HasVarArgs;
     250                 :             :                                             bool HasOptArg;
     251                 :             :                                             bool IsNoReturn;
     252                 :             :                                             bool ReturnOptional;
     253                 :             :                                             unsigned int ReturnTypeTok;
     254                 :             :                                             unsigned int ProcedureTok;
     255                 :             :                                           };
     256                 :             : 
     257                 :             : struct SymbolTable_SymParam_r {
     258                 :             :                                 NameKey_Name name;
     259                 :             :                                 unsigned int Type;
     260                 :             :                                 bool IsUnbounded;
     261                 :             :                                 unsigned int Scope;
     262                 :             :                                 unsigned int ShadowVar;
     263                 :             :                                 unsigned int FullTok;
     264                 :             :                                 unsigned int At;
     265                 :             :                               };
     266                 :             : 
     267                 :             : struct SymbolTable_SymVarParam_r {
     268                 :             :                                    NameKey_Name name;
     269                 :             :                                    unsigned int Type;
     270                 :             :                                    bool IsUnbounded;
     271                 :             :                                    unsigned int HeapVar;
     272                 :             :                                    unsigned int Scope;
     273                 :             :                                    unsigned int ShadowVar;
     274                 :             :                                    unsigned int FullTok;
     275                 :             :                                    unsigned int At;
     276                 :             :                                  };
     277                 :             : 
     278                 :             : struct SymbolTable_SymDummy_r {
     279                 :             :                                 unsigned int NextFree;
     280                 :             :                               };
     281                 :             : 
     282                 :             : struct SymbolTable_CallFrame_r {
     283                 :             :                                  unsigned int Main;
     284                 :             :                                  unsigned int Search;
     285                 :             :                                  unsigned int Start;
     286                 :             :                                };
     287                 :             : 
     288                 :             : typedef void (*SymbolTable_CheckProcedure_t) (unsigned int);
     289                 :             : struct SymbolTable_CheckProcedure_p { SymbolTable_CheckProcedure_t proc; };
     290                 :             : 
     291                 :             : struct SymbolTable__T4_r {
     292                 :             :                            unsigned int sym;
     293                 :             :                            unsigned int tok;
     294                 :             :                            NameKey_Name constName;
     295                 :             :                            unsigned int constType;
     296                 :             :                            SymbolTable_ConstLitPoolEntry next;
     297                 :             :                          };
     298                 :             : 
     299                 :             : struct SymbolTable__T5_r {
     300                 :             :                            unsigned int tokpos;
     301                 :             :                            NameKey_Name name;
     302                 :             :                            unsigned int str;
     303                 :             :                            unsigned int obj;
     304                 :             :                          };
     305                 :             : 
     306                 :             : struct SymbolTable_SymImportStatement_r {
     307                 :             :                                           unsigned int listNo;
     308                 :             :                                           Lists_List ListOfImports;
     309                 :             :                                           SymbolTable_Where at;
     310                 :             :                                         };
     311                 :             : 
     312                 :             : struct SymbolTable_SymImport_r {
     313                 :             :                                  unsigned int module;
     314                 :             :                                  unsigned int listNo;
     315                 :             :                                  bool qualified;
     316                 :             :                                  SymbolTable_Where at;
     317                 :             :                                };
     318                 :             : 
     319                 :             : struct SymbolTable_SymEquiv_r {
     320                 :             :                                 SymbolTable_PackedInfo packedInfo;
     321                 :             :                                 unsigned int nonPacked;
     322                 :             :                               };
     323                 :             : 
     324                 :             : struct SymbolTable_SymTuple_r {
     325                 :             :                                 SymbolTable_Where At;
     326                 :             :                                 unsigned int nTuple;
     327                 :             :                                 Indexing_Index list;
     328                 :             :                               };
     329                 :             : 
     330                 :             : struct SymbolTable_SymError_r {
     331                 :             :                                 NameKey_Name name;
     332                 :             :                                 unsigned int Scope;
     333                 :             :                                 SymbolTable_Where At;
     334                 :             :                               };
     335                 :             : 
     336                 :             : struct SymbolTable_SymObject_r {
     337                 :             :                                  NameKey_Name name;
     338                 :             :                                  SymbolTable_Where At;
     339                 :             :                                };
     340                 :             : 
     341                 :             : struct SymbolTable_SymUndefined_r {
     342                 :             :                                     NameKey_Name name;
     343                 :             :                                     unsigned int oafamily;
     344                 :             :                                     M2Error_ErrorScope errorScope;
     345                 :             :                                     SymbolTable_Where At;
     346                 :             :                                   };
     347                 :             : 
     348                 :             : struct SymbolTable_SymGnuAsm_r {
     349                 :             :                                  unsigned int String;
     350                 :             :                                  SymbolTable_Where At;
     351                 :             :                                  unsigned int Inputs;
     352                 :             :                                  unsigned int Outputs;
     353                 :             :                                  unsigned int Trashed;
     354                 :             :                                  bool Volatile;
     355                 :             :                                  bool Simple;
     356                 :             :                                };
     357                 :             : 
     358                 :             : struct SymbolTable_SymInterface_r {
     359                 :             :                                     Indexing_Index Parameters;
     360                 :             :                                     SymbolTable_Where At;
     361                 :             :                                   };
     362                 :             : 
     363                 :             : struct SymbolTable_SymVarient_r {
     364                 :             :                                   M2ALU_PtrToValue Size;
     365                 :             :                                   Lists_List ListOfSons;
     366                 :             :                                   bool DeclPacked;
     367                 :             :                                   bool DeclResolved;
     368                 :             :                                   unsigned int Parent;
     369                 :             :                                   unsigned int Varient;
     370                 :             :                                   unsigned int tag;
     371                 :             :                                   unsigned int Scope;
     372                 :             :                                   SymbolTable_Where At;
     373                 :             :                                 };
     374                 :             : 
     375                 :             : struct SymbolTable_SymRecord_r {
     376                 :             :                                  NameKey_Name name;
     377                 :             :                                  SymbolKey_SymbolTree LocalSymbols;
     378                 :             :                                  M2ALU_PtrToValue Size;
     379                 :             :                                  Lists_List ListOfSons;
     380                 :             :                                  unsigned int Align;
     381                 :             :                                  unsigned int DefaultAlign;
     382                 :             :                                  bool DeclPacked;
     383                 :             :                                  bool DeclResolved;
     384                 :             :                                  unsigned int oafamily;
     385                 :             :                                  unsigned int Parent;
     386                 :             :                                  unsigned int Scope;
     387                 :             :                                  SymbolTable_Where At;
     388                 :             :                                };
     389                 :             : 
     390                 :             : struct SymbolTable_SymSubrange_r {
     391                 :             :                                    NameKey_Name name;
     392                 :             :                                    unsigned int Low;
     393                 :             :                                    unsigned int High;
     394                 :             :                                    M2ALU_PtrToValue Size;
     395                 :             :                                    unsigned int Type;
     396                 :             :                                    unsigned int Align;
     397                 :             :                                    SymbolKey_SymbolTree ConstLitTree;
     398                 :             :                                    SymbolTable_PackedInfo packedInfo;
     399                 :             :                                    unsigned int oafamily;
     400                 :             :                                    unsigned int Scope;
     401                 :             :                                    SymbolTable_Where At;
     402                 :             :                                  };
     403                 :             : 
     404                 :             : struct SymbolTable_SymEnumeration_r {
     405                 :             :                                       NameKey_Name name;
     406                 :             :                                       unsigned int NoOfElements;
     407                 :             :                                       SymbolKey_SymbolTree LocalSymbols;
     408                 :             :                                       Lists_List ListOfFields;
     409                 :             :                                       M2ALU_PtrToValue Size;
     410                 :             :                                       SymbolTable_PackedInfo packedInfo;
     411                 :             :                                       unsigned int oafamily;
     412                 :             :                                       unsigned int Scope;
     413                 :             :                                       SymbolTable_Where At;
     414                 :             :                                     };
     415                 :             : 
     416                 :             : struct SymbolTable_SymArray_r {
     417                 :             :                                 NameKey_Name name;
     418                 :             :                                 unsigned int Subscript;
     419                 :             :                                 M2ALU_PtrToValue Size;
     420                 :             :                                 M2ALU_PtrToValue Offset;
     421                 :             :                                 unsigned int Type;
     422                 :             :                                 unsigned int Align;
     423                 :             :                                 bool Large;
     424                 :             :                                 unsigned int oafamily;
     425                 :             :                                 unsigned int Scope;
     426                 :             :                                 SymbolTable_Where At;
     427                 :             :                               };
     428                 :             : 
     429                 :             : struct SymbolTable_SymSubscript_r {
     430                 :             :                                     unsigned int Type;
     431                 :             :                                     M2ALU_PtrToValue Size;
     432                 :             :                                     M2ALU_PtrToValue Offset;
     433                 :             :                                     SymbolTable_Where At;
     434                 :             :                                   };
     435                 :             : 
     436                 :             : struct SymbolTable_SymUnbounded_r {
     437                 :             :                                     unsigned int Type;
     438                 :             :                                     M2ALU_PtrToValue Size;
     439                 :             :                                     unsigned int RecordType;
     440                 :             :                                     unsigned int Dimensions;
     441                 :             :                                     unsigned int Scope;
     442                 :             :                                     SymbolTable_Where At;
     443                 :             :                                   };
     444                 :             : 
     445                 :             : struct SymbolTable_SymProcType_r {
     446                 :             :                                    NameKey_Name name;
     447                 :             :                                    Lists_List ListOfParam;
     448                 :             :                                    bool HasVarArgs;
     449                 :             :                                    bool HasOptArg;
     450                 :             :                                    unsigned int OptArgInit;
     451                 :             :                                    unsigned int ReturnType;
     452                 :             :                                    bool ReturnOptional;
     453                 :             :                                    unsigned int ReturnTypeTok;
     454                 :             :                                    unsigned int Scope;
     455                 :             :                                    M2ALU_PtrToValue Size;
     456                 :             :                                    M2ALU_PtrToValue TotalParamSize;
     457                 :             :                                    unsigned int oafamily;
     458                 :             :                                    SymbolTable_Where At;
     459                 :             :                                  };
     460                 :             : 
     461                 :             : struct SymbolTable_SymConstString_r {
     462                 :             :                                       NameKey_Name name;
     463                 :             :                                       NameKey_Name Contents;
     464                 :             :                                       unsigned int Length;
     465                 :             :                                       SymbolTable_ConstStringVariant StringVariant;
     466                 :             :                                       bool Known;
     467                 :             :                                       unsigned int Scope;
     468                 :             :                                       SymbolTable_Where At;
     469                 :             :                                     };
     470                 :             : 
     471                 :             : struct SymbolTable_SymConstLit_r {
     472                 :             :                                    NameKey_Name name;
     473                 :             :                                    M2ALU_PtrToValue Value;
     474                 :             :                                    unsigned int Type;
     475                 :             :                                    bool IsSet;
     476                 :             :                                    bool IsConstructor;
     477                 :             :                                    bool IsInternal;
     478                 :             :                                    unsigned int FromType;
     479                 :             :                                    bool RangeError;
     480                 :             :                                    bool UnresFromType;
     481                 :             :                                    unsigned int Scope;
     482                 :             :                                    SymbolTable_Where At;
     483                 :             :                                  };
     484                 :             : 
     485                 :             : struct SymbolTable_SymConstVar_r {
     486                 :             :                                    NameKey_Name name;
     487                 :             :                                    M2ALU_PtrToValue Value;
     488                 :             :                                    unsigned int Type;
     489                 :             :                                    bool IsConditional;
     490                 :             :                                    bool IsSet;
     491                 :             :                                    bool IsConstructor;
     492                 :             :                                    unsigned int FromType;
     493                 :             :                                    bool UnresFromType;
     494                 :             :                                    bool IsTemp;
     495                 :             :                                    unsigned int Scope;
     496                 :             :                                    SymbolTable_Where At;
     497                 :             :                                  };
     498                 :             : 
     499                 :             : struct SymbolTable_SymVar_r {
     500                 :             :                               NameKey_Name name;
     501                 :             :                               unsigned int Type;
     502                 :             :                               unsigned int BackType;
     503                 :             :                               M2ALU_PtrToValue Size;
     504                 :             :                               M2ALU_PtrToValue Offset;
     505                 :             :                               SymbolTable_ModeOfAddr AddrMode;
     506                 :             :                               unsigned int Scope;
     507                 :             :                               bool AtAddress;
     508                 :             :                               unsigned int Address;
     509                 :             :                               bool IsComponentRef;
     510                 :             :                               Indexing_Index list;
     511                 :             :                               bool IsConditional;
     512                 :             :                               bool IsTemp;
     513                 :             :                               bool IsParam;
     514                 :             :                               bool IsPointerCheck;
     515                 :             :                               bool IsWritten;
     516                 :             :                               bool IsSSA;
     517                 :             :                               bool IsConst;
     518                 :             :                               bool ArrayRef;
     519                 :             :                               bool Heap;
     520                 :             :                               SymbolTable_LRInitDesc InitState;
     521                 :             :                               SymbolTable_VarDecl Declared;
     522                 :             :                               SymbolTable_Where At;
     523                 :             :                               SymbolTable_LRLists ReadUsageList;
     524                 :             :                               SymbolTable_LRLists WriteUsageList;
     525                 :             :                             };
     526                 :             : 
     527                 :             : struct SymbolTable_SymType_r {
     528                 :             :                                NameKey_Name name;
     529                 :             :                                unsigned int Type;
     530                 :             :                                bool IsHidden;
     531                 :             :                                SymbolKey_SymbolTree ConstLitTree;
     532                 :             :                                M2ALU_PtrToValue Size;
     533                 :             :                                SymbolTable_PackedInfo packedInfo;
     534                 :             :                                unsigned int oafamily;
     535                 :             :                                unsigned int Align;
     536                 :             :                                unsigned int Scope;
     537                 :             :                                SymbolTable_Where At;
     538                 :             :                              };
     539                 :             : 
     540                 :             : struct SymbolTable_SymPointer_r {
     541                 :             :                                   NameKey_Name name;
     542                 :             :                                   unsigned int Type;
     543                 :             :                                   M2ALU_PtrToValue Size;
     544                 :             :                                   unsigned int Align;
     545                 :             :                                   SymbolKey_SymbolTree ConstLitTree;
     546                 :             :                                   unsigned int oafamily;
     547                 :             :                                   unsigned int Scope;
     548                 :             :                                   SymbolTable_Where At;
     549                 :             :                                 };
     550                 :             : 
     551                 :             : struct SymbolTable_SymRecordField_r {
     552                 :             :                                       NameKey_Name name;
     553                 :             :                                       unsigned int Type;
     554                 :             :                                       bool Tag;
     555                 :             :                                       M2ALU_PtrToValue Size;
     556                 :             :                                       M2ALU_PtrToValue Offset;
     557                 :             :                                       unsigned int Parent;
     558                 :             :                                       unsigned int Varient;
     559                 :             :                                       unsigned int Align;
     560                 :             :                                       bool Used;
     561                 :             :                                       bool DeclPacked;
     562                 :             :                                       bool DeclResolved;
     563                 :             :                                       unsigned int Scope;
     564                 :             :                                       SymbolTable_Where At;
     565                 :             :                                     };
     566                 :             : 
     567                 :             : struct SymbolTable_SymVarientField_r {
     568                 :             :                                        NameKey_Name name;
     569                 :             :                                        M2ALU_PtrToValue Size;
     570                 :             :                                        M2ALU_PtrToValue Offset;
     571                 :             :                                        unsigned int Parent;
     572                 :             :                                        unsigned int Varient;
     573                 :             :                                        Lists_List ListOfSons;
     574                 :             :                                        bool DeclPacked;
     575                 :             :                                        bool DeclResolved;
     576                 :             :                                        unsigned int Scope;
     577                 :             :                                        SymbolTable_Where At;
     578                 :             :                                      };
     579                 :             : 
     580                 :             : struct SymbolTable_SymEnumerationField_r {
     581                 :             :                                            NameKey_Name name;
     582                 :             :                                            M2ALU_PtrToValue Value;
     583                 :             :                                            unsigned int Type;
     584                 :             :                                            unsigned int Scope;
     585                 :             :                                            SymbolTable_Where At;
     586                 :             :                                          };
     587                 :             : 
     588                 :             : struct SymbolTable_SymSet_r {
     589                 :             :                               NameKey_Name name;
     590                 :             :                               unsigned int Type;
     591                 :             :                               SymbolTable_PackedInfo packedInfo;
     592                 :             :                               bool ispacked;
     593                 :             :                               bool SetInWord;
     594                 :             :                               unsigned int SetArray;
     595                 :             :                               unsigned int Align;
     596                 :             :                               M2ALU_PtrToValue Size;
     597                 :             :                               unsigned int oafamily;
     598                 :             :                               unsigned int Scope;
     599                 :             :                               SymbolTable_Where At;
     600                 :             :                             };
     601                 :             : 
     602                 :             : struct SymbolTable_SymDefImp_r {
     603                 :             :                                  NameKey_Name name;
     604                 :             :                                  NameKey_Name libname;
     605                 :             :                                  SymbolTable_ModuleCtor ctors;
     606                 :             :                                  Lists_List DefListOfDep;
     607                 :             :                                  Lists_List ModListOfDep;
     608                 :             :                                  SymbolKey_SymbolTree ExportQualifiedTree;
     609                 :             :                                  SymbolKey_SymbolTree ExportUnQualifiedTree;
     610                 :             :                                  SymbolKey_SymbolTree ExportRequest;
     611                 :             :                                  Lists_List IncludeList;
     612                 :             :                                  Lists_List DefIncludeList;
     613                 :             :                                  SymbolKey_SymbolTree ImportTree;
     614                 :             :                                  SymbolKey_SymbolTree ExportUndeclared;
     615                 :             :                                  SymbolKey_SymbolTree NeedToBeImplemented;
     616                 :             :                                  SymbolKey_SymbolTree LocalSymbols;
     617                 :             :                                  Lists_List EnumerationScopeList;
     618                 :             :                                  SymbolKey_SymbolTree NamedObjects;
     619                 :             :                                  SymbolKey_SymbolTree NamedImports;
     620                 :             :                                  SymbolKey_SymbolTree WhereImported;
     621                 :             :                                  unsigned int Priority;
     622                 :             :                                  SymbolKey_SymbolTree Unresolved;
     623                 :             :                                  unsigned int StartQuad;
     624                 :             :                                  unsigned int EndQuad;
     625                 :             :                                  unsigned int StartFinishQuad;
     626                 :             :                                  unsigned int EndFinishQuad;
     627                 :             :                                  tree FinallyFunction;
     628                 :             :                                  bool ExceptionFinally;
     629                 :             :                                  bool ExceptionBlock;
     630                 :             :                                  bool ContainsHiddenType;
     631                 :             :                                  bool ContainsBuiltin;
     632                 :             :                                  bool ForC;
     633                 :             :                                  bool NeedExportList;
     634                 :             :                                  bool ModLink;
     635                 :             :                                  bool DefLink;
     636                 :             :                                  bool Builtin;
     637                 :             :                                  Lists_List ListOfVars;
     638                 :             :                                  Lists_List ListOfProcs;
     639                 :             :                                  Lists_List ListOfModules;
     640                 :             :                                  M2Error_ErrorScope errorScope;
     641                 :             :                                  SymbolTable_Where At;
     642                 :             :                                };
     643                 :             : 
     644                 :             : struct SymbolTable_SymModule_r {
     645                 :             :                                  NameKey_Name name;
     646                 :             :                                  NameKey_Name libname;
     647                 :             :                                  SymbolTable_ModuleCtor ctors;
     648                 :             :                                  Lists_List ModListOfDep;
     649                 :             :                                  SymbolKey_SymbolTree LocalSymbols;
     650                 :             :                                  SymbolKey_SymbolTree ExportTree;
     651                 :             :                                  Lists_List IncludeList;
     652                 :             :                                  SymbolKey_SymbolTree ImportTree;
     653                 :             :                                  SymbolKey_SymbolTree ExportUndeclared;
     654                 :             :                                  Lists_List EnumerationScopeList;
     655                 :             :                                  SymbolKey_SymbolTree NamedObjects;
     656                 :             :                                  SymbolKey_SymbolTree NamedImports;
     657                 :             :                                  SymbolKey_SymbolTree WhereImported;
     658                 :             :                                  unsigned int Scope;
     659                 :             :                                  unsigned int Priority;
     660                 :             :                                  SymbolKey_SymbolTree Unresolved;
     661                 :             :                                  unsigned int StartQuad;
     662                 :             :                                  unsigned int EndQuad;
     663                 :             :                                  unsigned int StartFinishQuad;
     664                 :             :                                  unsigned int EndFinishQuad;
     665                 :             :                                  tree FinallyFunction;
     666                 :             :                                  bool ExceptionFinally;
     667                 :             :                                  bool ExceptionBlock;
     668                 :             :                                  bool ModLink;
     669                 :             :                                  bool Builtin;
     670                 :             :                                  Lists_List ListOfVars;
     671                 :             :                                  Lists_List ListOfProcs;
     672                 :             :                                  Lists_List ListOfModules;
     673                 :             :                                  M2Error_ErrorScope errorScope;
     674                 :             :                                  SymbolTable_Where At;
     675                 :             :                                };
     676                 :             : 
     677                 :             : struct SymbolTable__T6_a { SymbolTable_ProcedureDeclaration array[SymbolTable_DefProcedure-SymbolTable_ProperProcedure+1]; };
     678                 :             : struct SymbolTable_SymProcedure_r {
     679                 :             :                                     NameKey_Name name;
     680                 :             :                                     SymbolTable__T6 Decl;
     681                 :             :                                     unsigned int OptArgInit;
     682                 :             :                                     bool IsExtern;
     683                 :             :                                     bool IsPublic;
     684                 :             :                                     bool IsCtor;
     685                 :             :                                     bool IsMonoName;
     686                 :             :                                     bool BuildProcType;
     687                 :             :                                     SymbolKey_SymbolTree Unresolved;
     688                 :             :                                     unsigned int ScopeQuad;
     689                 :             :                                     unsigned int StartQuad;
     690                 :             :                                     unsigned int EndQuad;
     691                 :             :                                     bool Reachable;
     692                 :             :                                     bool SavePriority;
     693                 :             :                                     unsigned int ReturnType;
     694                 :             :                                     unsigned int ProcedureType;
     695                 :             :                                     bool IsBuiltin;
     696                 :             :                                     NameKey_Name BuiltinName;
     697                 :             :                                     bool IsInline;
     698                 :             :                                     SymbolKey_SymbolTree LocalSymbols;
     699                 :             :                                     Lists_List EnumerationScopeList;
     700                 :             :                                     Lists_List ListOfVars;
     701                 :             :                                     Lists_List ListOfProcs;
     702                 :             :                                     SymbolKey_SymbolTree NamedObjects;
     703                 :             :                                     M2ALU_PtrToValue Size;
     704                 :             :                                     M2ALU_PtrToValue TotalParamSize;
     705                 :             :                                     bool ExceptionFinally;
     706                 :             :                                     bool ExceptionBlock;
     707                 :             :                                     unsigned int Scope;
     708                 :             :                                     M2Error_ErrorScope errorScope;
     709                 :             :                                     Lists_List ListOfModules;
     710                 :             :                                     unsigned int Begin;
     711                 :             :                                     unsigned int End;
     712                 :             :                                     SymbolTable_Where At;
     713                 :             :                                   };
     714                 :             : 
     715                 :             : struct SymbolTable_Symbol_r {
     716                 :             :                               SymbolTable_TypeOfSymbol SymbolType;  /* case tag */
     717                 :             :                               union {
     718                 :             :                                       SymbolTable_SymOAFamily OAFamily;
     719                 :             :                                       SymbolTable_SymObject Object;
     720                 :             :                                       SymbolTable_SymEquiv Equiv;
     721                 :             :                                       SymbolTable_SymRecord Record;
     722                 :             :                                       SymbolTable_SymVarient Varient;
     723                 :             :                                       SymbolTable_SymVar Var;
     724                 :             :                                       SymbolTable_SymEnumeration Enumeration;
     725                 :             :                                       SymbolTable_SymSubrange Subrange;
     726                 :             :                                       SymbolTable_SymSubscript Subscript;
     727                 :             :                                       SymbolTable_SymArray Array;
     728                 :             :                                       SymbolTable_SymUnbounded Unbounded;
     729                 :             :                                       SymbolTable_SymPartialUnbounded PartialUnbounded;
     730                 :             :                                       SymbolTable_SymConstVar ConstVar;
     731                 :             :                                       SymbolTable_SymConstLit ConstLit;
     732                 :             :                                       SymbolTable_SymConstString ConstString;
     733                 :             :                                       SymbolTable_SymVarParam VarParam;
     734                 :             :                                       SymbolTable_SymParam Param;
     735                 :             :                                       SymbolTable_SymError Error;
     736                 :             :                                       SymbolTable_SymUndefined Undefined;
     737                 :             :                                       SymbolTable_SymType Type;
     738                 :             :                                       SymbolTable_SymPointer Pointer;
     739                 :             :                                       SymbolTable_SymRecordField RecordField;
     740                 :             :                                       SymbolTable_SymVarientField VarientField;
     741                 :             :                                       SymbolTable_SymEnumerationField EnumerationField;
     742                 :             :                                       SymbolTable_SymDefImp DefImp;
     743                 :             :                                       SymbolTable_SymModule Module;
     744                 :             :                                       SymbolTable_SymSet Set;
     745                 :             :                                       SymbolTable_SymProcedure Procedure;
     746                 :             :                                       SymbolTable_SymProcType ProcType;
     747                 :             :                                       SymbolTable_SymImportStatement ImportStatement;
     748                 :             :                                       SymbolTable_SymImport Import;
     749                 :             :                                       SymbolTable_SymGnuAsm GnuAsm;
     750                 :             :                                       SymbolTable_SymInterface Interface;
     751                 :             :                                       SymbolTable_SymTuple Tuple;
     752                 :             :                                       SymbolTable_SymDummy Dummy;
     753                 :             :                                     };
     754                 :             :                             };
     755                 :             : 
     756                 :             : static Indexing_Index Symbols;
     757                 :             : static Indexing_Index ScopeCallFrame;
     758                 :             : static unsigned int FreeSymbol;
     759                 :             : static SymbolKey_SymbolTree DefModuleTree;
     760                 :             : static SymbolKey_SymbolTree ModuleTree;
     761                 :             : static unsigned int CurrentModule;
     762                 :             : static unsigned int MainModule;
     763                 :             : static unsigned int FileModule;
     764                 :             : static unsigned int ScopePtr;
     765                 :             : static unsigned int BaseScopePtr;
     766                 :             : static unsigned int BaseModule;
     767                 :             : static unsigned int TemporaryNo;
     768                 :             : static M2Error_Error CurrentError;
     769                 :             : static Lists_List AddressTypes;
     770                 :             : static Lists_List UnresolvedConstructorType;
     771                 :             : static unsigned int AnonymousName;
     772                 :             : static Sets_Set ReportedUnknowns;
     773                 :             : static SymbolKey_SymbolTree ConstLitPoolTree;
     774                 :             : static Indexing_Index ConstLitArray;
     775                 :             : static unsigned int BreakSym;
     776                 :             : static M2Diagnostic_Diagnostic SymMemDiag;
     777                 :             : static unsigned int recordConsist;
     778                 :             : static DynamicStrings_String ListifySentance;
     779                 :             : static unsigned int ListifyTotal;
     780                 :             : static unsigned int ListifyWordCount;
     781                 :             : static unsigned int ExportRequestModule;
     782                 :             : static unsigned int ResolveModule;
     783                 :             : 
     784                 :             : /*
     785                 :             :    FinalSymbol - returns the highest number symbol used.
     786                 :             : */
     787                 :             : 
     788                 :             : extern "C" unsigned int SymbolTable_FinalSymbol (void);
     789                 :             : 
     790                 :             : /*
     791                 :             :    MakeComponentRecord - make a temporary which will be used to reference and field
     792                 :             :                          (or sub field) of record.
     793                 :             : */
     794                 :             : 
     795                 :             : extern "C" unsigned int SymbolTable_MakeComponentRecord (unsigned int tok, SymbolTable_ModeOfAddr Mode, unsigned int record);
     796                 :             : 
     797                 :             : /*
     798                 :             :    MakeComponentRef - use, sym, to reference, field, sym is returned.
     799                 :             : */
     800                 :             : 
     801                 :             : extern "C" unsigned int SymbolTable_MakeComponentRef (unsigned int sym, unsigned int field);
     802                 :             : 
     803                 :             : /*
     804                 :             :    IsComponent - returns TRUE if symbol, sym, is a temporary and a component
     805                 :             :                  reference.
     806                 :             : */
     807                 :             : 
     808                 :             : extern "C" bool SymbolTable_IsComponent (unsigned int sym);
     809                 :             : 
     810                 :             : /*
     811                 :             :    MakeTemporary - Makes a new temporary variable at the highest real scope.
     812                 :             :                    The addressing mode of the temporary is set to NoValue.
     813                 :             : */
     814                 :             : 
     815                 :             : extern "C" unsigned int SymbolTable_MakeTemporary (unsigned int tok, SymbolTable_ModeOfAddr Mode);
     816                 :             : 
     817                 :             : /*
     818                 :             :    MakeTemporaryFromExpression - makes a new temporary variable at the
     819                 :             :                                  highest real scope.  The addressing
     820                 :             :                                  mode of the temporary is set and the
     821                 :             :                                  type is determined by expressions, e.
     822                 :             : */
     823                 :             : 
     824                 :             : extern "C" unsigned int SymbolTable_MakeTemporaryFromExpression (unsigned int tok, unsigned int e, SymbolTable_ModeOfAddr mode);
     825                 :             : 
     826                 :             : /*
     827                 :             :    MakeTemporaryFromExpressions - makes a new temporary variable at the
     828                 :             :                                   highest real scope.  The addressing
     829                 :             :                                   mode of the temporary is set and the
     830                 :             :                                   type is determined by expressions,
     831                 :             :                                   e1 and e2.
     832                 :             : */
     833                 :             : 
     834                 :             : extern "C" unsigned int SymbolTable_MakeTemporaryFromExpressions (unsigned int tok, unsigned int e1, unsigned int e2, SymbolTable_ModeOfAddr mode);
     835                 :             : 
     836                 :             : /*
     837                 :             :    PutMode - Puts the addressing mode, SymMode, into symbol Sym.
     838                 :             :              The mode may only be altered if the mode
     839                 :             :              is None.
     840                 :             : */
     841                 :             : 
     842                 :             : extern "C" void SymbolTable_PutMode (unsigned int Sym, SymbolTable_ModeOfAddr SymMode);
     843                 :             : 
     844                 :             : /*
     845                 :             :    GetMode - Returns the addressing mode of a symbol.
     846                 :             : */
     847                 :             : 
     848                 :             : extern "C" SymbolTable_ModeOfAddr SymbolTable_GetMode (unsigned int Sym);
     849                 :             : 
     850                 :             : /*
     851                 :             :    StartScope - starts a block scope at Sym. Transparent determines
     852                 :             :                 whether the search for a symbol will look at the
     853                 :             :                 previous ScopeCallFrame if Sym does not contain the
     854                 :             :                 symbol that GetSym is searching.
     855                 :             : 
     856                 :             :                 WITH statements are partially implemented by calling
     857                 :             :                 StartScope. Therefore we must retain the old Main from
     858                 :             :                 the previous ScopePtr when a record is added to the scope
     859                 :             :                 stack. (Main contains the symbol where all identifiers
     860                 :             :                 should be added.)
     861                 :             : */
     862                 :             : 
     863                 :             : extern "C" void SymbolTable_StartScope (unsigned int Sym);
     864                 :             : 
     865                 :             : /*
     866                 :             :    EndScope - ends a block scope started by StartScope. The current
     867                 :             :               head of the symbol scope reverts back to the symbol
     868                 :             :               which was the Head of the symbol scope before the
     869                 :             :               last StartScope was called.
     870                 :             : */
     871                 :             : 
     872                 :             : extern "C" void SymbolTable_EndScope (void);
     873                 :             : 
     874                 :             : /*
     875                 :             :    PseudoScope - starts a pseudo scope at Sym.
     876                 :             :                  We always connect parent up to the last scope,
     877                 :             :                  to determine the transparancy of a scope we call
     878                 :             :                  TransparentScope.
     879                 :             : 
     880                 :             :                  A Pseudo scope has no end block,
     881                 :             :                  but is terminated when the next EndScope is used.
     882                 :             :                  The function of the pseudo scope is to provide an
     883                 :             :                  automatic mechanism to solve enumeration types.
     884                 :             :                  A declared enumeration type is a Pseudo scope and
     885                 :             :                  identifiers used with the name of an enumeration
     886                 :             :                  type field will find the enumeration symbol by
     887                 :             :                  the scoping algorithm.
     888                 :             : */
     889                 :             : 
     890                 :             : extern "C" void SymbolTable_PseudoScope (unsigned int Sym);
     891                 :             : 
     892                 :             : /*
     893                 :             :    GetCurrentScope - returns the symbol who is responsible for the current
     894                 :             :                      scope. Note that it ignore pseudo scopes.
     895                 :             : */
     896                 :             : 
     897                 :             : extern "C" unsigned int SymbolTable_GetCurrentScope (void);
     898                 :             : 
     899                 :             : /*
     900                 :             :    IsDeclaredIn - returns TRUE if a symbol was declared in, scope.
     901                 :             : */
     902                 :             : 
     903                 :             : extern "C" bool SymbolTable_IsDeclaredIn (unsigned int scope, unsigned int sym);
     904                 :             : 
     905                 :             : /*
     906                 :             :    SetCurrentModule - Used to set the CurrentModule to a symbol, Sym.
     907                 :             :                       This Sym must represent the module name of the
     908                 :             :                       file currently being compiled.
     909                 :             : */
     910                 :             : 
     911                 :             : extern "C" void SymbolTable_SetCurrentModule (unsigned int Sym);
     912                 :             : 
     913                 :             : /*
     914                 :             :    SetFileModule - Used to set the FileModule to a symbol, Sym.
     915                 :             :                    This Sym must represent the current program module
     916                 :             :                    file which is being parsed.
     917                 :             : */
     918                 :             : 
     919                 :             : extern "C" void SymbolTable_SetFileModule (unsigned int Sym);
     920                 :             : 
     921                 :             : /*
     922                 :             :    SetMainModule - Used to set the MainModule to a symbol, Sym.
     923                 :             :                    This Sym must represent the main module which was
     924                 :             :                    envoked by the user to be compiled.
     925                 :             : */
     926                 :             : 
     927                 :             : extern "C" void SymbolTable_SetMainModule (unsigned int Sym);
     928                 :             : 
     929                 :             : /*
     930                 :             :    CheckAnonymous - checks to see whether the name is NulName and if so
     931                 :             :                     it creates a unique anonymous name.
     932                 :             : */
     933                 :             : 
     934                 :             : extern "C" NameKey_Name SymbolTable_CheckAnonymous (NameKey_Name name);
     935                 :             : 
     936                 :             : /*
     937                 :             :    IsNameAnonymous - returns TRUE if the symbol, sym, has an anonymous name
     938                 :             :                      or no name.
     939                 :             : */
     940                 :             : 
     941                 :             : extern "C" bool SymbolTable_IsNameAnonymous (unsigned int sym);
     942                 :             : 
     943                 :             : /*
     944                 :             :    NoOfVariables - returns the number of variables in scope.  The scope maybe
     945                 :             :                    a procedure, module or defimp scope.
     946                 :             : */
     947                 :             : 
     948                 :             : extern "C" unsigned int SymbolTable_NoOfVariables (unsigned int scope);
     949                 :             : 
     950                 :             : /*
     951                 :             :    MakeModule - creates a module sym with ModuleName. It returns the
     952                 :             :                 symbol index.
     953                 :             : */
     954                 :             : 
     955                 :             : extern "C" unsigned int SymbolTable_MakeModule (unsigned int tok, NameKey_Name ModuleName);
     956                 :             : 
     957                 :             : /*
     958                 :             :    MakeDefImp - creates a definition and implementation module sym
     959                 :             :                 with name DefImpName.  It returns the symbol index.
     960                 :             : */
     961                 :             : 
     962                 :             : extern "C" unsigned int SymbolTable_MakeDefImp (unsigned int tok, NameKey_Name DefImpName);
     963                 :             : 
     964                 :             : /*
     965                 :             :    MakeInnerModule - creates an inner module sym with ModuleName. It returns the
     966                 :             :                      symbol index.
     967                 :             : */
     968                 :             : 
     969                 :             : extern "C" unsigned int SymbolTable_MakeInnerModule (unsigned int tok, NameKey_Name ModuleName);
     970                 :             : 
     971                 :             : /*
     972                 :             :    MakeProcedure - creates a procedure sym with name. It returns
     973                 :             :                    the symbol index.
     974                 :             : */
     975                 :             : 
     976                 :             : extern "C" unsigned int SymbolTable_MakeProcedure (unsigned int tok, NameKey_Name ProcedureName);
     977                 :             : 
     978                 :             : /*
     979                 :             :    MakeProcedureCtorExtern - creates an extern ctor procedure
     980                 :             : */
     981                 :             : 
     982                 :             : extern "C" unsigned int SymbolTable_MakeProcedureCtorExtern (unsigned int tokenno, NameKey_Name libname, NameKey_Name modulename);
     983                 :             : 
     984                 :             : /*
     985                 :             :    PutLibName - places libname into defimp or module sym.
     986                 :             : */
     987                 :             : 
     988                 :             : extern "C" void SymbolTable_PutLibName (unsigned int sym, NameKey_Name libname);
     989                 :             : 
     990                 :             : /*
     991                 :             :    GetLibName - returns libname associated with a defimp or module sym.
     992                 :             : */
     993                 :             : 
     994                 :             : extern "C" NameKey_Name SymbolTable_GetLibName (unsigned int sym);
     995                 :             : 
     996                 :             : /*
     997                 :             :    PutMonoName - changes the IsMonoName boolean inside the procedure.
     998                 :             : */
     999                 :             : 
    1000                 :             : extern "C" void SymbolTable_PutMonoName (unsigned int sym, bool value);
    1001                 :             : 
    1002                 :             : /*
    1003                 :             :    IsMonoName - returns the public boolean associated with a procedure.
    1004                 :             : */
    1005                 :             : 
    1006                 :             : extern "C" bool SymbolTable_IsMonoName (unsigned int sym);
    1007                 :             : 
    1008                 :             : /*
    1009                 :             :    PutExtern - changes the extern boolean inside the procedure.
    1010                 :             : */
    1011                 :             : 
    1012                 :             : extern "C" void SymbolTable_PutExtern (unsigned int sym, bool value);
    1013                 :             : 
    1014                 :             : /*
    1015                 :             :    IsExtern - returns the public boolean associated with a procedure.
    1016                 :             : */
    1017                 :             : 
    1018                 :             : extern "C" bool SymbolTable_IsExtern (unsigned int sym);
    1019                 :             : 
    1020                 :             : /*
    1021                 :             :    PutPublic - changes the public boolean inside the procedure.
    1022                 :             : */
    1023                 :             : 
    1024                 :             : extern "C" void SymbolTable_PutPublic (unsigned int sym, bool value);
    1025                 :             : 
    1026                 :             : /*
    1027                 :             :    IsPublic - returns the public boolean associated with a procedure.
    1028                 :             : */
    1029                 :             : 
    1030                 :             : extern "C" bool SymbolTable_IsPublic (unsigned int sym);
    1031                 :             : 
    1032                 :             : /*
    1033                 :             :    PutCtor - changes the ctor boolean inside the procedure.
    1034                 :             : */
    1035                 :             : 
    1036                 :             : extern "C" void SymbolTable_PutCtor (unsigned int sym, bool value);
    1037                 :             : 
    1038                 :             : /*
    1039                 :             :    IsCtor - returns the ctor boolean associated with a procedure.
    1040                 :             : */
    1041                 :             : 
    1042                 :             : extern "C" bool SymbolTable_IsCtor (unsigned int sym);
    1043                 :             : 
    1044                 :             : /*
    1045                 :             :    GetModuleCtors - mod can be a DefImp or Module symbol.  ctor, init and fini
    1046                 :             :                     are assigned for this module.  An inner module ctor value will
    1047                 :             :                     be NulSym.
    1048                 :             : */
    1049                 :             : 
    1050                 :             : extern "C" void SymbolTable_GetModuleCtors (unsigned int mod, unsigned int *ctor, unsigned int *init, unsigned int *fini, unsigned int *dep);
    1051                 :             : 
    1052                 :             : /*
    1053                 :             :    MakeModuleCtor - for a defimp or module symbol create all the ctor
    1054                 :             :                     related procedures.
    1055                 :             : */
    1056                 :             : 
    1057                 :             : extern "C" void SymbolTable_MakeModuleCtor (unsigned int moduleTok, unsigned int beginTok, unsigned int finallyTok, unsigned int moduleSym);
    1058                 :             : 
    1059                 :             : /*
    1060                 :             :    PutModuleCtorExtern - for every ctor related procedure in module sym.
    1061                 :             :                          Make it external.  It will create any missing
    1062                 :             :                          init/fini procedures but not any missing dep/ctor
    1063                 :             :                          procedures.
    1064                 :             : */
    1065                 :             : 
    1066                 :             : extern "C" void SymbolTable_PutModuleCtorExtern (unsigned int tok, unsigned int sym, bool external);
    1067                 :             : 
    1068                 :             : /*
    1069                 :             :    PutVarHeap - assigns ArrayRef field with value.
    1070                 :             : */
    1071                 :             : 
    1072                 :             : extern "C" void SymbolTable_PutVarHeap (unsigned int sym, bool value);
    1073                 :             : 
    1074                 :             : /*
    1075                 :             :    IsVarHeap - returns ArrayRef field value.
    1076                 :             : */
    1077                 :             : 
    1078                 :             : extern "C" bool SymbolTable_IsVarHeap (unsigned int sym);
    1079                 :             : 
    1080                 :             : /*
    1081                 :             :    MakeVar - creates a variable sym with VarName. It returns the
    1082                 :             :              symbol index.
    1083                 :             : */
    1084                 :             : 
    1085                 :             : extern "C" unsigned int SymbolTable_MakeVar (unsigned int tok, NameKey_Name VarName);
    1086                 :             : 
    1087                 :             : /*
    1088                 :             :    PutVarConditional - assign IsConditional to value.
    1089                 :             : */
    1090                 :             : 
    1091                 :             : extern "C" void SymbolTable_PutVarConditional (unsigned int sym, bool value);
    1092                 :             : 
    1093                 :             : /*
    1094                 :             :    IsVarConditional - return TRUE if the symbol is a var symbol
    1095                 :             :                       containing the result of a boolean conditional.
    1096                 :             : */
    1097                 :             : 
    1098                 :             : extern "C" bool SymbolTable_IsVarConditional (unsigned int sym);
    1099                 :             : 
    1100                 :             : /*
    1101                 :             :    MakeRecord - makes a Record symbol with name RecordName.
    1102                 :             : */
    1103                 :             : 
    1104                 :             : extern "C" unsigned int SymbolTable_MakeRecord (unsigned int tok, NameKey_Name RecordName);
    1105                 :             : 
    1106                 :             : /*
    1107                 :             :    MakeVarient - creates a new symbol, a varient symbol for record or varient field
    1108                 :             :                  symbol, RecOrVarFieldSym.
    1109                 :             : */
    1110                 :             : 
    1111                 :             : extern "C" unsigned int SymbolTable_MakeVarient (unsigned int tok, unsigned int RecOrVarFieldSym);
    1112                 :             : 
    1113                 :             : /*
    1114                 :             :    MakeFieldVarient - returns a FieldVarient symbol which has been
    1115                 :             :                       assigned to the Varient symbol, Sym.
    1116                 :             : */
    1117                 :             : 
    1118                 :             : extern "C" unsigned int SymbolTable_MakeFieldVarient (NameKey_Name n, unsigned int Sym);
    1119                 :             : 
    1120                 :             : /*
    1121                 :             :    MakeEnumeration - places a new symbol in the current scope, the symbol
    1122                 :             :                      is an enumeration symbol. The symbol index is returned.
    1123                 :             : */
    1124                 :             : 
    1125                 :             : extern "C" unsigned int SymbolTable_MakeEnumeration (unsigned int tok, NameKey_Name EnumerationName);
    1126                 :             : 
    1127                 :             : /*
    1128                 :             :    MakeType - makes a type symbol with name TypeName.
    1129                 :             : */
    1130                 :             : 
    1131                 :             : extern "C" unsigned int SymbolTable_MakeType (unsigned int tok, NameKey_Name TypeName);
    1132                 :             : 
    1133                 :             : /*
    1134                 :             :    MakeHiddenType - makes a type symbol that is hidden from the
    1135                 :             :                     definition module.
    1136                 :             :                     This symbol is placed into the UnImplemented list of
    1137                 :             :                     the definition/implementation module.
    1138                 :             :                     The type will be filled in when the implementation module
    1139                 :             :                     is reached.
    1140                 :             : */
    1141                 :             : 
    1142                 :             : extern "C" unsigned int SymbolTable_MakeHiddenType (unsigned int tok, NameKey_Name TypeName);
    1143                 :             : 
    1144                 :             : /*
    1145                 :             :    MakeConstant - create a constant cardinal and return the symbol.
    1146                 :             : */
    1147                 :             : 
    1148                 :             : extern "C" unsigned int SymbolTable_MakeConstant (unsigned int tok, unsigned int value);
    1149                 :             : 
    1150                 :             : /*
    1151                 :             :    MakeConstLit - returns a constant literal of type, constType, with a constName,
    1152                 :             :                   at location, tok.
    1153                 :             : */
    1154                 :             : 
    1155                 :             : extern "C" unsigned int SymbolTable_MakeConstLit (unsigned int tok, NameKey_Name constName, unsigned int constType);
    1156                 :             : 
    1157                 :             : /*
    1158                 :             :    MakeConstVar - makes a ConstVar type with
    1159                 :             :                   name ConstVarName.
    1160                 :             : */
    1161                 :             : 
    1162                 :             : extern "C" unsigned int SymbolTable_MakeConstVar (unsigned int tok, NameKey_Name ConstVarName);
    1163                 :             : 
    1164                 :             : /*
    1165                 :             :    MakeConstString - create a string constant in the symboltable.
    1166                 :             : */
    1167                 :             : 
    1168                 :             : extern "C" unsigned int SymbolTable_MakeConstString (unsigned int tok, NameKey_Name ConstName);
    1169                 :             : 
    1170                 :             : /*
    1171                 :             :    MakeConstStringCnul - creates a constant string nul terminated string suitable for C.
    1172                 :             :                          If known is TRUE then name is assigned to the contents
    1173                 :             :                          and the escape sequences will be converted into characters.
    1174                 :             : */
    1175                 :             : 
    1176                 :             : extern "C" unsigned int SymbolTable_MakeConstStringCnul (unsigned int tok, NameKey_Name name, bool known);
    1177                 :             : 
    1178                 :             : /*
    1179                 :             :    MakeConstStringM2nul - creates a constant string nul terminated string suitable for M2.
    1180                 :             :                           If known is TRUE then name is assigned to the contents
    1181                 :             :                           however the escape sequences are not converted into characters.
    1182                 :             : */
    1183                 :             : 
    1184                 :             : extern "C" unsigned int SymbolTable_MakeConstStringM2nul (unsigned int tok, NameKey_Name name, bool known);
    1185                 :             : 
    1186                 :             : /*
    1187                 :             :    PutConstStringKnown - if sym is a constvar then convert it into a conststring.
    1188                 :             :                          If known is FALSE then contents is ignored and NulName is
    1189                 :             :                          stored.  If escape is TRUE then the contents will have
    1190                 :             :                          any escape sequences converted into single characters.
    1191                 :             : */
    1192                 :             : 
    1193                 :             : extern "C" void SymbolTable_PutConstStringKnown (unsigned int tok, unsigned int sym, NameKey_Name contents, bool escape, bool known);
    1194                 :             : 
    1195                 :             : /*
    1196                 :             :    CopyConstString - copies string contents from expr to des
    1197                 :             :                      and retain the kind of string.
    1198                 :             : */
    1199                 :             : 
    1200                 :             : extern "C" void SymbolTable_CopyConstString (unsigned int tok, unsigned int des, unsigned int expr);
    1201                 :             : 
    1202                 :             : /*
    1203                 :             :    IsConstStringKnown - returns TRUE if sym is a const string
    1204                 :             :                         and the contents are known.
    1205                 :             : */
    1206                 :             : 
    1207                 :             : extern "C" bool SymbolTable_IsConstStringKnown (unsigned int sym);
    1208                 :             : 
    1209                 :             : /*
    1210                 :             :    IsConstStringM2 - returns whether this conststring is a
    1211                 :             :                      Modula-2 string.
    1212                 :             : */
    1213                 :             : 
    1214                 :             : extern "C" bool SymbolTable_IsConstStringM2 (unsigned int sym);
    1215                 :             : 
    1216                 :             : /*
    1217                 :             :    IsConstStringC - returns whether this conststring is a C style string
    1218                 :             :                     which will have any escape translated.
    1219                 :             : */
    1220                 :             : 
    1221                 :             : extern "C" bool SymbolTable_IsConstStringC (unsigned int sym);
    1222                 :             : 
    1223                 :             : /*
    1224                 :             :    IsConstStringM2nul - returns whether this conststring is a Modula-2 string which
    1225                 :             :                         contains a nul terminator.
    1226                 :             : */
    1227                 :             : 
    1228                 :             : extern "C" bool SymbolTable_IsConstStringM2nul (unsigned int sym);
    1229                 :             : 
    1230                 :             : /*
    1231                 :             :    IsConstStringCnul - returns whether this conststring is a C style string
    1232                 :             :                        which will have any escape translated and also contains
    1233                 :             :                        a nul terminator.
    1234                 :             : */
    1235                 :             : 
    1236                 :             : extern "C" bool SymbolTable_IsConstStringCnul (unsigned int sym);
    1237                 :             : 
    1238                 :             : /*
    1239                 :             :    MakeSubrange - makes a new symbol into a subrange type with
    1240                 :             :                   name SubrangeName.
    1241                 :             : */
    1242                 :             : 
    1243                 :             : extern "C" unsigned int SymbolTable_MakeSubrange (unsigned int tok, NameKey_Name SubrangeName);
    1244                 :             : 
    1245                 :             : /*
    1246                 :             :    MakeSet - makes a set Symbol with name, SetName.
    1247                 :             : */
    1248                 :             : 
    1249                 :             : extern "C" unsigned int SymbolTable_MakeSet (unsigned int tok, NameKey_Name SetName);
    1250                 :             : 
    1251                 :             : /*
    1252                 :             :    GetSetArray - return the set array for a large set.
    1253                 :             : */
    1254                 :             : 
    1255                 :             : extern "C" unsigned int SymbolTable_GetSetArray (unsigned int sym);
    1256                 :             : 
    1257                 :             : /*
    1258                 :             :    PutSetArray - places array into the setarray field.
    1259                 :             : */
    1260                 :             : 
    1261                 :             : extern "C" void SymbolTable_PutSetArray (unsigned int Sym, unsigned int array);
    1262                 :             : 
    1263                 :             : /*
    1264                 :             :    MakeSetArray - create an ARRAY simpletype OF BOOLEAN.
    1265                 :             : */
    1266                 :             : 
    1267                 :             : extern "C" unsigned int SymbolTable_MakeSetArray (unsigned int token, unsigned int subrangetype);
    1268                 :             : 
    1269                 :             : /*
    1270                 :             :    PutSetInWord - set the SetInWord boolean to value.
    1271                 :             : */
    1272                 :             : 
    1273                 :             : extern "C" void SymbolTable_PutSetInWord (unsigned int sym, bool value);
    1274                 :             : 
    1275                 :             : /*
    1276                 :             :    GetSetInWord - return SetInWord.
    1277                 :             : */
    1278                 :             : 
    1279                 :             : extern "C" bool SymbolTable_GetSetInWord (unsigned int sym);
    1280                 :             : 
    1281                 :             : /*
    1282                 :             :    MakeArray - makes an Array symbol with name ArrayName.
    1283                 :             : */
    1284                 :             : 
    1285                 :             : extern "C" unsigned int SymbolTable_MakeArray (unsigned int tok, NameKey_Name ArrayName);
    1286                 :             : 
    1287                 :             : /*
    1288                 :             :    PutArrayLarge - indicates that this is a large array in which case
    1289                 :             :                    the interface to gcc maps this array from 0..high-low,
    1290                 :             :                    using an integer indice.
    1291                 :             : */
    1292                 :             : 
    1293                 :             : extern "C" void SymbolTable_PutArrayLarge (unsigned int array);
    1294                 :             : 
    1295                 :             : /*
    1296                 :             :    IsArrayLarge - returns TRUE if we need to treat this as a large array.
    1297                 :             : */
    1298                 :             : 
    1299                 :             : extern "C" bool SymbolTable_IsArrayLarge (unsigned int array);
    1300                 :             : 
    1301                 :             : /*
    1302                 :             :    PutPriority - places a interrupt, priority, value into module, module.
    1303                 :             : */
    1304                 :             : 
    1305                 :             : extern "C" void SymbolTable_PutPriority (unsigned int module, unsigned int priority);
    1306                 :             : 
    1307                 :             : /*
    1308                 :             :    GetPriority - returns the interrupt priority which was assigned to
    1309                 :             :                  module, module.
    1310                 :             : */
    1311                 :             : 
    1312                 :             : extern "C" unsigned int SymbolTable_GetPriority (unsigned int module);
    1313                 :             : 
    1314                 :             : /*
    1315                 :             :    PutNeedSavePriority - set a boolean flag indicating that this procedure
    1316                 :             :                          needs to save and restore interrupts.
    1317                 :             : */
    1318                 :             : 
    1319                 :             : extern "C" void SymbolTable_PutNeedSavePriority (unsigned int sym);
    1320                 :             : 
    1321                 :             : /*
    1322                 :             :    GetNeedSavePriority - returns the boolean flag indicating whether this procedure
    1323                 :             :                          needs to save and restore interrupts.
    1324                 :             : */
    1325                 :             : 
    1326                 :             : extern "C" bool SymbolTable_GetNeedSavePriority (unsigned int sym);
    1327                 :             : 
    1328                 :             : /*
    1329                 :             :    PutVariableAtAddress - determines that a variable, sym, is declared at
    1330                 :             :                           a specific address.
    1331                 :             : */
    1332                 :             : 
    1333                 :             : extern "C" void SymbolTable_PutVariableAtAddress (unsigned int sym, unsigned int address);
    1334                 :             : 
    1335                 :             : /*
    1336                 :             :    GetVariableAtAddress - returns the address at which variable, sym, is declared.
    1337                 :             : */
    1338                 :             : 
    1339                 :             : extern "C" unsigned int SymbolTable_GetVariableAtAddress (unsigned int sym);
    1340                 :             : 
    1341                 :             : /*
    1342                 :             :    IsVariableAtAddress - returns TRUE if a variable, sym, was declared at
    1343                 :             :                          a specific address.
    1344                 :             : */
    1345                 :             : 
    1346                 :             : extern "C" bool SymbolTable_IsVariableAtAddress (unsigned int sym);
    1347                 :             : 
    1348                 :             : /*
    1349                 :             :    PutVariableSSA - assigns value to the SSA field within variable sym.
    1350                 :             : */
    1351                 :             : 
    1352                 :             : extern "C" void SymbolTable_PutVariableSSA (unsigned int sym, bool value);
    1353                 :             : 
    1354                 :             : /*
    1355                 :             :    IsVariableSSA - returns TRUE if variable is known to be a SSA.
    1356                 :             : */
    1357                 :             : 
    1358                 :             : extern "C" bool SymbolTable_IsVariableSSA (unsigned int sym);
    1359                 :             : 
    1360                 :             : /*
    1361                 :             :    PutVarConst - sets the IsConst field to value indicating the variable is read only.
    1362                 :             : */
    1363                 :             : 
    1364                 :             : extern "C" void SymbolTable_PutVarConst (unsigned int sym, bool value);
    1365                 :             : 
    1366                 :             : /*
    1367                 :             :    MakeGnuAsm - create a GnuAsm symbol.
    1368                 :             : */
    1369                 :             : 
    1370                 :             : extern "C" unsigned int SymbolTable_MakeGnuAsm (void);
    1371                 :             : 
    1372                 :             : /*
    1373                 :             :    PutGnuAsm - places the instruction textual name into the GnuAsm symbol.
    1374                 :             : */
    1375                 :             : 
    1376                 :             : extern "C" void SymbolTable_PutGnuAsm (unsigned int sym, unsigned int string);
    1377                 :             : 
    1378                 :             : /*
    1379                 :             :    PutGnuAsmOutput - places the interface object, out, into GnuAsm symbol, sym.
    1380                 :             : */
    1381                 :             : 
    1382                 :             : extern "C" void SymbolTable_PutGnuAsmOutput (unsigned int sym, unsigned int out);
    1383                 :             : 
    1384                 :             : /*
    1385                 :             :    PutGnuAsmInput - places the interface object, in, into GnuAsm symbol, sym.
    1386                 :             : */
    1387                 :             : 
    1388                 :             : extern "C" void SymbolTable_PutGnuAsmInput (unsigned int sym, unsigned int in);
    1389                 :             : 
    1390                 :             : /*
    1391                 :             :    PutGnuAsmTrash - places the interface object, trash, into GnuAsm symbol, sym.
    1392                 :             : */
    1393                 :             : 
    1394                 :             : extern "C" void SymbolTable_PutGnuAsmTrash (unsigned int sym, unsigned int trash);
    1395                 :             : 
    1396                 :             : /*
    1397                 :             :    GetGnuAsm - returns the string symbol, representing the instruction textual
    1398                 :             :                of the GnuAsm symbol. It will return a ConstString.
    1399                 :             : */
    1400                 :             : 
    1401                 :             : extern "C" unsigned int SymbolTable_GetGnuAsm (unsigned int sym);
    1402                 :             : 
    1403                 :             : /*
    1404                 :             :    GetGnuAsmInput - returns the input list of registers.
    1405                 :             : */
    1406                 :             : 
    1407                 :             : extern "C" unsigned int SymbolTable_GetGnuAsmInput (unsigned int sym);
    1408                 :             : 
    1409                 :             : /*
    1410                 :             :    GetGnuAsmOutput - returns the output list of registers.
    1411                 :             : */
    1412                 :             : 
    1413                 :             : extern "C" unsigned int SymbolTable_GetGnuAsmOutput (unsigned int sym);
    1414                 :             : 
    1415                 :             : /*
    1416                 :             :    GetGnuAsmTrash - returns the list of trashed registers.
    1417                 :             : */
    1418                 :             : 
    1419                 :             : extern "C" unsigned int SymbolTable_GetGnuAsmTrash (unsigned int sym);
    1420                 :             : 
    1421                 :             : /*
    1422                 :             :    PutGnuAsmVolatile - defines a GnuAsm symbol as VOLATILE.
    1423                 :             : */
    1424                 :             : 
    1425                 :             : extern "C" void SymbolTable_PutGnuAsmVolatile (unsigned int Sym);
    1426                 :             : 
    1427                 :             : /*
    1428                 :             :    PutGnuAsmSimple - defines a GnuAsm symbol as a simple kind.
    1429                 :             : */
    1430                 :             : 
    1431                 :             : extern "C" void SymbolTable_PutGnuAsmSimple (unsigned int Sym);
    1432                 :             : 
    1433                 :             : /*
    1434                 :             :    MakeRegInterface - creates and returns a register interface symbol.
    1435                 :             : */
    1436                 :             : 
    1437                 :             : extern "C" unsigned int SymbolTable_MakeRegInterface (void);
    1438                 :             : 
    1439                 :             : /*
    1440                 :             :    PutRegInterface - places a, name, string, and, object, into the interface array,
    1441                 :             :                      sym, at position, i.
    1442                 :             :                      The string symbol will either be a register name or a constraint.
    1443                 :             :                      The object is an optional Modula-2 variable or constant symbol.
    1444                 :             :                      read and write are the quadruple numbers representing any read
    1445                 :             :                      or write operation.
    1446                 :             : */
    1447                 :             : 
    1448                 :             : extern "C" void SymbolTable_PutRegInterface (unsigned int tok, unsigned int sym, unsigned int i, NameKey_Name n, unsigned int string, unsigned int object, unsigned int read_, unsigned int write_);
    1449                 :             : 
    1450                 :             : /*
    1451                 :             :    GetRegInterface - gets a, name, string, and, object, from the interface array,
    1452                 :             :                      sym, from position, i.
    1453                 :             : */
    1454                 :             : 
    1455                 :             : extern "C" void SymbolTable_GetRegInterface (unsigned int sym, unsigned int i, unsigned int *tok, NameKey_Name *n, unsigned int *string, unsigned int *object);
    1456                 :             : 
    1457                 :             : /*
    1458                 :             :    GetModule - Returns the Module symbol for the module with name, name.
    1459                 :             : */
    1460                 :             : 
    1461                 :             : extern "C" unsigned int SymbolTable_GetModule (NameKey_Name name);
    1462                 :             : 
    1463                 :             : /*
    1464                 :             :    GetCurrentModule - returns the current module Sym that is being
    1465                 :             :                       compiled.
    1466                 :             : */
    1467                 :             : 
    1468                 :             : extern "C" unsigned int SymbolTable_GetCurrentModule (void);
    1469                 :             : 
    1470                 :             : /*
    1471                 :             :    GetFileModule - returns the FileModule symbol that was requested by
    1472                 :             :                    the user to be compiled.
    1473                 :             : */
    1474                 :             : 
    1475                 :             : extern "C" unsigned int SymbolTable_GetFileModule (void);
    1476                 :             : 
    1477                 :             : /*
    1478                 :             :    GetBaseModule - returns the base module symbol that contains Modula-2
    1479                 :             :                    base types, procedures and functions.
    1480                 :             : */
    1481                 :             : 
    1482                 :             : extern "C" unsigned int SymbolTable_GetBaseModule (void);
    1483                 :             : 
    1484                 :             : /*
    1485                 :             :    GetMainModule - returns the main module symbol that was requested by
    1486                 :             :                    the user to be compiled.
    1487                 :             : */
    1488                 :             : 
    1489                 :             : extern "C" unsigned int SymbolTable_GetMainModule (void);
    1490                 :             : 
    1491                 :             : /*
    1492                 :             :    GetCurrentModuleScope - returns the module symbol which forms the
    1493                 :             :                            current (possibly inner most) module.
    1494                 :             : */
    1495                 :             : 
    1496                 :             : extern "C" unsigned int SymbolTable_GetCurrentModuleScope (void);
    1497                 :             : 
    1498                 :             : /*
    1499                 :             :    GetLastModuleScope - returns the last module scope encountered,
    1500                 :             :                         the module scope before the Current Module Scope.
    1501                 :             : */
    1502                 :             : 
    1503                 :             : extern "C" unsigned int SymbolTable_GetLastModuleScope (void);
    1504                 :             : 
    1505                 :             : /*
    1506                 :             :    AddSymToModuleScope - adds a symbol, Sym, to the scope of the module
    1507                 :             :                          ModSym.
    1508                 :             : */
    1509                 :             : 
    1510                 :             : extern "C" void SymbolTable_AddSymToModuleScope (unsigned int ModSym, unsigned int Sym);
    1511                 :             : 
    1512                 :             : /*
    1513                 :             :    GetType - Returns the symbol that is the TYPE symbol to Sym.
    1514                 :             :              If zero is returned then we assume type unknown.
    1515                 :             : */
    1516                 :             : 
    1517                 :             : extern "C" unsigned int SymbolTable_GetType (unsigned int Sym);
    1518                 :             : 
    1519                 :             : /*
    1520                 :             :    SkipType - if sym is a TYPE foo = bar
    1521                 :             :               then call SkipType(bar)
    1522                 :             :               else return sym
    1523                 :             : 
    1524                 :             :               it does not skip over hidden types.
    1525                 :             : */
    1526                 :             : 
    1527                 :             : extern "C" unsigned int SymbolTable_SkipType (unsigned int Sym);
    1528                 :             : 
    1529                 :             : /*
    1530                 :             :    SkipTypeAndSubrange - if sym is a TYPE foo = bar OR
    1531                 :             :                             sym is declared as a subrange of bar
    1532                 :             :                          then call SkipTypeAndSubrange(bar)
    1533                 :             :                          else return sym
    1534                 :             : 
    1535                 :             :                          it does not skip over hidden types.
    1536                 :             : */
    1537                 :             : 
    1538                 :             : extern "C" unsigned int SymbolTable_SkipTypeAndSubrange (unsigned int Sym);
    1539                 :             : 
    1540                 :             : /*
    1541                 :             :    GetLowestType - Returns the lowest type in the type chain of
    1542                 :             :                    symbol Sym.
    1543                 :             :                    If NulSym is returned then we assume type unknown or
    1544                 :             :                    you have reqested the type of a base type.
    1545                 :             : */
    1546                 :             : 
    1547                 :             : extern "C" unsigned int SymbolTable_GetLowestType (unsigned int Sym);
    1548                 :             : 
    1549                 :             : /*
    1550                 :             :    GetLType - get lowest type.  It returns the lowest type
    1551                 :             :               of symbol, sym.  It skips over type equivalences.
    1552                 :             :               It will not skip over base types.
    1553                 :             : */
    1554                 :             : 
    1555                 :             : extern "C" unsigned int SymbolTable_GetLType (unsigned int sym);
    1556                 :             : 
    1557                 :             : /*
    1558                 :             :    GetSType - get source type.  It returns the type closest
    1559                 :             :               to the object.  It does not skip over type
    1560                 :             :               equivalences.  It will skip over base types.
    1561                 :             : */
    1562                 :             : 
    1563                 :             : extern "C" unsigned int SymbolTable_GetSType (unsigned int sym);
    1564                 :             : 
    1565                 :             : /*
    1566                 :             :    GetDType - get gcc declared type.  It returns the type
    1567                 :             :               of the object which is declared to GCC.
    1568                 :             :               It does skip over type equivalences but only
    1569                 :             :               if they do not contain a user alignment.
    1570                 :             :               It does not skip over hidden types.
    1571                 :             :               It does not skip over base types.
    1572                 :             : */
    1573                 :             : 
    1574                 :             : extern "C" unsigned int SymbolTable_GetDType (unsigned int sym);
    1575                 :             : 
    1576                 :             : /*
    1577                 :             :    GetTypeMode - return the type of sym, it returns Address is the
    1578                 :             :                  symbol is a LValue.
    1579                 :             : */
    1580                 :             : 
    1581                 :             : extern "C" unsigned int SymbolTable_GetTypeMode (unsigned int sym);
    1582                 :             : 
    1583                 :             : /*
    1584                 :             :    GetSym - searches the current scope (and previous scopes if the
    1585                 :             :             scope tranparent allows) for a symbol with name.
    1586                 :             : */
    1587                 :             : 
    1588                 :             : extern "C" unsigned int SymbolTable_GetSym (NameKey_Name name);
    1589                 :             : 
    1590                 :             : /*
    1591                 :             :    GetDeclareSym - searches for a symbol with a name SymName in the
    1592                 :             :                    current and previous scopes.
    1593                 :             :                    If the symbol is found then it is returned
    1594                 :             :                    else an unknown symbol is returned.
    1595                 :             :                    This procedure assumes that SymName is being
    1596                 :             :                    declared at this point and therefore it does
    1597                 :             :                    not examine the base scope (for pervasive
    1598                 :             :                    identifiers).
    1599                 :             : */
    1600                 :             : 
    1601                 :             : extern "C" unsigned int SymbolTable_GetDeclareSym (unsigned int tok, NameKey_Name SymName);
    1602                 :             : 
    1603                 :             : /*
    1604                 :             :    GetLocalSym - only searches the scope Sym for a symbol with name
    1605                 :             :                  and returns the index to the symbol.
    1606                 :             : */
    1607                 :             : 
    1608                 :             : extern "C" unsigned int SymbolTable_GetLocalSym (unsigned int Sym, NameKey_Name name);
    1609                 :             : 
    1610                 :             : /*
    1611                 :             :    GetRecord - fetches the record symbol from the parent of Sym.
    1612                 :             :                Sym maybe a varient symbol in which case its parent is searched
    1613                 :             :                etc.
    1614                 :             : */
    1615                 :             : 
    1616                 :             : extern "C" unsigned int SymbolTable_GetRecord (unsigned int Sym);
    1617                 :             : 
    1618                 :             : /*
    1619                 :             :    FromModuleGetSym - attempts to find a symbol of name, n, in the
    1620                 :             :                       module, mod, scope.  An unknown symbol is created
    1621                 :             :                       at token position tok if necessary.
    1622                 :             : */
    1623                 :             : 
    1624                 :             : extern "C" unsigned int SymbolTable_FromModuleGetSym (unsigned int tok, NameKey_Name n, unsigned int mod);
    1625                 :             : 
    1626                 :             : /*
    1627                 :             :    GetNth - returns the n th symbol in the list associated with the scope
    1628                 :             :             of Sym.  Sym may be a Module, DefImp, Procedure, Record or
    1629                 :             :             Enumeration symbol.
    1630                 :             : */
    1631                 :             : 
    1632                 :             : extern "C" unsigned int SymbolTable_GetNth (unsigned int Sym, unsigned int n);
    1633                 :             : 
    1634                 :             : /*
    1635                 :             :    GetNthParam - returns the n th parameter of a procedure Sym.
    1636                 :             : */
    1637                 :             : 
    1638                 :             : extern "C" unsigned int SymbolTable_GetNthParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo);
    1639                 :             : 
    1640                 :             : /*
    1641                 :             :    GetVarScope - returns the symbol which is the scope of variable Sym.
    1642                 :             :                  ie a Module, DefImp or Procedure Symbol.
    1643                 :             : */
    1644                 :             : 
    1645                 :             : extern "C" unsigned int SymbolTable_GetVarScope (unsigned int Sym);
    1646                 :             : 
    1647                 :             : /*
    1648                 :             :    GetSubrange - returns HighSym and LowSym - two constants which make up the
    1649                 :             :                  subrange.
    1650                 :             : */
    1651                 :             : 
    1652                 :             : extern "C" void SymbolTable_GetSubrange (unsigned int Sym, unsigned int *HighSym, unsigned int *LowSym);
    1653                 :             : 
    1654                 :             : /*
    1655                 :             :    GetParam - returns the ParamNo parameter from procedure ProcSym
    1656                 :             : */
    1657                 :             : 
    1658                 :             : extern "C" unsigned int SymbolTable_GetParam (unsigned int Sym, unsigned int ParamNo);
    1659                 :             : 
    1660                 :             : /*
    1661                 :             :    GetString - returns the contents of the string symbol sym, note that
    1662                 :             :                this is not the same as GetName (unless it was a literal).
    1663                 :             : */
    1664                 :             : 
    1665                 :             : extern "C" NameKey_Name SymbolTable_GetString (unsigned int Sym);
    1666                 :             : 
    1667                 :             : /*
    1668                 :             :    GetStringLength - returns the length of the string symbol Sym.
    1669                 :             : */
    1670                 :             : 
    1671                 :             : extern "C" unsigned int SymbolTable_GetStringLength (unsigned int tok, unsigned int sym);
    1672                 :             : 
    1673                 :             : /*
    1674                 :             :    GetProcedureBuiltin - returns the builtin name for the equivalent procedure, Sym.
    1675                 :             : */
    1676                 :             : 
    1677                 :             : extern "C" NameKey_Name SymbolTable_GetProcedureBuiltin (unsigned int Sym);
    1678                 :             : 
    1679                 :             : /*
    1680                 :             :    PutProcedureBuiltin - assigns the builtin name for the equivalent procedure, Sym.
    1681                 :             : */
    1682                 :             : 
    1683                 :             : extern "C" void SymbolTable_PutProcedureBuiltin (unsigned int Sym, NameKey_Name name);
    1684                 :             : 
    1685                 :             : /*
    1686                 :             :    IsProcedureBuiltin - returns TRUE if this procedure has a builtin equivalent.
    1687                 :             : */
    1688                 :             : 
    1689                 :             : extern "C" bool SymbolTable_IsProcedureBuiltin (unsigned int Sym);
    1690                 :             : 
    1691                 :             : /*
    1692                 :             :    PutProcedureInline - determines that procedure, Sym, has been requested to be inlined.
    1693                 :             : */
    1694                 :             : 
    1695                 :             : extern "C" void SymbolTable_PutProcedureInline (unsigned int Sym);
    1696                 :             : extern "C" bool SymbolTable_IsProcedureInline (unsigned int Sym);
    1697                 :             : 
    1698                 :             : /*
    1699                 :             :    PutExceptionBlock - sets a BOOLEAN in block module/procedure/defimp,
    1700                 :             :                        sym, indicating that this block as an EXCEPT
    1701                 :             :                        statement sequence.
    1702                 :             : */
    1703                 :             : 
    1704                 :             : extern "C" void SymbolTable_PutExceptionBlock (unsigned int sym);
    1705                 :             : 
    1706                 :             : /*
    1707                 :             :    HasExceptionBlock - returns a BOOLEAN determining whether
    1708                 :             :                        module/procedure/defimp, sym, has
    1709                 :             :                        an EXCEPT statement sequence.
    1710                 :             : */
    1711                 :             : 
    1712                 :             : extern "C" bool SymbolTable_HasExceptionBlock (unsigned int sym);
    1713                 :             : 
    1714                 :             : /*
    1715                 :             :    PutExceptionFinally - sets a BOOLEAN in block module/defimp,
    1716                 :             :                          sym, indicating that this FINALLY block
    1717                 :             :                          as an EXCEPT statement sequence.
    1718                 :             : */
    1719                 :             : 
    1720                 :             : extern "C" void SymbolTable_PutExceptionFinally (unsigned int sym);
    1721                 :             : 
    1722                 :             : /*
    1723                 :             :    HasExceptionFinally - returns a BOOLEAN determining whether
    1724                 :             :                          module/defimp, sym, has
    1725                 :             :                          an EXCEPT statement sequence.
    1726                 :             : */
    1727                 :             : 
    1728                 :             : extern "C" bool SymbolTable_HasExceptionFinally (unsigned int sym);
    1729                 :             : 
    1730                 :             : /*
    1731                 :             :    PutVar - gives the VarSym symbol Sym a type Type.
    1732                 :             : */
    1733                 :             : 
    1734                 :             : extern "C" void SymbolTable_PutVar (unsigned int Sym, unsigned int VarType);
    1735                 :             : 
    1736                 :             : /*
    1737                 :             :    PutVarTok - gives the VarSym symbol Sym a type Type at typetok.
    1738                 :             : */
    1739                 :             : 
    1740                 :             : extern "C" void SymbolTable_PutVarTok (unsigned int Sym, unsigned int VarType, unsigned int typetok);
    1741                 :             : 
    1742                 :             : /*
    1743                 :             :    PutLeftValueFrontBackType - gives the variable symbol a front and backend type.
    1744                 :             :                                The variable must be a LeftValue.
    1745                 :             : */
    1746                 :             : 
    1747                 :             : extern "C" void SymbolTable_PutLeftValueFrontBackType (unsigned int Sym, unsigned int FrontType, unsigned int BackType);
    1748                 :             : 
    1749                 :             : /*
    1750                 :             :    GetVarBackEndType - returns the back end type if specified.
    1751                 :             : */
    1752                 :             : 
    1753                 :             : extern "C" unsigned int SymbolTable_GetVarBackEndType (unsigned int Sym);
    1754                 :             : 
    1755                 :             : /*
    1756                 :             :    PutVarPointerCheck - marks variable, sym, as requiring (or not
    1757                 :             :                         depending upon the, value), a NIL pointer check
    1758                 :             :                         when this symbol is dereferenced.
    1759                 :             : */
    1760                 :             : 
    1761                 :             : extern "C" void SymbolTable_PutVarPointerCheck (unsigned int sym, bool value);
    1762                 :             : 
    1763                 :             : /*
    1764                 :             :    GetVarPointerCheck - returns TRUE if this symbol is a variable and
    1765                 :             :                         has been marked as needing a pointer via NIL check.
    1766                 :             : */
    1767                 :             : 
    1768                 :             : extern "C" bool SymbolTable_GetVarPointerCheck (unsigned int sym);
    1769                 :             : 
    1770                 :             : /*
    1771                 :             :    PutVarWritten - marks variable, sym, as being written to (or not
    1772                 :             :                    depending upon the, value).
    1773                 :             : */
    1774                 :             : 
    1775                 :             : extern "C" void SymbolTable_PutVarWritten (unsigned int sym, bool value);
    1776                 :             : 
    1777                 :             : /*
    1778                 :             :    GetVarWritten - returns TRUE if this symbol is a variable and
    1779                 :             :                    has been marked as being written.
    1780                 :             : */
    1781                 :             : 
    1782                 :             : extern "C" bool SymbolTable_GetVarWritten (unsigned int sym);
    1783                 :             : 
    1784                 :             : /*
    1785                 :             :    PutConst - gives the constant symbol Sym a type ConstType.
    1786                 :             : */
    1787                 :             : 
    1788                 :             : extern "C" void SymbolTable_PutConst (unsigned int Sym, unsigned int ConstType);
    1789                 :             : 
    1790                 :             : /*
    1791                 :             :    PutConstSet - informs the const var symbol, sym, that it is or will contain
    1792                 :             :                  a set value.
    1793                 :             : */
    1794                 :             : 
    1795                 :             : extern "C" void SymbolTable_PutConstSet (unsigned int Sym);
    1796                 :             : 
    1797                 :             : /*
    1798                 :             :    IsConstSet - returns TRUE if the constant is declared as a set.
    1799                 :             : */
    1800                 :             : 
    1801                 :             : extern "C" bool SymbolTable_IsConstSet (unsigned int Sym);
    1802                 :             : 
    1803                 :             : /*
    1804                 :             :    PutConstructor - informs the const var symbol, sym, that it is or
    1805                 :             :                     will contain a constructor (record, set or array)
    1806                 :             :                     value.
    1807                 :             : */
    1808                 :             : 
    1809                 :             : extern "C" void SymbolTable_PutConstructor (unsigned int Sym);
    1810                 :             : 
    1811                 :             : /*
    1812                 :             :    PutConstructorFrom - sets the from type field in constructor,
    1813                 :             :                         Sym, to, from.
    1814                 :             : */
    1815                 :             : 
    1816                 :             : extern "C" void SymbolTable_PutConstructorFrom (unsigned int Sym, unsigned int from);
    1817                 :             : 
    1818                 :             : /*
    1819                 :             :    PutFieldRecord - places a field, FieldName and FieldType into a record, Sym.
    1820                 :             :                     VarSym is a optional varient symbol which can be returned
    1821                 :             :                     by a call to GetVarient(fieldsymbol).  The created field
    1822                 :             :                     is returned.
    1823                 :             : */
    1824                 :             : 
    1825                 :             : extern "C" unsigned int SymbolTable_PutFieldRecord (unsigned int Sym, NameKey_Name FieldName, unsigned int FieldType, unsigned int VarSym);
    1826                 :             : 
    1827                 :             : /*
    1828                 :             :    PutFieldVarient - places the field varient, Field, as a brother to, the
    1829                 :             :                      varient symbol, sym, and also tells Field that its varient
    1830                 :             :                      parent is Sym.
    1831                 :             : */
    1832                 :             : 
    1833                 :             : extern "C" void SymbolTable_PutFieldVarient (unsigned int Field, unsigned int Sym);
    1834                 :             : 
    1835                 :             : /*
    1836                 :             :    GetVarient - returns the varient symbol associated with the
    1837                 :             :                 record or varient field symbol, Field.
    1838                 :             : */
    1839                 :             : 
    1840                 :             : extern "C" unsigned int SymbolTable_GetVarient (unsigned int Field);
    1841                 :             : 
    1842                 :             : /*
    1843                 :             :    IsRecordFieldAVarientTag - returns TRUE if record field, sym, is
    1844                 :             :                               a varient tag.
    1845                 :             : */
    1846                 :             : 
    1847                 :             : extern "C" bool SymbolTable_IsRecordFieldAVarientTag (unsigned int sym);
    1848                 :             : 
    1849                 :             : /*
    1850                 :             :    IsEmptyFieldVarient - returns TRUE if the field variant has
    1851                 :             :                          no fields.  This will occur then the
    1852                 :             :                          compiler constructs 'else end' variants.
    1853                 :             : */
    1854                 :             : 
    1855                 :             : extern "C" bool SymbolTable_IsEmptyFieldVarient (unsigned int sym);
    1856                 :             : 
    1857                 :             : /*
    1858                 :             :    GetVarientTag - returns the varient tag from, Sym.
    1859                 :             : */
    1860                 :             : 
    1861                 :             : extern "C" unsigned int SymbolTable_GetVarientTag (unsigned int Sym);
    1862                 :             : 
    1863                 :             : /*
    1864                 :             :    PutVarientTag - places, Tag, into varient, Sym.
    1865                 :             : */
    1866                 :             : 
    1867                 :             : extern "C" void SymbolTable_PutVarientTag (unsigned int Sym, unsigned int Tag);
    1868                 :             : 
    1869                 :             : /*
    1870                 :             :    PutFieldEnumeration - places a field into the enumeration type
    1871                 :             :                          Sym. The field has a name FieldName and a
    1872                 :             :                          value FieldVal.
    1873                 :             : */
    1874                 :             : 
    1875                 :             : extern "C" void SymbolTable_PutFieldEnumeration (unsigned int tok, unsigned int Sym, NameKey_Name FieldName);
    1876                 :             : 
    1877                 :             : /*
    1878                 :             :    PutSubrange - places LowSym and HighSym as two symbols
    1879                 :             :                  which provide the limits of the range.
    1880                 :             : */
    1881                 :             : 
    1882                 :             : extern "C" void SymbolTable_PutSubrange (unsigned int Sym, unsigned int LowSym, unsigned int HighSym, unsigned int TypeSymbol);
    1883                 :             : 
    1884                 :             : /*
    1885                 :             :    PutSet - places SimpleType as the type for set, Sym.
    1886                 :             : */
    1887                 :             : 
    1888                 :             : extern "C" void SymbolTable_PutSet (unsigned int Sym, unsigned int SimpleType, bool packed);
    1889                 :             : 
    1890                 :             : /*
    1891                 :             :    IsSetPacked - returns TRUE if Sym is packed.
    1892                 :             : */
    1893                 :             : 
    1894                 :             : extern "C" bool SymbolTable_IsSetPacked (unsigned int Sym);
    1895                 :             : 
    1896                 :             : /*
    1897                 :             :    GetArraySubscript - returns the subscript symbol for array, Sym.
    1898                 :             : */
    1899                 :             : 
    1900                 :             : extern "C" unsigned int SymbolTable_GetArraySubscript (unsigned int Sym);
    1901                 :             : 
    1902                 :             : /*
    1903                 :             :    PutArraySubscript - places an index field into the array Sym. The
    1904                 :             :                        index field is a subscript sym.
    1905                 :             : */
    1906                 :             : 
    1907                 :             : extern "C" void SymbolTable_PutArraySubscript (unsigned int Sym, unsigned int SubscriptSymbol);
    1908                 :             : 
    1909                 :             : /*
    1910                 :             :    PutType - gives a type symbol Sym type TypeSymbol.
    1911                 :             : */
    1912                 :             : 
    1913                 :             : extern "C" void SymbolTable_PutType (unsigned int Sym, unsigned int TypeSymbol);
    1914                 :             : 
    1915                 :             : /*
    1916                 :             :    PutFunction - Places a TypeSym as the return type to a procedure Sym.
    1917                 :             : */
    1918                 :             : 
    1919                 :             : extern "C" void SymbolTable_PutFunction (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int TypeSym);
    1920                 :             : 
    1921                 :             : /*
    1922                 :             :    PutOptFunction - places a TypeSym as the optional return type to a procedure Sym.
    1923                 :             : */
    1924                 :             : 
    1925                 :             : extern "C" void SymbolTable_PutOptFunction (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int TypeSym);
    1926                 :             : 
    1927                 :             : /*
    1928                 :             :    IsReturnOptional - returns TRUE if the return value for, sym, is
    1929                 :             :                       optional.
    1930                 :             : */
    1931                 :             : 
    1932                 :             : extern "C" bool SymbolTable_IsReturnOptional (unsigned int sym, SymbolTable_ProcedureKind kind);
    1933                 :             : 
    1934                 :             : /*
    1935                 :             :    IsReturnOptionalAny - returns TRUE if the return value for sym is
    1936                 :             :                          optional.
    1937                 :             : */
    1938                 :             : 
    1939                 :             : extern "C" bool SymbolTable_IsReturnOptionalAny (unsigned int sym);
    1940                 :             : 
    1941                 :             : /*
    1942                 :             :    PutParam - Places a Non VAR parameter ParamName with type ParamType into
    1943                 :             :               procedure Sym:kind.  The parameter number is ParamNo.
    1944                 :             :               If the procedure Sym already has this parameter then
    1945                 :             :               the parameter is checked for consistancy and the
    1946                 :             :               consistancy test is returned.
    1947                 :             : */
    1948                 :             : 
    1949                 :             : extern "C" bool SymbolTable_PutParam (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo, NameKey_Name ParamName, unsigned int ParamType, bool isUnbounded, unsigned int typetok);
    1950                 :             : 
    1951                 :             : /*
    1952                 :             :    PutVarParam - Places a Non VAR parameter ParamName with type
    1953                 :             :                  ParamType into procedure Sym:kind.
    1954                 :             :                  The parameter number is ParamNo.
    1955                 :             :                  If the procedure Sym already has this parameter then
    1956                 :             :                  the parameter is checked for consistancy and the
    1957                 :             :                  consistancy test is returned.
    1958                 :             : */
    1959                 :             : 
    1960                 :             : extern "C" bool SymbolTable_PutVarParam (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo, NameKey_Name ParamName, unsigned int ParamType, bool isUnbounded, unsigned int typetok);
    1961                 :             : 
    1962                 :             : /*
    1963                 :             :    PutParamName - assigns a name to paramater no of procedure ProcSym:kind.
    1964                 :             : */
    1965                 :             : 
    1966                 :             : extern "C" void SymbolTable_PutParamName (unsigned int tok, unsigned int ProcSym, SymbolTable_ProcedureKind kind, unsigned int no, NameKey_Name name, unsigned int ParamType, unsigned int typetok);
    1967                 :             : 
    1968                 :             : /*
    1969                 :             :    PutProcedureReachable - Sets the procedure, Sym, to be reachable by the
    1970                 :             :                            main Module.
    1971                 :             : */
    1972                 :             : 
    1973                 :             : extern "C" void SymbolTable_PutProcedureReachable (unsigned int Sym);
    1974                 :             : 
    1975                 :             : /*
    1976                 :             :    IsProcedureReachable - Returns true if the procedure, Sym, is
    1977                 :             :                           reachable from the main Module.
    1978                 :             : */
    1979                 :             : 
    1980                 :             : extern "C" bool SymbolTable_IsProcedureReachable (unsigned int Sym);
    1981                 :             : 
    1982                 :             : /*
    1983                 :             :    PutProcedureNoReturn - places value into the no return attribute
    1984                 :             :                           field of procedure sym.
    1985                 :             : */
    1986                 :             : 
    1987                 :             : extern "C" void SymbolTable_PutProcedureNoReturn (unsigned int Sym, SymbolTable_ProcedureKind kind, bool value);
    1988                 :             : 
    1989                 :             : /*
    1990                 :             :    IsProcedureNoReturn - returns TRUE if this procedure never returns.
    1991                 :             : */
    1992                 :             : 
    1993                 :             : extern "C" bool SymbolTable_IsProcedureNoReturn (unsigned int Sym, SymbolTable_ProcedureKind kind);
    1994                 :             : 
    1995                 :             : /*
    1996                 :             :    GetProcedureProcType - returns the proctype matching procedure sym.
    1997                 :             : */
    1998                 :             : 
    1999                 :             : extern "C" unsigned int SymbolTable_GetProcedureProcType (unsigned int sym);
    2000                 :             : 
    2001                 :             : /*
    2002                 :             :    PutModuleStartQuad - Places QuadNumber into the Module symbol, Sym.
    2003                 :             :                         QuadNumber is the start quad of Module,
    2004                 :             :                         Sym.
    2005                 :             : */
    2006                 :             : 
    2007                 :             : extern "C" void SymbolTable_PutModuleStartQuad (unsigned int Sym, unsigned int QuadNumber);
    2008                 :             : 
    2009                 :             : /*
    2010                 :             :    PutModuleEndQuad - Places QuadNumber into the Module symbol, Sym.
    2011                 :             :                       QuadNumber is the end quad of Module,
    2012                 :             :                       Sym.
    2013                 :             : */
    2014                 :             : 
    2015                 :             : extern "C" void SymbolTable_PutModuleEndQuad (unsigned int Sym, unsigned int QuadNumber);
    2016                 :             : 
    2017                 :             : /*
    2018                 :             :    PutModuleFinallyStartQuad - Places QuadNumber into the Module symbol, Sym.
    2019                 :             :                                QuadNumber is the finally start quad of
    2020                 :             :                                Module, Sym.
    2021                 :             : */
    2022                 :             : 
    2023                 :             : extern "C" void SymbolTable_PutModuleFinallyStartQuad (unsigned int Sym, unsigned int QuadNumber);
    2024                 :             : 
    2025                 :             : /*
    2026                 :             :    PutModuleFinallyEndQuad - Places QuadNumber into the Module symbol, Sym.
    2027                 :             :                              QuadNumber is the end quad of the finally block
    2028                 :             :                              in Module, Sym.
    2029                 :             : */
    2030                 :             : 
    2031                 :             : extern "C" void SymbolTable_PutModuleFinallyEndQuad (unsigned int Sym, unsigned int QuadNumber);
    2032                 :             : 
    2033                 :             : /*
    2034                 :             :    GetModuleQuads - Returns, StartInit EndInit StartFinish EndFinish,
    2035                 :             :                     Quads of a Module, Sym.
    2036                 :             :                     Start and End represent the initialization code
    2037                 :             :                     of the Module, Sym.
    2038                 :             : */
    2039                 :             : 
    2040                 :             : extern "C" void SymbolTable_GetModuleQuads (unsigned int Sym, unsigned int *StartInit, unsigned int *EndInit, unsigned int *StartFinish, unsigned int *EndFinish);
    2041                 :             : 
    2042                 :             : /*
    2043                 :             :    PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
    2044                 :             : */
    2045                 :             : 
    2046                 :             : extern "C" void SymbolTable_PutModuleFinallyFunction (unsigned int Sym, tree finally);
    2047                 :             : 
    2048                 :             : /*
    2049                 :             :    GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
    2050                 :             : */
    2051                 :             : 
    2052                 :             : extern "C" tree SymbolTable_GetModuleFinallyFunction (unsigned int Sym);
    2053                 :             : 
    2054                 :             : /*
    2055                 :             :    PutProcedureScopeQuad - Places QuadNumber into the Procedure symbol, Sym.
    2056                 :             :                            QuadNumber is the start quad of scope for procedure,
    2057                 :             :                            Sym.
    2058                 :             : */
    2059                 :             : 
    2060                 :             : extern "C" void SymbolTable_PutProcedureScopeQuad (unsigned int Sym, unsigned int QuadNumber);
    2061                 :             : 
    2062                 :             : /*
    2063                 :             :    PutProcedureStartQuad - Places QuadNumber into the Procedure symbol, Sym.
    2064                 :             :                            QuadNumber is the start quad of procedure,
    2065                 :             :                            Sym.
    2066                 :             : */
    2067                 :             : 
    2068                 :             : extern "C" void SymbolTable_PutProcedureStartQuad (unsigned int Sym, unsigned int QuadNumber);
    2069                 :             : 
    2070                 :             : /*
    2071                 :             :    PutProcedureEndQuad - Places QuadNumber into the Procedure symbol, Sym.
    2072                 :             :                          QuadNumber is the end quad of procedure,
    2073                 :             :                          Sym.
    2074                 :             : */
    2075                 :             : 
    2076                 :             : extern "C" void SymbolTable_PutProcedureEndQuad (unsigned int Sym, unsigned int QuadNumber);
    2077                 :             : 
    2078                 :             : /*
    2079                 :             :    GetProcedureQuads - Returns, Start and End, Quads of a procedure, Sym.
    2080                 :             : */
    2081                 :             : 
    2082                 :             : extern "C" void SymbolTable_GetProcedureQuads (unsigned int Sym, unsigned int *scope, unsigned int *start, unsigned int *end);
    2083                 :             : 
    2084                 :             : /*
    2085                 :             :    GetQuads - assigns Start and End to the beginning and end of
    2086                 :             :               symbol, Sym, usage.
    2087                 :             : */
    2088                 :             : 
    2089                 :             : extern "C" void SymbolTable_GetQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End);
    2090                 :             : 
    2091                 :             : /*
    2092                 :             :    GetReadQuads - assigns Start and End to the beginning and end of
    2093                 :             :                   symbol, Sym, read history usage.
    2094                 :             : */
    2095                 :             : 
    2096                 :             : extern "C" void SymbolTable_GetReadQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End);
    2097                 :             : 
    2098                 :             : /*
    2099                 :             :    GetWriteQuads - assigns Start and End to the beginning and end of
    2100                 :             :                    symbol, Sym, usage.
    2101                 :             : */
    2102                 :             : 
    2103                 :             : extern "C" void SymbolTable_GetWriteQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End);
    2104                 :             : 
    2105                 :             : /*
    2106                 :             :    PutReadQuad - places Quad into the list of symbol usage.
    2107                 :             : */
    2108                 :             : 
    2109                 :             : extern "C" void SymbolTable_PutReadQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad);
    2110                 :             : 
    2111                 :             : /*
    2112                 :             :    RemoveReadQuad - places Quad into the list of symbol usage.
    2113                 :             : */
    2114                 :             : 
    2115                 :             : extern "C" void SymbolTable_RemoveReadQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad);
    2116                 :             : 
    2117                 :             : /*
    2118                 :             :    PutWriteQuad - places Quad into the list of symbol usage.
    2119                 :             : */
    2120                 :             : 
    2121                 :             : extern "C" void SymbolTable_PutWriteQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad);
    2122                 :             : 
    2123                 :             : /*
    2124                 :             :    RemoveWriteQuad - places Quad into the list of symbol usage.
    2125                 :             : */
    2126                 :             : 
    2127                 :             : extern "C" void SymbolTable_RemoveWriteQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad);
    2128                 :             : 
    2129                 :             : /*
    2130                 :             :    GetReadLimitQuads - returns Start and End which have been assigned
    2131                 :             :                        the start and end of when the symbol was read
    2132                 :             :                        to within: StartLimit..EndLimit.
    2133                 :             : */
    2134                 :             : 
    2135                 :             : extern "C" void SymbolTable_GetReadLimitQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End);
    2136                 :             : 
    2137                 :             : /*
    2138                 :             :    GetWriteLimitQuads - returns Start and End which have been assigned
    2139                 :             :                         the start and end of when the symbol was written
    2140                 :             :                         to within: StartLimit..EndLimit.
    2141                 :             : */
    2142                 :             : 
    2143                 :             : extern "C" void SymbolTable_GetWriteLimitQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End);
    2144                 :             : 
    2145                 :             : /*
    2146                 :             :    GetNthProcedure - Returns the Nth procedure in Module, Sym.
    2147                 :             : */
    2148                 :             : 
    2149                 :             : extern "C" unsigned int SymbolTable_GetNthProcedure (unsigned int Sym, unsigned int n);
    2150                 :             : 
    2151                 :             : /*
    2152                 :             :    GetDeclaredDef - returns the tokenno where the symbol was declared
    2153                 :             :                     in the definition module.  UnknownTokenNo is returned
    2154                 :             :                     if no declaration occurred.
    2155                 :             : */
    2156                 :             : 
    2157                 :             : extern "C" unsigned int SymbolTable_GetDeclaredDef (unsigned int Sym);
    2158                 :             : 
    2159                 :             : /*
    2160                 :             :    GetDeclaredMod - returns the tokenno where the symbol was declared.
    2161                 :             :                     in the program or implementation module.
    2162                 :             :                     UnknownTokenNo is returned if no declaration occurred.
    2163                 :             : */
    2164                 :             : 
    2165                 :             : extern "C" unsigned int SymbolTable_GetDeclaredMod (unsigned int Sym);
    2166                 :             : 
    2167                 :             : /*
    2168                 :             :    GetDeclaredFor - returns the token where this forward procedure symbol
    2169                 :             :                     was declared in the program or implementation module.
    2170                 :             :                     UnknownTokenNo is returned if no declaration occurred.
    2171                 :             : */
    2172                 :             : 
    2173                 :             : extern "C" unsigned int SymbolTable_GetDeclaredFor (unsigned int Sym);
    2174                 :             : 
    2175                 :             : /*
    2176                 :             :    GetDeclaredDefinition - returns the token where this symbol
    2177                 :             :                            was declared in the definition module.
    2178                 :             : */
    2179                 :             : 
    2180                 :             : extern "C" unsigned int SymbolTable_GetDeclaredDefinition (unsigned int Sym);
    2181                 :             : 
    2182                 :             : /*
    2183                 :             :    GetDeclaredModule - returns the token where this symbol was declared
    2184                 :             :                        in an implementation or program module.
    2185                 :             : */
    2186                 :             : 
    2187                 :             : extern "C" unsigned int SymbolTable_GetDeclaredModule (unsigned int Sym);
    2188                 :             : 
    2189                 :             : /*
    2190                 :             :    PutDeclared - adds an entry to symbol, Sym, indicating that it
    2191                 :             :                  was declared at, tok.  This routine
    2192                 :             :                  may be called twice, once for definition module
    2193                 :             :                  partial declaration and once when parsing the
    2194                 :             :                  implementation module.
    2195                 :             : */
    2196                 :             : 
    2197                 :             : extern "C" void SymbolTable_PutDeclared (unsigned int tok, unsigned int Sym);
    2198                 :             : 
    2199                 :             : /*
    2200                 :             :    GetFirstUsed - returns the token where this symbol was first used.
    2201                 :             : */
    2202                 :             : 
    2203                 :             : extern "C" unsigned int SymbolTable_GetFirstUsed (unsigned int Sym);
    2204                 :             : 
    2205                 :             : /*
    2206                 :             :    PutProcedureBegin - assigns begin as the token number matching the
    2207                 :             :                        procedure BEGIN.
    2208                 :             : */
    2209                 :             : 
    2210                 :             : extern "C" void SymbolTable_PutProcedureBegin (unsigned int Sym, unsigned int begin);
    2211                 :             : 
    2212                 :             : /*
    2213                 :             :    PutProcedureEnd - assigns end as the token number matching the
    2214                 :             :                      procedure END.
    2215                 :             : */
    2216                 :             : 
    2217                 :             : extern "C" void SymbolTable_PutProcedureEnd (unsigned int Sym, unsigned int end);
    2218                 :             : 
    2219                 :             : /*
    2220                 :             :    GetProcedureBeginEnd - assigns, begin, end, to the stored token values.
    2221                 :             : */
    2222                 :             : 
    2223                 :             : extern "C" void SymbolTable_GetProcedureBeginEnd (unsigned int Sym, unsigned int *begin, unsigned int *end);
    2224                 :             : 
    2225                 :             : /*
    2226                 :             :    ForeachProcedureDo - for each procedure in module, Sym, do procedure, P.
    2227                 :             : */
    2228                 :             : 
    2229                 :             : extern "C" void SymbolTable_ForeachProcedureDo (unsigned int Sym, SymbolKey_PerformOperation P);
    2230                 :             : 
    2231                 :             : /*
    2232                 :             :    ForeachModuleDo - for each module do procedure, P.
    2233                 :             : */
    2234                 :             : 
    2235                 :             : extern "C" void SymbolTable_ForeachModuleDo (SymbolKey_PerformOperation P);
    2236                 :             : 
    2237                 :             : /*
    2238                 :             :    ForeachInnerModuleDo - for each inner module in module, Sym,
    2239                 :             :                           do procedure, P.
    2240                 :             : */
    2241                 :             : 
    2242                 :             : extern "C" void SymbolTable_ForeachInnerModuleDo (unsigned int Sym, SymbolKey_PerformOperation P);
    2243                 :             : 
    2244                 :             : /*
    2245                 :             :    IsVarParam - Returns a conditional depending whether parameter ParamNo
    2246                 :             :                 is a VAR parameter.
    2247                 :             : */
    2248                 :             : 
    2249                 :             : extern "C" bool SymbolTable_IsVarParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo);
    2250                 :             : 
    2251                 :             : /*
    2252                 :             :    IsVarParamAny - Returns a conditional depending whether parameter ParamNo
    2253                 :             :                    is a VAR parameter.
    2254                 :             : */
    2255                 :             : 
    2256                 :             : extern "C" bool SymbolTable_IsVarParamAny (unsigned int Sym, unsigned int ParamNo);
    2257                 :             : 
    2258                 :             : /*
    2259                 :             :    IsUnboundedParam - Returns a conditional depending whether parameter
    2260                 :             :                       ParamNo is an unbounded array procedure parameter.
    2261                 :             : */
    2262                 :             : 
    2263                 :             : extern "C" bool SymbolTable_IsUnboundedParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo);
    2264                 :             : extern "C" bool SymbolTable_IsUnboundedParamAny (unsigned int Sym, unsigned int ParamNo);
    2265                 :             : 
    2266                 :             : /*
    2267                 :             :    IsParameterUnbounded - returns TRUE if parameter, Sym, is
    2268                 :             :                           unbounded.
    2269                 :             : */
    2270                 :             : 
    2271                 :             : extern "C" bool SymbolTable_IsParameterUnbounded (unsigned int Sym);
    2272                 :             : 
    2273                 :             : /*
    2274                 :             :    IsParameterVar - returns true if parameter symbol Sym
    2275                 :             :                     was declared as a VAR.
    2276                 :             : */
    2277                 :             : 
    2278                 :             : extern "C" bool SymbolTable_IsParameterVar (unsigned int Sym);
    2279                 :             : 
    2280                 :             : /*
    2281                 :             :    GetParameterShadowVar - returns the local variable associated with the
    2282                 :             :                            parameter symbol, sym.
    2283                 :             : */
    2284                 :             : 
    2285                 :             : extern "C" unsigned int SymbolTable_GetParameterShadowVar (unsigned int sym);
    2286                 :             : 
    2287                 :             : /*
    2288                 :             :    NoOfParam - Returns the number of parameters that procedure Sym contains.
    2289                 :             : */
    2290                 :             : 
    2291                 :             : extern "C" unsigned int SymbolTable_NoOfParam (unsigned int Sym, SymbolTable_ProcedureKind kind);
    2292                 :             : 
    2293                 :             : /*
    2294                 :             :    HasVarParameters - returns TRUE if procedure, p, has any VAR parameters.
    2295                 :             : */
    2296                 :             : 
    2297                 :             : extern "C" bool SymbolTable_HasVarParameters (unsigned int p);
    2298                 :             : 
    2299                 :             : /*
    2300                 :             :    NoOfLocalVar - returns the number of local variables that exist in
    2301                 :             :                   procedure Sym. Parameters are NOT included in the
    2302                 :             :                   count.
    2303                 :             : */
    2304                 :             : 
    2305                 :             : extern "C" unsigned int SymbolTable_NoOfLocalVar (unsigned int Sym);
    2306                 :             : 
    2307                 :             : /*
    2308                 :             :    IsDefImp - returns true is the Sym is a DefImp symbol.
    2309                 :             :               Definition/Implementation module symbol.
    2310                 :             : */
    2311                 :             : 
    2312                 :             : extern "C" bool SymbolTable_IsDefImp (unsigned int Sym);
    2313                 :             : 
    2314                 :             : /*
    2315                 :             :    IsModule - returns true is the Sym is a Module symbol.
    2316                 :             :               Program module symbol.
    2317                 :             : */
    2318                 :             : 
    2319                 :             : extern "C" bool SymbolTable_IsModule (unsigned int Sym);
    2320                 :             : 
    2321                 :             : /*
    2322                 :             :    IsInnerModule - returns true if the symbol, Sym, is an inner module.
    2323                 :             : */
    2324                 :             : 
    2325                 :             : extern "C" bool SymbolTable_IsInnerModule (unsigned int Sym);
    2326                 :             : 
    2327                 :             : /*
    2328                 :             :    GetSymName - returns the symbol name.
    2329                 :             : */
    2330                 :             : 
    2331                 :             : extern "C" NameKey_Name SymbolTable_GetSymName (unsigned int Sym);
    2332                 :             : 
    2333                 :             : /*
    2334                 :             :    RenameSym - renames a symbol, Sym, with SymName.
    2335                 :             :                It also checks the unknown tree for a symbol
    2336                 :             :                with this new name. Must only be renamed in
    2337                 :             :                the same scope of being declared.
    2338                 :             : */
    2339                 :             : 
    2340                 :             : extern "C" void SymbolTable_RenameSym (unsigned int Sym, NameKey_Name SymName);
    2341                 :             : 
    2342                 :             : /*
    2343                 :             :    IsUnknown - returns true is the symbol Sym is unknown.
    2344                 :             : */
    2345                 :             : 
    2346                 :             : extern "C" bool SymbolTable_IsUnknown (unsigned int Sym);
    2347                 :             : 
    2348                 :             : /*
    2349                 :             :    IsPartialUnbounded - returns TRUE if, sym, is a partially unbounded symbol.
    2350                 :             : */
    2351                 :             : 
    2352                 :             : extern "C" bool SymbolTable_IsPartialUnbounded (unsigned int sym);
    2353                 :             : 
    2354                 :             : /*
    2355                 :             :    RequestSym - searches for a symbol with a name SymName in the
    2356                 :             :                 current and previous scopes.
    2357                 :             :                 If the symbol is found then it is returned
    2358                 :             :                 else an unknown symbol is returned create at token
    2359                 :             :                 position, tok.
    2360                 :             :                 This procedure does search the base scope (for
    2361                 :             :                 pervasive identifiers).
    2362                 :             : */
    2363                 :             : 
    2364                 :             : extern "C" unsigned int SymbolTable_RequestSym (unsigned int tok, NameKey_Name SymName);
    2365                 :             : 
    2366                 :             : /*
    2367                 :             :    PutImported - places a symbol, Sym, into the current main scope.
    2368                 :             : */
    2369                 :             : 
    2370                 :             : extern "C" void SymbolTable_PutImported (unsigned int Sym);
    2371                 :             : 
    2372                 :             : /*
    2373                 :             :    PutIncluded - places a symbol, Sym, into the included list of the
    2374                 :             :                  current module.
    2375                 :             :                  Symbols that are placed in this list are indirectly declared
    2376                 :             :                  by:
    2377                 :             : 
    2378                 :             :                  IMPORT modulename ;
    2379                 :             : 
    2380                 :             :                  modulename.identifier
    2381                 :             : */
    2382                 :             : 
    2383                 :             : extern "C" void SymbolTable_PutIncluded (unsigned int Sym);
    2384                 :             : 
    2385                 :             : /*
    2386                 :             :    PutExported - places a symbol, Sym into the next level out module.
    2387                 :             :                  Sym is also placed in the ExportTree of the current inner
    2388                 :             :                  module.
    2389                 :             : */
    2390                 :             : 
    2391                 :             : extern "C" void SymbolTable_PutExported (unsigned int Sym);
    2392                 :             : 
    2393                 :             : /*
    2394                 :             :    PutExportQualified - places a symbol with the name, SymName,
    2395                 :             :                         into the export tree of the
    2396                 :             :                         Definition module being compiled.
    2397                 :             :                         The symbol with name has been EXPORT QUALIFIED
    2398                 :             :                         by the definition module and therefore any reference
    2399                 :             :                         to this symbol in the code generation phase
    2400                 :             :                         will be in the form _Module_Name.
    2401                 :             : */
    2402                 :             : 
    2403                 :             : extern "C" void SymbolTable_PutExportQualified (unsigned int tokenno, NameKey_Name SymName);
    2404                 :             : 
    2405                 :             : /*
    2406                 :             :    PutExportUnQualified - places a symbol with the name, SymName,
    2407                 :             :                           into the export tree of the
    2408                 :             :                           Definition module being compiled.
    2409                 :             :                           The symbol with Name has been EXPORT UNQUALIFIED
    2410                 :             :                           by the definition module and therefore any reference
    2411                 :             :                           to this symbol in the code generation phase
    2412                 :             :                           will be in the form _Name.
    2413                 :             : */
    2414                 :             : 
    2415                 :             : extern "C" void SymbolTable_PutExportUnQualified (unsigned int tokenno, NameKey_Name SymName);
    2416                 :             : 
    2417                 :             : /*
    2418                 :             :    PutExportUnImplemented - places a symbol, Sym, into the currently compiled
    2419                 :             :                             DefImp module NeedToBeImplemented list.
    2420                 :             : */
    2421                 :             : 
    2422                 :             : extern "C" void SymbolTable_PutExportUnImplemented (unsigned int tokenno, unsigned int Sym);
    2423                 :             : 
    2424                 :             : /*
    2425                 :             :    GetExported - returns the symbol which has a name SymName,
    2426                 :             :                  and is exported from the definition module ModSym.
    2427                 :             : 
    2428                 :             : */
    2429                 :             : 
    2430                 :             : extern "C" unsigned int SymbolTable_GetExported (unsigned int tokenno, unsigned int ModSym, NameKey_Name SymName);
    2431                 :             : 
    2432                 :             : /*
    2433                 :             :    GetFromOuterModule - returns a symbol with name, SymName, which comes
    2434                 :             :                         from outside the current module.
    2435                 :             : */
    2436                 :             : 
    2437                 :             : extern "C" unsigned int SymbolTable_GetFromOuterModule (unsigned int tokenno, NameKey_Name SymName);
    2438                 :             : 
    2439                 :             : /*
    2440                 :             :    TryMoveUndeclaredSymToInnerModule - attempts to move a symbol of
    2441                 :             :                                        name, name, which is
    2442                 :             :                                        currently undefined in the
    2443                 :             :                                        outer scope to the inner scope.
    2444                 :             :                                        If successful then the symbol is
    2445                 :             :                                        returned otherwise NulSym is
    2446                 :             :                                        returned.
    2447                 :             : */
    2448                 :             : 
    2449                 :             : extern "C" unsigned int SymbolTable_TryMoveUndeclaredSymToInnerModule (unsigned int OuterScope, unsigned int InnerScope, NameKey_Name name);
    2450                 :             : 
    2451                 :             : /*
    2452                 :             :    IsExportQualified - returns true if a symbol, Sym, was defined as
    2453                 :             :                        being EXPORT QUALIFIED.
    2454                 :             :                        Sym is expected to be either a procedure or a
    2455                 :             :                        variable.
    2456                 :             : */
    2457                 :             : 
    2458                 :             : extern "C" bool SymbolTable_IsExportQualified (unsigned int Sym);
    2459                 :             : 
    2460                 :             : /*
    2461                 :             :    IsExportUnQualified - returns true if a symbol, Sym, was defined as
    2462                 :             :                          being EXPORT UNQUALIFIED.
    2463                 :             : */
    2464                 :             : 
    2465                 :             : extern "C" bool SymbolTable_IsExportUnQualified (unsigned int Sym);
    2466                 :             : 
    2467                 :             : /*
    2468                 :             :    IsExported - returns true if a symbol, Sym, is exported
    2469                 :             :                 from module, ModSym.
    2470                 :             :                 If ModSym is a DefImp symbol then its
    2471                 :             :                 ExportQualified and ExportUnQualified lists are examined.
    2472                 :             : */
    2473                 :             : 
    2474                 :             : extern "C" bool SymbolTable_IsExported (unsigned int ModSym, unsigned int Sym);
    2475                 :             : 
    2476                 :             : /*
    2477                 :             :    IsImplicityExported - returns TRUE if, Sym, is implicitly exported from module, ModSym.
    2478                 :             :                          ModSym must be a defimp symbol.
    2479                 :             : */
    2480                 :             : 
    2481                 :             : extern "C" bool SymbolTable_IsImplicityExported (unsigned int ModSym, unsigned int Sym);
    2482                 :             : 
    2483                 :             : /*
    2484                 :             :    IsImported - returns true if a symbol, Sym, in module, ModSym,
    2485                 :             :                 was imported.
    2486                 :             : */
    2487                 :             : 
    2488                 :             : extern "C" bool SymbolTable_IsImported (unsigned int ModSym, unsigned int Sym);
    2489                 :             : 
    2490                 :             : /*
    2491                 :             :    PutIncludedByDefinition - places a module symbol, Sym, into the
    2492                 :             :                              included list of the current definition module.
    2493                 :             : */
    2494                 :             : 
    2495                 :             : extern "C" void SymbolTable_PutIncludedByDefinition (unsigned int Sym);
    2496                 :             : 
    2497                 :             : /*
    2498                 :             :    IsIncludedByDefinition - returns TRUE if definition module symbol, Sym, was included
    2499                 :             :                             by ModSym's definition module.
    2500                 :             : */
    2501                 :             : 
    2502                 :             : extern "C" bool SymbolTable_IsIncludedByDefinition (unsigned int ModSym, unsigned int Sym);
    2503                 :             : 
    2504                 :             : /*
    2505                 :             :    ForeachImportedDo - calls a procedure, P, foreach imported symbol
    2506                 :             :                        in module, ModSym.
    2507                 :             : */
    2508                 :             : 
    2509                 :             : extern "C" void SymbolTable_ForeachImportedDo (unsigned int ModSym, SymbolKey_PerformOperation P);
    2510                 :             : 
    2511                 :             : /*
    2512                 :             :    ForeachExportedDo - calls a procedure, P, foreach imported symbol
    2513                 :             :                        in module, ModSym.
    2514                 :             : */
    2515                 :             : 
    2516                 :             : extern "C" void SymbolTable_ForeachExportedDo (unsigned int ModSym, SymbolKey_PerformOperation P);
    2517                 :             : 
    2518                 :             : /*
    2519                 :             :    CheckForExportedImplementation - checks to see whether an implementation
    2520                 :             :                                     module is currently being compiled, if so,
    2521                 :             :                                     symbol, Sym, is removed from the
    2522                 :             :                                     NeedToBeImplemented list.
    2523                 :             :                                     This procedure is called whenever a symbol
    2524                 :             :                                     is declared, thus attempting to reduce
    2525                 :             :                                     the NeedToBeImplemented list.
    2526                 :             :                                     Only needs to be called when a TYPE or
    2527                 :             :                                     PROCEDURE is built since the implementation
    2528                 :             :                                     module can only implement these objects
    2529                 :             :                                     declared in the definition module.
    2530                 :             : 
    2531                 :             :                                     It also checks whether a definition module
    2532                 :             :                                     is currently being compiled and, if so,
    2533                 :             :                                     it will ensure that symbol, Sym, is removed
    2534                 :             :                                     from the ExportRequest list. If Sym is an
    2535                 :             :                                     enumerated type it ensures that its fields
    2536                 :             :                                     are also removed.
    2537                 :             : */
    2538                 :             : 
    2539                 :             : extern "C" void SymbolTable_CheckForExportedImplementation (unsigned int Sym);
    2540                 :             : 
    2541                 :             : /*
    2542                 :             :    CheckForUnImplementedExports - displays an error and the offending symbols
    2543                 :             :                                   which have been exported but not implemented
    2544                 :             :                                   from the current compiled module.
    2545                 :             : */
    2546                 :             : 
    2547                 :             : extern "C" void SymbolTable_CheckForUnImplementedExports (void);
    2548                 :             : 
    2549                 :             : /*
    2550                 :             :    CheckForUndeclaredExports - displays an error and the offending symbols
    2551                 :             :                                which have been exported but not declared
    2552                 :             :                                from module, ModSym.
    2553                 :             : */
    2554                 :             : 
    2555                 :             : extern "C" void SymbolTable_CheckForUndeclaredExports (unsigned int ModSym);
    2556                 :             : 
    2557                 :             : /*
    2558                 :             :    CheckForUnknownInModule - checks for any unknown symbols in the
    2559                 :             :                              current module.
    2560                 :             :                              If any unknown symbols are found then
    2561                 :             :                              an error message is displayed.
    2562                 :             : */
    2563                 :             : 
    2564                 :             : extern "C" void SymbolTable_CheckForUnknownInModule (unsigned int tokno);
    2565                 :             : 
    2566                 :             : /*
    2567                 :             :    UnknownReported - if sym is an unknown symbol and has not been reported
    2568                 :             :                      then include it into the set of reported unknowns.
    2569                 :             : */
    2570                 :             : 
    2571                 :             : extern "C" void SymbolTable_UnknownReported (unsigned int sym);
    2572                 :             : 
    2573                 :             : /*
    2574                 :             :    IsReallyPointer - returns TRUE is sym is a pointer, address or a
    2575                 :             :                      type declared as a pointer or address.
    2576                 :             : */
    2577                 :             : 
    2578                 :             : extern "C" bool SymbolTable_IsReallyPointer (unsigned int Sym);
    2579                 :             : 
    2580                 :             : /*
    2581                 :             :    CheckHiddenTypeAreAddress - checks to see that any hidden types
    2582                 :             :                                which we have declared are actually
    2583                 :             :                                of type ADDRESS or map onto a POINTER type.
    2584                 :             : */
    2585                 :             : 
    2586                 :             : extern "C" void SymbolTable_CheckHiddenTypeAreAddress (void);
    2587                 :             : 
    2588                 :             : /*
    2589                 :             :    PutDefinitionForC - sets a flag in the current compiled module which
    2590                 :             :                        indicates that this module is a wrapper for a C
    2591                 :             :                        file. Parameters passes to procedures in this module
    2592                 :             :                        will adopt the C calling convention.
    2593                 :             : */
    2594                 :             : 
    2595                 :             : extern "C" void SymbolTable_PutDefinitionForC (unsigned int Sym);
    2596                 :             : 
    2597                 :             : /*
    2598                 :             :    IsDefinitionForC - returns true if this definition module was declared
    2599                 :             :                       as a DEFINITION MODULE FOR "C".
    2600                 :             : */
    2601                 :             : 
    2602                 :             : extern "C" bool SymbolTable_IsDefinitionForC (unsigned int Sym);
    2603                 :             : 
    2604                 :             : /*
    2605                 :             :    PutDoesNeedExportList - sets a flag in module, Sym, which
    2606                 :             :                            indicates that this module requires an explicit
    2607                 :             :                            EXPORT QUALIFIED or UNQUALIFIED list. PIM-2
    2608                 :             : */
    2609                 :             : 
    2610                 :             : extern "C" void SymbolTable_PutDoesNeedExportList (unsigned int Sym);
    2611                 :             : 
    2612                 :             : /*
    2613                 :             :    PutDoesNotNeedExportList - sets a flag in module, Sym, which
    2614                 :             :                               indicates that this module does not require an explicit
    2615                 :             :                               EXPORT QUALIFIED or UNQUALIFIED list. PIM-3|4
    2616                 :             : */
    2617                 :             : 
    2618                 :             : extern "C" void SymbolTable_PutDoesNotNeedExportList (unsigned int Sym);
    2619                 :             : 
    2620                 :             : /*
    2621                 :             :    DoesNotNeedExportList - returns TRUE if module, Sym, does not require an explicit
    2622                 :             :                            EXPORT QUALIFIED list.
    2623                 :             : */
    2624                 :             : 
    2625                 :             : extern "C" bool SymbolTable_DoesNotNeedExportList (unsigned int Sym);
    2626                 :             : 
    2627                 :             : /*
    2628                 :             :    CheckForEnumerationInCurrentModule - checks to see whether the enumeration
    2629                 :             :                                         type symbol, Sym, has been entered into
    2630                 :             :                                         the current modules scope list.
    2631                 :             : */
    2632                 :             : 
    2633                 :             : extern "C" void SymbolTable_CheckForEnumerationInCurrentModule (unsigned int Sym);
    2634                 :             : 
    2635                 :             : /*
    2636                 :             :    SanityCheckConstants - must only be called once all constants, types, procedures
    2637                 :             :                           have been declared.  It checks to see that constants are
    2638                 :             :                           not used as procedure parameter types.
    2639                 :             : */
    2640                 :             : 
    2641                 :             : extern "C" void SymbolTable_SanityCheckConstants (void);
    2642                 :             : 
    2643                 :             : /*
    2644                 :             :    ForeachLocalSymDo - foreach local symbol in module, Sym, or procedure, Sym,
    2645                 :             :                        perform the procedure, P.
    2646                 :             : */
    2647                 :             : 
    2648                 :             : extern "C" void SymbolTable_ForeachLocalSymDo (unsigned int Sym, SymbolKey_PerformOperation P);
    2649                 :             : 
    2650                 :             : /*
    2651                 :             :    ForeachParamSymDo - foreach parameter symbol in procedure Sym
    2652                 :             :                        perform the procedure P.  Each symbol
    2653                 :             :                        looked up will be VarParam or Param
    2654                 :             :                        (not the shadow variable).  Every parameter
    2655                 :             :                        from each KindProcedure is iterated over.
    2656                 :             : */
    2657                 :             : 
    2658                 :             : extern "C" void SymbolTable_ForeachParamSymDo (unsigned int Sym, SymbolKey_PerformOperation P);
    2659                 :             : 
    2660                 :             : /*
    2661                 :             :    ForeachFieldEnumerationDo - for each field in enumeration, Sym,
    2662                 :             :                                do procedure, P.  Each call to P contains
    2663                 :             :                                an enumeration field, the order is alphabetical.
    2664                 :             :                                Use ForeachLocalSymDo for declaration order.
    2665                 :             : */
    2666                 :             : 
    2667                 :             : extern "C" void SymbolTable_ForeachFieldEnumerationDo (unsigned int Sym, SymbolKey_PerformOperation P);
    2668                 :             : 
    2669                 :             : /*
    2670                 :             :    IsType - returns true if the Sym is a type symbol.
    2671                 :             : */
    2672                 :             : 
    2673                 :             : extern "C" bool SymbolTable_IsType (unsigned int Sym);
    2674                 :             : 
    2675                 :             : /*
    2676                 :             :    IsProcedure - returns true if Sym is a procedure symbol.
    2677                 :             : */
    2678                 :             : 
    2679                 :             : extern "C" bool SymbolTable_IsProcedure (unsigned int Sym);
    2680                 :             : 
    2681                 :             : /*
    2682                 :             :    IsParameter - returns true if Sym is a parameter symbol.
    2683                 :             : */
    2684                 :             : 
    2685                 :             : extern "C" bool SymbolTable_IsParameter (unsigned int Sym);
    2686                 :             : 
    2687                 :             : /*
    2688                 :             :    GetProcedureKind - returns the procedure kind given the declaration tok.
    2689                 :             :                       The declaration tok must match the ident tok in the
    2690                 :             :                       procedure name.  It is only safe to call this
    2691                 :             :                       procedure function during pass 2 onwards.
    2692                 :             : */
    2693                 :             : 
    2694                 :             : extern "C" SymbolTable_ProcedureKind SymbolTable_GetProcedureKind (unsigned int sym, unsigned int tok);
    2695                 :             : 
    2696                 :             : /*
    2697                 :             :    GetProcedureDeclaredTok - return the token where the
    2698                 :             :                              declaration of procedure sym:kind
    2699                 :             :                              occurred.
    2700                 :             : */
    2701                 :             : 
    2702                 :             : extern "C" unsigned int SymbolTable_GetProcedureDeclaredTok (unsigned int sym, SymbolTable_ProcedureKind kind);
    2703                 :             : 
    2704                 :             : /*
    2705                 :             :    PutProcedureDeclaredTok - places the tok where the
    2706                 :             :                              declaration of procedure sym:kind
    2707                 :             :                              occurred.
    2708                 :             : */
    2709                 :             : 
    2710                 :             : extern "C" void SymbolTable_PutProcedureDeclaredTok (unsigned int sym, SymbolTable_ProcedureKind kind, unsigned int tok);
    2711                 :             : 
    2712                 :             : /*
    2713                 :             :    GetReturnTypeTok - return the token where the
    2714                 :             :                                return type procedure sym:kind or proctype
    2715                 :             :                                was defined.
    2716                 :             : */
    2717                 :             : 
    2718                 :             : extern "C" unsigned int SymbolTable_GetReturnTypeTok (unsigned int sym, SymbolTable_ProcedureKind kind);
    2719                 :             : 
    2720                 :             : /*
    2721                 :             :    PutReturnTypeTok - places the tok where the
    2722                 :             :                       return type of procedure sym:kind or proctype
    2723                 :             :                       was defined.
    2724                 :             : */
    2725                 :             : 
    2726                 :             : extern "C" void SymbolTable_PutReturnTypeTok (unsigned int sym, SymbolTable_ProcedureKind kind, unsigned int tok);
    2727                 :             : 
    2728                 :             : /*
    2729                 :             :    PutProcedureParametersDefined - the procedure symbol sym:kind
    2730                 :             :                                    parameters have been defined.
    2731                 :             : */
    2732                 :             : 
    2733                 :             : extern "C" void SymbolTable_PutProcedureParametersDefined (unsigned int sym, SymbolTable_ProcedureKind kind);
    2734                 :             : 
    2735                 :             : /*
    2736                 :             :    GetProcedureParametersDefined - returns true if procedure symbol sym:kind
    2737                 :             :                                    parameters are defined.
    2738                 :             : */
    2739                 :             : 
    2740                 :             : extern "C" bool SymbolTable_GetProcedureParametersDefined (unsigned int sym, SymbolTable_ProcedureKind kind);
    2741                 :             : 
    2742                 :             : /*
    2743                 :             :    PutProcedureDefined - the procedure symbol sym:kind is defined.
    2744                 :             : */
    2745                 :             : 
    2746                 :             : extern "C" void SymbolTable_PutProcedureDefined (unsigned int sym, SymbolTable_ProcedureKind kind);
    2747                 :             : 
    2748                 :             : /*
    2749                 :             :    GetProcedureDefined - returns true if procedure symbol sym:kind
    2750                 :             :                          is defined.
    2751                 :             : */
    2752                 :             : 
    2753                 :             : extern "C" bool SymbolTable_GetProcedureDefined (unsigned int sym, SymbolTable_ProcedureKind kind);
    2754                 :             : 
    2755                 :             : /*
    2756                 :             :    PutUseVarArgs - tell the symbol table that this procedure, Sym,
    2757                 :             :                    uses varargs.
    2758                 :             :                    The procedure _must_ be declared inside a
    2759                 :             :                    DEFINITION FOR "C"
    2760                 :             : 
    2761                 :             : */
    2762                 :             : 
    2763                 :             : extern "C" void SymbolTable_PutUseVarArgs (unsigned int Sym);
    2764                 :             : 
    2765                 :             : /*
    2766                 :             :    UsesVarArgs - returns TRUE if procedure, Sym, uses varargs.
    2767                 :             :                  The procedure _must_ be declared inside a
    2768                 :             :                  DEFINITION FOR "C"
    2769                 :             : */
    2770                 :             : 
    2771                 :             : extern "C" bool SymbolTable_UsesVarArgs (unsigned int Sym);
    2772                 :             : 
    2773                 :             : /*
    2774                 :             :    PutUseOptArg - tell the symbol table that this procedure, Sym,
    2775                 :             :                   uses an optarg.
    2776                 :             : */
    2777                 :             : 
    2778                 :             : extern "C" void SymbolTable_PutUseOptArg (unsigned int Sym, SymbolTable_ProcedureKind kind);
    2779                 :             : 
    2780                 :             : /*
    2781                 :             :    UsesOptArg - returns TRUE if procedure, Sym, uses varargs.
    2782                 :             : */
    2783                 :             : 
    2784                 :             : extern "C" bool SymbolTable_UsesOptArg (unsigned int Sym, SymbolTable_ProcedureKind kind);
    2785                 :             : 
    2786                 :             : /*
    2787                 :             :    PutOptArgInit - makes symbol, Sym, the initializer value to
    2788                 :             :                    procedure, ProcSym.
    2789                 :             : */
    2790                 :             : 
    2791                 :             : extern "C" void SymbolTable_PutOptArgInit (unsigned int ProcSym, unsigned int Sym);
    2792                 :             : 
    2793                 :             : /*
    2794                 :             :    GetOptArgInit - returns the initializer value to the optional parameter in
    2795                 :             :                    procedure, ProcSym.
    2796                 :             : */
    2797                 :             : 
    2798                 :             : extern "C" unsigned int SymbolTable_GetOptArgInit (unsigned int ProcSym);
    2799                 :             : 
    2800                 :             : /*
    2801                 :             :    MakePointer - returns a pointer symbol with PointerName.
    2802                 :             : */
    2803                 :             : 
    2804                 :             : extern "C" unsigned int SymbolTable_MakePointer (unsigned int tok, NameKey_Name PointerName);
    2805                 :             : 
    2806                 :             : /*
    2807                 :             :    PutPointer - gives a pointer symbol a type, PointerType.
    2808                 :             : */
    2809                 :             : 
    2810                 :             : extern "C" void SymbolTable_PutPointer (unsigned int Sym, unsigned int PointerType);
    2811                 :             : 
    2812                 :             : /*
    2813                 :             :    IsPointer - returns true is Sym is a pointer type symbol.
    2814                 :             : */
    2815                 :             : 
    2816                 :             : extern "C" bool SymbolTable_IsPointer (unsigned int Sym);
    2817                 :             : 
    2818                 :             : /*
    2819                 :             :    IsRecord - returns true is Sym is a record type symbol.
    2820                 :             : */
    2821                 :             : 
    2822                 :             : extern "C" bool SymbolTable_IsRecord (unsigned int Sym);
    2823                 :             : 
    2824                 :             : /*
    2825                 :             :    IsVarient - returns true if the symbol, Sym, is a
    2826                 :             :                varient symbol.
    2827                 :             : */
    2828                 :             : 
    2829                 :             : extern "C" bool SymbolTable_IsVarient (unsigned int Sym);
    2830                 :             : 
    2831                 :             : /*
    2832                 :             :    IsFieldVarient - returns true if the symbol, Sym, is a
    2833                 :             :                     varient field.
    2834                 :             : */
    2835                 :             : 
    2836                 :             : extern "C" bool SymbolTable_IsFieldVarient (unsigned int Sym);
    2837                 :             : 
    2838                 :             : /*
    2839                 :             :    IsFieldEnumeration - returns true if the symbol, Sym, is an
    2840                 :             :                         enumeration field.
    2841                 :             : */
    2842                 :             : 
    2843                 :             : extern "C" bool SymbolTable_IsFieldEnumeration (unsigned int Sym);
    2844                 :             : 
    2845                 :             : /*
    2846                 :             :    IsArray - returns true is Sym is an array type symbol.
    2847                 :             : */
    2848                 :             : 
    2849                 :             : extern "C" bool SymbolTable_IsArray (unsigned int Sym);
    2850                 :             : 
    2851                 :             : /*
    2852                 :             :    IsEnumeration - returns true if Sym is an enumeration symbol.
    2853                 :             : */
    2854                 :             : 
    2855                 :             : extern "C" bool SymbolTable_IsEnumeration (unsigned int Sym);
    2856                 :             : 
    2857                 :             : /*
    2858                 :             :    IsSet - returns TRUE if Sym is a set symbol.
    2859                 :             : */
    2860                 :             : 
    2861                 :             : extern "C" bool SymbolTable_IsSet (unsigned int Sym);
    2862                 :             : 
    2863                 :             : /*
    2864                 :             :    IsHiddenType - returns TRUE if, Sym, is a Type and is also declared as a hidden type.
    2865                 :             : */
    2866                 :             : 
    2867                 :             : extern "C" bool SymbolTable_IsHiddenType (unsigned int Sym);
    2868                 :             : 
    2869                 :             : /*
    2870                 :             :    IsOAFamily - returns TRUE if, Sym, is an OAFamily symbol.
    2871                 :             : */
    2872                 :             : 
    2873                 :             : extern "C" bool SymbolTable_IsOAFamily (unsigned int Sym);
    2874                 :             : 
    2875                 :             : /*
    2876                 :             :    GetDimension - return the number of dimensions associated with
    2877                 :             :                   this unbounded ARRAY parameter.
    2878                 :             : */
    2879                 :             : 
    2880                 :             : extern "C" unsigned int SymbolTable_GetDimension (unsigned int sym);
    2881                 :             : 
    2882                 :             : /*
    2883                 :             :    MakeOAFamily - makes an OAFamily symbol based on SimpleType.
    2884                 :             :                   It returns the OAFamily symbol.  A new symbol
    2885                 :             :                   is created if one does not already exist for
    2886                 :             :                   SimpleType.
    2887                 :             : */
    2888                 :             : 
    2889                 :             : extern "C" unsigned int SymbolTable_MakeOAFamily (unsigned int SimpleType);
    2890                 :             : 
    2891                 :             : /*
    2892                 :             :    GetOAFamily - returns the oafamily symbol associated with
    2893                 :             :                  SimpleType.
    2894                 :             : */
    2895                 :             : 
    2896                 :             : extern "C" unsigned int SymbolTable_GetOAFamily (unsigned int SimpleType);
    2897                 :             : 
    2898                 :             : /*
    2899                 :             :    ForeachOAFamily - call, p[oaf, ndim, symbol] for every unbounded symbol,
    2900                 :             :                      sym, in the oaf.
    2901                 :             : */
    2902                 :             : 
    2903                 :             : extern "C" void SymbolTable_ForeachOAFamily (unsigned int sym, SymbolTable_FamilyOperation p);
    2904                 :             : 
    2905                 :             : /*
    2906                 :             :    IsUnbounded - returns true if Sym is an unbounded symbol.
    2907                 :             : */
    2908                 :             : 
    2909                 :             : extern "C" bool SymbolTable_IsUnbounded (unsigned int Sym);
    2910                 :             : 
    2911                 :             : /*
    2912                 :             :    GetUnbounded - returns the unbounded symbol associated with
    2913                 :             :                   the OAFamily symbol, oaf, and the number of
    2914                 :             :                   dimensions, ndim, of the open array.
    2915                 :             : */
    2916                 :             : 
    2917                 :             : extern "C" unsigned int SymbolTable_GetUnbounded (unsigned int oaf, unsigned int ndim);
    2918                 :             : 
    2919                 :             : /*
    2920                 :             :    GetUnboundedRecordType - returns the record type used to
    2921                 :             :                             implement the unbounded array.
    2922                 :             : */
    2923                 :             : 
    2924                 :             : extern "C" unsigned int SymbolTable_GetUnboundedRecordType (unsigned int Sym);
    2925                 :             : 
    2926                 :             : /*
    2927                 :             :    GetUnboundedAddressOffset - returns the offset of the address field
    2928                 :             :                                inside the record used to implement the
    2929                 :             :                                unbounded type.
    2930                 :             : */
    2931                 :             : 
    2932                 :             : extern "C" unsigned int SymbolTable_GetUnboundedAddressOffset (unsigned int sym);
    2933                 :             : 
    2934                 :             : /*
    2935                 :             :    GetUnboundedHighOffset - returns the offset of the high field
    2936                 :             :                             inside the record used to implement the
    2937                 :             :                             unbounded type.
    2938                 :             : */
    2939                 :             : 
    2940                 :             : extern "C" unsigned int SymbolTable_GetUnboundedHighOffset (unsigned int sym, unsigned int ndim);
    2941                 :             : 
    2942                 :             : /*
    2943                 :             :    MakeSubscript - makes a subscript Symbol.
    2944                 :             :                    No name is required.
    2945                 :             : */
    2946                 :             : 
    2947                 :             : extern "C" unsigned int SymbolTable_MakeSubscript (void);
    2948                 :             : 
    2949                 :             : /*
    2950                 :             :    PutSubscript - gives a subscript symbol a type, SimpleType.
    2951                 :             : */
    2952                 :             : 
    2953                 :             : extern "C" void SymbolTable_PutSubscript (unsigned int Sym, unsigned int SimpleType);
    2954                 :             : 
    2955                 :             : /*
    2956                 :             :    MakeUnbounded - makes an unbounded array Symbol.
    2957                 :             :                    ndim is the number of dimensions required.
    2958                 :             :                    No name is required.
    2959                 :             : */
    2960                 :             : 
    2961                 :             : extern "C" unsigned int SymbolTable_MakeUnbounded (unsigned int tok, unsigned int SimpleType, unsigned int ndim);
    2962                 :             : 
    2963                 :             : /*
    2964                 :             :    NoOfElements - Returns the number of elements in array Sym,
    2965                 :             :                   or the number of elements in an enumeration Sym or
    2966                 :             :                   the number of interface symbols in an Interface list.
    2967                 :             : */
    2968                 :             : 
    2969                 :             : extern "C" unsigned int SymbolTable_NoOfElements (unsigned int Sym);
    2970                 :             : 
    2971                 :             : /*
    2972                 :             :    PutArray - places a type symbol into an arraysym.
    2973                 :             : */
    2974                 :             : 
    2975                 :             : extern "C" void SymbolTable_PutArray (unsigned int arraysym, unsigned int typesym);
    2976                 :             : 
    2977                 :             : /*
    2978                 :             :    ResolveImports - it examines the import list of all inner modules
    2979                 :             :                     and resolves all relative imports.
    2980                 :             : */
    2981                 :             : 
    2982                 :             : extern "C" void SymbolTable_ResolveImports (void);
    2983                 :             : 
    2984                 :             : /*
    2985                 :             :    ResolveConstructorTypes - to be called at the end of pass three.  Its
    2986                 :             :                              purpose is to fix up all constructors whose
    2987                 :             :                              types are unknown.
    2988                 :             : */
    2989                 :             : 
    2990                 :             : extern "C" void SymbolTable_ResolveConstructorTypes (void);
    2991                 :             : 
    2992                 :             : /*
    2993                 :             :    AddNameToScope - adds a Name, n, to the list of objects declared at the
    2994                 :             :                     current scope.
    2995                 :             : */
    2996                 :             : 
    2997                 :             : extern "C" void SymbolTable_AddNameToScope (NameKey_Name n);
    2998                 :             : 
    2999                 :             : /*
    3000                 :             :    AddNameToImportList - adds a Name, n, to the import list of the current
    3001                 :             :                          module.
    3002                 :             : */
    3003                 :             : 
    3004                 :             : extern "C" void SymbolTable_AddNameToImportList (NameKey_Name n);
    3005                 :             : 
    3006                 :             : /*
    3007                 :             :    GetScope - returns the declaration scope of the symbol.
    3008                 :             : */
    3009                 :             : 
    3010                 :             : extern "C" unsigned int SymbolTable_GetScope (unsigned int Sym);
    3011                 :             : 
    3012                 :             : /*
    3013                 :             :    GetModuleScope - returns the module scope of symbol, sym.
    3014                 :             :                     If sym was declared within a nested procedure
    3015                 :             :                     then return the module which defines the
    3016                 :             :                     procedure.
    3017                 :             : */
    3018                 :             : 
    3019                 :             : extern "C" unsigned int SymbolTable_GetModuleScope (unsigned int sym);
    3020                 :             : 
    3021                 :             : /*
    3022                 :             :    GetProcedureScope - returns the innermost procedure (if any)
    3023                 :             :                        in which the symbol, sym, resides.
    3024                 :             :                        A module inside the procedure is skipped
    3025                 :             :                        over.
    3026                 :             : */
    3027                 :             : 
    3028                 :             : extern "C" unsigned int SymbolTable_GetProcedureScope (unsigned int sym);
    3029                 :             : 
    3030                 :             : /*
    3031                 :             :    IsModuleWithinProcedure - returns TRUE if module, sym, is
    3032                 :             :                              inside a procedure.
    3033                 :             : */
    3034                 :             : 
    3035                 :             : extern "C" bool SymbolTable_IsModuleWithinProcedure (unsigned int sym);
    3036                 :             : 
    3037                 :             : /*
    3038                 :             :    GetParent - returns the parent of symbol, Sym.
    3039                 :             : */
    3040                 :             : 
    3041                 :             : extern "C" unsigned int SymbolTable_GetParent (unsigned int Sym);
    3042                 :             : 
    3043                 :             : /*
    3044                 :             :    IsRecordField - returns true if Sym is a record field.
    3045                 :             : */
    3046                 :             : 
    3047                 :             : extern "C" bool SymbolTable_IsRecordField (unsigned int Sym);
    3048                 :             : 
    3049                 :             : /*
    3050                 :             :    MakeProcType - returns a procedure type symbol with ProcTypeName.
    3051                 :             : */
    3052                 :             : 
    3053                 :             : extern "C" unsigned int SymbolTable_MakeProcType (unsigned int tok, NameKey_Name ProcTypeName);
    3054                 :             : 
    3055                 :             : /*
    3056                 :             :    PutProcTypeParam - Places a Non VAR parameter ParamName with type
    3057                 :             :                       ParamType into ProcType Sym.
    3058                 :             : */
    3059                 :             : 
    3060                 :             : extern "C" void SymbolTable_PutProcTypeParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded);
    3061                 :             : 
    3062                 :             : /*
    3063                 :             :    PutProcTypeVarParam - Places a Non VAR parameter ParamName with type
    3064                 :             :                          ParamType into ProcType Sym.
    3065                 :             : */
    3066                 :             : 
    3067                 :             : extern "C" void SymbolTable_PutProcTypeVarParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded);
    3068                 :             : 
    3069                 :             : /*
    3070                 :             :    IsProcType - returns true if Sym is a ProcType Symbol.
    3071                 :             : */
    3072                 :             : 
    3073                 :             : extern "C" bool SymbolTable_IsProcType (unsigned int Sym);
    3074                 :             : 
    3075                 :             : /*
    3076                 :             :    IsVar - returns true if Sym is a Var Symbol.
    3077                 :             : */
    3078                 :             : 
    3079                 :             : extern "C" bool SymbolTable_IsVar (unsigned int Sym);
    3080                 :             : 
    3081                 :             : /*
    3082                 :             :    IsVarConst - returns the IsConst field indicating the variable is read only.
    3083                 :             : */
    3084                 :             : 
    3085                 :             : extern "C" bool SymbolTable_IsVarConst (unsigned int sym);
    3086                 :             : 
    3087                 :             : /*
    3088                 :             :    IsConst - returns true if Sym contains a constant value.
    3089                 :             : */
    3090                 :             : 
    3091                 :             : extern "C" bool SymbolTable_IsConst (unsigned int Sym);
    3092                 :             : 
    3093                 :             : /*
    3094                 :             :    IsConstString - returns whether sym is a conststring of any variant.
    3095                 :             : */
    3096                 :             : 
    3097                 :             : extern "C" bool SymbolTable_IsConstString (unsigned int sym);
    3098                 :             : 
    3099                 :             : /*
    3100                 :             :    IsConstStringNulTerminated - returns TRUE if the constant string, sym,
    3101                 :             :                                 should be created with a nul terminator.
    3102                 :             : */
    3103                 :             : 
    3104                 :             : extern "C" bool SymbolTable_IsConstStringNulTerminated (unsigned int sym);
    3105                 :             : 
    3106                 :             : /*
    3107                 :             :    IsConstLit - returns true if Sym is a literal constant.
    3108                 :             : */
    3109                 :             : 
    3110                 :             : extern "C" bool SymbolTable_IsConstLit (unsigned int Sym);
    3111                 :             : 
    3112                 :             : /*
    3113                 :             :    IsConstructor - returns TRUE if the constant is declared as a
    3114                 :             :                    constant set, array or record.
    3115                 :             : */
    3116                 :             : 
    3117                 :             : extern "C" bool SymbolTable_IsConstructor (unsigned int Sym);
    3118                 :             : 
    3119                 :             : /*
    3120                 :             :    IsDummy - returns true if Sym is a Dummy symbol.
    3121                 :             : */
    3122                 :             : 
    3123                 :             : extern "C" bool SymbolTable_IsDummy (unsigned int Sym);
    3124                 :             : 
    3125                 :             : /*
    3126                 :             :    IsTemporary - returns true if Sym is a Temporary symbol.
    3127                 :             : */
    3128                 :             : 
    3129                 :             : extern "C" bool SymbolTable_IsTemporary (unsigned int Sym);
    3130                 :             : 
    3131                 :             : /*
    3132                 :             :    IsVarAParam - returns true if Sym is a variable declared as a parameter.
    3133                 :             : */
    3134                 :             : 
    3135                 :             : extern "C" bool SymbolTable_IsVarAParam (unsigned int Sym);
    3136                 :             : 
    3137                 :             : /*
    3138                 :             :    IsSubscript - returns true if Sym is a subscript symbol.
    3139                 :             : */
    3140                 :             : 
    3141                 :             : extern "C" bool SymbolTable_IsSubscript (unsigned int Sym);
    3142                 :             : 
    3143                 :             : /*
    3144                 :             :    IsSubrange - returns true if Sym is a subrange symbol.
    3145                 :             : */
    3146                 :             : 
    3147                 :             : extern "C" bool SymbolTable_IsSubrange (unsigned int Sym);
    3148                 :             : 
    3149                 :             : /*
    3150                 :             :    IsProcedureVariable - returns true if a Sym is a variable and
    3151                 :             :                          it was declared within a procedure.
    3152                 :             : */
    3153                 :             : 
    3154                 :             : extern "C" bool SymbolTable_IsProcedureVariable (unsigned int Sym);
    3155                 :             : 
    3156                 :             : /*
    3157                 :             :    IsProcedureNested - returns TRUE if procedure, Sym, was
    3158                 :             :                        declared as a nested procedure.
    3159                 :             : */
    3160                 :             : 
    3161                 :             : extern "C" bool SymbolTable_IsProcedureNested (unsigned int Sym);
    3162                 :             : 
    3163                 :             : /*
    3164                 :             :    IsAModula2Type - returns true if Sym, is a:
    3165                 :             :                     IsType, IsPointer, IsRecord, IsEnumeration,
    3166                 :             :                     IsSubrange, IsArray, IsUnbounded, IsProcType.
    3167                 :             :                     NOTE that it different from IsType.
    3168                 :             : */
    3169                 :             : 
    3170                 :             : extern "C" bool SymbolTable_IsAModula2Type (unsigned int Sym);
    3171                 :             : 
    3172                 :             : /*
    3173                 :             :    IsGnuAsmVolatile - returns TRUE if a GnuAsm symbol was defined as VOLATILE.
    3174                 :             : */
    3175                 :             : 
    3176                 :             : extern "C" bool SymbolTable_IsGnuAsmVolatile (unsigned int Sym);
    3177                 :             : 
    3178                 :             : /*
    3179                 :             :    IsGnuAsmSimple - returns TRUE if a GnuAsm symbol is a simple kind.
    3180                 :             : */
    3181                 :             : 
    3182                 :             : extern "C" bool SymbolTable_IsGnuAsmSimple (unsigned int Sym);
    3183                 :             : 
    3184                 :             : /*
    3185                 :             :    IsGnuAsm - returns TRUE if Sym is a GnuAsm symbol.
    3186                 :             : */
    3187                 :             : 
    3188                 :             : extern "C" bool SymbolTable_IsGnuAsm (unsigned int Sym);
    3189                 :             : 
    3190                 :             : /*
    3191                 :             :    IsRegInterface - returns TRUE if Sym is a RegInterface symbol.
    3192                 :             : */
    3193                 :             : 
    3194                 :             : extern "C" bool SymbolTable_IsRegInterface (unsigned int Sym);
    3195                 :             : 
    3196                 :             : /*
    3197                 :             :    IsSizeSolved - returns true if the size of Sym is solved.
    3198                 :             : */
    3199                 :             : 
    3200                 :             : extern "C" bool SymbolTable_IsSizeSolved (unsigned int Sym);
    3201                 :             : 
    3202                 :             : /*
    3203                 :             :    IsOffsetSolved - returns true if the Offset of Sym is solved.
    3204                 :             : */
    3205                 :             : 
    3206                 :             : extern "C" bool SymbolTable_IsOffsetSolved (unsigned int Sym);
    3207                 :             : 
    3208                 :             : /*
    3209                 :             :    IsValueSolved - returns true if the value of Sym is solved.
    3210                 :             : */
    3211                 :             : 
    3212                 :             : extern "C" bool SymbolTable_IsValueSolved (unsigned int Sym);
    3213                 :             : 
    3214                 :             : /*
    3215                 :             :    IsConstructorConstant - returns TRUE if constructor, Sym, is
    3216                 :             :                            defined by only constants.
    3217                 :             : */
    3218                 :             : 
    3219                 :             : extern "C" bool SymbolTable_IsConstructorConstant (unsigned int Sym);
    3220                 :             : 
    3221                 :             : /*
    3222                 :             :    IsComposite - returns TRUE if symbol, sym, is a composite
    3223                 :             :                  type:  ie an ARRAY or RECORD.
    3224                 :             : */
    3225                 :             : 
    3226                 :             : extern "C" bool SymbolTable_IsComposite (unsigned int sym);
    3227                 :             : 
    3228                 :             : /*
    3229                 :             :    IsSumOfParamSizeSolved - has the sum of parameters been solved yet?
    3230                 :             : */
    3231                 :             : 
    3232                 :             : extern "C" bool SymbolTable_IsSumOfParamSizeSolved (unsigned int Sym);
    3233                 :             : 
    3234                 :             : /*
    3235                 :             :    PutAlignment - assigns the alignment constant associated with,
    3236                 :             :                   type, with, align.
    3237                 :             : */
    3238                 :             : 
    3239                 :             : extern "C" void SymbolTable_PutAlignment (unsigned int type, unsigned int align);
    3240                 :             : 
    3241                 :             : /*
    3242                 :             :    GetAlignment - returns the alignment constant associated with,
    3243                 :             :                   type.
    3244                 :             : */
    3245                 :             : 
    3246                 :             : extern "C" unsigned int SymbolTable_GetAlignment (unsigned int type);
    3247                 :             : 
    3248                 :             : /*
    3249                 :             :    GetDefaultRecordFieldAlignment - assigns, align, as the default alignment
    3250                 :             :                                     to record, sym.
    3251                 :             : */
    3252                 :             : 
    3253                 :             : extern "C" unsigned int SymbolTable_GetDefaultRecordFieldAlignment (unsigned int sym);
    3254                 :             : 
    3255                 :             : /*
    3256                 :             :    PutDefaultRecordFieldAlignment - assigns, align, as the default alignment
    3257                 :             :                                     to record, sym.
    3258                 :             : */
    3259                 :             : 
    3260                 :             : extern "C" void SymbolTable_PutDefaultRecordFieldAlignment (unsigned int sym, unsigned int align);
    3261                 :             : 
    3262                 :             : /*
    3263                 :             :    PutUnused - sets, sym, as unused.  This is a gm2 pragma.
    3264                 :             : */
    3265                 :             : 
    3266                 :             : extern "C" void SymbolTable_PutUnused (unsigned int sym);
    3267                 :             : 
    3268                 :             : /*
    3269                 :             :    IsUnused - returns TRUE if the symbol was declared as unused with a
    3270                 :             :               gm2 pragma.
    3271                 :             : */
    3272                 :             : 
    3273                 :             : extern "C" bool SymbolTable_IsUnused (unsigned int sym);
    3274                 :             : 
    3275                 :             : /*
    3276                 :             :    PutDeclaredPacked - sets the Packed field of the record or record field symbol.
    3277                 :             : */
    3278                 :             : 
    3279                 :             : extern "C" void SymbolTable_PutDeclaredPacked (unsigned int sym, bool b);
    3280                 :             : 
    3281                 :             : /*
    3282                 :             :    IsDeclaredPacked - was the record symbol or record field, sym,
    3283                 :             :                       declared as packed?
    3284                 :             : */
    3285                 :             : 
    3286                 :             : extern "C" bool SymbolTable_IsDeclaredPacked (unsigned int sym);
    3287                 :             : 
    3288                 :             : /*
    3289                 :             :    IsDeclaredPackedResolved - do we know if the record symbol or record
    3290                 :             :                               field, sym, declared as packed or not packed?
    3291                 :             : */
    3292                 :             : 
    3293                 :             : extern "C" bool SymbolTable_IsDeclaredPackedResolved (unsigned int sym);
    3294                 :             : 
    3295                 :             : /*
    3296                 :             :    GetPackedEquivalent - returns the packed equivalent of type, sym.
    3297                 :             :                          sym must be a type, subrange or enumerated type.
    3298                 :             : */
    3299                 :             : 
    3300                 :             : extern "C" unsigned int SymbolTable_GetPackedEquivalent (unsigned int sym);
    3301                 :             : 
    3302                 :             : /*
    3303                 :             :    GetNonPackedEquivalent - returns the equivalent non packed symbol associated with, sym.
    3304                 :             : */
    3305                 :             : 
    3306                 :             : extern "C" unsigned int SymbolTable_GetNonPackedEquivalent (unsigned int sym);
    3307                 :             : 
    3308                 :             : /*
    3309                 :             :    IsEquivalent - returns TRUE if, sym, is an equivalent symbol.
    3310                 :             : */
    3311                 :             : 
    3312                 :             : extern "C" bool SymbolTable_IsEquivalent (unsigned int sym);
    3313                 :             : 
    3314                 :             : /*
    3315                 :             :    PushSize - pushes the size of Sym.
    3316                 :             : */
    3317                 :             : 
    3318                 :             : extern "C" void SymbolTable_PushSize (unsigned int Sym);
    3319                 :             : 
    3320                 :             : /*
    3321                 :             :    PopSize - pops the ALU stack into Size of Sym.
    3322                 :             : */
    3323                 :             : 
    3324                 :             : extern "C" void SymbolTable_PopSize (unsigned int Sym);
    3325                 :             : 
    3326                 :             : /*
    3327                 :             :    PushValue - pushes the Value of Sym onto the ALU stack.
    3328                 :             : */
    3329                 :             : 
    3330                 :             : extern "C" void SymbolTable_PushValue (unsigned int Sym);
    3331                 :             : 
    3332                 :             : /*
    3333                 :             :    PushVarSize - pushes the size of a variable, Sym.
    3334                 :             :                  The runtime size of Sym will depend upon its addressing mode,
    3335                 :             :                  RightValue has size PushSize(GetType(Sym)) and
    3336                 :             :                  LeftValue has size PushSize(Address) since it points to a
    3337                 :             :                  variable.
    3338                 :             : */
    3339                 :             : 
    3340                 :             : extern "C" void SymbolTable_PushVarSize (unsigned int Sym);
    3341                 :             : 
    3342                 :             : /*
    3343                 :             :    PopValue - pops the ALU stack into Value of Sym.
    3344                 :             : */
    3345                 :             : 
    3346                 :             : extern "C" void SymbolTable_PopValue (unsigned int Sym);
    3347                 :             : 
    3348                 :             : /*
    3349                 :             :    IsObject - returns TRUE if the symbol is an object symbol.
    3350                 :             : */
    3351                 :             : 
    3352                 :             : extern "C" bool SymbolTable_IsObject (unsigned int Sym);
    3353                 :             : 
    3354                 :             : /*
    3355                 :             :    IsTuple - returns TRUE if the symbol is a tuple symbol.
    3356                 :             : */
    3357                 :             : 
    3358                 :             : extern "C" bool SymbolTable_IsTuple (unsigned int Sym);
    3359                 :             : 
    3360                 :             : /*
    3361                 :             :    Make2Tuple - creates and returns a 2 tuple from, a, and, b.
    3362                 :             : */
    3363                 :             : 
    3364                 :             : extern "C" unsigned int SymbolTable_Make2Tuple (unsigned int a, unsigned int b);
    3365                 :             : 
    3366                 :             : /*
    3367                 :             :    MakeError - creates an error node, which can be used in MetaError messages.
    3368                 :             :                It will be removed from ExportUndeclared and Unknown trees.
    3369                 :             : */
    3370                 :             : 
    3371                 :             : extern "C" unsigned int SymbolTable_MakeError (unsigned int tok, NameKey_Name name);
    3372                 :             : 
    3373                 :             : /*
    3374                 :             :    MakeErrorS - creates an error node from a string, which can be used
    3375                 :             :                 in MetaError messages.
    3376                 :             :                 It will be removed from ExportUndeclared and Unknown trees.
    3377                 :             : */
    3378                 :             : 
    3379                 :             : extern "C" unsigned int SymbolTable_MakeErrorS (unsigned int tok, DynamicStrings_String name);
    3380                 :             : 
    3381                 :             : /*
    3382                 :             :    IsError - returns TRUE if the symbol is an error symbol.
    3383                 :             : */
    3384                 :             : 
    3385                 :             : extern "C" bool SymbolTable_IsError (unsigned int Sym);
    3386                 :             : 
    3387                 :             : /*
    3388                 :             :    IsLegal - returns TRUE if, sym, is a legal symbol.
    3389                 :             : */
    3390                 :             : 
    3391                 :             : extern "C" bool SymbolTable_IsLegal (unsigned int sym);
    3392                 :             : 
    3393                 :             : /*
    3394                 :             :    PutModuleContainsBuiltin - sets a flag in the current compiled module which
    3395                 :             :                               indicates that a builtin procedure is being declared.
    3396                 :             :                               This is only expected to be called when we are
    3397                 :             :                               parsing the definition module.
    3398                 :             : */
    3399                 :             : 
    3400                 :             : extern "C" void SymbolTable_PutModuleContainsBuiltin (void);
    3401                 :             : 
    3402                 :             : /*
    3403                 :             :    IsBuiltinInModule - returns true if a module, Sym, has declared a builtin procedure.
    3404                 :             : */
    3405                 :             : 
    3406                 :             : extern "C" bool SymbolTable_IsBuiltinInModule (unsigned int Sym);
    3407                 :             : 
    3408                 :             : /*
    3409                 :             :    PutHiddenTypeDeclared - sets a flag in the current compiled module which
    3410                 :             :                            indicates that a Hidden Type is declared within
    3411                 :             :                            the implementation part of the module.
    3412                 :             :                            This procedure is expected to be called while
    3413                 :             :                            compiling the associated definition module.
    3414                 :             : */
    3415                 :             : 
    3416                 :             : extern "C" void SymbolTable_PutHiddenTypeDeclared (void);
    3417                 :             : 
    3418                 :             : /*
    3419                 :             :    IsHiddenTypeDeclared - returns true if a Hidden Type was declared in
    3420                 :             :                           the module, Sym.
    3421                 :             : */
    3422                 :             : 
    3423                 :             : extern "C" bool SymbolTable_IsHiddenTypeDeclared (unsigned int Sym);
    3424                 :             : 
    3425                 :             : /*
    3426                 :             :    IsHiddenReallyPointer - returns TRUE is sym is a pointer, address or a
    3427                 :             :                            type declared as a pointer or address.
    3428                 :             : */
    3429                 :             : 
    3430                 :             : extern "C" bool SymbolTable_IsHiddenReallyPointer (unsigned int Sym);
    3431                 :             : 
    3432                 :             : /*
    3433                 :             :    DisplayTrees - displays the SymbolTrees for Module symbol, ModSym.
    3434                 :             : */
    3435                 :             : 
    3436                 :             : extern "C" void SymbolTable_DisplayTrees (unsigned int ModSym);
    3437                 :             : 
    3438                 :             : /*
    3439                 :             :    DebugLineNumbers - internal debugging, emit all procedure names in this module
    3440                 :             :                       together with the line numbers for the corresponding begin/end
    3441                 :             :                       tokens.
    3442                 :             : */
    3443                 :             : 
    3444                 :             : extern "C" void SymbolTable_DebugLineNumbers (unsigned int sym);
    3445                 :             : 
    3446                 :             : /*
    3447                 :             :    GetErrorScope - returns the error scope for a symbol.
    3448                 :             :                    The error scope is the title scope which is used to
    3449                 :             :                    announce the symbol in the GCC error message.
    3450                 :             : */
    3451                 :             : 
    3452                 :             : extern "C" M2Error_ErrorScope SymbolTable_GetErrorScope (unsigned int sym);
    3453                 :             : 
    3454                 :             : /*
    3455                 :             :    MakeImport - create and return an import symbol.
    3456                 :             :                 moduleSym is the symbol being imported.
    3457                 :             :                 isqualified is FALSE if it were IMPORT modulename and
    3458                 :             :                 TRUE for the qualified FROM modulename IMPORT etc.
    3459                 :             :                 listno is the import list count for this module.
    3460                 :             :                 tok should match this modulename position.
    3461                 :             : */
    3462                 :             : 
    3463                 :             : extern "C" unsigned int SymbolTable_MakeImport (unsigned int tok, unsigned int moduleSym, unsigned int listno, bool isqualified);
    3464                 :             : 
    3465                 :             : /*
    3466                 :             :    MakeImportStatement - return a dependent symbol which represents an import statement
    3467                 :             :                    or a qualified import statement.  The tok should either match
    3468                 :             :                    the FROM token or the IMPORT token.  listno is the import list
    3469                 :             :                    count for the module.
    3470                 :             : */
    3471                 :             : 
    3472                 :             : extern "C" unsigned int SymbolTable_MakeImportStatement (unsigned int tok, unsigned int listno);
    3473                 :             : 
    3474                 :             : /*
    3475                 :             :    IsImport - returns TRUE if sym is an import symbol.
    3476                 :             : */
    3477                 :             : 
    3478                 :             : extern "C" bool SymbolTable_IsImport (unsigned int sym);
    3479                 :             : 
    3480                 :             : /*
    3481                 :             :    IsImportStatement - returns TRUE if sym is a dependent symbol.
    3482                 :             : */
    3483                 :             : 
    3484                 :             : extern "C" bool SymbolTable_IsImportStatement (unsigned int sym);
    3485                 :             : 
    3486                 :             : /*
    3487                 :             :    GetImportModule - returns the module associated with the import symbol.
    3488                 :             : */
    3489                 :             : 
    3490                 :             : extern "C" unsigned int SymbolTable_GetImportModule (unsigned int sym);
    3491                 :             : 
    3492                 :             : /*
    3493                 :             :    GetImportDeclared - returns the token associated with the import symbol.
    3494                 :             : */
    3495                 :             : 
    3496                 :             : extern "C" unsigned int SymbolTable_GetImportDeclared (unsigned int sym);
    3497                 :             : 
    3498                 :             : /*
    3499                 :             :    GetImportStatementList - returns the list of imports for this dependent.
    3500                 :             :                             Each import symbol corresponds to a module.
    3501                 :             : */
    3502                 :             : 
    3503                 :             : extern "C" Lists_List SymbolTable_GetImportStatementList (unsigned int sym);
    3504                 :             : 
    3505                 :             : /*
    3506                 :             :    GetModuleDefImportStatementList - returns the list of dependents associated with
    3507                 :             :                                      the definition module.
    3508                 :             : */
    3509                 :             : 
    3510                 :             : extern "C" Lists_List SymbolTable_GetModuleDefImportStatementList (unsigned int sym);
    3511                 :             : 
    3512                 :             : /*
    3513                 :             :    GetModuleModImportStatementList - returns the list of dependents associated with
    3514                 :             :                                      the implementation or program module.
    3515                 :             : */
    3516                 :             : 
    3517                 :             : extern "C" Lists_List SymbolTable_GetModuleModImportStatementList (unsigned int sym);
    3518                 :             : 
    3519                 :             : /*
    3520                 :             :    AppendModuleImportStatement - appends the ImportStatement symbol onto the
    3521                 :             :                                  module import list.
    3522                 :             : 
    3523                 :             :                                  For example:
    3524                 :             : 
    3525                 :             :                                  FROM x IMPORT y, z ;
    3526                 :             :                                  ^^^^
    3527                 :             : 
    3528                 :             :                                  also:
    3529                 :             : 
    3530                 :             :                                  IMPORT p, q, r;
    3531                 :             :                                  ^^^^^^
    3532                 :             :                                  will result in a new ImportStatement symbol added
    3533                 :             :                                  to the current module import list.
    3534                 :             :                                  The statement symbol is expected to be created
    3535                 :             :                                  by MakeImportStatement using the token positions
    3536                 :             :                                  outlined above.
    3537                 :             : */
    3538                 :             : 
    3539                 :             : extern "C" void SymbolTable_AppendModuleImportStatement (unsigned int module, unsigned int statement);
    3540                 :             : 
    3541                 :             : /*
    3542                 :             :    AppendModuleOnImportStatement - appends the import symbol onto the
    3543                 :             :                                    dependent list (chain).
    3544                 :             : 
    3545                 :             :                                    For example each:
    3546                 :             : 
    3547                 :             :                                    FROM x IMPORT y, z ;
    3548                 :             :                                         ^
    3549                 :             :                                    x are added to the dependent list.
    3550                 :             : 
    3551                 :             :                                    also:
    3552                 :             : 
    3553                 :             :                                    IMPORT p, q, r;
    3554                 :             :                                           ^  ^  ^
    3555                 :             :                                    will result in p, q and r added to
    3556                 :             :                                    to the dependent list.
    3557                 :             : 
    3558                 :             :                                    The import symbol is created by MakeImport
    3559                 :             :                                    and the token is expected to match the module
    3560                 :             :                                    name position outlined above.
    3561                 :             : */
    3562                 :             : 
    3563                 :             : extern "C" void SymbolTable_AppendModuleOnImportStatement (unsigned int module, unsigned int import);
    3564                 :             : 
    3565                 :             : /*
    3566                 :             :    PutModLink - assigns link to module sym.
    3567                 :             : */
    3568                 :             : 
    3569                 :             : extern "C" void SymbolTable_PutModLink (unsigned int sym, bool link);
    3570                 :             : 
    3571                 :             : /*
    3572                 :             :    IsModLink - returns the ModLink value associated with the module symbol.
    3573                 :             : */
    3574                 :             : 
    3575                 :             : extern "C" bool SymbolTable_IsModLink (unsigned int sym);
    3576                 :             : 
    3577                 :             : /*
    3578                 :             :    PutDefLink - assigns link to the definition module sym.
    3579                 :             : */
    3580                 :             : 
    3581                 :             : extern "C" void SymbolTable_PutDefLink (unsigned int sym, bool link);
    3582                 :             : 
    3583                 :             : /*
    3584                 :             :    IsDefLink - returns the DefLink value associated with the definition module symbol.
    3585                 :             : */
    3586                 :             : 
    3587                 :             : extern "C" bool SymbolTable_IsDefLink (unsigned int sym);
    3588                 :             : 
    3589                 :             : /*
    3590                 :             :    IsModuleBuiltin - returns TRUE if the module is a builtin module.
    3591                 :             :                      (For example _BaseTypes).
    3592                 :             : */
    3593                 :             : 
    3594                 :             : extern "C" bool SymbolTable_IsModuleBuiltin (unsigned int sym);
    3595                 :             : 
    3596                 :             : /*
    3597                 :             :    PutModuleBuiltin - sets the Builtin flag to value.
    3598                 :             :                       Currently the procedure expects sym to be a DefImp
    3599                 :             :                       module only.
    3600                 :             : */
    3601                 :             : 
    3602                 :             : extern "C" void SymbolTable_PutModuleBuiltin (unsigned int sym, bool value);
    3603                 :             : 
    3604                 :             : /*
    3605                 :             :    PutVarArrayRef - assigns ArrayRef field with value.
    3606                 :             : */
    3607                 :             : 
    3608                 :             : extern "C" void SymbolTable_PutVarArrayRef (unsigned int sym, bool value);
    3609                 :             : 
    3610                 :             : /*
    3611                 :             :    IsVarArrayRef - returns ArrayRef field value.
    3612                 :             : */
    3613                 :             : 
    3614                 :             : extern "C" bool SymbolTable_IsVarArrayRef (unsigned int sym);
    3615                 :             : 
    3616                 :             : /*
    3617                 :             :    VarCheckReadInit - returns TRUE if sym has been initialized.
    3618                 :             : */
    3619                 :             : 
    3620                 :             : extern "C" bool SymbolTable_VarCheckReadInit (unsigned int sym, SymbolTable_ModeOfAddr mode);
    3621                 :             : 
    3622                 :             : /*
    3623                 :             :    VarInitState - initializes the init state for variable sym.
    3624                 :             : */
    3625                 :             : 
    3626                 :             : extern "C" void SymbolTable_VarInitState (unsigned int sym);
    3627                 :             : 
    3628                 :             : /*
    3629                 :             :    PutVarInitialized - set sym as initialized.
    3630                 :             : */
    3631                 :             : 
    3632                 :             : extern "C" void SymbolTable_PutVarInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode);
    3633                 :             : 
    3634                 :             : /*
    3635                 :             :    PutVarFieldInitialized - records that field has been initialized with
    3636                 :             :                             variable sym.  TRUE is returned if the field
    3637                 :             :                             is detected and changed to initialized.
    3638                 :             : */
    3639                 :             : 
    3640                 :             : extern "C" bool SymbolTable_PutVarFieldInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode, Lists_List fieldlist);
    3641                 :             : 
    3642                 :             : /*
    3643                 :             :    GetVarFieldInitialized - return TRUE if fieldlist has been initialized
    3644                 :             :                             within variable sym.
    3645                 :             : */
    3646                 :             : 
    3647                 :             : extern "C" bool SymbolTable_GetVarFieldInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode, Lists_List fieldlist);
    3648                 :             : 
    3649                 :             : /*
    3650                 :             :    PrintInitialized - display variable sym initialization state.
    3651                 :             : */
    3652                 :             : 
    3653                 :             : extern "C" void SymbolTable_PrintInitialized (unsigned int sym);
    3654                 :             : 
    3655                 :             : /*
    3656                 :             :    GetParameterHeapVar - return the heap variable associated with the
    3657                 :             :                          parameter or NulSym.
    3658                 :             : */
    3659                 :             : 
    3660                 :             : extern "C" unsigned int SymbolTable_GetParameterHeapVar (unsigned int ParSym);
    3661                 :             : 
    3662                 :             : /*
    3663                 :             :    PutProcedureParameterHeapVars - creates heap variables for parameter sym.
    3664                 :             : */
    3665                 :             : 
    3666                 :             : extern "C" void SymbolTable_PutProcedureParameterHeapVars (unsigned int sym);
    3667                 :             : 
    3668                 :             : /*
    3669                 :             :    IsProcedureBuiltinAvailable - return TRUE if procedure is available as a builtin
    3670                 :             :                                  for the target architecture.
    3671                 :             : */
    3672                 :             : 
    3673                 :             : extern "C" bool SymbolTable_IsProcedureBuiltinAvailable (unsigned int procedure);
    3674                 :             : 
    3675                 :             : /*
    3676                 :             :    PutConstLitInternal - marks the sym as being an internal constant.
    3677                 :             :                          Currently this is used when generating a default
    3678                 :             :                          BY constant expression during a FOR loop.
    3679                 :             :                          A constant marked as internal will always pass
    3680                 :             :                          an expression type check.
    3681                 :             : */
    3682                 :             : 
    3683                 :             : extern "C" void SymbolTable_PutConstLitInternal (unsigned int sym, bool value);
    3684                 :             : 
    3685                 :             : /*
    3686                 :             :    IsConstLitInternal - returns the value of the IsInternal field within
    3687                 :             :                         a constant expression.
    3688                 :             : */
    3689                 :             : 
    3690                 :             : extern "C" bool SymbolTable_IsConstLitInternal (unsigned int sym);
    3691                 :             : 
    3692                 :             : /*
    3693                 :             :    GetVarDeclTypeTok - returns the TypeTok field associate with variable sym.
    3694                 :             : */
    3695                 :             : 
    3696                 :             : extern "C" unsigned int SymbolTable_GetVarDeclTypeTok (unsigned int sym);
    3697                 :             : 
    3698                 :             : /*
    3699                 :             :    PutVarDeclTypeTok - assigns the TypeTok field to typetok.
    3700                 :             :                        sym can be a variable or parameter.
    3701                 :             : */
    3702                 :             : 
    3703                 :             : extern "C" void SymbolTable_PutVarDeclTypeTok (unsigned int sym, unsigned int typetok);
    3704                 :             : 
    3705                 :             : /*
    3706                 :             :    GetVarDeclTok - returns the TypeTok field associate with variable sym.
    3707                 :             : */
    3708                 :             : 
    3709                 :             : extern "C" unsigned int SymbolTable_GetVarDeclTok (unsigned int sym);
    3710                 :             : 
    3711                 :             : /*
    3712                 :             :    PutVarDeclTok - assigns the VarTok field to typetok.
    3713                 :             :                    sym can be a variable or parameter.
    3714                 :             : */
    3715                 :             : 
    3716                 :             : extern "C" void SymbolTable_PutVarDeclTok (unsigned int sym, unsigned int vartok);
    3717                 :             : 
    3718                 :             : /*
    3719                 :             :    GetVarDeclFullTok - returns the full virtual token containing var: type.
    3720                 :             : */
    3721                 :             : 
    3722                 :             : extern "C" unsigned int SymbolTable_GetVarDeclFullTok (unsigned int sym);
    3723                 :             : 
    3724                 :             : /*
    3725                 :             :    IsProcedureAnyNoReturn - return TRUE if any of the defined kinds
    3726                 :             :                             of procedure sym is declared no return.
    3727                 :             : */
    3728                 :             : 
    3729                 :             : extern "C" bool SymbolTable_IsProcedureAnyNoReturn (unsigned int sym);
    3730                 :             : 
    3731                 :             : /*
    3732                 :             :    GetNthParamAny - returns the nth parameter from the order
    3733                 :             :                     proper procedure, forward declaration
    3734                 :             :                     or definition module procedure.
    3735                 :             : */
    3736                 :             : 
    3737                 :             : extern "C" unsigned int SymbolTable_GetNthParamAny (unsigned int sym, unsigned int ParamNo);
    3738                 :             : 
    3739                 :             : /*
    3740                 :             :    NoOfParamAny - return the number of parameters for sym.
    3741                 :             : */
    3742                 :             : 
    3743                 :             : extern "C" unsigned int SymbolTable_NoOfParamAny (unsigned int sym);
    3744                 :             : 
    3745                 :             : /*
    3746                 :             :    SetReturnOptional - sets the ReturnOptional field in the Procedure:kind or
    3747                 :             :                        ProcType symboltable entry.
    3748                 :             : */
    3749                 :             : 
    3750                 :             : extern "C" void SymbolTable_SetReturnOptional (unsigned int sym, SymbolTable_ProcedureKind kind, bool isopt);
    3751                 :             : 
    3752                 :             : /*
    3753                 :             :    UsesOptArgAny - returns TRUE if procedure Sym:kind uses an optional argument.
    3754                 :             : */
    3755                 :             : 
    3756                 :             : extern "C" bool SymbolTable_UsesOptArgAny (unsigned int Sym);
    3757                 :             : 
    3758                 :             : /*
    3759                 :             :    GetProcedureKindDesc - return a string describing kind.
    3760                 :             : */
    3761                 :             : 
    3762                 :             : extern "C" DynamicStrings_String SymbolTable_GetProcedureKindDesc (SymbolTable_ProcedureKind kind);
    3763                 :             : 
    3764                 :             : /*
    3765                 :             :    GetNthParamAnyClosest - returns the nth parameter from the order
    3766                 :             :                            proper procedure, forward declaration
    3767                 :             :                            or definition module procedure.
    3768                 :             :                            It chooses the parameter which is closest
    3769                 :             :                            in source terms to currentmodule.
    3770                 :             :                            The same module will return using the order
    3771                 :             :                            proper procedure, forward procedure, definition module.
    3772                 :             :                            Whereas an imported procedure will choose from
    3773                 :             :                            DefProcedure, ProperProcedure, ForwardProcedure.
    3774                 :             : */
    3775                 :             : 
    3776                 :             : extern "C" unsigned int SymbolTable_GetNthParamAnyClosest (unsigned int sym, unsigned int ParamNo, unsigned int currentmodule);
    3777                 :             : 
    3778                 :             : /*
    3779                 :             :    IsConstVar - returns TRUE if sym is a const var.  This is a
    3780                 :             :                 constant which might be assigned to TRUE or FALSE
    3781                 :             :                 depending upon the result of the quad stack control flow.
    3782                 :             :                 Typically used in CONST foo = (a AND b) or similar.
    3783                 :             :                 This symbol will only be assigned once with a value, but
    3784                 :             :                 will appear more than once as a designator to an assignment
    3785                 :             :                 in the quad table.  However as the quad table is reduced
    3786                 :             :                 only one assignment will remain.  If after reducing quads
    3787                 :             :                 two or more assignments remain, then there is an error
    3788                 :             :                 as sym should not have been declared a constant.
    3789                 :             : */
    3790                 :             : 
    3791                 :             : extern "C" bool SymbolTable_IsConstVar (unsigned int sym);
    3792                 :             : static void InitWhereDeclaredTok (unsigned int tok, SymbolTable_Where *at);
    3793                 :             : 
    3794                 :             : /*
    3795                 :             :    InitWhereDeclared - sets the Declared and FirstUsed fields of record, at.
    3796                 :             : */
    3797                 :             : 
    3798                 :             : static void InitWhereDeclared (SymbolTable_Where *at);
    3799                 :             : 
    3800                 :             : /*
    3801                 :             :    InitWhereFirstUsed - sets the FirstUsed field of record, at.
    3802                 :             : */
    3803                 :             : 
    3804                 :             : static void InitWhereFirstUsed (SymbolTable_Where *at);
    3805                 :             : 
    3806                 :             : /*
    3807                 :             :    InitWhereFirstUsedTok - sets the FirstUsed field of record, at.
    3808                 :             : */
    3809                 :             : 
    3810                 :             : static void InitWhereFirstUsedTok (unsigned int tok, SymbolTable_Where *at);
    3811                 :             : 
    3812                 :             : /*
    3813                 :             :    gdbhook - a debugger convenience hook.
    3814                 :             : */
    3815                 :             : 
    3816                 :             : static void gdbhook (void);
    3817                 :             : 
    3818                 :             : /*
    3819                 :             :    BreakWhenSymCreated - to be called interactively by gdb.
    3820                 :             : */
    3821                 :             : 
    3822                 :             : static void BreakWhenSymCreated (unsigned int sym);
    3823                 :             : 
    3824                 :             : /*
    3825                 :             :    CheckBreak - if sym = BreakSym then call gdbhook.
    3826                 :             : */
    3827                 :             : 
    3828                 :             : static void CheckBreak (unsigned int sym);
    3829                 :             : 
    3830                 :             : /*
    3831                 :             :    NewSym - Sets Sym to a new symbol index.
    3832                 :             : */
    3833                 :             : 
    3834                 :             : static void NewSym (unsigned int *sym);
    3835                 :             : 
    3836                 :             : /*
    3837                 :             :    GetPsym - returns the pointer to, sym.
    3838                 :             : */
    3839                 :             : 
    3840                 :             : static SymbolTable_PtrToSymbol GetPsym (unsigned int sym);
    3841                 :             : 
    3842                 :             : /*
    3843                 :             :    GetPcall - returns the pointer to the CallFrame.
    3844                 :             : */
    3845                 :             : 
    3846                 :             : static SymbolTable_PtrToCallFrame GetPcall (unsigned int call);
    3847                 :             : 
    3848                 :             : /*
    3849                 :             :    DebugProcedureLineNumber -
    3850                 :             : */
    3851                 :             : 
    3852                 :             : static void DebugProcedureLineNumber (unsigned int sym);
    3853                 :             : 
    3854                 :             : /*
    3855                 :             :    PutPartialUnbounded -
    3856                 :             : */
    3857                 :             : 
    3858                 :             : static void PutPartialUnbounded (unsigned int sym, unsigned int type, unsigned int ndim);
    3859                 :             : 
    3860                 :             : /*
    3861                 :             :    AlreadyDeclaredError - generate an error message, a, and two areas of code showing
    3862                 :             :                           the places where the symbols were declared.
    3863                 :             : */
    3864                 :             : 
    3865                 :             : static void AlreadyDeclaredError (DynamicStrings_String s, NameKey_Name name, unsigned int OtherOccurance);
    3866                 :             : 
    3867                 :             : /*
    3868                 :             :    MakeObject - creates an object node.
    3869                 :             : */
    3870                 :             : 
    3871                 :             : static unsigned int MakeObject (NameKey_Name name);
    3872                 :             : 
    3873                 :             : /*
    3874                 :             :    DeclareSym - returns a symbol which was either in the unknown tree or
    3875                 :             :                 a New symbol, since name is about to be declared.
    3876                 :             : */
    3877                 :             : 
    3878                 :             : static unsigned int DeclareSym (unsigned int tok, NameKey_Name name);
    3879                 :             : 
    3880                 :             : /*
    3881                 :             :    Init - Initializes the data structures and variables in this module.
    3882                 :             :           Initialize the trees.
    3883                 :             : */
    3884                 :             : 
    3885                 :             : static void Init (void);
    3886                 :             : 
    3887                 :             : /*
    3888                 :             :    AddSymToUnknown -
    3889                 :             : */
    3890                 :             : 
    3891                 :             : static void AddSymToUnknown (unsigned int scope, NameKey_Name name, unsigned int Sym);
    3892                 :             : 
    3893                 :             : /*
    3894                 :             :    AddSymToUnknownTree - adds a symbol with name, name, and Sym to the
    3895                 :             :                          unknown tree.
    3896                 :             : */
    3897                 :             : 
    3898                 :             : static void AddSymToUnknownTree (int ScopeId, NameKey_Name name, unsigned int Sym);
    3899                 :             : 
    3900                 :             : /*
    3901                 :             :    SubSymFromUnknownTree - removes a symbol with name, name, from the
    3902                 :             :                            unknown tree.
    3903                 :             : */
    3904                 :             : 
    3905                 :             : static void SubSymFromUnknownTree (NameKey_Name name);
    3906                 :             : 
    3907                 :             : /*
    3908                 :             :    GetSymFromUnknownTree - returns a symbol with name, name, from the
    3909                 :             :                            unknown tree.
    3910                 :             :                            If no symbol with name is found then NulSym
    3911                 :             :                            is returned.
    3912                 :             : */
    3913                 :             : 
    3914                 :             : static unsigned int GetSymFromUnknownTree (NameKey_Name name);
    3915                 :             : 
    3916                 :             : /*
    3917                 :             :    ExamineUnresolvedTree - returns a symbol with name, name, from the
    3918                 :             :                            unresolved tree of module, ModSym.
    3919                 :             :                            If no symbol with name is found then NulSym
    3920                 :             :                            is returned.
    3921                 :             : */
    3922                 :             : 
    3923                 :             : static unsigned int ExamineUnresolvedTree (unsigned int ScopeSym, NameKey_Name name);
    3924                 :             : 
    3925                 :             : /*
    3926                 :             :    RemoveFromUnresolvedTree - removes a symbol with name, name, from the
    3927                 :             :                               unresolved tree of symbol, ScopeSym.
    3928                 :             : */
    3929                 :             : 
    3930                 :             : static bool RemoveFromUnresolvedTree (unsigned int ScopeSym, NameKey_Name name);
    3931                 :             : 
    3932                 :             : /*
    3933                 :             :    FetchUnknownSym - returns a symbol from the unknown tree if one is
    3934                 :             :                      available. It also updates the unknown tree.
    3935                 :             : */
    3936                 :             : 
    3937                 :             : static unsigned int FetchUnknownSym (NameKey_Name name);
    3938                 :             : 
    3939                 :             : /*
    3940                 :             :    TransparentScope - returns true is the scope symbol Sym is allowed
    3941                 :             :                       to look to an outer level for a symbol.
    3942                 :             :                       ie is the symbol allowed to look to the parent
    3943                 :             :                       scope for a symbol.
    3944                 :             : */
    3945                 :             : 
    3946                 :             : static bool TransparentScope (unsigned int Sym);
    3947                 :             : 
    3948                 :             : /*
    3949                 :             :    GetLastModuleOrProcedureScope - returns the last module or procedure scope encountered,
    3950                 :             :                                    the scope before the current module scope.
    3951                 :             : */
    3952                 :             : 
    3953                 :             : static unsigned int GetLastModuleOrProcedureScope (void);
    3954                 :             : 
    3955                 :             : /*
    3956                 :             :    AddSymToScope - adds a symbol Sym with name name to
    3957                 :             :                    the current scope symbol tree.
    3958                 :             : */
    3959                 :             : 
    3960                 :             : static void AddSymToScope (unsigned int Sym, NameKey_Name name);
    3961                 :             : 
    3962                 :             : /*
    3963                 :             :    PlaceMajorScopesEnumerationListOntoStack - places the DefImp, Module and
    3964                 :             :                                               Procedure symbols enumeration
    3965                 :             :                                               list onto the scope stack.
    3966                 :             : */
    3967                 :             : 
    3968                 :             : static void PlaceMajorScopesEnumerationListOntoStack (unsigned int Sym);
    3969                 :             : 
    3970                 :             : /*
    3971                 :             :    PlaceEnumerationListOntoScope - places an enumeration list, l, onto the
    3972                 :             :                                    scope stack. This list will automatically
    3973                 :             :                                    removed via one call to EndScope which
    3974                 :             :                                    matches the StartScope by which this
    3975                 :             :                                    procedure is invoked.
    3976                 :             : */
    3977                 :             : 
    3978                 :             : static void PlaceEnumerationListOntoScope (Lists_List l);
    3979                 :             : 
    3980                 :             : /*
    3981                 :             :    SetFirstUsed - assigns the FirstUsed field in at to tok providing
    3982                 :             :                   it has not already been set.
    3983                 :             : */
    3984                 :             : 
    3985                 :             : static void SetFirstUsed (unsigned int tok, SymbolTable_Where *at);
    3986                 :             : 
    3987                 :             : /*
    3988                 :             :    PutFirstUsed - sets tok to the first used providing it has not already been set.
    3989                 :             :                   It also includes the read and write quad into the usage list
    3990                 :             :                   providing the quad numbers are not 0.
    3991                 :             : */
    3992                 :             : 
    3993                 :             : static void PutFirstUsed (unsigned int object, unsigned int tok, unsigned int read_, unsigned int write_);
    3994                 :             : 
    3995                 :             : /*
    3996                 :             :    CanLookThroughScope - by default this procedure returns TRUE.  It only returns
    3997                 :             :                          FALSE if, throughProcedure, is FALSE and the ScopeSym is
    3998                 :             :                          a procedure.
    3999                 :             : */
    4000                 :             : 
    4001                 :             : static bool CanLookThroughScope (unsigned int ScopeSym, bool throughProcedure);
    4002                 :             : 
    4003                 :             : /*
    4004                 :             :    GetScopeSym - searches the current scope and below, providing that the
    4005                 :             :                  scopes are transparent, for a symbol with name, name.
    4006                 :             :                  It only passes over procedure scopes if, throughProcedure,
    4007                 :             :                  is TRUE.
    4008                 :             : */
    4009                 :             : 
    4010                 :             : static unsigned int GetScopeSym (NameKey_Name name, bool throughProcedure);
    4011                 :             : 
    4012                 :             : /*
    4013                 :             :    CheckScopeForSym - checks the scope, ScopeSym, for an identifier
    4014                 :             :                       of name, name. CheckScopeForSym checks for
    4015                 :             :                       the symbol by the GetLocalSym and also
    4016                 :             :                       ExamineUnresolvedTree.
    4017                 :             : */
    4018                 :             : 
    4019                 :             : static unsigned int CheckScopeForSym (unsigned int ScopeSym, NameKey_Name name);
    4020                 :             : 
    4021                 :             : /*
    4022                 :             :    GetModuleScopeId - returns the scope index to the next module starting
    4023                 :             :                       at index, Id.
    4024                 :             :                       Id will either point to a null scope (NulSym) or
    4025                 :             :                       alternatively point to a Module or DefImp symbol.
    4026                 :             : */
    4027                 :             : 
    4028                 :             : static unsigned int GetModuleScopeId (unsigned int Id);
    4029                 :             : 
    4030                 :             : /*
    4031                 :             :    GetVisibleSym -
    4032                 :             : */
    4033                 :             : 
    4034                 :             : static unsigned int GetVisibleSym (NameKey_Name name);
    4035                 :             : 
    4036                 :             : /*
    4037                 :             :    IsAlreadyDeclaredSym - returns true if Sym has already been declared
    4038                 :             :                           in the current main scope.
    4039                 :             : */
    4040                 :             : 
    4041                 :             : static bool IsAlreadyDeclaredSym (NameKey_Name name);
    4042                 :             : 
    4043                 :             : /*
    4044                 :             :    GenName - returns a new name consisting of pre, name, post concatenation.
    4045                 :             : */
    4046                 :             : 
    4047                 :             : static NameKey_Name GenName (NameKey_Name libname, const char *pre_, unsigned int _pre_high, NameKey_Name name, const char *post_, unsigned int _post_high);
    4048                 :             : 
    4049                 :             : /*
    4050                 :             :    InitCtor - initialize the ModuleCtor fields to NulSym.
    4051                 :             : */
    4052                 :             : 
    4053                 :             : static void InitCtor (SymbolTable_ModuleCtor *ctor);
    4054                 :             : 
    4055                 :             : /*
    4056                 :             :    InitCtorFields - initialize the ModuleCtor fields.  An inner module has no
    4057                 :             :                     ctor procedure.
    4058                 :             : */
    4059                 :             : 
    4060                 :             : static void InitCtorFields (unsigned int moduleTok, unsigned int beginTok, unsigned int finallyTok, unsigned int moduleSym, SymbolTable_ModuleCtor *ctor, NameKey_Name name, bool inner, bool pub);
    4061                 :             : 
    4062                 :             : /*
    4063                 :             :    CheckTok - checks to see that tok is at a known location.  If not
    4064                 :             :               it uses GetTokenNo as a fall back.
    4065                 :             : */
    4066                 :             : 
    4067                 :             : static unsigned int CheckTok (unsigned int tok, const char *name_, unsigned int _name_high);
    4068                 :             : 
    4069                 :             : /*
    4070                 :             :    GetLink - returns TRUE if the current module is only used for linkage.
    4071                 :             : */
    4072                 :             : 
    4073                 :             : static bool GetLink (void);
    4074                 :             : 
    4075                 :             : /*
    4076                 :             :    AddModuleToParent - adds symbol, Sym, to module, Parent.
    4077                 :             : */
    4078                 :             : 
    4079                 :             : static void AddModuleToParent (unsigned int Sym, unsigned int Parent);
    4080                 :             : 
    4081                 :             : /*
    4082                 :             :    PutProcedureExternPublic - if procedure is not NulSym set extern
    4083                 :             :                               and public booleans.
    4084                 :             : */
    4085                 :             : 
    4086                 :             : static void PutProcedureExternPublic (unsigned int procedure, bool extern_, bool pub);
    4087                 :             : 
    4088                 :             : /*
    4089                 :             :    PutCtorExtern -
    4090                 :             : */
    4091                 :             : 
    4092                 :             : static void PutCtorExtern (unsigned int tok, unsigned int sym, SymbolTable_ModuleCtor *ctor, bool extern_);
    4093                 :             : 
    4094                 :             : /*
    4095                 :             :    InitProcedureDeclaration - initialize all the ProcedureDeclaration
    4096                 :             :                               fields.
    4097                 :             : */
    4098                 :             : 
    4099                 :             : static void InitProcedureDeclaration (SymbolTable_ProcedureDeclaration *decl);
    4100                 :             : 
    4101                 :             : /*
    4102                 :             :    AddProcedureToList - adds a procedure, Proc, to the list of procedures
    4103                 :             :                         in module, Mod.
    4104                 :             : */
    4105                 :             : 
    4106                 :             : static void AddProcedureToList (unsigned int Mod, unsigned int Proc);
    4107                 :             : 
    4108                 :             : /*
    4109                 :             :    AddVarToScopeList - adds symbol, sym, to, scope.
    4110                 :             : */
    4111                 :             : 
    4112                 :             : static void AddVarToScopeList (unsigned int scope, unsigned int sym);
    4113                 :             : 
    4114                 :             : /*
    4115                 :             :    AddVarToList - add a variable symbol to the list of variables maintained
    4116                 :             :                   by the inner most scope. (Procedure or Module).
    4117                 :             : */
    4118                 :             : 
    4119                 :             : static void AddVarToList (unsigned int Sym);
    4120                 :             : 
    4121                 :             : /*
    4122                 :             :    InitVarDecl - initialize the variable and type token location positions.
    4123                 :             : */
    4124                 :             : 
    4125                 :             : static void InitVarDecl (SymbolTable_VarDecl *decl, unsigned int vartok);
    4126                 :             : 
    4127                 :             : /*
    4128                 :             :    doPutVarDeclTypeTok - places typetok into decl.TypeTok.
    4129                 :             :                          sym must be a variable.
    4130                 :             : */
    4131                 :             : 
    4132                 :             : static void doPutVarDeclTypeTok (unsigned int sym, unsigned int typetok);
    4133                 :             : 
    4134                 :             : /*
    4135                 :             :    doPutVarDeclTok - places vartok into decl.VarTok.
    4136                 :             :                      sym must be a variable.
    4137                 :             : */
    4138                 :             : 
    4139                 :             : static void doPutVarDeclTok (unsigned int sym, unsigned int vartok);
    4140                 :             : 
    4141                 :             : /*
    4142                 :             :    doGetVarDeclTok - return decl.VarTok for a variable.
    4143                 :             : */
    4144                 :             : 
    4145                 :             : static unsigned int doGetVarDeclTok (unsigned int sym);
    4146                 :             : 
    4147                 :             : /*
    4148                 :             :    doGetVarDeclTypeTok - return decl.TypeTok for a variable.
    4149                 :             : */
    4150                 :             : 
    4151                 :             : static unsigned int doGetVarDeclTypeTok (unsigned int sym);
    4152                 :             : 
    4153                 :             : /*
    4154                 :             :    doGetVarDeclFullTok - return the full declaration of var: type.
    4155                 :             : */
    4156                 :             : 
    4157                 :             : static unsigned int doGetVarDeclFullTok (unsigned int sym);
    4158                 :             : 
    4159                 :             : /*
    4160                 :             :    FillInRecordFields - given a new symbol, sym, make it a record symbol
    4161                 :             :                         and initialize its fields.
    4162                 :             : */
    4163                 :             : 
    4164                 :             : static void FillInRecordFields (unsigned int tok, unsigned int sym, NameKey_Name RecordName, unsigned int scope, unsigned int oaf);
    4165                 :             : 
    4166                 :             : /*
    4167                 :             :    HandleHiddenOrDeclare -
    4168                 :             : */
    4169                 :             : 
    4170                 :             : static unsigned int HandleHiddenOrDeclare (unsigned int tok, NameKey_Name name, unsigned int *oaf);
    4171                 :             : 
    4172                 :             : /*
    4173                 :             :    CreateConstLit -
    4174                 :             : */
    4175                 :             : 
    4176                 :             : static unsigned int CreateConstLit (unsigned int tok, NameKey_Name constName, unsigned int constType);
    4177                 :             : 
    4178                 :             : /*
    4179                 :             :    LookupConstLitPoolEntry - return a ConstLit symbol from the constant pool which
    4180                 :             :                              matches tok, constName and constType.
    4181                 :             : */
    4182                 :             : 
    4183                 :             : static unsigned int LookupConstLitPoolEntry (unsigned int tok, NameKey_Name constName, unsigned int constType);
    4184                 :             : 
    4185                 :             : /*
    4186                 :             :    AddConstLitPoolEntry - adds sym to the constlit pool.
    4187                 :             : */
    4188                 :             : 
    4189                 :             : static void AddConstLitPoolEntry (unsigned int sym, unsigned int tok, NameKey_Name constName, unsigned int constType);
    4190                 :             : 
    4191                 :             : /*
    4192                 :             :    InitConstString - initialize the constant string.
    4193                 :             : */
    4194                 :             : 
    4195                 :             : static void InitConstString (unsigned int tok, unsigned int sym, NameKey_Name name, NameKey_Name contents, SymbolTable_ConstStringVariant kind, bool escape, bool known);
    4196                 :             : 
    4197                 :             : /*
    4198                 :             :    GetConstStringKind - return the StringVariant field associated with sym.
    4199                 :             : */
    4200                 :             : 
    4201                 :             : static SymbolTable_ConstStringVariant GetConstStringKind (unsigned int sym);
    4202                 :             : 
    4203                 :             : /*
    4204                 :             :    CanUseBuiltin - returns TRUE if the procedure, Sym, can be
    4205                 :             :                    inlined via a builtin function.
    4206                 :             : */
    4207                 :             : 
    4208                 :             : static bool CanUseBuiltin (unsigned int Sym);
    4209                 :             : 
    4210                 :             : /*
    4211                 :             :    InitPacked - initialise packedInfo to FALSE and NulSym.
    4212                 :             : */
    4213                 :             : 
    4214                 :             : static void InitPacked (SymbolTable_PackedInfo *packedInfo);
    4215                 :             : 
    4216                 :             : /*
    4217                 :             :    doEquivalent - create a packed equivalent symbol for, sym, and return the
    4218                 :             :                   new symbol.  It sets both fields in packedInfo to FALSE
    4219                 :             :                   and the new symbol.
    4220                 :             : */
    4221                 :             : 
    4222                 :             : static unsigned int doEquivalent (SymbolTable_PackedInfo *packedInfo, unsigned int sym);
    4223                 :             : 
    4224                 :             : /*
    4225                 :             :    MakeEquivalent - return the equivalent packed symbol for, sym.
    4226                 :             : */
    4227                 :             : 
    4228                 :             : static unsigned int MakeEquivalent (unsigned int sym);
    4229                 :             : 
    4230                 :             : /*
    4231                 :             :    GetEquivalent -
    4232                 :             : */
    4233                 :             : 
    4234                 :             : static unsigned int GetEquivalent (SymbolTable_PackedInfo *packedInfo, unsigned int sym);
    4235                 :             : 
    4236                 :             : /*
    4237                 :             :    doGetType - subsiduary helper procedure function of GetDType, GetSType and GetLType.
    4238                 :             : */
    4239                 :             : 
    4240                 :             : static unsigned int doGetType (unsigned int sym, bool skipEquiv, bool skipAlign, bool skipHidden, bool skipBase);
    4241                 :             : 
    4242                 :             : /*
    4243                 :             :    GetTypeOfVar - returns the type of symbol, var.
    4244                 :             : */
    4245                 :             : 
    4246                 :             : static unsigned int GetTypeOfVar (unsigned int var);
    4247                 :             : 
    4248                 :             : /*
    4249                 :             :    GetConstLitType - returns the type of the constant of, name.
    4250                 :             :                      All floating point constants have type LONGREAL.
    4251                 :             :                      Character constants are type CHAR.
    4252                 :             :                      Integer values are INTEGER, LONGINT or LONGCARD
    4253                 :             :                      depending upon their value.
    4254                 :             : */
    4255                 :             : 
    4256                 :             : static unsigned int GetConstLitType (unsigned int tok, NameKey_Name name, bool *overflow, bool issueError);
    4257                 :             : 
    4258                 :             : /*
    4259                 :             :    GetNthFromComponent -
    4260                 :             : */
    4261                 :             : 
    4262                 :             : static unsigned int GetNthFromComponent (unsigned int Sym, unsigned int n);
    4263                 :             : 
    4264                 :             : /*
    4265                 :             :    GetNthParamChoice - returns the parameter definition from
    4266                 :             :                        sym:ParamNo:kind or NulSym.
    4267                 :             : */
    4268                 :             : 
    4269                 :             : static unsigned int GetNthParamChoice (unsigned int sym, unsigned int ParamNo, SymbolTable_ProcedureKind kind);
    4270                 :             : 
    4271                 :             : /*
    4272                 :             :    GetNthParamOrdered - returns the parameter definition from list {a, b, c}
    4273                 :             :                         in order.
    4274                 :             :                         sym:ParamNo:{a,b,c} or NulSym.
    4275                 :             : */
    4276                 :             : 
    4277                 :             : static unsigned int GetNthParamOrdered (unsigned int sym, unsigned int ParamNo, SymbolTable_ProcedureKind a, SymbolTable_ProcedureKind b, SymbolTable_ProcedureKind c);
    4278                 :             : 
    4279                 :             : /*
    4280                 :             :    GetOuterModuleScope - returns the outer module symbol scope for sym.
    4281                 :             : */
    4282                 :             : 
    4283                 :             : static unsigned int GetOuterModuleScope (unsigned int sym);
    4284                 :             : 
    4285                 :             : /*
    4286                 :             :    EnsureOrder - providing that both symbols, a, and, b, exist in
    4287                 :             :                  list, l.  Ensure that, b, is placed after a.
    4288                 :             : */
    4289                 :             : 
    4290                 :             : static void EnsureOrder (Lists_List l, unsigned int a, unsigned int b);
    4291                 :             : 
    4292                 :             : /*
    4293                 :             :    DumpSons -
    4294                 :             : */
    4295                 :             : 
    4296                 :             : static void DumpSons (unsigned int sym);
    4297                 :             : 
    4298                 :             : /*
    4299                 :             :    CheckListOfSons - checks to see that sym, is present in, recordConsist, ListOfSons.
    4300                 :             : */
    4301                 :             : 
    4302                 :             : static void CheckListOfSons (unsigned int sym);
    4303                 :             : 
    4304                 :             : /*
    4305                 :             :    CheckRecordConsistency -
    4306                 :             : */
    4307                 :             : 
    4308                 :             : static void CheckRecordConsistency (unsigned int sym);
    4309                 :             : 
    4310                 :             : /*
    4311                 :             :    PutConstVarTemporary - indicates that constant, sym, is a temporary.
    4312                 :             : */
    4313                 :             : 
    4314                 :             : static void PutConstVarTemporary (unsigned int sym);
    4315                 :             : 
    4316                 :             : /*
    4317                 :             :    buildTemporary - builds the temporary filling in componentRef, record and sets mode.
    4318                 :             : */
    4319                 :             : 
    4320                 :             : static unsigned int buildTemporary (unsigned int tok, SymbolTable_ModeOfAddr Mode, bool componentRef, unsigned int record);
    4321                 :             : 
    4322                 :             : /*
    4323                 :             :    AssertInRange - determines whether the Sym is a legal symbol.
    4324                 :             : */
    4325                 :             : 
    4326                 :             : static void AssertInRange (unsigned int Sym);
    4327                 :             : 
    4328                 :             : /*
    4329                 :             :    CheckForHiddenType - scans the NeedToBeImplemented tree providing
    4330                 :             :                         that we are currently compiling an implementation
    4331                 :             :                         module. If a symbol is found with TypeName
    4332                 :             :                         then its Sym is returned.
    4333                 :             :                         Otherwise NulSym is returned.
    4334                 :             :                         CheckForHiddenType is called before any type is
    4335                 :             :                         created, therefore the compiler allows hidden
    4336                 :             :                         types to be implemented using any type.
    4337                 :             : */
    4338                 :             : 
    4339                 :             : static unsigned int CheckForHiddenType (NameKey_Name TypeName);
    4340                 :             : 
    4341                 :             : /*
    4342                 :             :    RequestFromModule - returns a symbol from module ModSym with name, SymName.
    4343                 :             : */
    4344                 :             : 
    4345                 :             : static unsigned int RequestFromModule (unsigned int tok, unsigned int ModSym, NameKey_Name SymName);
    4346                 :             : 
    4347                 :             : /*
    4348                 :             :    RequestFromDefinition - returns a symbol from module ModSym with name,
    4349                 :             :                            SymName.
    4350                 :             : */
    4351                 :             : 
    4352                 :             : static unsigned int RequestFromDefinition (unsigned int tok, unsigned int ModSym, NameKey_Name SymName);
    4353                 :             : 
    4354                 :             : /*
    4355                 :             :    GetWhereImported - returns the token number where this symbol
    4356                 :             :                       was imported into the current module.
    4357                 :             : */
    4358                 :             : 
    4359                 :             : static unsigned int GetWhereImported (unsigned int Sym);
    4360                 :             : 
    4361                 :             : /*
    4362                 :             :    DisplayName - displays the name.
    4363                 :             : */
    4364                 :             : 
    4365                 :             : static void DisplayName (unsigned int sym);
    4366                 :             : 
    4367                 :             : /*
    4368                 :             :    DisplaySymbol - displays the name of a symbol
    4369                 :             : */
    4370                 :             : 
    4371                 :             : static void DisplaySymbol (unsigned int sym);
    4372                 :             : 
    4373                 :             : /*
    4374                 :             :    FetchUnknownFromModule - returns an Unknown symbol from module, ModSym.
    4375                 :             : */
    4376                 :             : 
    4377                 :             : static unsigned int FetchUnknownFromModule (unsigned int tok, unsigned int ModSym, NameKey_Name SymName);
    4378                 :             : 
    4379                 :             : /*
    4380                 :             :    FetchUnknownFromDefImp - returns an Unknown symbol from module, ModSym.
    4381                 :             : */
    4382                 :             : 
    4383                 :             : static unsigned int FetchUnknownFromDefImp (unsigned int tok, unsigned int ModSym, NameKey_Name SymName);
    4384                 :             : 
    4385                 :             : /*
    4386                 :             :    FetchUnknownFromDefImp - returns an Unknown symbol from module, ModSym.
    4387                 :             : */
    4388                 :             : 
    4389                 :             : static unsigned int FetchUnknownFrom (unsigned int tok, unsigned int scope, NameKey_Name SymName);
    4390                 :             : 
    4391                 :             : /*
    4392                 :             :    UnknownSymbolError - displays symbol name for symbol, sym.
    4393                 :             : */
    4394                 :             : 
    4395                 :             : static void UnknownSymbolError (unsigned int sym);
    4396                 :             : 
    4397                 :             : /*
    4398                 :             :    IsUnreportedUnknown - returns TRUE if symbol, sym, has not been
    4399                 :             :                          reported and is an unknown symbol.
    4400                 :             : */
    4401                 :             : 
    4402                 :             : static bool IsUnreportedUnknown (unsigned int sym);
    4403                 :             : 
    4404                 :             : /*
    4405                 :             :    AddListify -
    4406                 :             : */
    4407                 :             : 
    4408                 :             : static void AddListify (unsigned int sym);
    4409                 :             : 
    4410                 :             : /*
    4411                 :             :    Listify - convert tree into a string list and return the result.
    4412                 :             : */
    4413                 :             : 
    4414                 :             : static DynamicStrings_String Listify (SymbolKey_SymbolTree tree, SymbolKey_IsSymbol isCondition);
    4415                 :             : 
    4416                 :             : /*
    4417                 :             :    CheckForUnknowns - checks a binary tree, Tree, to see whether it contains
    4418                 :             :                       an unknown symbol. All unknown symbols are displayed
    4419                 :             :                       together with an error message.
    4420                 :             : */
    4421                 :             : 
    4422                 :             : static void CheckForUnknowns (unsigned int tokno, NameKey_Name name, SymbolKey_SymbolTree Tree, const char *a_, unsigned int _a_high);
    4423                 :             : 
    4424                 :             : /*
    4425                 :             :    SymbolError - displays symbol name for symbol, Sym.
    4426                 :             : */
    4427                 :             : 
    4428                 :             : static void SymbolError (unsigned int Sym);
    4429                 :             : 
    4430                 :             : /*
    4431                 :             :    CheckForSymbols  - checks a binary tree, Tree, to see whether it contains
    4432                 :             :                       any symbol. The tree is expected to be empty, if not
    4433                 :             :                       then an error has occurred.
    4434                 :             : */
    4435                 :             : 
    4436                 :             : static void CheckForSymbols (SymbolKey_SymbolTree Tree, const char *a_, unsigned int _a_high);
    4437                 :             : 
    4438                 :             : /*
    4439                 :             :    PutExportUndeclared - places a symbol, Sym, into module, ModSym,
    4440                 :             :                          ExportUndeclared list provided that Sym
    4441                 :             :                          is unknown.
    4442                 :             : */
    4443                 :             : 
    4444                 :             : static void PutExportUndeclared (unsigned int ModSym, unsigned int Sym);
    4445                 :             : 
    4446                 :             : /*
    4447                 :             :    GetExportUndeclared - returns a symbol which has, name, from module, ModSym,
    4448                 :             :                          which is in the ExportUndeclared list.
    4449                 :             : */
    4450                 :             : 
    4451                 :             : static unsigned int GetExportUndeclared (unsigned int ModSym, NameKey_Name name);
    4452                 :             : 
    4453                 :             : /*
    4454                 :             :    RemoveExportUndeclared - removes a symbol, Sym, from the module, ModSym,
    4455                 :             :                             ExportUndeclaredTree.
    4456                 :             : */
    4457                 :             : 
    4458                 :             : static void RemoveExportUndeclared (unsigned int ModSym, unsigned int Sym);
    4459                 :             : 
    4460                 :             : /*
    4461                 :             :    CheckForExportedDeclaration - checks to see whether a definition module
    4462                 :             :                                  is currently being compiled, if so,
    4463                 :             :                                  symbol, Sym, is removed from the
    4464                 :             :                                  ExportUndeclared list.
    4465                 :             :                                  This procedure is called whenever a symbol
    4466                 :             :                                  is declared, thus attempting to reduce
    4467                 :             :                                  the ExportUndeclared list.
    4468                 :             : */
    4469                 :             : 
    4470                 :             : static void CheckForExportedDeclaration (unsigned int Sym);
    4471                 :             : 
    4472                 :             : /*
    4473                 :             :    UndeclaredSymbolError - displays symbol name for symbol, Sym.
    4474                 :             : */
    4475                 :             : 
    4476                 :             : static void UndeclaredSymbolError (unsigned int Sym);
    4477                 :             : 
    4478                 :             : /*
    4479                 :             :    RemoveExportUnImplemented - removes a symbol, Sym, from the module, ModSym,
    4480                 :             :                                NeedToBeImplemented list.
    4481                 :             : */
    4482                 :             : 
    4483                 :             : static void RemoveExportUnImplemented (unsigned int ModSym, unsigned int Sym);
    4484                 :             : 
    4485                 :             : /*
    4486                 :             :    RemoveFromExportRequest -
    4487                 :             : */
    4488                 :             : 
    4489                 :             : static void RemoveFromExportRequest (unsigned int Sym);
    4490                 :             : 
    4491                 :             : /*
    4492                 :             :    RemoveEnumerationFromExportRequest - removes enumeration symbol, sym,
    4493                 :             :                                         (and its fields) from the ExportRequest tree.
    4494                 :             : */
    4495                 :             : 
    4496                 :             : static void RemoveEnumerationFromExportRequest (unsigned int ModSym, unsigned int Sym);
    4497                 :             : 
    4498                 :             : /*
    4499                 :             :    UnImplementedSymbolError - displays symbol name for symbol, Sym.
    4500                 :             : */
    4501                 :             : 
    4502                 :             : static void UnImplementedSymbolError (unsigned int Sym);
    4503                 :             : 
    4504                 :             : /*
    4505                 :             :    CheckEnumerationInList - places symbol, Sym, in the list, l,
    4506                 :             :                             providing it does not already exist.
    4507                 :             :                             PseudoScope(Sym) is called if Sym needs to
    4508                 :             :                             be added to the enumeration list, l.
    4509                 :             : */
    4510                 :             : 
    4511                 :             : static void CheckEnumerationInList (Lists_List l, unsigned int Sym);
    4512                 :             : 
    4513                 :             : /*
    4514                 :             :    CheckIfEnumerationExported - An outer module may use an enumeration that
    4515                 :             :                                 is declared inside an inner module. The usage
    4516                 :             :                                 may occur before definition. The first pass
    4517                 :             :                                 exports a symbol, later the symbol is declared
    4518                 :             :                                 as an emumeration type. At this stage the
    4519                 :             :                                 CheckIfEnumerationExported procedure should be
    4520                 :             :                                 called. This procedure ripples from the current
    4521                 :             :                                 (inner) module to outer module and every time
    4522                 :             :                                 it is exported it must be added to the outer
    4523                 :             :                                 module EnumerationScopeList.
    4524                 :             : */
    4525                 :             : 
    4526                 :             : static void CheckIfEnumerationExported (unsigned int Sym, unsigned int ScopeId);
    4527                 :             : 
    4528                 :             : /*
    4529                 :             :    CheckForEnumerationInOuterModule - checks to see whether the enumeration
    4530                 :             :                                       type symbol, Sym, has been entered into
    4531                 :             :                                       the outer module, OuterModule, scope list.
    4532                 :             :                                       OuterModule may be internal to the
    4533                 :             :                                       program module.
    4534                 :             : */
    4535                 :             : 
    4536                 :             : static void CheckForEnumerationInOuterModule (unsigned int Sym, unsigned int OuterModule);
    4537                 :             : 
    4538                 :             : /*
    4539                 :             :    MakeVariableForParam -
    4540                 :             : */
    4541                 :             : 
    4542                 :             : static unsigned int MakeVariableForParam (unsigned int tok, NameKey_Name ParamName, unsigned int ProcSym, SymbolTable_ProcedureKind kind, unsigned int no, unsigned int ParmType, unsigned int typetok);
    4543                 :             : 
    4544                 :             : /*
    4545                 :             :    AddParameter - adds a parameter ParSym to a procedure Sym.
    4546                 :             : */
    4547                 :             : 
    4548                 :             : static void AddParameter (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParSym);
    4549                 :             : 
    4550                 :             : /*
    4551                 :             :    AddProcedureProcTypeParam - adds ParamType to the parameter ProcType
    4552                 :             :                                associated with procedure Sym.
    4553                 :             : */
    4554                 :             : 
    4555                 :             : static void AddProcedureProcTypeParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded, bool isVarParam);
    4556                 :             : 
    4557                 :             : /*
    4558                 :             :    IsNthParamVar - returns true if the n th parameter of the parameter list,
    4559                 :             :                    List, is a VAR parameter.
    4560                 :             : */
    4561                 :             : 
    4562                 :             : static bool IsNthParamVar (Lists_List Head, unsigned int n);
    4563                 :             : 
    4564                 :             : /*
    4565                 :             :    MakeParameterHeapVar - create a heap variable if sym is a pointer.
    4566                 :             : */
    4567                 :             : 
    4568                 :             : static unsigned int MakeParameterHeapVar (unsigned int tok, unsigned int type, SymbolTable_ModeOfAddr mode);
    4569                 :             : 
    4570                 :             : /*
    4571                 :             :    PutParameterHeapVar - creates a heap variable associated with parameter sym.
    4572                 :             : */
    4573                 :             : 
    4574                 :             : static void PutParameterHeapVar (unsigned int sym);
    4575                 :             : 
    4576                 :             : /*
    4577                 :             :    IsProcedureAnyBoolean - returns the boolean result from p
    4578                 :             :                            for any of procedure kind which is defined.
    4579                 :             : */
    4580                 :             : 
    4581                 :             : static bool IsProcedureAnyBoolean (unsigned int sym, SymbolTable_ProcAnyBoolean p);
    4582                 :             : 
    4583                 :             : /*
    4584                 :             :    IsProcedureAnyDefaultBoolean - returns the boolean result from p
    4585                 :             :                                   for any of procedure kind which is defined.
    4586                 :             : */
    4587                 :             : 
    4588                 :             : static bool IsProcedureAnyDefaultBoolean (unsigned int sym, bool default_, SymbolTable_ProcAnyBoolean p);
    4589                 :             : 
    4590                 :             : /*
    4591                 :             :    FillInUnknownFields -
    4592                 :             : */
    4593                 :             : 
    4594                 :             : static void FillInUnknownFields (unsigned int tok, unsigned int sym, NameKey_Name SymName);
    4595                 :             : 
    4596                 :             : /*
    4597                 :             :    FillInPointerFields - given a new symbol, sym, make it a pointer symbol
    4598                 :             :                          and initialize its fields.
    4599                 :             : */
    4600                 :             : 
    4601                 :             : static void FillInPointerFields (unsigned int Sym, NameKey_Name PointerName, unsigned int scope, unsigned int oaf);
    4602                 :             : 
    4603                 :             : /*
    4604                 :             :    ForeachParameterDo -
    4605                 :             : */
    4606                 :             : 
    4607                 :             : static void ForeachParameterDo (SymbolTable_CheckProcedure p);
    4608                 :             : 
    4609                 :             : /*
    4610                 :             :    CheckUnbounded - checks to see if parameter, Sym, is now an unbounded parameter.
    4611                 :             : */
    4612                 :             : 
    4613                 :             : static void CheckUnbounded (unsigned int Sym);
    4614                 :             : 
    4615                 :             : /*
    4616                 :             :    PutOAFamily - places the, oaf, into, SimpleType, oafamily field.
    4617                 :             : */
    4618                 :             : 
    4619                 :             : static void PutOAFamily (unsigned int SimpleType, unsigned int oaf);
    4620                 :             : 
    4621                 :             : /*
    4622                 :             :    doFillInOAFamily -
    4623                 :             : */
    4624                 :             : 
    4625                 :             : static void doFillInOAFamily (unsigned int oaf, unsigned int i, unsigned int unbounded);
    4626                 :             : 
    4627                 :             : /*
    4628                 :             :    FillInUnboundedFields -
    4629                 :             : */
    4630                 :             : 
    4631                 :             : static void FillInUnboundedFields (unsigned int tok, unsigned int sym, unsigned int SimpleType, unsigned int ndim);
    4632                 :             : 
    4633                 :             : /*
    4634                 :             :    PutUnbounded - associates the unbounded symbol, open, with
    4635                 :             :                   SimpleType.
    4636                 :             : */
    4637                 :             : 
    4638                 :             : static void PutUnbounded (unsigned int oaf, unsigned int sym, unsigned int ndim);
    4639                 :             : 
    4640                 :             : /*
    4641                 :             :    GetArrayDimension - returns the number of dimensions defined.
    4642                 :             : */
    4643                 :             : 
    4644                 :             : static unsigned int GetArrayDimension (unsigned int sym);
    4645                 :             : 
    4646                 :             : /*
    4647                 :             :    ResolveConstructorType - if, sym, has an unresolved constructor type
    4648                 :             :                             then attempt to resolve it by examining the
    4649                 :             :                             from, type.
    4650                 :             : */
    4651                 :             : 
    4652                 :             : static void ResolveConstructorType (unsigned int sym, unsigned int *type, unsigned int *from, bool *unres);
    4653                 :             : 
    4654                 :             : /*
    4655                 :             :    IsConstructorResolved - returns TRUE if the constructor does not
    4656                 :             :                            have an unresolved type.
    4657                 :             : */
    4658                 :             : 
    4659                 :             : static bool IsConstructorResolved (unsigned int sym);
    4660                 :             : 
    4661                 :             : /*
    4662                 :             :    CanResolveConstructor - returns TRUE if the type of the constructor,
    4663                 :             :                            sym, is known.
    4664                 :             : */
    4665                 :             : 
    4666                 :             : static bool CanResolveConstructor (unsigned int sym);
    4667                 :             : 
    4668                 :             : /*
    4669                 :             :    CheckAllConstructorsResolved - checks to see that the
    4670                 :             :                                   UnresolvedConstructorType list is
    4671                 :             :                                   empty and if it is not then it
    4672                 :             :                                   generates error messages.
    4673                 :             : */
    4674                 :             : 
    4675                 :             : static void CheckAllConstructorsResolved (void);
    4676                 :             : 
    4677                 :             : /*
    4678                 :             :    SanityCheckParameters -
    4679                 :             : */
    4680                 :             : 
    4681                 :             : static void SanityCheckParameters (unsigned int sym);
    4682                 :             : 
    4683                 :             : /*
    4684                 :             :    SanityCheckArray - checks to see that an array has a correct subrange type.
    4685                 :             : */
    4686                 :             : 
    4687                 :             : static void SanityCheckArray (unsigned int sym);
    4688                 :             : 
    4689                 :             : /*
    4690                 :             :    ForeachSymbolDo - foreach symbol, call, P(sym).
    4691                 :             : */
    4692                 :             : 
    4693                 :             : static void ForeachSymbolDo (SymbolKey_PerformOperation P);
    4694                 :             : 
    4695                 :             : /*
    4696                 :             :    SanityCheckProcedure - check to see that procedure parameters do not use constants
    4697                 :             :                           instead of types in their formal parameter section.
    4698                 :             : */
    4699                 :             : 
    4700                 :             : static void SanityCheckProcedure (unsigned int sym);
    4701                 :             : 
    4702                 :             : /*
    4703                 :             :    SanityCheckModule -
    4704                 :             : */
    4705                 :             : 
    4706                 :             : static void SanityCheckModule (unsigned int sym);
    4707                 :             : 
    4708                 :             : /*
    4709                 :             :    AddNameTo - adds Name, n, to tree, s.
    4710                 :             : */
    4711                 :             : 
    4712                 :             : static void AddNameTo (SymbolKey_SymbolTree s, unsigned int o);
    4713                 :             : 
    4714                 :             : /*
    4715                 :             :    CollectSymbolFrom -
    4716                 :             : */
    4717                 :             : 
    4718                 :             : static unsigned int CollectSymbolFrom (unsigned int tok, unsigned int scope, NameKey_Name n);
    4719                 :             : 
    4720                 :             : /*
    4721                 :             :    CollectUnknown -
    4722                 :             : */
    4723                 :             : 
    4724                 :             : static unsigned int CollectUnknown (unsigned int tok, unsigned int sym, NameKey_Name n);
    4725                 :             : 
    4726                 :             : /*
    4727                 :             :    ResolveImport -
    4728                 :             : */
    4729                 :             : 
    4730                 :             : static void ResolveImport (unsigned int o);
    4731                 :             : 
    4732                 :             : /*
    4733                 :             :    ResolveRelativeImport -
    4734                 :             : */
    4735                 :             : 
    4736                 :             : static void ResolveRelativeImport (unsigned int sym);
    4737                 :             : 
    4738                 :             : /*
    4739                 :             :    Max -
    4740                 :             : */
    4741                 :             : 
    4742                 :             : static unsigned int Max (unsigned int a, unsigned int b);
    4743                 :             : 
    4744                 :             : /*
    4745                 :             :    Min -
    4746                 :             : */
    4747                 :             : 
    4748                 :             : static unsigned int Min (unsigned int a, unsigned int b);
    4749                 :             : 
    4750                 :             : /*
    4751                 :             :    DoFindLimits - assigns, Start, and, End, to the start and end
    4752                 :             :                   limits contained in the list, l.  It ensures that
    4753                 :             :                   Start and End are within StartLimit..EndLimit.
    4754                 :             :                   If StartLimit or EndLimit are 0 then Start is
    4755                 :             :                   is set to the first value and End to the last.
    4756                 :             : */
    4757                 :             : 
    4758                 :             : static void DoFindLimits (unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End, Lists_List l);
    4759                 :             : 
    4760                 :             : /*
    4761                 :             :    PutDeclaredDefinition - associates the current tokenno with
    4762                 :             :                            the symbols declaration in the definition
    4763                 :             :                            module.
    4764                 :             : */
    4765                 :             : 
    4766                 :             : static void PutDeclaredDefinition (unsigned int tok, unsigned int Sym);
    4767                 :             : 
    4768                 :             : /*
    4769                 :             :    PutDeclaredModule - returns the token where this symbol was declared
    4770                 :             :                        in an implementation or program module.
    4771                 :             : */
    4772                 :             : 
    4773                 :             : static void PutDeclaredModule (unsigned int tok, unsigned int Sym);
    4774                 :             : 
    4775                 :             : /*
    4776                 :             :    DoIsConst - returns TRUE if Sym is defined as a constant
    4777                 :             :                or is an enumeration field or string.
    4778                 :             : */
    4779                 :             : 
    4780                 :             : static bool DoIsConst (unsigned int Sym);
    4781                 :             : 
    4782                 :             : /*
    4783                 :             :    GetFromIndex - return a value from list, i, at position, n.
    4784                 :             : */
    4785                 :             : 
    4786                 :             : static unsigned int GetFromIndex (Indexing_Index i, unsigned int n);
    4787                 :             : 
    4788                 :             : /*
    4789                 :             :    PutIntoIndex - places value, v, into list, i, at position, n.
    4790                 :             : */
    4791                 :             : 
    4792                 :             : static void PutIntoIndex (Indexing_Index *i, unsigned int n, unsigned int v);
    4793                 :             : 
    4794                 :             : /*
    4795                 :             :    PushConstString - pushes the character string onto the ALU stack.
    4796                 :             :                      It assumes that the character string is only
    4797                 :             :                      one character long.
    4798                 :             : */
    4799                 :             : 
    4800                 :             : static void PushConstString (unsigned int Sym);
    4801                 :             : 
    4802                 :    36517307 : static void InitWhereDeclaredTok (unsigned int tok, SymbolTable_Where *at)
    4803                 :             : {
    4804                 :             :   /* 
    4805                 :             :    InitWhereDeclared - sets the Declared and FirstUsed fields of record, at.
    4806                 :             :   */
    4807                 :    36517307 :   if (M2Comp_CompilingDefinitionModule ())
    4808                 :             :     {
    4809                 :    19287297 :       (*at).DefDeclared = tok;
    4810                 :    19287297 :       (*at).ModDeclared = M2LexBuf_UnknownTokenNo;
    4811                 :             :     }
    4812                 :             :   else
    4813                 :             :     {
    4814                 :    17230010 :       (*at).DefDeclared = M2LexBuf_UnknownTokenNo;
    4815                 :    17230010 :       (*at).ModDeclared = tok;
    4816                 :             :     }
    4817                 :    36517307 :   (*at).FirstUsed = tok;  /* we assign this field to something legal  */
    4818                 :    36517307 : }
    4819                 :             : 
    4820                 :             : 
    4821                 :             : /*
    4822                 :             :    InitWhereDeclared - sets the Declared and FirstUsed fields of record, at.
    4823                 :             : */
    4824                 :             : 
    4825                 :     8517671 : static void InitWhereDeclared (SymbolTable_Where *at)
    4826                 :             : {
    4827                 :     8517671 :   InitWhereDeclaredTok (M2LexBuf_GetTokenNo (), at);
    4828                 :     8517671 : }
    4829                 :             : 
    4830                 :             : 
    4831                 :             : /*
    4832                 :             :    InitWhereFirstUsed - sets the FirstUsed field of record, at.
    4833                 :             : */
    4834                 :             : 
    4835                 :     7936435 : static void InitWhereFirstUsed (SymbolTable_Where *at)
    4836                 :             : {
    4837                 :           0 :   InitWhereFirstUsedTok (M2LexBuf_GetTokenNo (), at);
    4838                 :           0 : }
    4839                 :             : 
    4840                 :             : 
    4841                 :             : /*
    4842                 :             :    InitWhereFirstUsedTok - sets the FirstUsed field of record, at.
    4843                 :             : */
    4844                 :             : 
    4845                 :    32354502 : static void InitWhereFirstUsedTok (unsigned int tok, SymbolTable_Where *at)
    4846                 :             : {
    4847                 :    32354502 :   (*at).FirstUsed = tok;
    4848                 :     1167573 : }
    4849                 :             : 
    4850                 :             : 
    4851                 :             : /*
    4852                 :             :    gdbhook - a debugger convenience hook.
    4853                 :             : */
    4854                 :             : 
    4855                 :           0 : static void gdbhook (void)
    4856                 :             : {
    4857                 :           0 : }
    4858                 :             : 
    4859                 :             : 
    4860                 :             : /*
    4861                 :             :    BreakWhenSymCreated - to be called interactively by gdb.
    4862                 :             : */
    4863                 :             : 
    4864                 :       15506 : static void BreakWhenSymCreated (unsigned int sym)
    4865                 :             : {
    4866                 :       15506 :   BreakSym = sym;
    4867                 :           0 : }
    4868                 :             : 
    4869                 :             : 
    4870                 :             : /*
    4871                 :             :    CheckBreak - if sym = BreakSym then call gdbhook.
    4872                 :             : */
    4873                 :             : 
    4874                 :           0 : static void CheckBreak (unsigned int sym)
    4875                 :             : {
    4876                 :           0 :   if (sym == BreakSym)
    4877                 :             :     {
    4878                 :           0 :       gdbhook ();
    4879                 :             :     }
    4880                 :           0 : }
    4881                 :             : 
    4882                 :             : 
    4883                 :             : /*
    4884                 :             :    NewSym - Sets Sym to a new symbol index.
    4885                 :             : */
    4886                 :             : 
    4887                 :    62195808 : static void NewSym (unsigned int *sym)
    4888                 :             : {
    4889                 :    62195808 :   SymbolTable_PtrToSymbol pSym;
    4890                 :             : 
    4891                 :    62195808 :   (*sym) = FreeSymbol;
    4892                 :    62195808 :   Storage_ALLOCATE ((void **) &pSym, sizeof (SymbolTable_Symbol));
    4893                 :    62195808 :   pSym->SymbolType = SymbolTable_DummySym;
    4894                 :    62195808 :   Indexing_PutIndice (Symbols, (*sym), reinterpret_cast <void *> (pSym));
    4895                 :    62195808 :   CheckBreak ((*sym));
    4896                 :    62195808 :   FreeSymbol += 1;
    4897                 :    62195808 :   M2Diagnostic_MemSet (SymMemDiag, 1, FreeSymbol-1);
    4898                 :    62195808 :   M2Diagnostic_MemIncr (SymMemDiag, 2, sizeof ((*pSym)));
    4899                 :    62195808 : }
    4900                 :             : 
    4901                 :             : 
    4902                 :             : /*
    4903                 :             :    GetPsym - returns the pointer to, sym.
    4904                 :             : */
    4905                 :             : 
    4906                 : 15226181868 : static SymbolTable_PtrToSymbol GetPsym (unsigned int sym)
    4907                 :             : {
    4908                 : 15226181868 :   SymbolTable_PtrToSymbol pSym;
    4909                 :             : 
    4910                 : 15226181868 :   if (Indexing_InBounds (Symbols, sym))
    4911                 :             :     {
    4912                 : 15226181868 :       pSym = static_cast<SymbolTable_PtrToSymbol> (Indexing_GetIndice (Symbols, sym));
    4913                 : 15226181868 :       return pSym;
    4914                 :             :     }
    4915                 :             :   else
    4916                 :             :     {
    4917                 :           0 :       M2Error_InternalError ((const char *) "symbol out of bounds", 20);
    4918                 :             :     }
    4919                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    4920                 :             :   __builtin_unreachable ();
    4921                 :             : }
    4922                 :             : 
    4923                 :             : 
    4924                 :             : /*
    4925                 :             :    GetPcall - returns the pointer to the CallFrame.
    4926                 :             : */
    4927                 :             : 
    4928                 :   413338773 : static SymbolTable_PtrToCallFrame GetPcall (unsigned int call)
    4929                 :             : {
    4930                 :   413338773 :   SymbolTable_PtrToCallFrame pCall;
    4931                 :             : 
    4932                 :   413338773 :   if (Indexing_InBounds (ScopeCallFrame, call))
    4933                 :             :     {
    4934                 :   413338773 :       pCall = static_cast<SymbolTable_PtrToCallFrame> (Indexing_GetIndice (ScopeCallFrame, call));
    4935                 :   413338773 :       return pCall;
    4936                 :             :     }
    4937                 :             :   else
    4938                 :             :     {
    4939                 :           0 :       M2Error_InternalError ((const char *) "symbol out of bounds", 20);
    4940                 :             :     }
    4941                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    4942                 :             :   __builtin_unreachable ();
    4943                 :             : }
    4944                 :             : 
    4945                 :             : 
    4946                 :             : /*
    4947                 :             :    DebugProcedureLineNumber -
    4948                 :             : */
    4949                 :             : 
    4950                 :           0 : static void DebugProcedureLineNumber (unsigned int sym)
    4951                 :             : {
    4952                 :           0 :   unsigned int begin;
    4953                 :           0 :   unsigned int end;
    4954                 :           0 :   NameKey_Name n;
    4955                 :           0 :   DynamicStrings_String f;
    4956                 :           0 :   unsigned int l;
    4957                 :             : 
    4958                 :           0 :   SymbolTable_GetProcedureBeginEnd (sym, &begin, &end);
    4959                 :           0 :   n = SymbolTable_GetSymName (sym);
    4960                 :           0 :   if (begin != 0)
    4961                 :             :     {
    4962                 :           0 :       f = M2LexBuf_FindFileNameFromToken (begin, 0);
    4963                 :           0 :       l = M2LexBuf_TokenToLineNo (begin, 0);
    4964                 :           0 :       M2Printf_printf3 ((const char *) "%s:%d:%a:begin\\n", 16, (const unsigned char *) &f, (sizeof (f)-1), (const unsigned char *) &l, (sizeof (l)-1), (const unsigned char *) &n, (sizeof (n)-1));
    4965                 :             :     }
    4966                 :           0 :   if (end != 0)
    4967                 :             :     {
    4968                 :           0 :       f = M2LexBuf_FindFileNameFromToken (end, 0);
    4969                 :           0 :       l = M2LexBuf_TokenToLineNo (end, 0);
    4970                 :           0 :       M2Printf_printf3 ((const char *) "%s:%d:%a:end\\n", 14, (const unsigned char *) &f, (sizeof (f)-1), (const unsigned char *) &l, (sizeof (l)-1), (const unsigned char *) &n, (sizeof (n)-1));
    4971                 :             :     }
    4972                 :           0 : }
    4973                 :             : 
    4974                 :             : 
    4975                 :             : /*
    4976                 :             :    PutPartialUnbounded -
    4977                 :             : */
    4978                 :             : 
    4979                 :           0 : static void PutPartialUnbounded (unsigned int sym, unsigned int type, unsigned int ndim)
    4980                 :             : {
    4981                 :           0 :   SymbolTable_PtrToSymbol pSym;
    4982                 :             : 
    4983                 :           0 :   pSym = GetPsym (sym);
    4984                 :           0 :   if (SymbolTable_IsDummy (sym))
    4985                 :             :     {
    4986                 :           0 :       pSym->SymbolType = SymbolTable_PartialUnboundedSym;
    4987                 :             :     }
    4988                 :           0 :   switch (pSym->SymbolType)
    4989                 :             :     {
    4990                 :           0 :       case SymbolTable_PartialUnboundedSym:
    4991                 :           0 :         pSym->PartialUnbounded.Type = type;
    4992                 :           0 :         pSym->PartialUnbounded.NDim = ndim;
    4993                 :           0 :         break;
    4994                 :             : 
    4995                 :             : 
    4996                 :           0 :       default:
    4997                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type", 23);
    4998                 :           0 :         break;
    4999                 :             :     }
    5000                 :           0 : }
    5001                 :             : 
    5002                 :             : 
    5003                 :             : /*
    5004                 :             :    AlreadyDeclaredError - generate an error message, a, and two areas of code showing
    5005                 :             :                           the places where the symbols were declared.
    5006                 :             : */
    5007                 :             : 
    5008                 :           0 : static void AlreadyDeclaredError (DynamicStrings_String s, NameKey_Name name, unsigned int OtherOccurance)
    5009                 :             : {
    5010                 :           0 :   M2Error_Error e;
    5011                 :             : 
    5012                 :           0 :   if ((OtherOccurance == 0) || (OtherOccurance == (M2LexBuf_GetTokenNo ())))
    5013                 :             :     {
    5014                 :           0 :       e = M2Error_NewError (M2LexBuf_GetTokenNo ());
    5015                 :           0 :       M2Error_ErrorString (e, s);
    5016                 :             :     }
    5017                 :             :   else
    5018                 :             :     {
    5019                 :           0 :       e = M2Error_NewError (M2LexBuf_GetTokenNo ());
    5020                 :           0 :       M2Error_ErrorString (e, s);
    5021                 :           0 :       e = M2Error_ChainError (OtherOccurance, e);
    5022                 :           0 :       M2Error_ErrorFormat1 (e, (const char *) "and symbol (%a) is also declared here", 37, (const unsigned char *) &name, (sizeof (name)-1));
    5023                 :             :     }
    5024                 :           0 : }
    5025                 :             : 
    5026                 :             : 
    5027                 :             : /*
    5028                 :             :    MakeObject - creates an object node.
    5029                 :             : */
    5030                 :             : 
    5031                 :     7933363 : static unsigned int MakeObject (NameKey_Name name)
    5032                 :             : {
    5033                 :     7933363 :   SymbolTable_PtrToSymbol pSym;
    5034                 :     7933363 :   unsigned int Sym;
    5035                 :             : 
    5036                 :     7933363 :   NewSym (&Sym);
    5037                 :     7933363 :   pSym = GetPsym (Sym);
    5038                 :     7933363 :   pSym->SymbolType = SymbolTable_ObjectSym;
    5039                 :     7933363 :   pSym->Object.name = name;
    5040                 :     7933363 :   InitWhereDeclared (&pSym->Object.At);
    5041                 :     7933363 :   InitWhereFirstUsed (&pSym->Object.At);
    5042                 :     7933363 :   return Sym;
    5043                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5044                 :             :   __builtin_unreachable ();
    5045                 :             : }
    5046                 :             : 
    5047                 :             : 
    5048                 :             : /*
    5049                 :             :    DeclareSym - returns a symbol which was either in the unknown tree or
    5050                 :             :                 a New symbol, since name is about to be declared.
    5051                 :             : */
    5052                 :             : 
    5053                 :    24862764 : static unsigned int DeclareSym (unsigned int tok, NameKey_Name name)
    5054                 :             : {
    5055                 :    24862764 :   unsigned int Sym;
    5056                 :             : 
    5057                 :    24862764 :   if (name == NameKey_NulName)
    5058                 :             :     {
    5059                 :     5522532 :       NewSym (&Sym);
    5060                 :             :     }
    5061                 :    19340232 :   else if (IsAlreadyDeclaredSym (name))
    5062                 :             :     {
    5063                 :             :       /* avoid dangling else.  */
    5064                 :          36 :       Sym = SymbolTable_GetSym (name);
    5065                 :          36 :       if (SymbolTable_IsImported (SymbolTable_GetCurrentModuleScope (), Sym))
    5066                 :             :         {
    5067                 :             :           /* avoid dangling else.  */
    5068                 :           6 :           M2MetaError_MetaErrorT1 (GetWhereImported (Sym), (const char *) "symbol {%1Rad} is already present in this scope, check both definition and implementation modules, use a different name or remove the import", 140, Sym);
    5069                 :           6 :           M2MetaError_MetaErrorT1 (tok, (const char *) "symbol {%1Cad} also declared in this module", 43, Sym);
    5070                 :           6 :           if (Sym != (GetVisibleSym (name)))
    5071                 :             :             {
    5072                 :           0 :               M2MetaError_MetaErrorT1 (tok, (const char *) "symbol {%1CMad} also declared in this module", 44, GetVisibleSym (name));
    5073                 :             :             }
    5074                 :             :         }
    5075                 :             :       else
    5076                 :             :         {
    5077                 :          30 :           M2MetaError_MetaErrorT1 (tok, (const char *) "symbol {%1RMad} is already declared in this scope, use a different name or remove the declaration", 97, Sym);
    5078                 :          30 :           M2MetaError_MetaErrorT1 (tok, (const char *) "symbol {%1Cad} also declared in this module", 43, Sym);
    5079                 :          30 :           if (Sym != (GetVisibleSym (name)))
    5080                 :             :             {
    5081                 :           0 :               M2MetaError_MetaErrorT1 (tok, (const char *) "symbol {%1CMad} also declared in this module", 44, GetVisibleSym (name));
    5082                 :             :             }
    5083                 :             :         }
    5084                 :          36 :       Sym = SymbolTable_MakeError (tok, name);
    5085                 :             :     }
    5086                 :             :   else
    5087                 :             :     {
    5088                 :             :       /* avoid dangling else.  */
    5089                 :    19340196 :       Sym = FetchUnknownSym (name);
    5090                 :    19340196 :       if (Sym == SymbolTable_NulSym)
    5091                 :             :         {
    5092                 :    14662325 :           NewSym (&Sym);
    5093                 :             :         }
    5094                 :    19340196 :       CheckForExportedDeclaration (Sym);
    5095                 :             :     }
    5096                 :    24862764 :   return Sym;
    5097                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5098                 :             :   __builtin_unreachable ();
    5099                 :             : }
    5100                 :             : 
    5101                 :             : 
    5102                 :             : /*
    5103                 :             :    Init - Initializes the data structures and variables in this module.
    5104                 :             :           Initialize the trees.
    5105                 :             : */
    5106                 :             : 
    5107                 :       15506 : static void Init (void)
    5108                 :             : {
    5109                 :       15506 :   SymbolTable_PtrToCallFrame pCall;
    5110                 :             : 
    5111                 :       15506 :   SymMemDiag = M2Diagnostic_InitMemDiagnostic ((const char *) "SymbolTable:Symbols", 19, (const char *) "{0N} total symbols {1d} consuming {2M} ram {0M} ({2P})", 54);
    5112                 :       15506 :   BreakWhenSymCreated (SymbolTable_NulSym);  /* Disable the intereactive sym watch.  */
    5113                 :             :   /* To examine the symbol table when a symbol is created run cc1gm2 from gdb
    5114                 :             :       and set a break point on gdbhook.
    5115                 :             :       (gdb) break gdbhook
    5116                 :             :       (gdb) run
    5117                 :             :       Now below interactively call BreakWhenSymCreated with the symbol
    5118                 :             :       under investigation.  */
    5119                 :       15506 :   gdbhook ();
    5120                 :             :   /* Now is the time to interactively call gdb, for example:
    5121                 :             :       (gdb) print BreakWhenSymCreated (1234)
    5122                 :             :       (gdb) cont
    5123                 :             :       and you will arrive at gdbhook when this symbol is created.  */
    5124                 :       15506 :   AnonymousName = 0;
    5125                 :       15506 :   CurrentError = static_cast<M2Error_Error> (NULL);
    5126                 :       15506 :   SymbolKey_InitTree (&ConstLitPoolTree);
    5127                 :       15506 :   SymbolKey_InitTree (&DefModuleTree);
    5128                 :       15506 :   SymbolKey_InitTree (&ModuleTree);
    5129                 :       15506 :   Symbols = Indexing_InitIndexTuned (1, (1024*1024) / 16, 16);
    5130                 :       15506 :   ConstLitArray = Indexing_InitIndex (1);
    5131                 :       15506 :   FreeSymbol = 1;
    5132                 :       15506 :   ScopePtr = 1;
    5133                 :       15506 :   ScopeCallFrame = Indexing_InitIndex (1);
    5134                 :       15506 :   Storage_ALLOCATE ((void **) &pCall, sizeof (SymbolTable_CallFrame));
    5135                 :       15506 :   pCall->Main = SymbolTable_NulSym;
    5136                 :       15506 :   pCall->Search = SymbolTable_NulSym;
    5137                 :       15506 :   Indexing_PutIndice (ScopeCallFrame, ScopePtr, reinterpret_cast <void *> (pCall));
    5138                 :       15506 :   CurrentModule = SymbolTable_NulSym;
    5139                 :       15506 :   MainModule = SymbolTable_NulSym;
    5140                 :       15506 :   FileModule = SymbolTable_NulSym;
    5141                 :       15506 :   TemporaryNo = 0;
    5142                 :             :   /* 
    5143                 :             :    InitList(FreeFVarientList) ;              Lists used to maintain GC of field 
    5144                 :             :    InitList(UsedFVarientList) ;              varients.                          
    5145                 :             :   */
    5146                 :       15506 :   Lists_InitList (&UnresolvedConstructorType);
    5147                 :       15506 :   M2Base_InitBase (m2linemap_BuiltinsLocation (), &BaseModule);
    5148                 :       15506 :   SymbolTable_StartScope (BaseModule);  /* BaseModule scope placed at the bottom of the stack  */
    5149                 :       15506 :   BaseScopePtr = ScopePtr;  /* BaseScopePtr points to the top of the BaseModule scope  */
    5150                 :       15506 :   Lists_InitList (&AddressTypes);  /* BaseScopePtr points to the top of the BaseModule scope  */
    5151                 :       15506 :   ReportedUnknowns = Sets_InitSet (1);
    5152                 :       15506 : }
    5153                 :             : 
    5154                 :             : 
    5155                 :             : /*
    5156                 :             :    AddSymToUnknown -
    5157                 :             : */
    5158                 :             : 
    5159                 :    10686231 : static void AddSymToUnknown (unsigned int scope, NameKey_Name name, unsigned int Sym)
    5160                 :             : {
    5161                 :    10686231 :   SymbolTable_PtrToSymbol pSym;
    5162                 :    10686231 :   NameKey_Name n;
    5163                 :             : 
    5164                 :    10686231 :   if (DebugUnknowns)
    5165                 :             :     {
    5166                 :             :       n = SymbolTable_GetSymName (scope);
    5167                 :             :       M2Printf_printf3 ((const char *) "adding unknown %a (%d) to scope %a\\n", 36, (const unsigned char *) &name, (sizeof (name)-1), (const unsigned char *) &Sym, (sizeof (Sym)-1), (const unsigned char *) &n, (sizeof (n)-1));
    5168                 :             :     }
    5169                 :             :   /* Add symbol to unknown tree  */
    5170                 :    10686231 :   pSym = GetPsym (scope);
    5171                 :    10686231 :   switch (pSym->SymbolType)
    5172                 :             :     {
    5173                 :    10676177 :       case SymbolTable_DefImpSym:
    5174                 :    10676177 :         SymbolKey_PutSymKey (pSym->DefImp.Unresolved, name, Sym);
    5175                 :    10676177 :         break;
    5176                 :             : 
    5177                 :       10054 :       case SymbolTable_ModuleSym:
    5178                 :       10054 :         SymbolKey_PutSymKey (pSym->Module.Unresolved, name, Sym);
    5179                 :       10054 :         break;
    5180                 :             : 
    5181                 :           0 :       case SymbolTable_ProcedureSym:
    5182                 :           0 :         SymbolKey_PutSymKey (pSym->Procedure.Unresolved, name, Sym);
    5183                 :           0 :         break;
    5184                 :             : 
    5185                 :             : 
    5186                 :           0 :       default:
    5187                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp, Module or Procedure symbol", 44);
    5188                 :    10686231 :         break;
    5189                 :             :     }
    5190                 :    10686231 : }
    5191                 :             : 
    5192                 :             : 
    5193                 :             : /*
    5194                 :             :    AddSymToUnknownTree - adds a symbol with name, name, and Sym to the
    5195                 :             :                          unknown tree.
    5196                 :             : */
    5197                 :             : 
    5198                 :    10686213 : static void AddSymToUnknownTree (int ScopeId, NameKey_Name name, unsigned int Sym)
    5199                 :             : {
    5200                 :    10686213 :   SymbolTable_PtrToCallFrame pCall;
    5201                 :    10686213 :   unsigned int ScopeSym;
    5202                 :             : 
    5203                 :    10686213 :   if (ScopeId > 0)
    5204                 :             :     {
    5205                 :             :       /* choose to place the unknown symbol in the first module scope
    5206                 :             :          outside the current scope  */
    5207                 :    10686903 :       do {
    5208                 :    10686903 :         pCall = GetPcall (static_cast<unsigned int> (ScopeId));
    5209                 :    10686903 :         ScopeSym = pCall->Main;
    5210                 :    10686903 :         if ((ScopeSym > 0) && ((SymbolTable_IsDefImp (ScopeSym)) || (SymbolTable_IsModule (ScopeSym))))
    5211                 :             :           {
    5212                 :    10686213 :             AddSymToUnknown (ScopeSym, name, Sym);
    5213                 :    10686213 :             return;
    5214                 :             :           }
    5215                 :         690 :         ScopeId -= 1;
    5216                 :         690 :       } while (! (ScopeId == 0));
    5217                 :             :     }
    5218                 :           0 :   AddSymToUnknown (CurrentModule, name, Sym);
    5219                 :             : }
    5220                 :             : 
    5221                 :             : 
    5222                 :             : /*
    5223                 :             :    SubSymFromUnknownTree - removes a symbol with name, name, from the
    5224                 :             :                            unknown tree.
    5225                 :             : */
    5226                 :             : 
    5227                 :     4677877 : static void SubSymFromUnknownTree (NameKey_Name name)
    5228                 :             : {
    5229                 :     4677877 :   SymbolTable_PtrToCallFrame pCall;
    5230                 :     4677877 :   unsigned int ScopeSym;
    5231                 :     4677877 :   unsigned int ScopeId;
    5232                 :             : 
    5233                 :     4677877 :   if (ScopePtr > 0)
    5234                 :             :     {
    5235                 :             :       ScopeId = ScopePtr;
    5236                 :     6016111 :       do {
    5237                 :     6016111 :         pCall = GetPcall (ScopeId);
    5238                 :     6016111 :         ScopeSym = pCall->Search;
    5239                 :     6016111 :         if (((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsDefImp (ScopeSym))) || (SymbolTable_IsProcedure (ScopeSym)))
    5240                 :             :           {
    5241                 :     4678495 :             if (RemoveFromUnresolvedTree (ScopeSym, name))
    5242                 :             :               {
    5243                 :             :                 return;
    5244                 :             :               }
    5245                 :             :           }
    5246                 :     1338234 :         ScopeId -= 1;
    5247                 :     2676468 :       } while (! ((ScopeId > 0) && ((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsDefImp (ScopeSym)))));
    5248                 :             :     }
    5249                 :           0 :   if (RemoveFromUnresolvedTree (CurrentModule, name))
    5250                 :             :     {}  /* empty.  */
    5251                 :             : }
    5252                 :             : 
    5253                 :             : 
    5254                 :             : /*
    5255                 :             :    GetSymFromUnknownTree - returns a symbol with name, name, from the
    5256                 :             :                            unknown tree.
    5257                 :             :                            If no symbol with name is found then NulSym
    5258                 :             :                            is returned.
    5259                 :             : */
    5260                 :             : 
    5261                 :    30026609 : static unsigned int GetSymFromUnknownTree (NameKey_Name name)
    5262                 :             : {
    5263                 :    30026609 :   SymbolTable_PtrToCallFrame pCall;
    5264                 :    30026609 :   unsigned int ScopeSym;
    5265                 :    30026609 :   unsigned int ScopeId;
    5266                 :    30026609 :   unsigned int Sym;
    5267                 :             : 
    5268                 :    30026609 :   if (ScopePtr > 0)
    5269                 :             :     {
    5270                 :             :       ScopeId = ScopePtr;
    5271                 :    48921792 :       do {
    5272                 :    48921792 :         pCall = GetPcall (ScopeId);
    5273                 :    48921792 :         ScopeSym = pCall->Search;
    5274                 :    48921792 :         if (((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsDefImp (ScopeSym))) || (SymbolTable_IsProcedure (ScopeSym)))
    5275                 :             :           {
    5276                 :    41379600 :             Sym = ExamineUnresolvedTree (ScopeSym, name);
    5277                 :    41379600 :             if (Sym != SymbolTable_NulSym)
    5278                 :             :               {
    5279                 :             :                 return Sym;
    5280                 :             :               }
    5281                 :             :           }
    5282                 :    44243915 :         ScopeId -= 1;
    5283                 :    88487830 :       } while (! ((ScopeId > 0) && ((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsDefImp (ScopeSym)))));
    5284                 :             :     }
    5285                 :             :   /* Get symbol from unknown tree  */
    5286                 :    25348732 :   return ExamineUnresolvedTree (CurrentModule, name);
    5287                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5288                 :             :   __builtin_unreachable ();
    5289                 :             : }
    5290                 :             : 
    5291                 :             : 
    5292                 :             : /*
    5293                 :             :    ExamineUnresolvedTree - returns a symbol with name, name, from the
    5294                 :             :                            unresolved tree of module, ModSym.
    5295                 :             :                            If no symbol with name is found then NulSym
    5296                 :             :                            is returned.
    5297                 :             : */
    5298                 :             : 
    5299                 :   139432544 : static unsigned int ExamineUnresolvedTree (unsigned int ScopeSym, NameKey_Name name)
    5300                 :             : {
    5301                 :   139432544 :   SymbolTable_PtrToSymbol pSym;
    5302                 :   139432544 :   unsigned int Sym;
    5303                 :             : 
    5304                 :             :   /* Get symbol from unknown tree  */
    5305                 :   139432544 :   pSym = GetPsym (ScopeSym);
    5306                 :   139432544 :   switch (pSym->SymbolType)
    5307                 :             :     {
    5308                 :    83836548 :       case SymbolTable_DefImpSym:
    5309                 :    83836548 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.Unresolved, name));
    5310                 :    83836548 :         break;
    5311                 :             : 
    5312                 :    14224963 :       case SymbolTable_ModuleSym:
    5313                 :    14224963 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.Unresolved, name));
    5314                 :    14224963 :         break;
    5315                 :             : 
    5316                 :    41371033 :       case SymbolTable_ProcedureSym:
    5317                 :    41371033 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Procedure.Unresolved, name));
    5318                 :    41371033 :         break;
    5319                 :             : 
    5320                 :             : 
    5321                 :           0 :       default:
    5322                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp, Module or Procedure symbol", 44);
    5323                 :   139432544 :         break;
    5324                 :             :     }
    5325                 :   139432544 :   return Sym;
    5326                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5327                 :             :   __builtin_unreachable ();
    5328                 :             : }
    5329                 :             : 
    5330                 :             : 
    5331                 :             : /*
    5332                 :             :    RemoveFromUnresolvedTree - removes a symbol with name, name, from the
    5333                 :             :                               unresolved tree of symbol, ScopeSym.
    5334                 :             : */
    5335                 :             : 
    5336                 :     4678495 : static bool RemoveFromUnresolvedTree (unsigned int ScopeSym, NameKey_Name name)
    5337                 :             : {
    5338                 :     4678495 :   SymbolTable_PtrToSymbol pSym;
    5339                 :             : 
    5340                 :             :   /* Get symbol from unknown tree  */
    5341                 :     4678495 :   pSym = GetPsym (ScopeSym);
    5342                 :     4678495 :   switch (pSym->SymbolType)
    5343                 :             :     {
    5344                 :     4667967 :       case SymbolTable_DefImpSym:
    5345                 :     4667967 :         if ((SymbolKey_GetSymKey (pSym->DefImp.Unresolved, name)) != SymbolKey_NulKey)
    5346                 :             :           {
    5347                 :     4667967 :             SymbolKey_DelSymKey (pSym->DefImp.Unresolved, name);
    5348                 :     4667967 :             return true;
    5349                 :             :           }
    5350                 :             :         break;
    5351                 :             : 
    5352                 :        9892 :       case SymbolTable_ModuleSym:
    5353                 :        9892 :         if ((SymbolKey_GetSymKey (pSym->Module.Unresolved, name)) != SymbolKey_NulKey)
    5354                 :             :           {
    5355                 :        9892 :             SymbolKey_DelSymKey (pSym->Module.Unresolved, name);
    5356                 :        9892 :             return true;
    5357                 :             :           }
    5358                 :             :         break;
    5359                 :             : 
    5360                 :         636 :       case SymbolTable_ProcedureSym:
    5361                 :         636 :         if ((SymbolKey_GetSymKey (pSym->Procedure.Unresolved, name)) != SymbolKey_NulKey)
    5362                 :             :           {
    5363                 :          18 :             SymbolKey_DelSymKey (pSym->Procedure.Unresolved, name);
    5364                 :          18 :             return true;
    5365                 :             :           }
    5366                 :             :         break;
    5367                 :             : 
    5368                 :             : 
    5369                 :           0 :       default:
    5370                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp, Module or Procedure symbol", 44);
    5371                 :             :         break;
    5372                 :             :     }
    5373                 :             :   return false;
    5374                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5375                 :             :   __builtin_unreachable ();
    5376                 :             : }
    5377                 :             : 
    5378                 :             : 
    5379                 :             : /*
    5380                 :             :    FetchUnknownSym - returns a symbol from the unknown tree if one is
    5381                 :             :                      available. It also updates the unknown tree.
    5382                 :             : */
    5383                 :             : 
    5384                 :    19340396 : static unsigned int FetchUnknownSym (NameKey_Name name)
    5385                 :             : {
    5386                 :    19340396 :   unsigned int Sym;
    5387                 :             : 
    5388                 :    19340396 :   Sym = GetSymFromUnknownTree (name);
    5389                 :    19340396 :   if (Sym != SymbolTable_NulSym)
    5390                 :             :     {
    5391                 :     4677877 :       SubSymFromUnknownTree (name);
    5392                 :             :     }
    5393                 :    19340396 :   return Sym;
    5394                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5395                 :             :   __builtin_unreachable ();
    5396                 :             : }
    5397                 :             : 
    5398                 :             : 
    5399                 :             : /*
    5400                 :             :    TransparentScope - returns true is the scope symbol Sym is allowed
    5401                 :             :                       to look to an outer level for a symbol.
    5402                 :             :                       ie is the symbol allowed to look to the parent
    5403                 :             :                       scope for a symbol.
    5404                 :             : */
    5405                 :             : 
    5406                 :   114659064 : static bool TransparentScope (unsigned int Sym)
    5407                 :             : {
    5408                 :   114659064 :   SymbolTable_PtrToSymbol pSym;
    5409                 :             : 
    5410                 :   114659064 :   pSym = GetPsym (Sym);
    5411                 :   114659064 :   return (pSym->SymbolType != SymbolTable_DefImpSym) && (pSym->SymbolType != SymbolTable_ModuleSym);
    5412                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5413                 :             :   __builtin_unreachable ();
    5414                 :             : }
    5415                 :             : 
    5416                 :             : 
    5417                 :             : /*
    5418                 :             :    GetLastModuleOrProcedureScope - returns the last module or procedure scope encountered,
    5419                 :             :                                    the scope before the current module scope.
    5420                 :             : */
    5421                 :             : 
    5422                 :         276 : static unsigned int GetLastModuleOrProcedureScope (void)
    5423                 :             : {
    5424                 :         276 :   SymbolTable_PtrToCallFrame pCall;
    5425                 :         276 :   unsigned int i;
    5426                 :             : 
    5427                 :             :   /* find current inner module  */
    5428                 :         276 :   i = ScopePtr;
    5429                 :         276 :   pCall = GetPcall (i);
    5430                 :         552 :   while ((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search))))
    5431                 :             :     {
    5432                 :           0 :       M2Debug_Assert (i > 0);
    5433                 :           0 :       i -= 1;
    5434                 :           0 :       pCall = GetPcall (i);
    5435                 :             :     }
    5436                 :             :   /* found module at position, i.  */
    5437                 :         276 :   i -= 1;  /* Move to an outer level module or procedure scope  */
    5438                 :         276 :   pCall = GetPcall (i);  /* Move to an outer level module or procedure scope  */
    5439                 :         552 :   while (((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search)))) && (! (SymbolTable_IsProcedure (pCall->Search))))
    5440                 :             :     {
    5441                 :           0 :       M2Debug_Assert (i > 0);
    5442                 :           0 :       i -= 1;
    5443                 :           0 :       pCall = GetPcall (i);
    5444                 :             :     }
    5445                 :             :   /* Found module at position, i.  */
    5446                 :         276 :   return pCall->Search;
    5447                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5448                 :             :   __builtin_unreachable ();
    5449                 :             : }
    5450                 :             : 
    5451                 :             : 
    5452                 :             : /*
    5453                 :             :    AddSymToScope - adds a symbol Sym with name name to
    5454                 :             :                    the current scope symbol tree.
    5455                 :             : */
    5456                 :             : 
    5457                 :    24368720 : static void AddSymToScope (unsigned int Sym, NameKey_Name name)
    5458                 :             : {
    5459                 :    24368720 :   SymbolTable_PtrToSymbol pSym;
    5460                 :    24368720 :   SymbolTable_PtrToCallFrame pCall;
    5461                 :    24368720 :   unsigned int ScopeId;
    5462                 :             : 
    5463                 :    24368720 :   pCall = GetPcall (ScopePtr);
    5464                 :    24368720 :   ScopeId = pCall->Main;
    5465                 :             :   /* 
    5466                 :             :       WriteString('Adding ') ; WriteKey(name) ; WriteString(' :') ; WriteCard(Sym, 4) ; WriteString(' to scope: ') ;
    5467                 :             :       WriteKey(GetSymName(ScopeId)) ; WriteLn ;
    5468                 :             :   */
    5469                 :    24368720 :   pSym = GetPsym (ScopeId);
    5470                 :    24368720 :   switch (pSym->SymbolType)
    5471                 :             :     {
    5472                 :    10508368 :       case SymbolTable_DefImpSym:
    5473                 :    10508368 :         if (name != NameKey_NulName)
    5474                 :             :           {
    5475                 :     6008176 :             SymbolKey_PutSymKey (pSym->DefImp.LocalSymbols, name, Sym);
    5476                 :             :           }
    5477                 :    10508368 :         if (SymbolTable_IsEnumeration (Sym))
    5478                 :             :           {
    5479                 :       33194 :             CheckEnumerationInList (pSym->DefImp.EnumerationScopeList, Sym);
    5480                 :             :           }
    5481                 :             :         break;
    5482                 :             : 
    5483                 :     2354692 :       case SymbolTable_ModuleSym:
    5484                 :     2354692 :         if (name != NameKey_NulName)
    5485                 :             :           {
    5486                 :     1531998 :             SymbolKey_PutSymKey (pSym->Module.LocalSymbols, name, Sym);
    5487                 :             :           }
    5488                 :     2354692 :         if (SymbolTable_IsEnumeration (Sym))
    5489                 :             :           {
    5490                 :       16484 :             CheckEnumerationInList (pSym->Module.EnumerationScopeList, Sym);
    5491                 :             :           }
    5492                 :             :         break;
    5493                 :             : 
    5494                 :    11505660 :       case SymbolTable_ProcedureSym:
    5495                 :    11505660 :         if (name != NameKey_NulName)
    5496                 :             :           {
    5497                 :    11306014 :             SymbolKey_PutSymKey (pSym->Procedure.LocalSymbols, name, Sym);
    5498                 :             :           }
    5499                 :    11505660 :         if (SymbolTable_IsEnumeration (Sym))
    5500                 :             :           {
    5501                 :           0 :             CheckEnumerationInList (pSym->Procedure.EnumerationScopeList, Sym);
    5502                 :             :           }
    5503                 :             :         break;
    5504                 :             : 
    5505                 :             : 
    5506                 :           0 :       default:
    5507                 :           0 :         M2Error_InternalError ((const char *) "should never get here", 21);
    5508                 :    24368720 :         break;
    5509                 :             :     }
    5510                 :    24368720 : }
    5511                 :             : 
    5512                 :             : 
    5513                 :             : /*
    5514                 :             :    PlaceMajorScopesEnumerationListOntoStack - places the DefImp, Module and
    5515                 :             :                                               Procedure symbols enumeration
    5516                 :             :                                               list onto the scope stack.
    5517                 :             : */
    5518                 :             : 
    5519                 :    31340000 : static void PlaceMajorScopesEnumerationListOntoStack (unsigned int Sym)
    5520                 :             : {
    5521                 :    31340000 :   SymbolTable_PtrToSymbol pSym;
    5522                 :             : 
    5523                 :    31340000 :   pSym = GetPsym (Sym);
    5524                 :    31340000 :   switch (pSym->SymbolType)
    5525                 :             :     {
    5526                 :    10195137 :       case SymbolTable_DefImpSym:
    5527                 :    10195137 :         PlaceEnumerationListOntoScope (pSym->DefImp.EnumerationScopeList);
    5528                 :    10195137 :         break;
    5529                 :             : 
    5530                 :       79414 :       case SymbolTable_ModuleSym:
    5531                 :       79414 :         PlaceEnumerationListOntoScope (pSym->Module.EnumerationScopeList);
    5532                 :       79414 :         break;
    5533                 :             : 
    5534                 :    21065448 :       case SymbolTable_ProcedureSym:
    5535                 :    21065448 :         PlaceEnumerationListOntoScope (pSym->Procedure.EnumerationScopeList);
    5536                 :    21065448 :         break;
    5537                 :             : 
    5538                 :             : 
    5539                 :           1 :       default:
    5540                 :           1 :         M2Error_InternalError ((const char *) "expecting - DefImp, Module or Procedure symbol", 46);
    5541                 :    31339999 :         break;
    5542                 :             :     }
    5543                 :    31339999 : }
    5544                 :             : 
    5545                 :             : 
    5546                 :             : /*
    5547                 :             :    PlaceEnumerationListOntoScope - places an enumeration list, l, onto the
    5548                 :             :                                    scope stack. This list will automatically
    5549                 :             :                                    removed via one call to EndScope which
    5550                 :             :                                    matches the StartScope by which this
    5551                 :             :                                    procedure is invoked.
    5552                 :             : */
    5553                 :             : 
    5554                 :    31339999 : static void PlaceEnumerationListOntoScope (Lists_List l)
    5555                 :             : {
    5556                 :    31339999 :   unsigned int i;
    5557                 :    31339999 :   unsigned int n;
    5558                 :             : 
    5559                 :    31339999 :   n = Lists_NoOfItemsInList (l);
    5560                 :    31339999 :   i = 1;
    5561                 :    63255144 :   while (i <= n)
    5562                 :             :     {
    5563                 :      575146 :       SymbolTable_PseudoScope (Lists_GetItemFromList (l, i));
    5564                 :      575146 :       i += 1;
    5565                 :             :     }
    5566                 :    31339999 : }
    5567                 :             : 
    5568                 :             : 
    5569                 :             : /*
    5570                 :             :    SetFirstUsed - assigns the FirstUsed field in at to tok providing
    5571                 :             :                   it has not already been set.
    5572                 :             : */
    5573                 :             : 
    5574                 :          33 : static void SetFirstUsed (unsigned int tok, SymbolTable_Where *at)
    5575                 :             : {
    5576                 :           0 :   if ((*at).FirstUsed == M2LexBuf_UnknownTokenNo)
    5577                 :             :     {
    5578                 :           0 :       (*at).FirstUsed = tok;
    5579                 :             :     }
    5580                 :           0 : }
    5581                 :             : 
    5582                 :             : 
    5583                 :             : /*
    5584                 :             :    PutFirstUsed - sets tok to the first used providing it has not already been set.
    5585                 :             :                   It also includes the read and write quad into the usage list
    5586                 :             :                   providing the quad numbers are not 0.
    5587                 :             : */
    5588                 :             : 
    5589                 :          36 : static void PutFirstUsed (unsigned int object, unsigned int tok, unsigned int read_, unsigned int write_)
    5590                 :             : {
    5591                 :          36 :   SymbolTable_PtrToSymbol pSym;
    5592                 :             : 
    5593                 :          36 :   if (SymbolTable_IsVar (object))
    5594                 :             :     {
    5595                 :          33 :       pSym = GetPsym (object);
    5596                 :          33 :       SetFirstUsed (tok, &pSym->Var.At);
    5597                 :          33 :       if (read_ != 0)
    5598                 :             :         {
    5599                 :          18 :           SymbolTable_PutReadQuad (object, SymbolTable_GetMode (object), read_);
    5600                 :             :         }
    5601                 :          33 :       if (write_ != 0)
    5602                 :             :         {
    5603                 :          15 :           SymbolTable_PutWriteQuad (object, SymbolTable_GetMode (object), write_);
    5604                 :             :         }
    5605                 :             :     }
    5606                 :          36 : }
    5607                 :             : 
    5608                 :             : 
    5609                 :             : /*
    5610                 :             :    CanLookThroughScope - by default this procedure returns TRUE.  It only returns
    5611                 :             :                          FALSE if, throughProcedure, is FALSE and the ScopeSym is
    5612                 :             :                          a procedure.
    5613                 :             : */
    5614                 :             : 
    5615                 :    76261163 : static bool CanLookThroughScope (unsigned int ScopeSym, bool throughProcedure)
    5616                 :             : {
    5617                 :    76261163 :   if (SymbolTable_IsProcedure (ScopeSym))
    5618                 :             :     {
    5619                 :             :       return throughProcedure;
    5620                 :             :     }
    5621                 :             :   else
    5622                 :             :     {
    5623                 :           0 :       return true;
    5624                 :             :     }
    5625                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5626                 :             :   __builtin_unreachable ();
    5627                 :             : }
    5628                 :             : 
    5629                 :             : 
    5630                 :             : /*
    5631                 :             :    GetScopeSym - searches the current scope and below, providing that the
    5632                 :             :                  scopes are transparent, for a symbol with name, name.
    5633                 :             :                  It only passes over procedure scopes if, throughProcedure,
    5634                 :             :                  is TRUE.
    5635                 :             : */
    5636                 :             : 
    5637                 :   105736813 : static unsigned int GetScopeSym (NameKey_Name name, bool throughProcedure)
    5638                 :             : {
    5639                 :   105736813 :   SymbolTable_PtrToCallFrame pCall;
    5640                 :   105736813 :   unsigned int ScopeSym;
    5641                 :   105736813 :   unsigned int ScopeId;
    5642                 :   105736813 :   unsigned int Sym;
    5643                 :             : 
    5644                 :             :   /* DisplayScopes ;  */
    5645                 :   105736813 :   ScopeId = ScopePtr;
    5646                 :   105736813 :   pCall = GetPcall (ScopeId);
    5647                 :   105736813 :   ScopeSym = pCall->Search;
    5648                 :             :   /* WriteString(' scope: ') ; WriteKey(GetSymName(ScopeSym)) ;  */
    5649                 :   105736813 :   Sym = CheckScopeForSym (ScopeSym, name);
    5650                 :   432411655 :   while ((((ScopeId > 0) && (Sym == SymbolTable_NulSym)) && (TransparentScope (ScopeSym))) && (CanLookThroughScope (ScopeSym, throughProcedure)))
    5651                 :             :     {
    5652                 :    76261163 :       ScopeId -= 1;
    5653                 :    76261163 :       pCall = GetPcall (ScopeId);
    5654                 :    76261163 :       ScopeSym = pCall->Search;
    5655                 :    76261163 :       Sym = CheckScopeForSym (ScopeSym, name);
    5656                 :             :     }
    5657                 :             :   /* WriteString(' scope: ') ; WriteKey(GetSymName(ScopeSym))  */
    5658                 :             :   /* IF Sym#NulSym THEN WriteKey(GetSymName(Sym)) END ; WriteLn ;  */
    5659                 :   105736813 :   return Sym;
    5660                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5661                 :             :   __builtin_unreachable ();
    5662                 :             : }
    5663                 :             : 
    5664                 :             : 
    5665                 :             : /*
    5666                 :             :    CheckScopeForSym - checks the scope, ScopeSym, for an identifier
    5667                 :             :                       of name, name. CheckScopeForSym checks for
    5668                 :             :                       the symbol by the GetLocalSym and also
    5669                 :             :                       ExamineUnresolvedTree.
    5670                 :             : */
    5671                 :             : 
    5672                 :   181998222 : static unsigned int CheckScopeForSym (unsigned int ScopeSym, NameKey_Name name)
    5673                 :             : {
    5674                 :   181998222 :   unsigned int Sym;
    5675                 :             : 
    5676                 :   181998222 :   Sym = SymbolTable_GetLocalSym (ScopeSym, name);
    5677                 :   181998222 :   if ((Sym == SymbolTable_NulSym) && (((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsDefImp (ScopeSym))) || (SymbolTable_IsProcedure (ScopeSym))))
    5678                 :             :     {
    5679                 :    72704080 :       Sym = ExamineUnresolvedTree (ScopeSym, name);
    5680                 :             :     }
    5681                 :   181998222 :   return Sym;
    5682                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5683                 :             :   __builtin_unreachable ();
    5684                 :             : }
    5685                 :             : 
    5686                 :             : 
    5687                 :             : /*
    5688                 :             :    GetModuleScopeId - returns the scope index to the next module starting
    5689                 :             :                       at index, Id.
    5690                 :             :                       Id will either point to a null scope (NulSym) or
    5691                 :             :                       alternatively point to a Module or DefImp symbol.
    5692                 :             : */
    5693                 :             : 
    5694                 :      137024 : static unsigned int GetModuleScopeId (unsigned int Id)
    5695                 :             : {
    5696                 :      137024 :   SymbolTable_PtrToCallFrame pCall;
    5697                 :      137024 :   unsigned int s;
    5698                 :             : 
    5699                 :      137024 :   pCall = GetPcall (Id);
    5700                 :      137024 :   s = pCall->Search;
    5701                 :      227382 :   while (((Id > 0) && (s != SymbolTable_NulSym)) && ((! (SymbolTable_IsModule (s))) && (! (SymbolTable_IsDefImp (s)))))
    5702                 :             :     {
    5703                 :       90358 :       Id -= 1;
    5704                 :       90358 :       pCall = GetPcall (Id);
    5705                 :       90358 :       s = pCall->Search;
    5706                 :             :     }
    5707                 :      137024 :   return Id;
    5708                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5709                 :             :   __builtin_unreachable ();
    5710                 :             : }
    5711                 :             : 
    5712                 :             : 
    5713                 :             : /*
    5714                 :             :    GetVisibleSym -
    5715                 :             : */
    5716                 :             : 
    5717                 :          36 : static unsigned int GetVisibleSym (NameKey_Name name)
    5718                 :             : {
    5719                 :          36 :   SymbolTable_PtrToCallFrame pCall;
    5720                 :          36 :   unsigned int Sym;
    5721                 :          36 :   unsigned int i;
    5722                 :             : 
    5723                 :          36 :   i = ScopePtr;
    5724                 :          42 :   while (i >= 1)
    5725                 :             :     {
    5726                 :          42 :       pCall = GetPcall (i);
    5727                 :          42 :       if (pCall->Search == pCall->Main)
    5728                 :             :         {
    5729                 :          30 :           return SymbolTable_GetLocalSym (pCall->Main, name);
    5730                 :             :         }
    5731                 :             :       else
    5732                 :             :         {
    5733                 :          12 :           if (SymbolTable_IsEnumeration (pCall->Search))
    5734                 :             :             {
    5735                 :          12 :               Sym = SymbolTable_GetLocalSym (pCall->Search, name);
    5736                 :          12 :               if (Sym != SymbolTable_NulSym)
    5737                 :             :                 {
    5738                 :             :                   return Sym;
    5739                 :             :                 }
    5740                 :             :             }
    5741                 :             :         }
    5742                 :           6 :       i -= 1;
    5743                 :             :     }
    5744                 :             :   return SymbolTable_NulSym;
    5745                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5746                 :             :   __builtin_unreachable ();
    5747                 :             : }
    5748                 :             : 
    5749                 :             : 
    5750                 :             : /*
    5751                 :             :    IsAlreadyDeclaredSym - returns true if Sym has already been declared
    5752                 :             :                           in the current main scope.
    5753                 :             : */
    5754                 :             : 
    5755                 :    19340232 : static bool IsAlreadyDeclaredSym (NameKey_Name name)
    5756                 :             : {
    5757                 :    19340232 :   SymbolTable_PtrToCallFrame pCall;
    5758                 :    19340232 :   unsigned int i;
    5759                 :             : 
    5760                 :    19340232 :   i = ScopePtr;
    5761                 :    22276068 :   while (i >= 1)
    5762                 :             :     {
    5763                 :    22276068 :       pCall = GetPcall (i);
    5764                 :    22276068 :       if (pCall->Search == pCall->Main)
    5765                 :             :         {
    5766                 :    19340226 :           return (SymbolTable_GetLocalSym (pCall->Main, name)) != SymbolTable_NulSym;
    5767                 :             :         }
    5768                 :             :       else
    5769                 :             :         {
    5770                 :     2935842 :           if ((SymbolTable_IsEnumeration (pCall->Search)) && ((SymbolTable_GetLocalSym (pCall->Search, name)) != SymbolTable_NulSym))
    5771                 :             :             {
    5772                 :             :               return true;
    5773                 :             :             }
    5774                 :             :         }
    5775                 :     2935836 :       i -= 1;
    5776                 :             :     }
    5777                 :             :   return false;
    5778                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5779                 :             :   __builtin_unreachable ();
    5780                 :             : }
    5781                 :             : 
    5782                 :             : 
    5783                 :             : /*
    5784                 :             :    GenName - returns a new name consisting of pre, name, post concatenation.
    5785                 :             : */
    5786                 :             : 
    5787                 :      408640 : static NameKey_Name GenName (NameKey_Name libname, const char *pre_, unsigned int _pre_high, NameKey_Name name, const char *post_, unsigned int _post_high)
    5788                 :             : {
    5789                 :      408640 :   DynamicStrings_String str;
    5790                 :      408640 :   NameKey_Name result;
    5791                 :      408640 :   char pre[_pre_high+1];
    5792                 :      408640 :   char post[_post_high+1];
    5793                 :             : 
    5794                 :             :   /* make a local copy of each unbounded array.  */
    5795                 :      408640 :   memcpy (pre, pre_, _pre_high+1);
    5796                 :      408640 :   memcpy (post, post_, _post_high+1);
    5797                 :             : 
    5798                 :      408640 :   str = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (libname));
    5799                 :      408640 :   str = DynamicStrings_ConCat (str, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) pre, _pre_high)));
    5800                 :      408640 :   str = DynamicStrings_ConCat (str, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (name))));
    5801                 :      408640 :   str = DynamicStrings_ConCat (str, DynamicStrings_InitString ((const char *) post, _post_high));
    5802                 :      408640 :   result = NameKey_makekey (DynamicStrings_string (str));
    5803                 :      408640 :   str = DynamicStrings_KillString (str);
    5804                 :      408640 :   return result;
    5805                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5806                 :             :   __builtin_unreachable ();
    5807                 :      408640 : }
    5808                 :             : 
    5809                 :             : 
    5810                 :             : /*
    5811                 :             :    InitCtor - initialize the ModuleCtor fields to NulSym.
    5812                 :             : */
    5813                 :             : 
    5814                 :      204559 : static void InitCtor (SymbolTable_ModuleCtor *ctor)
    5815                 :             : {
    5816                 :      204559 :   (*ctor).ctor = SymbolTable_NulSym;
    5817                 :      204559 :   (*ctor).dep = SymbolTable_NulSym;
    5818                 :      204559 :   (*ctor).init = SymbolTable_NulSym;
    5819                 :      204559 :   (*ctor).fini = SymbolTable_NulSym;
    5820                 :           0 : }
    5821                 :             : 
    5822                 :             : 
    5823                 :             : /*
    5824                 :             :    InitCtorFields - initialize the ModuleCtor fields.  An inner module has no
    5825                 :             :                     ctor procedure.
    5826                 :             : */
    5827                 :             : 
    5828                 :       83355 : static void InitCtorFields (unsigned int moduleTok, unsigned int beginTok, unsigned int finallyTok, unsigned int moduleSym, SymbolTable_ModuleCtor *ctor, NameKey_Name name, bool inner, bool pub)
    5829                 :             : {
    5830                 :       83355 :   if (M2Options_ScaffoldDynamic && ! inner)
    5831                 :             :     {
    5832                 :             :       /* The ctor procedure must be public.  */
    5833                 :       82621 :       (*ctor).ctor = SymbolTable_MakeProcedure (moduleTok, GenName (SymbolTable_GetLibName (moduleSym), (const char *) "_M2_", 4, name, (const char *) "_ctor", 5));
    5834                 :       82621 :       SymbolTable_PutCtor ((*ctor).ctor, true);
    5835                 :       82621 :       M2Debug_Assert (pub);
    5836                 :       82621 :       SymbolTable_PutPublic ((*ctor).ctor, pub);
    5837                 :       82621 :       SymbolTable_PutExtern ((*ctor).ctor, ! pub);
    5838                 :       82621 :       SymbolTable_PutMonoName ((*ctor).ctor, true);
    5839                 :             :       /* The dep procedure is local to the module.  */
    5840                 :       82621 :       (*ctor).dep = SymbolTable_MakeProcedure (moduleTok, GenName (SymbolTable_GetLibName (moduleSym), (const char *) "_M2_", 4, name, (const char *) "_dep", 4));
    5841                 :       82621 :       SymbolTable_PutMonoName ((*ctor).dep, true);
    5842                 :             :     }
    5843                 :             :   else
    5844                 :             :     {
    5845                 :         734 :       (*ctor).ctor = SymbolTable_NulSym;
    5846                 :         734 :       (*ctor).dep = SymbolTable_NulSym;
    5847                 :             :     }
    5848                 :             :   /* The init/fini procedures must be public.  */
    5849                 :       83355 :   (*ctor).init = SymbolTable_MakeProcedure (beginTok, GenName (SymbolTable_GetLibName (moduleSym), (const char *) "_M2_", 4, name, (const char *) "_init", 5));
    5850                 :       83355 :   SymbolTable_PutPublic ((*ctor).init, pub);
    5851                 :       83355 :   SymbolTable_PutExtern ((*ctor).init, ! pub);
    5852                 :       83355 :   SymbolTable_PutMonoName ((*ctor).init, ! inner);
    5853                 :       83355 :   M2Scaffold_DeclareArgEnvParams (beginTok, (*ctor).init);
    5854                 :       83355 :   (*ctor).fini = SymbolTable_MakeProcedure (finallyTok, GenName (SymbolTable_GetLibName (moduleSym), (const char *) "_M2_", 4, name, (const char *) "_fini", 5));
    5855                 :       83355 :   SymbolTable_PutPublic ((*ctor).fini, pub);
    5856                 :       83355 :   SymbolTable_PutExtern ((*ctor).fini, ! pub);
    5857                 :       83355 :   SymbolTable_PutMonoName ((*ctor).fini, ! inner);
    5858                 :       83355 :   M2Scaffold_DeclareArgEnvParams (beginTok, (*ctor).fini);
    5859                 :       83355 : }
    5860                 :             : 
    5861                 :             : 
    5862                 :             : /*
    5863                 :             :    CheckTok - checks to see that tok is at a known location.  If not
    5864                 :             :               it uses GetTokenNo as a fall back.
    5865                 :             : */
    5866                 :             : 
    5867                 :    24159168 : static unsigned int CheckTok (unsigned int tok, const char *name_, unsigned int _name_high)
    5868                 :             : {
    5869                 :    24159168 :   DynamicStrings_String s;
    5870                 :    24159168 :   char name[_name_high+1];
    5871                 :             : 
    5872                 :             :   /* make a local copy of each unbounded array.  */
    5873                 :    24159168 :   memcpy (name, name_, _name_high+1);
    5874                 :             : 
    5875                 :    24159168 :   if (tok == M2LexBuf_UnknownTokenNo)
    5876                 :             :     {
    5877                 :       45070 :       tok = M2LexBuf_GetTokenNo ();
    5878                 :       45070 :       if (DebugUnknownToken)
    5879                 :             :         {
    5880                 :             :           s = DynamicStrings_InitString ((const char *) name, _name_high);
    5881                 :             :           s = DynamicStrings_ConCat (s, DynamicStrings_InitString ((const char *) " symbol {%W} has been created with an unknown token location", 60));
    5882                 :             :           M2MetaError_MetaErrorStringT0 (M2LexBuf_GetTokenNo (), s);
    5883                 :             :         }
    5884                 :             :     }
    5885                 :    24159168 :   return tok;
    5886                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5887                 :             :   __builtin_unreachable ();
    5888                 :           0 : }
    5889                 :             : 
    5890                 :             : 
    5891                 :             : /*
    5892                 :             :    GetLink - returns TRUE if the current module is only used for linkage.
    5893                 :             : */
    5894                 :             : 
    5895                 :      381354 : static bool GetLink (void)
    5896                 :             : {
    5897                 :      381354 :   unsigned int OuterModule;
    5898                 :             : 
    5899                 :      381354 :   OuterModule = SymbolTable_GetCurrentModule ();
    5900                 :      381354 :   if (OuterModule != SymbolTable_NulSym)
    5901                 :             :     {
    5902                 :             :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    5903                 :      365848 :       if (M2Comp_CompilingDefinitionModule ())
    5904                 :             :         {
    5905                 :        8664 :           return SymbolTable_IsDefLink (OuterModule);
    5906                 :             :         }
    5907                 :             :       else
    5908                 :             :         {
    5909                 :      357184 :           return SymbolTable_IsModLink (OuterModule);
    5910                 :             :         }
    5911                 :             :     }
    5912                 :             :   /* Default is that the module is for compiling.  */
    5913                 :             :   return false;
    5914                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    5915                 :             :   __builtin_unreachable ();
    5916                 :             : }
    5917                 :             : 
    5918                 :             : 
    5919                 :             : /*
    5920                 :             :    AddModuleToParent - adds symbol, Sym, to module, Parent.
    5921                 :             : */
    5922                 :             : 
    5923                 :         426 : static void AddModuleToParent (unsigned int Sym, unsigned int Parent)
    5924                 :             : {
    5925                 :         426 :   SymbolTable_PtrToSymbol pSym;
    5926                 :             : 
    5927                 :         426 :   pSym = GetPsym (Parent);
    5928                 :         426 :   switch (pSym->SymbolType)
    5929                 :             :     {
    5930                 :          18 :       case SymbolTable_DefImpSym:
    5931                 :          18 :         Lists_PutItemIntoList (pSym->DefImp.ListOfModules, Sym);
    5932                 :          18 :         break;
    5933                 :             : 
    5934                 :         252 :       case SymbolTable_ModuleSym:
    5935                 :         252 :         Lists_PutItemIntoList (pSym->Module.ListOfModules, Sym);
    5936                 :         252 :         break;
    5937                 :             : 
    5938                 :         156 :       case SymbolTable_ProcedureSym:
    5939                 :         156 :         Lists_PutItemIntoList (pSym->Procedure.ListOfModules, Sym);
    5940                 :         156 :         break;
    5941                 :             : 
    5942                 :             : 
    5943                 :           0 :       default:
    5944                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
    5945                 :         426 :         break;
    5946                 :             :     }
    5947                 :         426 : }
    5948                 :             : 
    5949                 :             : 
    5950                 :             : /*
    5951                 :             :    PutProcedureExternPublic - if procedure is not NulSym set extern
    5952                 :             :                               and public booleans.
    5953                 :             : */
    5954                 :             : 
    5955                 :      452272 : static void PutProcedureExternPublic (unsigned int procedure, bool extern_, bool pub)
    5956                 :             : {
    5957                 :      452272 :   if (procedure != SymbolTable_NulSym)
    5958                 :             :     {
    5959                 :      452272 :       SymbolTable_PutExtern (procedure, extern_);
    5960                 :      452272 :       SymbolTable_PutPublic (procedure, pub);
    5961                 :             :     }
    5962                 :      452272 : }
    5963                 :             : 
    5964                 :             : 
    5965                 :             : /*
    5966                 :             :    PutCtorExtern -
    5967                 :             : */
    5968                 :             : 
    5969                 :      113068 : static void PutCtorExtern (unsigned int tok, unsigned int sym, SymbolTable_ModuleCtor *ctor, bool extern_)
    5970                 :             : {
    5971                 :             :   /* If the ctor does not exist then make it extern/ (~extern) public.  */
    5972                 :      113068 :   if ((*ctor).ctor == SymbolTable_NulSym)
    5973                 :             :     {
    5974                 :       19304 :       (*ctor).ctor = SymbolTable_MakeProcedure (tok, GenName (SymbolTable_GetLibName (sym), (const char *) "_M2_", 4, SymbolTable_GetSymName (sym), (const char *) "_ctor", 5));
    5975                 :       19304 :       SymbolTable_PutMonoName ((*ctor).ctor, true);
    5976                 :             :     }
    5977                 :      113068 :   PutProcedureExternPublic ((*ctor).ctor, extern_, ! extern_);
    5978                 :      113068 :   SymbolTable_PutCtor ((*ctor).ctor, true);
    5979                 :             :   /* If the ctor does not exist then make it extern/ (~extern) public.  */
    5980                 :      113068 :   if ((*ctor).dep == SymbolTable_NulSym)
    5981                 :             :     {
    5982                 :       19304 :       (*ctor).dep = SymbolTable_MakeProcedure (tok, GenName (SymbolTable_GetLibName (sym), (const char *) "_M2_", 4, SymbolTable_GetSymName (sym), (const char *) "_dep", 4));
    5983                 :       19304 :       SymbolTable_PutMonoName ((*ctor).dep, true);
    5984                 :             :     }
    5985                 :      113068 :   PutProcedureExternPublic ((*ctor).dep, extern_, ! extern_);
    5986                 :             :   /* If init/fini do not exist then create them.  */
    5987                 :      113068 :   if ((*ctor).init == SymbolTable_NulSym)
    5988                 :             :     {
    5989                 :       19040 :       (*ctor).init = SymbolTable_MakeProcedure (tok, GenName (SymbolTable_GetLibName (sym), (const char *) "_M2_", 4, SymbolTable_GetSymName (sym), (const char *) "_init", 5));
    5990                 :       19040 :       M2Scaffold_DeclareArgEnvParams (tok, (*ctor).init);
    5991                 :       19040 :       SymbolTable_PutMonoName ((*ctor).init, ! (SymbolTable_IsInnerModule (sym)));
    5992                 :             :     }
    5993                 :      113068 :   PutProcedureExternPublic ((*ctor).init, extern_, ! extern_);
    5994                 :      113068 :   if ((*ctor).fini == SymbolTable_NulSym)
    5995                 :             :     {
    5996                 :       19040 :       (*ctor).fini = SymbolTable_MakeProcedure (tok, GenName (SymbolTable_GetLibName (sym), (const char *) "_M2_", 4, SymbolTable_GetSymName (sym), (const char *) "_fini", 5));
    5997                 :       19040 :       M2Scaffold_DeclareArgEnvParams (tok, (*ctor).fini);
    5998                 :       19040 :       SymbolTable_PutMonoName ((*ctor).fini, ! (SymbolTable_IsInnerModule (sym)));
    5999                 :             :     }
    6000                 :      113068 :   PutProcedureExternPublic ((*ctor).fini, extern_, ! extern_);
    6001                 :      113068 : }
    6002                 :             : 
    6003                 :             : 
    6004                 :             : /*
    6005                 :             :    InitProcedureDeclaration - initialize all the ProcedureDeclaration
    6006                 :             :                               fields.
    6007                 :             : */
    6008                 :             : 
    6009                 :    15273390 : static void InitProcedureDeclaration (SymbolTable_ProcedureDeclaration *decl)
    6010                 :             : {
    6011                 :    15273390 :   (*decl).Defined = false;  /* Has the procedure been  */
    6012                 :             :   /* declared yet?  */
    6013                 :    15273390 :   (*decl).ParamDefined = false;  /* Have the parameters been  */
    6014                 :             :   /* defined yet?  */
    6015                 :    15273390 :   (*decl).HasVarArgs = false;  /* Does the procedure use ... ?  */
    6016                 :    15273390 :   (*decl).HasOptArg = false;  /* Does this procedure use [ ] ?  */
    6017                 :    15273390 :   (*decl).IsNoReturn = false;  /* Declared attribute noreturn ?  */
    6018                 :    15273390 :   (*decl).ReturnOptional = false;  /* Is the return value optional?  */
    6019                 :    15273390 :   (*decl).ProcedureTok = M2LexBuf_UnknownTokenNo;  /* Is the return value optional?  */
    6020                 :           0 : }
    6021                 :             : 
    6022                 :             : 
    6023                 :             : /*
    6024                 :             :    AddProcedureToList - adds a procedure, Proc, to the list of procedures
    6025                 :             :                         in module, Mod.
    6026                 :             : */
    6027                 :             : 
    6028                 :     5091130 : static void AddProcedureToList (unsigned int Mod, unsigned int Proc)
    6029                 :             : {
    6030                 :     5091130 :   SymbolTable_PtrToSymbol pSym;
    6031                 :             : 
    6032                 :     5091130 :   pSym = GetPsym (Mod);
    6033                 :     5091130 :   switch (pSym->SymbolType)
    6034                 :             :     {
    6035                 :     4406128 :       case SymbolTable_DefImpSym:
    6036                 :     4406128 :         Lists_PutItemIntoList (pSym->DefImp.ListOfProcs, Proc);
    6037                 :     4406128 :         break;
    6038                 :             : 
    6039                 :      684570 :       case SymbolTable_ModuleSym:
    6040                 :      684570 :         Lists_PutItemIntoList (pSym->Module.ListOfProcs, Proc);
    6041                 :      684570 :         break;
    6042                 :             : 
    6043                 :         432 :       case SymbolTable_ProcedureSym:
    6044                 :         432 :         Lists_PutItemIntoList (pSym->Procedure.ListOfProcs, Proc);
    6045                 :         432 :         break;
    6046                 :             : 
    6047                 :             : 
    6048                 :           0 :       default:
    6049                 :           0 :         M2Error_InternalError ((const char *) "expecting ModuleSym, DefImpSym or ProcedureSym symbol", 53);
    6050                 :     5091130 :         break;
    6051                 :             :     }
    6052                 :     5091130 : }
    6053                 :             : 
    6054                 :             : 
    6055                 :             : /*
    6056                 :             :    AddVarToScopeList - adds symbol, sym, to, scope.
    6057                 :             : */
    6058                 :             : 
    6059                 :    11414270 : static void AddVarToScopeList (unsigned int scope, unsigned int sym)
    6060                 :             : {
    6061                 :    11414270 :   SymbolTable_PtrToSymbol pSym;
    6062                 :             : 
    6063                 :    11414270 :   pSym = GetPsym (scope);
    6064                 :    11414270 :   switch (pSym->SymbolType)
    6065                 :             :     {
    6066                 :    11165728 :       case SymbolTable_ProcedureSym:
    6067                 :    11165728 :         Lists_PutItemIntoList (pSym->Procedure.ListOfVars, sym);
    6068                 :    11165728 :         break;
    6069                 :             : 
    6070                 :      102382 :       case SymbolTable_ModuleSym:
    6071                 :      102382 :         Lists_PutItemIntoList (pSym->Module.ListOfVars, sym);
    6072                 :      102382 :         break;
    6073                 :             : 
    6074                 :      146160 :       case SymbolTable_DefImpSym:
    6075                 :      146160 :         Lists_PutItemIntoList (pSym->DefImp.ListOfVars, sym);
    6076                 :      146160 :         break;
    6077                 :             : 
    6078                 :             : 
    6079                 :           0 :       default:
    6080                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure or Module symbol", 36);
    6081                 :    11414270 :         break;
    6082                 :             :     }
    6083                 :    11414270 : }
    6084                 :             : 
    6085                 :             : 
    6086                 :             : /*
    6087                 :             :    AddVarToList - add a variable symbol to the list of variables maintained
    6088                 :             :                   by the inner most scope. (Procedure or Module).
    6089                 :             : */
    6090                 :             : 
    6091                 :    11414252 : static void AddVarToList (unsigned int Sym)
    6092                 :             : {
    6093                 :    11414252 :   SymbolTable_PtrToCallFrame pCall;
    6094                 :             : 
    6095                 :    11414252 :   pCall = GetPcall (ScopePtr);
    6096                 :    11414252 :   AddVarToScopeList (pCall->Main, Sym);
    6097                 :    11414252 : }
    6098                 :             : 
    6099                 :             : 
    6100                 :             : /*
    6101                 :             :    InitVarDecl - initialize the variable and type token location positions.
    6102                 :             : */
    6103                 :             : 
    6104                 :    11414252 : static void InitVarDecl (SymbolTable_VarDecl *decl, unsigned int vartok)
    6105                 :             : {
    6106                 :    11414252 :   (*decl).FullTok = M2LexBuf_UnknownTokenNo;
    6107                 :    11414252 :   (*decl).VarTok = vartok;
    6108                 :    11414252 :   (*decl).TypeTok = M2LexBuf_UnknownTokenNo;
    6109                 :           0 : }
    6110                 :             : 
    6111                 :             : 
    6112                 :             : /*
    6113                 :             :    doPutVarDeclTypeTok - places typetok into decl.TypeTok.
    6114                 :             :                          sym must be a variable.
    6115                 :             : */
    6116                 :             : 
    6117                 :           0 : static void doPutVarDeclTypeTok (unsigned int sym, unsigned int typetok)
    6118                 :             : {
    6119                 :           0 :   SymbolTable_PtrToSymbol pSym;
    6120                 :             : 
    6121                 :           0 :   M2Debug_Assert (SymbolTable_IsVar (sym));
    6122                 :           0 :   pSym = GetPsym (sym);
    6123                 :           0 :   pSym->Var.Declared.TypeTok = typetok;
    6124                 :           0 : }
    6125                 :             : 
    6126                 :             : 
    6127                 :             : /*
    6128                 :             :    doPutVarDeclTok - places vartok into decl.VarTok.
    6129                 :             :                      sym must be a variable.
    6130                 :             : */
    6131                 :             : 
    6132                 :     1690910 : static void doPutVarDeclTok (unsigned int sym, unsigned int vartok)
    6133                 :             : {
    6134                 :     1690910 :   SymbolTable_PtrToSymbol pSym;
    6135                 :             : 
    6136                 :     1690910 :   M2Debug_Assert (SymbolTable_IsVar (sym));
    6137                 :     1690910 :   pSym = GetPsym (sym);
    6138                 :     1690910 :   pSym->Var.Declared.VarTok = vartok;
    6139                 :     1690910 : }
    6140                 :             : 
    6141                 :             : 
    6142                 :             : /*
    6143                 :             :    doGetVarDeclTok - return decl.VarTok for a variable.
    6144                 :             : */
    6145                 :             : 
    6146                 :          60 : static unsigned int doGetVarDeclTok (unsigned int sym)
    6147                 :             : {
    6148                 :          60 :   SymbolTable_PtrToSymbol pSym;
    6149                 :             : 
    6150                 :          60 :   pSym = GetPsym (sym);
    6151                 :          60 :   M2Debug_Assert (SymbolTable_IsVar (sym));
    6152                 :          60 :   return pSym->Var.Declared.VarTok;
    6153                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6154                 :             :   __builtin_unreachable ();
    6155                 :             : }
    6156                 :             : 
    6157                 :             : 
    6158                 :             : /*
    6159                 :             :    doGetVarDeclTypeTok - return decl.TypeTok for a variable.
    6160                 :             : */
    6161                 :             : 
    6162                 :           0 : static unsigned int doGetVarDeclTypeTok (unsigned int sym)
    6163                 :             : {
    6164                 :           0 :   SymbolTable_PtrToSymbol pSym;
    6165                 :             : 
    6166                 :           0 :   pSym = GetPsym (sym);
    6167                 :           0 :   M2Debug_Assert (SymbolTable_IsVar (sym));
    6168                 :           0 :   return pSym->Var.Declared.TypeTok;
    6169                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6170                 :             :   __builtin_unreachable ();
    6171                 :             : }
    6172                 :             : 
    6173                 :             : 
    6174                 :             : /*
    6175                 :             :    doGetVarDeclFullTok - return the full declaration of var: type.
    6176                 :             : */
    6177                 :             : 
    6178                 :         282 : static unsigned int doGetVarDeclFullTok (unsigned int sym)
    6179                 :             : {
    6180                 :         282 :   SymbolTable_PtrToSymbol pSym;
    6181                 :             : 
    6182                 :         282 :   pSym = GetPsym (sym);
    6183                 :         282 :   M2Debug_Assert (SymbolTable_IsVar (sym));
    6184                 :         282 :   if (pSym->Var.Declared.FullTok == M2LexBuf_UnknownTokenNo)
    6185                 :             :     {
    6186                 :             :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    6187                 :         282 :       if (pSym->Var.Declared.TypeTok == M2LexBuf_UnknownTokenNo)
    6188                 :             :         {
    6189                 :          66 :           return pSym->Var.Declared.VarTok;
    6190                 :             :         }
    6191                 :             :       else
    6192                 :             :         {
    6193                 :         216 :           pSym->Var.Declared.FullTok = M2LexBuf_MakeVirtual2Tok (pSym->Var.Declared.VarTok, pSym->Var.Declared.TypeTok);
    6194                 :             :         }
    6195                 :             :     }
    6196                 :         216 :   return pSym->Var.Declared.FullTok;
    6197                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6198                 :             :   __builtin_unreachable ();
    6199                 :             : }
    6200                 :             : 
    6201                 :             : 
    6202                 :             : /*
    6203                 :             :    FillInRecordFields - given a new symbol, sym, make it a record symbol
    6204                 :             :                         and initialize its fields.
    6205                 :             : */
    6206                 :             : 
    6207                 :      102521 : static void FillInRecordFields (unsigned int tok, unsigned int sym, NameKey_Name RecordName, unsigned int scope, unsigned int oaf)
    6208                 :             : {
    6209                 :      102521 :   SymbolTable_PtrToSymbol pSym;
    6210                 :             : 
    6211                 :      102521 :   if (! (SymbolTable_IsError (sym)))
    6212                 :             :     {
    6213                 :      102515 :       pSym = GetPsym (sym);
    6214                 :      102515 :       pSym->SymbolType = SymbolTable_RecordSym;
    6215                 :      102515 :       pSym->Record.name = RecordName;
    6216                 :      102515 :       SymbolKey_InitTree (&pSym->Record.LocalSymbols);
    6217                 :      102515 :       pSym->Record.Size = M2ALU_InitValue ();
    6218                 :      102515 :       Lists_InitList (&pSym->Record.ListOfSons);  /* List of RecordFieldSym and VarientSym  */
    6219                 :      102515 :       pSym->Record.oafamily = oaf;  /* List of RecordFieldSym and VarientSym  */
    6220                 :      102515 :       pSym->Record.Parent = SymbolTable_NulSym;
    6221                 :      102515 :       pSym->Record.Align = SymbolTable_NulSym;
    6222                 :      102515 :       pSym->Record.DefaultAlign = SymbolTable_NulSym;
    6223                 :      102515 :       pSym->Record.DeclPacked = false;
    6224                 :      102515 :       pSym->Record.DeclResolved = false;
    6225                 :      102515 :       pSym->Record.Scope = scope;
    6226                 :      102515 :       InitWhereDeclaredTok (tok, &pSym->Record.At);
    6227                 :             :     }
    6228                 :      102521 : }
    6229                 :             : 
    6230                 :             : 
    6231                 :             : /*
    6232                 :             :    HandleHiddenOrDeclare -
    6233                 :             : */
    6234                 :             : 
    6235                 :     6500561 : static unsigned int HandleHiddenOrDeclare (unsigned int tok, NameKey_Name name, unsigned int *oaf)
    6236                 :             : {
    6237                 :     6500561 :   unsigned int sym;
    6238                 :             : 
    6239                 :     6500561 :   sym = CheckForHiddenType (name);
    6240                 :     6500561 :   if (sym == SymbolTable_NulSym)
    6241                 :             :     {
    6242                 :     6484909 :       sym = DeclareSym (tok, name);
    6243                 :     6484909 :       if (! (SymbolTable_IsError (sym)))
    6244                 :             :         {
    6245                 :             :           /* Now add this type to the symbol table of the current scope  */
    6246                 :     6484897 :           AddSymToScope (sym, name);
    6247                 :             :         }
    6248                 :             :     }
    6249                 :     6500561 :   (*oaf) = SymbolTable_GetOAFamily (sym);
    6250                 :     6500561 :   return sym;
    6251                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6252                 :             :   __builtin_unreachable ();
    6253                 :             : }
    6254                 :             : 
    6255                 :             : 
    6256                 :             : /*
    6257                 :             :    CreateConstLit -
    6258                 :             : */
    6259                 :             : 
    6260                 :      618106 : static unsigned int CreateConstLit (unsigned int tok, NameKey_Name constName, unsigned int constType)
    6261                 :             : {
    6262                 :      618106 :   SymbolTable_PtrToSymbol pSym;
    6263                 :      618106 :   unsigned int Sym;
    6264                 :      618106 :   bool overflow;
    6265                 :             : 
    6266                 :      618106 :   overflow = false;
    6267                 :      618106 :   if (constType == SymbolTable_NulSym)
    6268                 :             :     {
    6269                 :      470706 :       constType = GetConstLitType (tok, constName, &overflow, true);
    6270                 :             :     }
    6271                 :      618106 :   NewSym (&Sym);
    6272                 :      618106 :   pSym = GetPsym (Sym);
    6273                 :      618106 :   pSym->SymbolType = SymbolTable_ConstLitSym;
    6274                 :      618106 :   switch (pSym->SymbolType)
    6275                 :             :     {
    6276                 :      618106 :       case SymbolTable_ConstLitSym:
    6277                 :      618106 :         pSym->ConstLit.name = constName;
    6278                 :      618106 :         pSym->ConstLit.Value = M2ALU_InitValue ();
    6279                 :      618106 :         M2ALU_PushString (tok, constName, ! overflow);
    6280                 :      618106 :         M2ALU_PopInto (pSym->ConstLit.Value);
    6281                 :      618106 :         pSym->ConstLit.Type = constType;
    6282                 :      618106 :         pSym->ConstLit.IsSet = false;
    6283                 :      618106 :         pSym->ConstLit.IsInternal = false;  /* Is it a default BY constant
    6284                 :             :                                                         expression?  */
    6285                 :      618106 :         pSym->ConstLit.IsConstructor = false;  /* Is it a default BY constant
    6286                 :             :                                                         expression?  */
    6287                 :      618106 :         pSym->ConstLit.FromType = SymbolTable_NulSym;  /* type is determined FromType  */
    6288                 :      618106 :         pSym->ConstLit.RangeError = overflow;  /* type is determined FromType  */
    6289                 :      618106 :         pSym->ConstLit.UnresFromType = false;  /* is Type resolved?  */
    6290                 :      618106 :         pSym->ConstLit.Scope = SymbolTable_GetCurrentScope ();  /* is Type resolved?  */
    6291                 :      618106 :         InitWhereDeclaredTok (tok, &pSym->ConstLit.At);
    6292                 :      618106 :         InitWhereFirstUsedTok (tok, &pSym->ConstLit.At);
    6293                 :      618106 :         break;
    6294                 :             : 
    6295                 :             : 
    6296                 :             :       default:
    6297                 :             :         M2Error_InternalError ((const char *) "expecting ConstLit symbol", 25);
    6298                 :      618106 :         break;
    6299                 :             :     }
    6300                 :      618106 :   return Sym;
    6301                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6302                 :             :   __builtin_unreachable ();
    6303                 :             : }
    6304                 :             : 
    6305                 :             : 
    6306                 :             : /*
    6307                 :             :    LookupConstLitPoolEntry - return a ConstLit symbol from the constant pool which
    6308                 :             :                              matches tok, constName and constType.
    6309                 :             : */
    6310                 :             : 
    6311                 :     1651733 : static unsigned int LookupConstLitPoolEntry (unsigned int tok, NameKey_Name constName, unsigned int constType)
    6312                 :             : {
    6313                 :     1651733 :   SymbolTable_ConstLitPoolEntry pe;
    6314                 :     1651733 :   unsigned int rootIndex;
    6315                 :             : 
    6316                 :     1651733 :   rootIndex = static_cast<unsigned int> (SymbolKey_GetSymKey (ConstLitPoolTree, constName));
    6317                 :     1651733 :   if (rootIndex != 0)
    6318                 :             :     {
    6319                 :     1348543 :       pe = static_cast<SymbolTable_ConstLitPoolEntry> (Indexing_GetIndice (ConstLitArray, rootIndex));
    6320                 :    16930620 :       while (pe != NULL)
    6321                 :             :         {
    6322                 :    15267161 :           if (((pe->tok == tok) && (pe->constName == constName)) && (pe->constType == constType))
    6323                 :             :             {
    6324                 :     1033627 :               return pe->sym;
    6325                 :             :             }
    6326                 :    14233534 :           pe = pe->next;
    6327                 :             :         }
    6328                 :             :     }
    6329                 :             :   return SymbolTable_NulSym;
    6330                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6331                 :             :   __builtin_unreachable ();
    6332                 :             : }
    6333                 :             : 
    6334                 :             : 
    6335                 :             : /*
    6336                 :             :    AddConstLitPoolEntry - adds sym to the constlit pool.
    6337                 :             : */
    6338                 :             : 
    6339                 :      618106 : static void AddConstLitPoolEntry (unsigned int sym, unsigned int tok, NameKey_Name constName, unsigned int constType)
    6340                 :             : {
    6341                 :      618106 :   SymbolTable_ConstLitPoolEntry pe;
    6342                 :      618106 :   SymbolTable_ConstLitPoolEntry old;
    6343                 :      618106 :   unsigned int rootIndex;
    6344                 :      618106 :   unsigned int high;
    6345                 :             : 
    6346                 :      618106 :   rootIndex = static_cast<unsigned int> (SymbolKey_GetSymKey (ConstLitPoolTree, constName));
    6347                 :      618106 :   if (rootIndex == SymbolKey_NulKey)
    6348                 :             :     {
    6349                 :      303190 :       high = Indexing_HighIndice (ConstLitArray);
    6350                 :      303190 :       Storage_ALLOCATE ((void **) &pe, sizeof (SymbolTable__T4));
    6351                 :      303190 :       if (pe == NULL)
    6352                 :             :         {
    6353                 :           0 :           M2Error_InternalError ((const char *) "out of memory", 13);
    6354                 :             :         }
    6355                 :             :       else
    6356                 :             :         {
    6357                 :      303190 :           pe->sym = sym;
    6358                 :      303190 :           pe->tok = tok;
    6359                 :      303190 :           pe->constName = constName;
    6360                 :      303190 :           pe->constType = constType;
    6361                 :      303190 :           pe->next = NULL;
    6362                 :      303190 :           SymbolKey_PutSymKey (ConstLitPoolTree, constName, high+1);
    6363                 :      303190 :           Indexing_PutIndice (ConstLitArray, high+1, reinterpret_cast <void *> (pe));
    6364                 :             :         }
    6365                 :             :     }
    6366                 :             :   else
    6367                 :             :     {
    6368                 :      314916 :       Storage_ALLOCATE ((void **) &pe, sizeof (SymbolTable__T4));
    6369                 :      314916 :       if (pe == NULL)
    6370                 :             :         {
    6371                 :           0 :           M2Error_InternalError ((const char *) "out of memory", 13);
    6372                 :             :         }
    6373                 :             :       else
    6374                 :             :         {
    6375                 :      314916 :           old = static_cast<SymbolTable_ConstLitPoolEntry> (Indexing_GetIndice (ConstLitArray, rootIndex));
    6376                 :      314916 :           pe->sym = sym;
    6377                 :      314916 :           pe->tok = tok;
    6378                 :      314916 :           pe->constName = constName;
    6379                 :      314916 :           pe->constType = constType;
    6380                 :      314916 :           pe->next = old;
    6381                 :      314916 :           Indexing_PutIndice (ConstLitArray, rootIndex, reinterpret_cast <void *> (pe));
    6382                 :             :         }
    6383                 :             :     }
    6384                 :      618106 : }
    6385                 :             : 
    6386                 :             : 
    6387                 :             : /*
    6388                 :             :    InitConstString - initialize the constant string.
    6389                 :             : */
    6390                 :             : 
    6391                 :      376032 : static void InitConstString (unsigned int tok, unsigned int sym, NameKey_Name name, NameKey_Name contents, SymbolTable_ConstStringVariant kind, bool escape, bool known)
    6392                 :             : {
    6393                 :      376032 :   SymbolTable_PtrToSymbol pSym;
    6394                 :             : 
    6395                 :      376032 :   pSym = GetPsym (sym);
    6396                 :      376032 :   pSym->SymbolType = SymbolTable_ConstStringSym;
    6397                 :      376032 :   switch (pSym->SymbolType)
    6398                 :             :     {
    6399                 :      376032 :       case SymbolTable_ConstStringSym:
    6400                 :      376032 :         pSym->ConstString.name = name;
    6401                 :      376032 :         pSym->ConstString.StringVariant = kind;
    6402                 :      376032 :         pSym->ConstString.Scope = SymbolTable_GetCurrentScope ();
    6403                 :      376032 :         InitWhereDeclaredTok (tok, &pSym->ConstString.At);
    6404                 :      376032 :         SymbolTable_PutConstStringKnown (tok, sym, contents, escape, known);
    6405                 :      376032 :         break;
    6406                 :             : 
    6407                 :             : 
    6408                 :             :       default:
    6409                 :             :         M2Error_InternalError ((const char *) "expecting ConstStringSym", 24);
    6410                 :      376032 :         break;
    6411                 :             :     }
    6412                 :      376032 : }
    6413                 :             : 
    6414                 :             : 
    6415                 :             : /*
    6416                 :             :    GetConstStringKind - return the StringVariant field associated with sym.
    6417                 :             : */
    6418                 :             : 
    6419                 :      298681 : static SymbolTable_ConstStringVariant GetConstStringKind (unsigned int sym)
    6420                 :             : {
    6421                 :      298681 :   SymbolTable_PtrToSymbol pSym;
    6422                 :             : 
    6423                 :      298681 :   pSym = GetPsym (sym);
    6424                 :      298681 :   switch (pSym->SymbolType)
    6425                 :             :     {
    6426                 :      298681 :       case SymbolTable_ConstStringSym:
    6427                 :      298681 :         return pSym->ConstString.StringVariant;
    6428                 :           0 :         break;
    6429                 :             : 
    6430                 :             : 
    6431                 :           0 :       default:
    6432                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
    6433                 :             :         break;
    6434                 :             :     }
    6435                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    6436                 :             :   __builtin_unreachable ();
    6437                 :             : }
    6438                 :             : 
    6439                 :             : 
    6440                 :             : /*
    6441                 :             :    CanUseBuiltin - returns TRUE if the procedure, Sym, can be
    6442                 :             :                    inlined via a builtin function.
    6443                 :             : */
    6444                 :             : 
    6445                 :       19162 : static bool CanUseBuiltin (unsigned int Sym)
    6446                 :             : {
    6447                 :       19162 :   return ! M2Options_DebugBuiltins && ((m2builtins_BuiltinExists (reinterpret_cast <char * > (NameKey_KeyToCharStar (SymbolTable_GetProcedureBuiltin (Sym))))) || (m2builtins_BuiltinExists (reinterpret_cast <char * > (NameKey_KeyToCharStar (SymbolTable_GetSymName (Sym))))));
    6448                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6449                 :             :   __builtin_unreachable ();
    6450                 :             : }
    6451                 :             : 
    6452                 :             : 
    6453                 :             : /*
    6454                 :             :    InitPacked - initialise packedInfo to FALSE and NulSym.
    6455                 :             : */
    6456                 :             : 
    6457                 :      972760 : static void InitPacked (SymbolTable_PackedInfo *packedInfo)
    6458                 :             : {
    6459                 :      972760 :   (*packedInfo).IsPacked = false;
    6460                 :      972760 :   (*packedInfo).PackedEquiv = SymbolTable_NulSym;
    6461                 :           0 : }
    6462                 :             : 
    6463                 :             : 
    6464                 :             : /*
    6465                 :             :    doEquivalent - create a packed equivalent symbol for, sym, and return the
    6466                 :             :                   new symbol.  It sets both fields in packedInfo to FALSE
    6467                 :             :                   and the new symbol.
    6468                 :             : */
    6469                 :             : 
    6470                 :       14611 : static unsigned int doEquivalent (SymbolTable_PackedInfo *packedInfo, unsigned int sym)
    6471                 :             : {
    6472                 :       14611 :   unsigned int nSym;
    6473                 :       14611 :   SymbolTable_PtrToSymbol pSym;
    6474                 :             : 
    6475                 :       14611 :   NewSym (&nSym);
    6476                 :       14611 :   pSym = GetPsym (nSym);
    6477                 :       14611 :   pSym->SymbolType = SymbolTable_EquivSym;
    6478                 :       14611 :   pSym->Equiv.nonPacked = sym;
    6479                 :       14611 :   pSym->Equiv.packedInfo.IsPacked = true;
    6480                 :       14611 :   pSym->Equiv.packedInfo.PackedEquiv = SymbolTable_NulSym;
    6481                 :       14611 :   (*packedInfo).IsPacked = false;
    6482                 :       14611 :   (*packedInfo).PackedEquiv = nSym;
    6483                 :       14611 :   return nSym;
    6484                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6485                 :             :   __builtin_unreachable ();
    6486                 :             : }
    6487                 :             : 
    6488                 :             : 
    6489                 :             : /*
    6490                 :             :    MakeEquivalent - return the equivalent packed symbol for, sym.
    6491                 :             : */
    6492                 :             : 
    6493                 :       14611 : static unsigned int MakeEquivalent (unsigned int sym)
    6494                 :             : {
    6495                 :       14611 :   SymbolTable_PtrToSymbol pSym;
    6496                 :             : 
    6497                 :       14611 :   pSym = GetPsym (sym);
    6498                 :       14611 :   switch (pSym->SymbolType)
    6499                 :             :     {
    6500                 :       14551 :       case SymbolTable_EnumerationSym:
    6501                 :       14551 :         return doEquivalent (&pSym->Enumeration.packedInfo, sym);
    6502                 :          60 :         break;
    6503                 :             : 
    6504                 :          60 :       case SymbolTable_SubrangeSym:
    6505                 :          60 :         return doEquivalent (&pSym->Subrange.packedInfo, sym);
    6506                 :           0 :         break;
    6507                 :             : 
    6508                 :           0 :       case SymbolTable_TypeSym:
    6509                 :           0 :         return doEquivalent (&pSym->Type.packedInfo, sym);
    6510                 :           0 :         break;
    6511                 :             : 
    6512                 :           0 :       case SymbolTable_SetSym:
    6513                 :           0 :         return doEquivalent (&pSym->Set.packedInfo, sym);
    6514                 :           0 :         break;
    6515                 :             : 
    6516                 :             : 
    6517                 :           0 :       default:
    6518                 :           0 :         M2Error_InternalError ((const char *) "expecting type, subrange or enumerated type symbol", 50);
    6519                 :             :         break;
    6520                 :             :     }
    6521                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    6522                 :             :   __builtin_unreachable ();
    6523                 :             : }
    6524                 :             : 
    6525                 :             : 
    6526                 :             : /*
    6527                 :             :    GetEquivalent -
    6528                 :             : */
    6529                 :             : 
    6530                 :       14851 : static unsigned int GetEquivalent (SymbolTable_PackedInfo *packedInfo, unsigned int sym)
    6531                 :             : {
    6532                 :       14851 :   if ((*packedInfo).IsPacked)
    6533                 :             :     {
    6534                 :             :       return sym;
    6535                 :             :     }
    6536                 :       14851 :   else if ((*packedInfo).PackedEquiv == SymbolTable_NulSym)
    6537                 :             :     {
    6538                 :             :       /* avoid dangling else.  */
    6539                 :       14611 :       (*packedInfo).PackedEquiv = MakeEquivalent (sym);
    6540                 :             :     }
    6541                 :       14851 :   return (*packedInfo).PackedEquiv;
    6542                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6543                 :             :   __builtin_unreachable ();
    6544                 :             : }
    6545                 :             : 
    6546                 :             : 
    6547                 :             : /*
    6548                 :             :    doGetType - subsiduary helper procedure function of GetDType, GetSType and GetLType.
    6549                 :             : */
    6550                 :             : 
    6551                 :  1368025921 : static unsigned int doGetType (unsigned int sym, bool skipEquiv, bool skipAlign, bool skipHidden, bool skipBase)
    6552                 :             : {
    6553                 :  1368025921 :   SymbolTable_PtrToSymbol pSym;
    6554                 :  1368025921 :   unsigned int type;
    6555                 :             : 
    6556                 :  1368025921 :   type = SymbolTable_NulSym;
    6557                 :  1368025921 :   M2Debug_Assert (sym != SymbolTable_NulSym);
    6558                 :  1368025921 :   pSym = GetPsym (sym);
    6559                 :  1368025921 :   switch (pSym->SymbolType)
    6560                 :             :     {
    6561                 :           0 :       case SymbolTable_OAFamilySym:
    6562                 :           0 :         type = pSym->OAFamily.SimpleType;
    6563                 :           0 :         break;
    6564                 :             : 
    6565                 :   158133610 :       case SymbolTable_VarSym:
    6566                 :   158133610 :         type = GetTypeOfVar (sym);
    6567                 :   158133610 :         break;
    6568                 :             : 
    6569                 :    44070568 :       case SymbolTable_ConstLitSym:
    6570                 :    44070568 :         type = pSym->ConstLit.Type;
    6571                 :    44070568 :         break;
    6572                 :             : 
    6573                 :    38650208 :       case SymbolTable_ConstVarSym:
    6574                 :    38650208 :         type = pSym->ConstVar.Type;
    6575                 :    38650208 :         break;
    6576                 :             : 
    6577                 :     9896073 :       case SymbolTable_ConstStringSym:
    6578                 :     9896073 :         if (pSym->ConstString.Length == 1)
    6579                 :             :           {
    6580                 :     2017104 :             type = M2Base_Char;
    6581                 :             :           }
    6582                 :             :         else
    6583                 :             :           {
    6584                 :             :             type = SymbolTable_NulSym;  /* No type for a string  */
    6585                 :             :           }
    6586                 :             :         break;
    6587                 :             : 
    6588                 :   187470346 :       case SymbolTable_TypeSym:
    6589                 :   187470346 :         type = pSym->Type.Type;
    6590                 :   187470346 :         break;
    6591                 :             : 
    6592                 :   475452260 :       case SymbolTable_RecordFieldSym:
    6593                 :   475452260 :         type = pSym->RecordField.Type;
    6594                 :   475452260 :         break;
    6595                 :             : 
    6596                 :             :       case SymbolTable_RecordSym:
    6597                 :             :         type = SymbolTable_NulSym;  /* No type for a record  */
    6598                 :             :         break;
    6599                 :             : 
    6600                 :             :       case SymbolTable_VarientSym:
    6601                 :             :         type = SymbolTable_NulSym;  /* No type for a record  */
    6602                 :             :         break;
    6603                 :             : 
    6604                 :    86593432 :       case SymbolTable_EnumerationFieldSym:
    6605                 :    86593432 :         type = pSym->EnumerationField.Type;  /* No type for a record  */
    6606                 :    86593432 :         break;
    6607                 :             : 
    6608                 :             :       case SymbolTable_EnumerationSym:
    6609                 :             :         type = SymbolTable_NulSym;  /* No type for enumeration  */
    6610                 :             :         break;
    6611                 :             : 
    6612                 :   198490928 :       case SymbolTable_PointerSym:
    6613                 :   198490928 :         type = pSym->Pointer.Type;  /* No type for enumeration  */
    6614                 :   198490928 :         break;
    6615                 :             : 
    6616                 :    26333675 :       case SymbolTable_ProcedureSym:
    6617                 :    26333675 :         type = pSym->Procedure.ReturnType;
    6618                 :    26333675 :         break;
    6619                 :             : 
    6620                 :    11078546 :       case SymbolTable_ProcTypeSym:
    6621                 :    11078546 :         type = pSym->ProcType.ReturnType;
    6622                 :    11078546 :         break;
    6623                 :             : 
    6624                 :    19362369 :       case SymbolTable_ParamSym:
    6625                 :    19362369 :         type = pSym->Param.Type;
    6626                 :    19362369 :         break;
    6627                 :             : 
    6628                 :     4324946 :       case SymbolTable_VarParamSym:
    6629                 :     4324946 :         type = pSym->VarParam.Type;
    6630                 :     4324946 :         break;
    6631                 :             : 
    6632                 :    24144312 :       case SymbolTable_SubrangeSym:
    6633                 :    24144312 :         type = pSym->Subrange.Type;
    6634                 :    24144312 :         break;
    6635                 :             : 
    6636                 :    10818902 :       case SymbolTable_ArraySym:
    6637                 :    10818902 :         type = pSym->Array.Type;
    6638                 :    10818902 :         break;
    6639                 :             : 
    6640                 :    10998312 :       case SymbolTable_SubscriptSym:
    6641                 :    10998312 :         type = pSym->Subscript.Type;
    6642                 :    10998312 :         break;
    6643                 :             : 
    6644                 :     2263956 :       case SymbolTable_SetSym:
    6645                 :     2263956 :         type = pSym->Set.Type;
    6646                 :     2263956 :         break;
    6647                 :             : 
    6648                 :    58862516 :       case SymbolTable_UnboundedSym:
    6649                 :    58862516 :         type = pSym->Unbounded.Type;
    6650                 :    58862516 :         break;
    6651                 :             : 
    6652                 :             :       case SymbolTable_UndefinedSym:
    6653                 :             :         type = SymbolTable_NulSym;
    6654                 :             :         break;
    6655                 :             : 
    6656                 :           0 :       case SymbolTable_PartialUnboundedSym:
    6657                 :           0 :         type = pSym->PartialUnbounded.Type;
    6658                 :           0 :         break;
    6659                 :             : 
    6660                 :             :       case SymbolTable_ObjectSym:
    6661                 :             :         type = SymbolTable_NulSym;
    6662                 :             :         break;
    6663                 :             : 
    6664                 :             : 
    6665                 :           6 :       default:
    6666                 :           6 :         M2Error_InternalError ((const char *) "not implemented yet", 19);
    6667                 :  1359065990 :         break;
    6668                 :             :     }
    6669                 :  1368025915 :   if (((type == SymbolTable_NulSym) && (SymbolTable_IsType (sym))) && ! skipBase)
    6670                 :             :     {
    6671                 :             :       return sym;  /* sym is a base type  */
    6672                 :             :     }
    6673                 :  1352570770 :   else if (type != SymbolTable_NulSym)
    6674                 :             :     {
    6675                 :             :       /* avoid dangling else.  */
    6676                 :  1147267290 :       if ((SymbolTable_IsType (type)) && skipEquiv)
    6677                 :             :         {
    6678                 :    16116946 :           if ((! (SymbolTable_IsHiddenType (type))) || skipHidden)
    6679                 :             :             {
    6680                 :    15943234 :               if (((SymbolTable_GetAlignment (type)) == SymbolTable_NulSym) || skipAlign)
    6681                 :             :                 {
    6682                 :    15943216 :                   return doGetType (type, skipEquiv, skipAlign, skipHidden, skipBase);
    6683                 :             :                 }
    6684                 :             :             }
    6685                 :             :         }
    6686                 :             :     }
    6687                 :             :   return type;
    6688                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6689                 :             :   __builtin_unreachable ();
    6690                 :             : }
    6691                 :             : 
    6692                 :             : 
    6693                 :             : /*
    6694                 :             :    GetTypeOfVar - returns the type of symbol, var.
    6695                 :             : */
    6696                 :             : 
    6697                 :   248112062 : static unsigned int GetTypeOfVar (unsigned int var)
    6698                 :             : {
    6699                 :   248112062 :   SymbolTable_PtrToSymbol pSym;
    6700                 :   248112062 :   unsigned int high;
    6701                 :             : 
    6702                 :   248112062 :   pSym = GetPsym (var);
    6703                 :   248112062 :   switch (pSym->SymbolType)
    6704                 :             :     {
    6705                 :   248112062 :       case SymbolTable_VarSym:
    6706                 :   248112062 :         if (pSym->Var.IsTemp && pSym->Var.IsComponentRef)
    6707                 :             :           {
    6708                 :     6371128 :             high = Indexing_HighIndice (pSym->Var.list);
    6709                 :    12742256 :             return SymbolTable_GetType (GetFromIndex (pSym->Var.list, high));
    6710                 :             :           }
    6711                 :             :         else
    6712                 :             :           {
    6713                 :   241740934 :             return pSym->Var.Type;
    6714                 :             :           }
    6715                 :           0 :         break;
    6716                 :             : 
    6717                 :             : 
    6718                 :           0 :       default:
    6719                 :           0 :         M2Error_InternalError ((const char *) "expecting a var symbol", 22);
    6720                 :             :         break;
    6721                 :             :     }
    6722                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    6723                 :             :   __builtin_unreachable ();
    6724                 :             : }
    6725                 :             : 
    6726                 :             : 
    6727                 :             : /*
    6728                 :             :    GetConstLitType - returns the type of the constant of, name.
    6729                 :             :                      All floating point constants have type LONGREAL.
    6730                 :             :                      Character constants are type CHAR.
    6731                 :             :                      Integer values are INTEGER, LONGINT or LONGCARD
    6732                 :             :                      depending upon their value.
    6733                 :             : */
    6734                 :             : 
    6735                 :      470706 : static unsigned int GetConstLitType (unsigned int tok, NameKey_Name name, bool *overflow, bool issueError)
    6736                 :             : {
    6737                 :      470706 :   location_t loc;
    6738                 :      470706 :   DynamicStrings_String s;
    6739                 :             : 
    6740                 :      470706 :   s = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (name));
    6741                 :      470706 :   if ((DynamicStrings_char (s, -1)) == 'C')
    6742                 :             :     {
    6743                 :      120138 :       s = DynamicStrings_KillString (s);
    6744                 :      120138 :       return M2Base_Char;
    6745                 :             :     }
    6746                 :             :   else
    6747                 :             :     {
    6748                 :      350568 :       if ((DynamicStrings_Index (s, '.', 0)) != -1)  /* found a '.' in our constant  */
    6749                 :             :         {
    6750                 :        6676 :           s = DynamicStrings_KillString (s);
    6751                 :        6676 :           return M2Base_RType;
    6752                 :             :         }
    6753                 :      343892 :       loc = M2LexBuf_TokenToLocation (tok);
    6754                 :      343892 :       switch (DynamicStrings_char (s, -1))
    6755                 :             :         {
    6756                 :         698 :           case 'H':
    6757                 :         698 :             (*overflow) = m2expr_OverflowZType (loc, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (s))), 16, issueError);
    6758                 :         698 :             break;
    6759                 :             : 
    6760                 :        2734 :           case 'B':
    6761                 :        2734 :             (*overflow) = m2expr_OverflowZType (loc, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (s))), 8, issueError);
    6762                 :        2734 :             break;
    6763                 :             : 
    6764                 :          24 :           case 'A':
    6765                 :          24 :             (*overflow) = m2expr_OverflowZType (loc, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (s))), 2, issueError);
    6766                 :          24 :             break;
    6767                 :             : 
    6768                 :             : 
    6769                 :      340436 :           default:
    6770                 :      340436 :             (*overflow) = m2expr_OverflowZType (loc, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (s))), 10, issueError);
    6771                 :      340436 :             break;
    6772                 :             :         }
    6773                 :      343892 :       s = DynamicStrings_KillString (s);
    6774                 :      343892 :       return M2Base_ZType;
    6775                 :             :     }
    6776                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6777                 :             :   __builtin_unreachable ();
    6778                 :             : }
    6779                 :             : 
    6780                 :             : 
    6781                 :             : /*
    6782                 :             :    GetNthFromComponent -
    6783                 :             : */
    6784                 :             : 
    6785                 :      378920 : static unsigned int GetNthFromComponent (unsigned int Sym, unsigned int n)
    6786                 :             : {
    6787                 :      378920 :   SymbolTable_PtrToSymbol pSym;
    6788                 :             : 
    6789                 :      378920 :   pSym = GetPsym (Sym);
    6790                 :      378920 :   switch (pSym->SymbolType)
    6791                 :             :     {
    6792                 :      378920 :       case SymbolTable_VarSym:
    6793                 :      378920 :         if (SymbolTable_IsComponent (Sym))
    6794                 :             :           {
    6795                 :      378920 :             if (Indexing_InBounds (pSym->Var.list, n))
    6796                 :             :               {
    6797                 :      508560 :                 return GetFromIndex (pSym->Var.list, n);
    6798                 :             :               }
    6799                 :             :             else
    6800                 :             :               {
    6801                 :             :                 return SymbolTable_NulSym;
    6802                 :             :               }
    6803                 :             :           }
    6804                 :             :         else
    6805                 :             :           {
    6806                 :           0 :             M2Error_InternalError ((const char *) "cannot GetNth from this symbol", 30);
    6807                 :             :           }
    6808                 :           0 :         break;
    6809                 :             : 
    6810                 :             : 
    6811                 :           0 :       default:
    6812                 :           0 :         M2Error_InternalError ((const char *) "cannot GetNth from this symbol", 30);
    6813                 :             :         break;
    6814                 :             :     }
    6815                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    6816                 :             :   __builtin_unreachable ();
    6817                 :             : }
    6818                 :             : 
    6819                 :             : 
    6820                 :             : /*
    6821                 :             :    GetNthParamChoice - returns the parameter definition from
    6822                 :             :                        sym:ParamNo:kind or NulSym.
    6823                 :             : */
    6824                 :             : 
    6825                 :      633990 : static unsigned int GetNthParamChoice (unsigned int sym, unsigned int ParamNo, SymbolTable_ProcedureKind kind)
    6826                 :             : {
    6827                 :      633990 :   if (SymbolTable_GetProcedureParametersDefined (sym, kind))
    6828                 :             :     {
    6829                 :      633990 :       return SymbolTable_GetNthParam (sym, kind, ParamNo);
    6830                 :             :     }
    6831                 :             :   else
    6832                 :             :     {
    6833                 :             :       return SymbolTable_NulSym;
    6834                 :             :     }
    6835                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6836                 :             :   __builtin_unreachable ();
    6837                 :             : }
    6838                 :             : 
    6839                 :             : 
    6840                 :             : /*
    6841                 :             :    GetNthParamOrdered - returns the parameter definition from list {a, b, c}
    6842                 :             :                         in order.
    6843                 :             :                         sym:ParamNo:{a,b,c} or NulSym.
    6844                 :             : */
    6845                 :             : 
    6846                 :      633990 : static unsigned int GetNthParamOrdered (unsigned int sym, unsigned int ParamNo, SymbolTable_ProcedureKind a, SymbolTable_ProcedureKind b, SymbolTable_ProcedureKind c)
    6847                 :             : {
    6848                 :      633990 :   if (SymbolTable_GetProcedureParametersDefined (sym, a))
    6849                 :             :     {
    6850                 :      633990 :       return GetNthParamChoice (sym, ParamNo, a);
    6851                 :             :     }
    6852                 :           0 :   else if (SymbolTable_GetProcedureParametersDefined (sym, b))
    6853                 :             :     {
    6854                 :             :       /* avoid dangling else.  */
    6855                 :           0 :       return GetNthParamChoice (sym, ParamNo, b);
    6856                 :             :     }
    6857                 :           0 :   else if (SymbolTable_GetProcedureParametersDefined (sym, c))
    6858                 :             :     {
    6859                 :             :       /* avoid dangling else.  */
    6860                 :           0 :       return GetNthParamChoice (sym, ParamNo, c);
    6861                 :             :     }
    6862                 :             :   else
    6863                 :             :     {
    6864                 :             :       /* avoid dangling else.  */
    6865                 :             :       return SymbolTable_NulSym;
    6866                 :             :     }
    6867                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    6868                 :             :   __builtin_unreachable ();
    6869                 :             : }
    6870                 :             : 
    6871                 :             : 
    6872                 :             : /*
    6873                 :             :    GetOuterModuleScope - returns the outer module symbol scope for sym.
    6874                 :             : */
    6875                 :             : 
    6876                 :     1267980 : static unsigned int GetOuterModuleScope (unsigned int sym)
    6877                 :             : {
    6878                 :     1902156 :   do {
    6879                 :     1902156 :     if (SymbolTable_IsDefImp (sym))
    6880                 :             :       {
    6881                 :             :         /* Definition/implementation module.  */
    6882                 :             :         return sym;
    6883                 :             :       }
    6884                 :     1139373 :     else if (SymbolTable_IsModule (sym))
    6885                 :             :       {
    6886                 :             :         /* avoid dangling else.  */
    6887                 :      505281 :         if ((SymbolTable_GetScope (sym)) == SymbolTable_NulSym)
    6888                 :             :           {
    6889                 :             :             /* Outer module.  */
    6890                 :             :             return sym;
    6891                 :             :           }
    6892                 :             :       }
    6893                 :      634176 :     sym = SymbolTable_GetScope (sym);
    6894                 :      634176 :   } while (! (sym == SymbolTable_NulSym));
    6895                 :           0 :   M2Error_InternalError ((const char *) "not expecting to reach an outer scope", 37);
    6896                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    6897                 :             :   __builtin_unreachable ();
    6898                 :             : }
    6899                 :             : 
    6900                 :             : 
    6901                 :             : /*
    6902                 :             :    EnsureOrder - providing that both symbols, a, and, b, exist in
    6903                 :             :                  list, l.  Ensure that, b, is placed after a.
    6904                 :             : */
    6905                 :             : 
    6906                 :        2970 : static void EnsureOrder (Lists_List l, unsigned int a, unsigned int b)
    6907                 :             : {
    6908                 :        2970 :   unsigned int n;
    6909                 :             : 
    6910                 :        2970 :   n = Lists_NoOfItemsInList (l);
    6911                 :        2970 :   if ((Lists_IsItemInList (l, a)) && (Lists_IsItemInList (l, b)))
    6912                 :             :     {
    6913                 :        2970 :       Lists_RemoveItemFromList (l, b);
    6914                 :        2970 :       Lists_IncludeItemIntoList (l, b);
    6915                 :             :     }
    6916                 :        2970 :   M2Debug_Assert (n == (Lists_NoOfItemsInList (l)));
    6917                 :        2970 : }
    6918                 :             : 
    6919                 :             : 
    6920                 :             : /*
    6921                 :             :    DumpSons -
    6922                 :             : */
    6923                 :             : 
    6924                 :           0 : static void DumpSons (unsigned int sym)
    6925                 :             : {
    6926                 :           0 :   SymbolTable_PtrToSymbol pSym;
    6927                 :           0 :   unsigned int f;
    6928                 :           0 :   unsigned int n;
    6929                 :           0 :   unsigned int i;
    6930                 :             : 
    6931                 :           0 :   pSym = GetPsym (sym);
    6932                 :           0 :   switch (pSym->SymbolType)
    6933                 :             :     {
    6934                 :           0 :       case SymbolTable_RecordSym:
    6935                 :           0 :         n = Lists_NoOfItemsInList (pSym->Record.ListOfSons);
    6936                 :           0 :         i = 1;
    6937                 :           0 :         while (i <= n)
    6938                 :             :           {
    6939                 :           0 :             f = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Record.ListOfSons, i));
    6940                 :           0 :             M2Printf_printf3 ((const char *) "record %d field %d is %d\\n", 26, (const unsigned char *) &sym, (sizeof (sym)-1), (const unsigned char *) &i, (sizeof (i)-1), (const unsigned char *) &f, (sizeof (f)-1));
    6941                 :           0 :             i += 1;
    6942                 :             :           }
    6943                 :           0 :         break;
    6944                 :             : 
    6945                 :             : 
    6946                 :           0 :       default:
    6947                 :           0 :         M2Error_InternalError ((const char *) "expecting record symbol", 23);
    6948                 :           0 :         break;
    6949                 :             :     }
    6950                 :           0 : }
    6951                 :             : 
    6952                 :             : 
    6953                 :             : /*
    6954                 :             :    CheckListOfSons - checks to see that sym, is present in, recordConsist, ListOfSons.
    6955                 :             : */
    6956                 :             : 
    6957                 :           0 : static void CheckListOfSons (unsigned int sym)
    6958                 :             : {
    6959                 :           0 :   SymbolTable_PtrToSymbol pSym;
    6960                 :             : 
    6961                 :           0 :   pSym = GetPsym (recordConsist);
    6962                 :           0 :   switch (pSym->SymbolType)
    6963                 :             :     {
    6964                 :           0 :       case SymbolTable_RecordSym:
    6965                 :           0 :         if (! (Lists_IsItemInList (pSym->Record.ListOfSons, sym)))
    6966                 :             :           {
    6967                 :           0 :             DumpSons (recordConsist);
    6968                 :           0 :             M2MetaError_MetaError1 ((const char *) "internal error:  expecting {%1ad} to exist in record ListOfSons", 63, sym);
    6969                 :             :           }
    6970                 :           0 :         break;
    6971                 :             : 
    6972                 :             : 
    6973                 :           0 :       default:
    6974                 :           0 :         M2Error_InternalError ((const char *) "expecting record symbol", 23);
    6975                 :           0 :         break;
    6976                 :             :     }
    6977                 :           0 : }
    6978                 :             : 
    6979                 :             : 
    6980                 :             : /*
    6981                 :             :    CheckRecordConsistency -
    6982                 :             : */
    6983                 :             : 
    6984                 :           0 : static void CheckRecordConsistency (unsigned int sym)
    6985                 :             : {
    6986                 :           0 :   SymbolTable_PtrToSymbol pSym;
    6987                 :             : 
    6988                 :           0 :   return;
    6989                 :             :   pSym = GetPsym (sym);
    6990                 :             :   switch (pSym->SymbolType)
    6991                 :             :     {
    6992                 :             :       case SymbolTable_RecordSym:
    6993                 :             :         recordConsist = sym;
    6994                 :             :         SymbolKey_ForeachNodeDo (pSym->Record.LocalSymbols, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) CheckListOfSons});
    6995                 :             :         break;
    6996                 :             : 
    6997                 :             : 
    6998                 :             :       default:
    6999                 :             :         M2Error_InternalError ((const char *) "record symbol expected", 22);
    7000                 :           0 :         break;
    7001                 :             :     }
    7002                 :             : }
    7003                 :             : 
    7004                 :             : 
    7005                 :             : /*
    7006                 :             :    PutConstVarTemporary - indicates that constant, sym, is a temporary.
    7007                 :             : */
    7008                 :             : 
    7009                 :      467624 : static void PutConstVarTemporary (unsigned int sym)
    7010                 :             : {
    7011                 :      467624 :   SymbolTable_PtrToSymbol pSym;
    7012                 :             : 
    7013                 :      467624 :   pSym = GetPsym (sym);
    7014                 :      467624 :   switch (pSym->SymbolType)
    7015                 :             :     {
    7016                 :      467624 :       case SymbolTable_ConstVarSym:
    7017                 :      467624 :         pSym->ConstVar.IsTemp = true;
    7018                 :      467624 :         break;
    7019                 :             : 
    7020                 :             : 
    7021                 :           0 :       default:
    7022                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
    7023                 :      467624 :         break;
    7024                 :             :     }
    7025                 :      467624 : }
    7026                 :             : 
    7027                 :             : 
    7028                 :             : /*
    7029                 :             :    buildTemporary - builds the temporary filling in componentRef, record and sets mode.
    7030                 :             : */
    7031                 :             : 
    7032                 :     1171415 : static unsigned int buildTemporary (unsigned int tok, SymbolTable_ModeOfAddr Mode, bool componentRef, unsigned int record)
    7033                 :             : {
    7034                 :     1171415 :   SymbolTable_PtrToSymbol pSym;
    7035                 :     1171415 :   DynamicStrings_String s;
    7036                 :     1171415 :   unsigned int Sym;
    7037                 :             : 
    7038                 :     1171415 :   TemporaryNo += 1;
    7039                 :             :   /* Make the name  */
    7040                 :     1171415 :   s = FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_T%d", 4)), (const unsigned char *) &TemporaryNo, (sizeof (TemporaryNo)-1));
    7041                 :     1171415 :   if (Mode == SymbolTable_ImmediateValue)
    7042                 :             :     {
    7043                 :      433124 :       Sym = SymbolTable_MakeConstVar (tok, NameKey_makekey (DynamicStrings_string (s)));
    7044                 :      433124 :       PutConstVarTemporary (Sym);
    7045                 :             :     }
    7046                 :             :   else
    7047                 :             :     {
    7048                 :      738291 :       Sym = SymbolTable_MakeVar (tok, NameKey_makekey (DynamicStrings_string (s)));
    7049                 :      738291 :       pSym = GetPsym (Sym);
    7050                 :      738291 :       switch (pSym->SymbolType)
    7051                 :             :         {
    7052                 :      738291 :           case SymbolTable_VarSym:
    7053                 :      738291 :             pSym->Var.AddrMode = Mode;
    7054                 :      738291 :             pSym->Var.IsComponentRef = componentRef;
    7055                 :      738291 :             pSym->Var.IsTemp = true;  /* Variable is a temporary var  */
    7056                 :      738291 :             if (componentRef)  /* Variable is a temporary var  */
    7057                 :             :               {
    7058                 :      147866 :                 pSym->Var.list = Indexing_InitIndex (1);
    7059                 :      147866 :                 PutIntoIndex (&pSym->Var.list, 1, record);
    7060                 :             :               }
    7061                 :      738291 :             InitWhereDeclaredTok (tok, &pSym->Var.At);  /* Declared here  */
    7062                 :      738291 :             InitWhereFirstUsedTok (tok, &pSym->Var.At);  /* Where symbol first used.  */
    7063                 :      738291 :             break;
    7064                 :             : 
    7065                 :             : 
    7066                 :           0 :           default:
    7067                 :           0 :             M2Error_InternalError ((const char *) "expecting a Var symbol", 22);  /* Where symbol first used.  */
    7068                 :     1171415 :             break;
    7069                 :             :         }
    7070                 :             :     }
    7071                 :     1171415 :   s = DynamicStrings_KillString (s);
    7072                 :     1171415 :   return Sym;
    7073                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7074                 :             :   __builtin_unreachable ();
    7075                 :             : }
    7076                 :             : 
    7077                 :             : 
    7078                 :             : /*
    7079                 :             :    AssertInRange - determines whether the Sym is a legal symbol.
    7080                 :             : */
    7081                 :             : 
    7082                 :  3106140377 : static void AssertInRange (unsigned int Sym)
    7083                 :             : {
    7084                 :  3106140377 :   if ((Sym < 1) || (Sym > (SymbolTable_FinalSymbol ())))
    7085                 :             :     {
    7086                 :           6 :       M2Error_InternalError ((const char *) "illegal symbol", 14);
    7087                 :             :     }
    7088                 :  3106140371 : }
    7089                 :             : 
    7090                 :             : 
    7091                 :             : /*
    7092                 :             :    CheckForHiddenType - scans the NeedToBeImplemented tree providing
    7093                 :             :                         that we are currently compiling an implementation
    7094                 :             :                         module. If a symbol is found with TypeName
    7095                 :             :                         then its Sym is returned.
    7096                 :             :                         Otherwise NulSym is returned.
    7097                 :             :                         CheckForHiddenType is called before any type is
    7098                 :             :                         created, therefore the compiler allows hidden
    7099                 :             :                         types to be implemented using any type.
    7100                 :             : */
    7101                 :             : 
    7102                 :     7044253 : static unsigned int CheckForHiddenType (NameKey_Name TypeName)
    7103                 :             : {
    7104                 :     7044253 :   SymbolTable_PtrToSymbol pSym;
    7105                 :     7044253 :   unsigned int Sym;
    7106                 :             : 
    7107                 :     7044253 :   Sym = SymbolTable_NulSym;
    7108                 :     7044253 :   if ((((M2Comp_CompilingImplementationModule ()) && (SymbolTable_IsDefImp (CurrentModule))) && (SymbolTable_IsHiddenTypeDeclared (CurrentModule))) && (TypeName != NameKey_NulName))
    7109                 :             :     {
    7110                 :             :       /* Check to see whether we are declaring a HiddenType.  */
    7111                 :      104293 :       pSym = GetPsym (CurrentModule);
    7112                 :      104293 :       switch (pSym->SymbolType)
    7113                 :             :         {
    7114                 :      104293 :           case SymbolTable_DefImpSym:
    7115                 :      104293 :             Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.NeedToBeImplemented, TypeName));
    7116                 :      104293 :             break;
    7117                 :             : 
    7118                 :             : 
    7119                 :           0 :           default:
    7120                 :           0 :             M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
    7121                 :      104293 :             break;
    7122                 :             :         }
    7123                 :             :     }
    7124                 :     7044253 :   return Sym;
    7125                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7126                 :             :   __builtin_unreachable ();
    7127                 :             : }
    7128                 :             : 
    7129                 :             : 
    7130                 :             : /*
    7131                 :             :    RequestFromModule - returns a symbol from module ModSym with name, SymName.
    7132                 :             : */
    7133                 :             : 
    7134                 :         108 : static unsigned int RequestFromModule (unsigned int tok, unsigned int ModSym, NameKey_Name SymName)
    7135                 :             : {
    7136                 :         108 :   SymbolTable_PtrToSymbol pSym;
    7137                 :         108 :   unsigned int Sym;
    7138                 :             : 
    7139                 :         108 :   pSym = GetPsym (ModSym);
    7140                 :         108 :   switch (pSym->SymbolType)
    7141                 :             :     {
    7142                 :           0 :       case SymbolTable_DefImpSym:
    7143                 :           0 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.LocalSymbols, SymName));
    7144                 :           0 :         if (Sym == SymbolTable_NulSym)
    7145                 :             :           {
    7146                 :           0 :             Sym = FetchUnknownFromDefImp (tok, ModSym, SymName);
    7147                 :             :           }
    7148                 :             :         break;
    7149                 :             : 
    7150                 :         108 :       case SymbolTable_ModuleSym:
    7151                 :         108 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.LocalSymbols, SymName));
    7152                 :         108 :         if (Sym == SymbolTable_NulSym)
    7153                 :             :           {
    7154                 :          12 :             Sym = FetchUnknownFromModule (tok, ModSym, SymName);
    7155                 :             :           }
    7156                 :             :         break;
    7157                 :             : 
    7158                 :             : 
    7159                 :           0 :       default:
    7160                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
    7161                 :         108 :         break;
    7162                 :             :     }
    7163                 :         108 :   return Sym;
    7164                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7165                 :             :   __builtin_unreachable ();
    7166                 :             : }
    7167                 :             : 
    7168                 :             : 
    7169                 :             : /*
    7170                 :             :    RequestFromDefinition - returns a symbol from module ModSym with name,
    7171                 :             :                            SymName.
    7172                 :             : */
    7173                 :             : 
    7174                 :     2766091 : static unsigned int RequestFromDefinition (unsigned int tok, unsigned int ModSym, NameKey_Name SymName)
    7175                 :             : {
    7176                 :     2766091 :   SymbolTable_PtrToSymbol pSym;
    7177                 :     2766091 :   unsigned int Sym;
    7178                 :     2766091 :   unsigned int OldScopePtr;
    7179                 :             : 
    7180                 :     2766091 :   pSym = GetPsym (ModSym);
    7181                 :     2766091 :   switch (pSym->SymbolType)
    7182                 :             :     {
    7183                 :     2766091 :       case SymbolTable_DefImpSym:
    7184                 :     2766091 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportQualifiedTree, SymName));
    7185                 :     2766091 :         if (Sym == SymbolTable_NulSym)
    7186                 :             :           {
    7187                 :      762914 :             Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportUnQualifiedTree, SymName));
    7188                 :      762914 :             if (Sym == SymbolTable_NulSym)
    7189                 :             :               {
    7190                 :      364272 :                 Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName));
    7191                 :      364272 :                 if (Sym == SymbolTable_NulSym)
    7192                 :             :                   {
    7193                 :      327130 :                     OldScopePtr = ScopePtr;
    7194                 :      327130 :                     SymbolTable_StartScope (ModSym);
    7195                 :      327130 :                     Sym = GetScopeSym (SymName, true);
    7196                 :      327130 :                     SymbolTable_EndScope ();
    7197                 :      327130 :                     M2Debug_Assert (OldScopePtr == ScopePtr);
    7198                 :      327130 :                     if (Sym == SymbolTable_NulSym)
    7199                 :             :                       {
    7200                 :      327098 :                         Sym = FetchUnknownFromDefImp (tok, ModSym, SymName);
    7201                 :             :                       }
    7202                 :             :                     else
    7203                 :             :                       {
    7204                 :          32 :                         if (SymbolTable_IsFieldEnumeration (Sym))
    7205                 :             :                           {
    7206                 :           6 :                             if (SymbolTable_IsExported (ModSym, SymbolTable_GetType (Sym)))
    7207                 :             :                               {
    7208                 :             :                                 return Sym;
    7209                 :             :                               }
    7210                 :             :                           }
    7211                 :             :                       }
    7212                 :      327124 :                     SymbolKey_PutSymKey (pSym->DefImp.ExportRequest, SymName, Sym);
    7213                 :             :                   }
    7214                 :             :               }
    7215                 :             :           }
    7216                 :             :         break;
    7217                 :             : 
    7218                 :             : 
    7219                 :           0 :       default:
    7220                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
    7221                 :             :         break;
    7222                 :             :     }
    7223                 :             :   return Sym;
    7224                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7225                 :             :   __builtin_unreachable ();
    7226                 :             : }
    7227                 :             : 
    7228                 :             : 
    7229                 :             : /*
    7230                 :             :    GetWhereImported - returns the token number where this symbol
    7231                 :             :                       was imported into the current module.
    7232                 :             : */
    7233                 :             : 
    7234                 :           6 : static unsigned int GetWhereImported (unsigned int Sym)
    7235                 :             : {
    7236                 :           6 :   SymbolTable_PtrToSymbol pSym;
    7237                 :             : 
    7238                 :           6 :   pSym = GetPsym (SymbolTable_GetCurrentModuleScope ());
    7239                 :           6 :   switch (pSym->SymbolType)
    7240                 :             :     {
    7241                 :           6 :       case SymbolTable_DefImpSym:
    7242                 :           6 :         return static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.WhereImported, Sym));
    7243                 :           0 :         break;
    7244                 :             : 
    7245                 :           0 :       case SymbolTable_ModuleSym:
    7246                 :           0 :         return static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.WhereImported, Sym));
    7247                 :           0 :         break;
    7248                 :             : 
    7249                 :             : 
    7250                 :           0 :       default:
    7251                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
    7252                 :             :         break;
    7253                 :             :     }
    7254                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    7255                 :             :   __builtin_unreachable ();
    7256                 :             : }
    7257                 :             : 
    7258                 :             : 
    7259                 :             : /*
    7260                 :             :    DisplayName - displays the name.
    7261                 :             : */
    7262                 :             : 
    7263                 :           0 : static void DisplayName (unsigned int sym)
    7264                 :             : {
    7265                 :           0 :   M2Printf_printf1 ((const char *) "   %a", 5, (const unsigned char *) &sym, (sizeof (sym)-1));
    7266                 :           0 : }
    7267                 :             : 
    7268                 :             : 
    7269                 :             : /*
    7270                 :             :    DisplaySymbol - displays the name of a symbol
    7271                 :             : */
    7272                 :             : 
    7273                 :           0 : static void DisplaySymbol (unsigned int sym)
    7274                 :             : {
    7275                 :           0 :   DynamicStrings_String s;
    7276                 :             : 
    7277                 :           0 :   s = DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym))));
    7278                 :           0 :   M2Printf_printf2 ((const char *) "   %s (%d)", 10, (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &sym, (sizeof (sym)-1));
    7279                 :           0 : }
    7280                 :             : 
    7281                 :             : 
    7282                 :             : /*
    7283                 :             :    FetchUnknownFromModule - returns an Unknown symbol from module, ModSym.
    7284                 :             : */
    7285                 :             : 
    7286                 :          12 : static unsigned int FetchUnknownFromModule (unsigned int tok, unsigned int ModSym, NameKey_Name SymName)
    7287                 :             : {
    7288                 :          12 :   SymbolTable_PtrToSymbol pSym;
    7289                 :          12 :   unsigned int Sym;
    7290                 :             : 
    7291                 :          12 :   pSym = GetPsym (ModSym);
    7292                 :          12 :   switch (pSym->SymbolType)
    7293                 :             :     {
    7294                 :          12 :       case SymbolTable_ModuleSym:
    7295                 :          12 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.Unresolved, SymName));
    7296                 :          12 :         if (Sym == SymbolTable_NulSym)
    7297                 :             :           {
    7298                 :          12 :             NewSym (&Sym);
    7299                 :          12 :             FillInUnknownFields (tok, Sym, SymName);
    7300                 :          12 :             SymbolKey_PutSymKey (pSym->Module.Unresolved, SymName, Sym);
    7301                 :             :           }
    7302                 :          12 :         break;
    7303                 :             : 
    7304                 :             : 
    7305                 :           0 :       default:
    7306                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module symbol", 25);
    7307                 :          12 :         break;
    7308                 :             :     }
    7309                 :          12 :   return Sym;
    7310                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7311                 :             :   __builtin_unreachable ();
    7312                 :             : }
    7313                 :             : 
    7314                 :             : 
    7315                 :             : /*
    7316                 :             :    FetchUnknownFromDefImp - returns an Unknown symbol from module, ModSym.
    7317                 :             : */
    7318                 :             : 
    7319                 :      327098 : static unsigned int FetchUnknownFromDefImp (unsigned int tok, unsigned int ModSym, NameKey_Name SymName)
    7320                 :             : {
    7321                 :      327098 :   SymbolTable_PtrToSymbol pSym;
    7322                 :      327098 :   unsigned int Sym;
    7323                 :             : 
    7324                 :      327098 :   pSym = GetPsym (ModSym);
    7325                 :      327098 :   switch (pSym->SymbolType)
    7326                 :             :     {
    7327                 :      327098 :       case SymbolTable_DefImpSym:
    7328                 :      327098 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.Unresolved, SymName));
    7329                 :      327098 :         if (Sym == SymbolTable_NulSym)
    7330                 :             :           {
    7331                 :      327098 :             NewSym (&Sym);
    7332                 :      327098 :             FillInUnknownFields (tok, Sym, SymName);
    7333                 :      327098 :             SymbolKey_PutSymKey (pSym->DefImp.Unresolved, SymName, Sym);
    7334                 :             :           }
    7335                 :      327098 :         break;
    7336                 :             : 
    7337                 :             : 
    7338                 :           0 :       default:
    7339                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
    7340                 :      327098 :         break;
    7341                 :             :     }
    7342                 :      327098 :   return Sym;
    7343                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7344                 :             :   __builtin_unreachable ();
    7345                 :             : }
    7346                 :             : 
    7347                 :             : 
    7348                 :             : /*
    7349                 :             :    FetchUnknownFromDefImp - returns an Unknown symbol from module, ModSym.
    7350                 :             : */
    7351                 :             : 
    7352                 :          54 : static unsigned int FetchUnknownFrom (unsigned int tok, unsigned int scope, NameKey_Name SymName)
    7353                 :             : {
    7354                 :          54 :   SymbolTable_PtrToSymbol pSym;
    7355                 :          54 :   unsigned int Sym;
    7356                 :             : 
    7357                 :          54 :   pSym = GetPsym (scope);
    7358                 :          54 :   switch (pSym->SymbolType)
    7359                 :             :     {
    7360                 :           0 :       case SymbolTable_DefImpSym:
    7361                 :           0 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.Unresolved, SymName));
    7362                 :           0 :         if (Sym == SymbolTable_NulSym)
    7363                 :             :           {
    7364                 :           0 :             NewSym (&Sym);
    7365                 :           0 :             FillInUnknownFields (tok, Sym, SymName);
    7366                 :           0 :             SymbolKey_PutSymKey (pSym->DefImp.Unresolved, SymName, Sym);
    7367                 :             :           }
    7368                 :             :         break;
    7369                 :             : 
    7370                 :          36 :       case SymbolTable_ModuleSym:
    7371                 :          36 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.Unresolved, SymName));
    7372                 :          36 :         if (Sym == SymbolTable_NulSym)
    7373                 :             :           {
    7374                 :          36 :             NewSym (&Sym);
    7375                 :          36 :             FillInUnknownFields (tok, Sym, SymName);
    7376                 :          36 :             SymbolKey_PutSymKey (pSym->Module.Unresolved, SymName, Sym);
    7377                 :             :           }
    7378                 :             :         break;
    7379                 :             : 
    7380                 :          18 :       case SymbolTable_ProcedureSym:
    7381                 :          18 :         Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Procedure.Unresolved, SymName));
    7382                 :          18 :         if (Sym == SymbolTable_NulSym)
    7383                 :             :           {
    7384                 :          18 :             NewSym (&Sym);
    7385                 :          18 :             FillInUnknownFields (tok, Sym, SymName);
    7386                 :          18 :             SymbolKey_PutSymKey (pSym->Procedure.Unresolved, SymName, Sym);
    7387                 :             :           }
    7388                 :             :         break;
    7389                 :             : 
    7390                 :             : 
    7391                 :           0 :       default:
    7392                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module or Procedure symbol", 48);
    7393                 :          54 :         break;
    7394                 :             :     }
    7395                 :          54 :   return Sym;
    7396                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7397                 :             :   __builtin_unreachable ();
    7398                 :             : }
    7399                 :             : 
    7400                 :             : 
    7401                 :             : /*
    7402                 :             :    UnknownSymbolError - displays symbol name for symbol, sym.
    7403                 :             : */
    7404                 :             : 
    7405                 :         132 : static void UnknownSymbolError (unsigned int sym)
    7406                 :             : {
    7407                 :         132 :   if (IsUnreportedUnknown (sym))
    7408                 :             :     {
    7409                 :         132 :       Sets_IncludeElementIntoSet (ReportedUnknowns, sym);
    7410                 :         132 :       M2MetaError_MetaErrorStringT1 (SymbolTable_GetFirstUsed (sym), DynamicStrings_InitString ((const char *) "unknown symbol {%1EUad} {%1&s}", 30), sym);
    7411                 :             :     }
    7412                 :         132 : }
    7413                 :             : 
    7414                 :             : 
    7415                 :             : /*
    7416                 :             :    IsUnreportedUnknown - returns TRUE if symbol, sym, has not been
    7417                 :             :                          reported and is an unknown symbol.
    7418                 :             : */
    7419                 :             : 
    7420                 :    33668451 : static bool IsUnreportedUnknown (unsigned int sym)
    7421                 :             : {
    7422                 :    33668451 :   return (SymbolTable_IsUnknown (sym)) && (! (Sets_IsElementInSet (ReportedUnknowns, sym)));
    7423                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7424                 :             :   __builtin_unreachable ();
    7425                 :             : }
    7426                 :             : 
    7427                 :             : 
    7428                 :             : /*
    7429                 :             :    AddListify -
    7430                 :             : */
    7431                 :             : 
    7432                 :           0 : static void AddListify (unsigned int sym)
    7433                 :             : {
    7434                 :           0 :   ListifyWordCount += 1;
    7435                 :             :   /* printf ("AddListify: ListifyWordCount = %d, ListifyTotal = %d
    7436                 :             :   ",
    7437                 :             :               ListifyWordCount, ListifyTotal) ;  */
    7438                 :           0 :   if (ListifyWordCount > 1)
    7439                 :             :     {
    7440                 :             :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    7441                 :           0 :       if (ListifyWordCount == ListifyTotal)
    7442                 :             :         {
    7443                 :           0 :           ListifySentance = DynamicStrings_ConCat (ListifySentance, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) " and ", 5)));
    7444                 :             :         }
    7445                 :             :       else
    7446                 :             :         {
    7447                 :           0 :           ListifySentance = DynamicStrings_ConCat (ListifySentance, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) ", ", 2)));
    7448                 :             :         }
    7449                 :             :     }
    7450                 :           0 :   ListifySentance = DynamicStrings_ConCat (ListifySentance, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym)))));
    7451                 :           0 : }
    7452                 :             : 
    7453                 :             : 
    7454                 :             : /*
    7455                 :             :    Listify - convert tree into a string list and return the result.
    7456                 :             : */
    7457                 :             : 
    7458                 :           0 : static DynamicStrings_String Listify (SymbolKey_SymbolTree tree, SymbolKey_IsSymbol isCondition)
    7459                 :             : {
    7460                 :           0 :   ListifyTotal = SymbolKey_NoOfNodes (tree, isCondition);
    7461                 :           0 :   ListifyWordCount = 0;
    7462                 :           0 :   ListifySentance = DynamicStrings_InitString ((const char *) "", 0);
    7463                 :           0 :   SymbolKey_ForeachNodeConditionDo (tree, isCondition, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) AddListify});
    7464                 :           0 :   return ListifySentance;
    7465                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7466                 :             :   __builtin_unreachable ();
    7467                 :             : }
    7468                 :             : 
    7469                 :             : 
    7470                 :             : /*
    7471                 :             :    CheckForUnknowns - checks a binary tree, Tree, to see whether it contains
    7472                 :             :                       an unknown symbol. All unknown symbols are displayed
    7473                 :             :                       together with an error message.
    7474                 :             : */
    7475                 :             : 
    7476                 :     1972768 : static void CheckForUnknowns (unsigned int tokno, NameKey_Name name, SymbolKey_SymbolTree Tree, const char *a_, unsigned int _a_high)
    7477                 :             : {
    7478                 :     1972768 :   DynamicStrings_String s;
    7479                 :     1972768 :   char a[_a_high+1];
    7480                 :             : 
    7481                 :             :   /* make a local copy of each unbounded array.  */
    7482                 :     1972768 :   memcpy (a, a_, _a_high+1);
    7483                 :             : 
    7484                 :     1972768 :   if (SymbolKey_DoesTreeContainAny (Tree, (SymbolKey_IsSymbol) {(SymbolKey_IsSymbol_t) IsUnreportedUnknown}))
    7485                 :             :     {
    7486                 :         108 :       SymbolKey_ForeachNodeDo (Tree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) UnknownSymbolError});
    7487                 :         108 :       if ((SymbolKey_NoOfNodes (Tree, (SymbolKey_IsSymbol) {(SymbolKey_IsSymbol_t) IsUnreportedUnknown})) > 0)
    7488                 :             :         {
    7489                 :           0 :           s = DynamicStrings_InitString ((const char *) "{%E} the following unknown symbols in module %<", 47);
    7490                 :           0 :           s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (name))));
    7491                 :           0 :           s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%> were ", 8)));
    7492                 :           0 :           s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
    7493                 :           0 :           s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) ": ", 2)));
    7494                 :           0 :           s = DynamicStrings_ConCat (s, DynamicStrings_Mark (Listify (Tree, (SymbolKey_IsSymbol) {(SymbolKey_IsSymbol_t) IsUnreportedUnknown})));
    7495                 :           0 :           M2MetaError_MetaErrorStringT0 (tokno, s);
    7496                 :             :         }
    7497                 :             :     }
    7498                 :     1972768 : }
    7499                 :             : 
    7500                 :             : 
    7501                 :             : /*
    7502                 :             :    SymbolError - displays symbol name for symbol, Sym.
    7503                 :             : */
    7504                 :             : 
    7505                 :           0 : static void SymbolError (unsigned int Sym)
    7506                 :             : {
    7507                 :           0 :   M2Error_Error e;
    7508                 :           0 :   NameKey_Name n;
    7509                 :             : 
    7510                 :           0 :   n = SymbolTable_GetSymName (Sym);
    7511                 :           0 :   e = M2Error_ChainError (SymbolTable_GetFirstUsed (Sym), CurrentError);
    7512                 :           0 :   M2Error_ErrorFormat1 (e, (const char *) "unknown symbol '%a' found", 25, (const unsigned char *) &n, (sizeof (n)-1));
    7513                 :           0 : }
    7514                 :             : 
    7515                 :             : 
    7516                 :             : /*
    7517                 :             :    CheckForSymbols  - checks a binary tree, Tree, to see whether it contains
    7518                 :             :                       any symbol. The tree is expected to be empty, if not
    7519                 :             :                       then an error has occurred.
    7520                 :             : */
    7521                 :             : 
    7522                 :      469355 : static void CheckForSymbols (SymbolKey_SymbolTree Tree, const char *a_, unsigned int _a_high)
    7523                 :             : {
    7524                 :      469355 :   DynamicStrings_String s;
    7525                 :      469355 :   char a[_a_high+1];
    7526                 :             : 
    7527                 :             :   /* make a local copy of each unbounded array.  */
    7528                 :      469355 :   memcpy (a, a_, _a_high+1);
    7529                 :             : 
    7530                 :      469355 :   if (! (SymbolKey_IsEmptyTree (Tree)))
    7531                 :             :     {
    7532                 :           0 :       s = DynamicStrings_InitString ((const char *) "the symbols are unknown at the end of module {%1Ea} when ", 57);
    7533                 :           0 :       s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
    7534                 :           0 :       M2MetaError_MetaErrorString1 (s, MainModule);
    7535                 :           0 :       SymbolKey_ForeachNodeDo (Tree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SymbolError});
    7536                 :             :     }
    7537                 :      469355 : }
    7538                 :             : 
    7539                 :             : 
    7540                 :             : /*
    7541                 :             :    PutExportUndeclared - places a symbol, Sym, into module, ModSym,
    7542                 :             :                          ExportUndeclared list provided that Sym
    7543                 :             :                          is unknown.
    7544                 :             : */
    7545                 :             : 
    7546                 :     4568428 : static void PutExportUndeclared (unsigned int ModSym, unsigned int Sym)
    7547                 :             : {
    7548                 :     4568428 :   SymbolTable_PtrToSymbol pSym;
    7549                 :             : 
    7550                 :     4568428 :   if (SymbolTable_IsUnknown (Sym))
    7551                 :             :     {
    7552                 :     4025059 :       pSym = GetPsym (ModSym);
    7553                 :     4025059 :       switch (pSym->SymbolType)
    7554                 :             :         {
    7555                 :         294 :           case SymbolTable_ModuleSym:
    7556                 :         294 :             SymbolKey_PutSymKey (pSym->Module.ExportUndeclared, SymbolTable_GetSymName (Sym), Sym);
    7557                 :         294 :             break;
    7558                 :             : 
    7559                 :     4024765 :           case SymbolTable_DefImpSym:
    7560                 :     4024765 :             SymbolKey_PutSymKey (pSym->DefImp.ExportUndeclared, SymbolTable_GetSymName (Sym), Sym);
    7561                 :     4024765 :             break;
    7562                 :             : 
    7563                 :             : 
    7564                 :           0 :           default:
    7565                 :           0 :             M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
    7566                 :             :             break;
    7567                 :             :         }
    7568                 :             :     }
    7569                 :     4568428 : }
    7570                 :             : 
    7571                 :             : 
    7572                 :             : /*
    7573                 :             :    GetExportUndeclared - returns a symbol which has, name, from module, ModSym,
    7574                 :             :                          which is in the ExportUndeclared list.
    7575                 :             : */
    7576                 :             : 
    7577                 :         234 : static unsigned int GetExportUndeclared (unsigned int ModSym, NameKey_Name name)
    7578                 :             : {
    7579                 :         234 :   SymbolTable_PtrToSymbol pSym;
    7580                 :             : 
    7581                 :         234 :   pSym = GetPsym (ModSym);
    7582                 :         234 :   switch (pSym->SymbolType)
    7583                 :             :     {
    7584                 :         228 :       case SymbolTable_ModuleSym:
    7585                 :         228 :         return static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.ExportUndeclared, name));
    7586                 :           6 :         break;
    7587                 :             : 
    7588                 :           6 :       case SymbolTable_DefImpSym:
    7589                 :           6 :         return static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportUndeclared, name));
    7590                 :           0 :         break;
    7591                 :             : 
    7592                 :             : 
    7593                 :           0 :       default:
    7594                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
    7595                 :             :         break;
    7596                 :             :     }
    7597                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    7598                 :             :   __builtin_unreachable ();
    7599                 :             : }
    7600                 :             : 
    7601                 :             : 
    7602                 :             : /*
    7603                 :             :    RemoveExportUndeclared - removes a symbol, Sym, from the module, ModSym,
    7604                 :             :                             ExportUndeclaredTree.
    7605                 :             : */
    7606                 :             : 
    7607                 :    11179286 : static void RemoveExportUndeclared (unsigned int ModSym, unsigned int Sym)
    7608                 :             : {
    7609                 :    11179286 :   SymbolTable_PtrToSymbol pSym;
    7610                 :             : 
    7611                 :    11179286 :   pSym = GetPsym (ModSym);
    7612                 :    11179286 :   switch (pSym->SymbolType)
    7613                 :             :     {
    7614                 :          18 :       case SymbolTable_ModuleSym:
    7615                 :          18 :         if ((SymbolKey_GetSymKey (pSym->Module.ExportUndeclared, SymbolTable_GetSymName (Sym))) == Sym)
    7616                 :             :           {
    7617                 :          18 :             SymbolKey_DelSymKey (pSym->Module.ExportUndeclared, SymbolTable_GetSymName (Sym));
    7618                 :             :           }
    7619                 :             :         break;
    7620                 :             : 
    7621                 :    11179268 :       case SymbolTable_DefImpSym:
    7622                 :    11179268 :         if ((SymbolKey_GetSymKey (pSym->DefImp.ExportUndeclared, SymbolTable_GetSymName (Sym))) == Sym)
    7623                 :             :           {
    7624                 :     4024405 :             SymbolKey_DelSymKey (pSym->DefImp.ExportUndeclared, SymbolTable_GetSymName (Sym));
    7625                 :             :           }
    7626                 :             :         break;
    7627                 :             : 
    7628                 :             : 
    7629                 :           0 :       default:
    7630                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
    7631                 :    11179286 :         break;
    7632                 :             :     }
    7633                 :    11179286 : }
    7634                 :             : 
    7635                 :             : 
    7636                 :             : /*
    7637                 :             :    CheckForExportedDeclaration - checks to see whether a definition module
    7638                 :             :                                  is currently being compiled, if so,
    7639                 :             :                                  symbol, Sym, is removed from the
    7640                 :             :                                  ExportUndeclared list.
    7641                 :             :                                  This procedure is called whenever a symbol
    7642                 :             :                                  is declared, thus attempting to reduce
    7643                 :             :                                  the ExportUndeclared list.
    7644                 :             : */
    7645                 :             : 
    7646                 :    19340196 : static void CheckForExportedDeclaration (unsigned int Sym)
    7647                 :             : {
    7648                 :    19340196 :   if (M2Comp_CompilingDefinitionModule ())
    7649                 :             :     {
    7650                 :    11179262 :       RemoveExportUndeclared (SymbolTable_GetCurrentModule (), Sym);
    7651                 :             :     }
    7652                 :    19340196 : }
    7653                 :             : 
    7654                 :             : 
    7655                 :             : /*
    7656                 :             :    UndeclaredSymbolError - displays symbol name for symbol, Sym.
    7657                 :             : */
    7658                 :             : 
    7659                 :           0 : static void UndeclaredSymbolError (unsigned int Sym)
    7660                 :             : {
    7661                 :           0 :   if (DebugUnknowns)
    7662                 :             :     {
    7663                 :             :       M2Printf_printf1 ((const char *) "undeclared symbol (%d)\\n", 24, (const unsigned char *) &Sym, (sizeof (Sym)-1));
    7664                 :             :     }
    7665                 :           0 :   M2MetaError_MetaError1 ((const char *) "{%1UC} undeclared symbol {%1a}", 30, Sym);
    7666                 :           0 : }
    7667                 :             : 
    7668                 :             : 
    7669                 :             : /*
    7670                 :             :    RemoveExportUnImplemented - removes a symbol, Sym, from the module, ModSym,
    7671                 :             :                                NeedToBeImplemented list.
    7672                 :             : */
    7673                 :             : 
    7674                 :     2227705 : static void RemoveExportUnImplemented (unsigned int ModSym, unsigned int Sym)
    7675                 :             : {
    7676                 :     2227705 :   SymbolTable_PtrToSymbol pSym;
    7677                 :             : 
    7678                 :     2227705 :   pSym = GetPsym (ModSym);
    7679                 :     2227705 :   switch (pSym->SymbolType)
    7680                 :             :     {
    7681                 :     2227705 :       case SymbolTable_DefImpSym:
    7682                 :     2227705 :         if ((SymbolKey_GetSymKey (pSym->DefImp.NeedToBeImplemented, SymbolTable_GetSymName (Sym))) == Sym)
    7683                 :             :           {
    7684                 :     1278874 :             SymbolKey_DelSymKey (pSym->DefImp.NeedToBeImplemented, SymbolTable_GetSymName (Sym));
    7685                 :             :           }
    7686                 :     2227705 :         break;
    7687                 :             : 
    7688                 :             : 
    7689                 :           0 :       default:
    7690                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
    7691                 :     2227705 :         break;
    7692                 :             :     }
    7693                 :     2227705 : }
    7694                 :             : 
    7695                 :             : 
    7696                 :             : /*
    7697                 :             :    RemoveFromExportRequest -
    7698                 :             : */
    7699                 :             : 
    7700                 :      411420 : static void RemoveFromExportRequest (unsigned int Sym)
    7701                 :             : {
    7702                 :      411420 :   SymbolTable_PtrToSymbol pSym;
    7703                 :             : 
    7704                 :      411420 :   pSym = GetPsym (ExportRequestModule);
    7705                 :      411420 :   switch (pSym->SymbolType)
    7706                 :             :     {
    7707                 :      411420 :       case SymbolTable_DefImpSym:
    7708                 :      411420 :         if ((SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymbolTable_GetSymName (Sym))) == Sym)
    7709                 :             :           {
    7710                 :           6 :             SymbolKey_DelSymKey (pSym->DefImp.ExportRequest, SymbolTable_GetSymName (Sym));
    7711                 :             :           }
    7712                 :      411420 :         break;
    7713                 :             : 
    7714                 :             : 
    7715                 :           0 :       default:
    7716                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
    7717                 :      411420 :         break;
    7718                 :             :     }
    7719                 :      411420 : }
    7720                 :             : 
    7721                 :             : 
    7722                 :             : /*
    7723                 :             :    RemoveEnumerationFromExportRequest - removes enumeration symbol, sym,
    7724                 :             :                                         (and its fields) from the ExportRequest tree.
    7725                 :             : */
    7726                 :             : 
    7727                 :       18816 : static void RemoveEnumerationFromExportRequest (unsigned int ModSym, unsigned int Sym)
    7728                 :             : {
    7729                 :       18816 :   if (SymbolTable_IsEnumeration (Sym))
    7730                 :             :     {
    7731                 :       18816 :       ExportRequestModule = ModSym;
    7732                 :       18816 :       RemoveFromExportRequest (Sym);
    7733                 :       18816 :       SymbolTable_ForeachLocalSymDo (Sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) RemoveFromExportRequest});
    7734                 :             :     }
    7735                 :       18816 : }
    7736                 :             : 
    7737                 :             : 
    7738                 :             : /*
    7739                 :             :    UnImplementedSymbolError - displays symbol name for symbol, Sym.
    7740                 :             : */
    7741                 :             : 
    7742                 :           0 : static void UnImplementedSymbolError (unsigned int Sym)
    7743                 :             : {
    7744                 :           0 :   NameKey_Name n;
    7745                 :             : 
    7746                 :           0 :   CurrentError = M2Error_ChainError (SymbolTable_GetFirstUsed (Sym), CurrentError);
    7747                 :           0 :   if (SymbolTable_IsType (Sym))
    7748                 :             :     {
    7749                 :           0 :       n = SymbolTable_GetSymName (Sym);
    7750                 :           0 :       M2Error_ErrorFormat1 (CurrentError, (const char *) "hidden type is undeclared (%a)", 30, (const unsigned char *) &n, (sizeof (n)-1));
    7751                 :             :     }
    7752                 :           0 :   else if (SymbolTable_IsProcedure (Sym))
    7753                 :             :     {
    7754                 :             :       /* avoid dangling else.  */
    7755                 :           0 :       n = SymbolTable_GetSymName (Sym);
    7756                 :           0 :       M2Error_ErrorFormat1 (CurrentError, (const char *) "procedure is undeclared (%a)", 28, (const unsigned char *) &n, (sizeof (n)-1));
    7757                 :             :     }
    7758                 :           0 :   else if (SymbolTable_IsProcType (Sym))
    7759                 :             :     {
    7760                 :             :       /* avoid dangling else.  */
    7761                 :           0 :       n = SymbolTable_GetSymName (Sym);
    7762                 :           0 :       M2Error_ErrorFormat1 (CurrentError, (const char *) "procedure type is undeclared (%a)", 33, (const unsigned char *) &n, (sizeof (n)-1));
    7763                 :             :     }
    7764                 :             :   else
    7765                 :             :     {
    7766                 :             :       /* avoid dangling else.  */
    7767                 :           0 :       M2Error_ErrorFormat0 (CurrentError, (const char *) "undeclared symbol", 17);
    7768                 :             :     }
    7769                 :           0 : }
    7770                 :             : 
    7771                 :             : 
    7772                 :             : /*
    7773                 :             :    CheckEnumerationInList - places symbol, Sym, in the list, l,
    7774                 :             :                             providing it does not already exist.
    7775                 :             :                             PseudoScope(Sym) is called if Sym needs to
    7776                 :             :                             be added to the enumeration list, l.
    7777                 :             : */
    7778                 :             : 
    7779                 :       67416 : static void CheckEnumerationInList (Lists_List l, unsigned int Sym)
    7780                 :             : {
    7781                 :       67416 :   if (! (Lists_IsItemInList (l, Sym)))
    7782                 :             :     {
    7783                 :       58870 :       Lists_PutItemIntoList (l, Sym);
    7784                 :       58870 :       SymbolTable_PseudoScope (Sym);
    7785                 :             :     }
    7786                 :       67416 : }
    7787                 :             : 
    7788                 :             : 
    7789                 :             : /*
    7790                 :             :    CheckIfEnumerationExported - An outer module may use an enumeration that
    7791                 :             :                                 is declared inside an inner module. The usage
    7792                 :             :                                 may occur before definition. The first pass
    7793                 :             :                                 exports a symbol, later the symbol is declared
    7794                 :             :                                 as an emumeration type. At this stage the
    7795                 :             :                                 CheckIfEnumerationExported procedure should be
    7796                 :             :                                 called. This procedure ripples from the current
    7797                 :             :                                 (inner) module to outer module and every time
    7798                 :             :                                 it is exported it must be added to the outer
    7799                 :             :                                 module EnumerationScopeList.
    7800                 :             : */
    7801                 :             : 
    7802                 :       49678 : static void CheckIfEnumerationExported (unsigned int Sym, unsigned int ScopeId)
    7803                 :             : {
    7804                 :       68512 :   SymbolTable_PtrToCallFrame pCall;
    7805                 :       68512 :   unsigned int InnerModId;
    7806                 :       68512 :   unsigned int OuterModId;
    7807                 :       68512 :   unsigned int InnerModSym;
    7808                 :       68512 :   unsigned int OuterModSym;
    7809                 :             : 
    7810                 :       68512 :   InnerModId = GetModuleScopeId (ScopeId);
    7811                 :       68512 :   if (InnerModId > 0)
    7812                 :             :     {
    7813                 :       68512 :       OuterModId = GetModuleScopeId (InnerModId-1);
    7814                 :       68512 :       if (OuterModId > 0)
    7815                 :             :         {
    7816                 :       68512 :           pCall = GetPcall (InnerModId);
    7817                 :       68512 :           InnerModSym = pCall->Search;
    7818                 :       68512 :           pCall = GetPcall (OuterModId);
    7819                 :       68512 :           OuterModSym = pCall->Search;
    7820                 :       68512 :           if ((InnerModSym != SymbolTable_NulSym) && (OuterModSym != SymbolTable_NulSym))
    7821                 :             :             {
    7822                 :       34196 :               if (SymbolTable_IsExported (InnerModSym, Sym))
    7823                 :             :                 {
    7824                 :       18834 :                   CheckForEnumerationInOuterModule (Sym, OuterModSym);
    7825                 :       18834 :                   CheckIfEnumerationExported (Sym, OuterModId);
    7826                 :             :                 }
    7827                 :             :             }
    7828                 :             :         }
    7829                 :             :     }
    7830                 :       49678 : }
    7831                 :             : 
    7832                 :             : 
    7833                 :             : /*
    7834                 :             :    CheckForEnumerationInOuterModule - checks to see whether the enumeration
    7835                 :             :                                       type symbol, Sym, has been entered into
    7836                 :             :                                       the outer module, OuterModule, scope list.
    7837                 :             :                                       OuterModule may be internal to the
    7838                 :             :                                       program module.
    7839                 :             : */
    7840                 :             : 
    7841                 :       18834 : static void CheckForEnumerationInOuterModule (unsigned int Sym, unsigned int OuterModule)
    7842                 :             : {
    7843                 :       18834 :   SymbolTable_PtrToSymbol pSym;
    7844                 :             : 
    7845                 :       18834 :   pSym = GetPsym (OuterModule);
    7846                 :       18834 :   switch (pSym->SymbolType)
    7847                 :             :     {
    7848                 :           0 :       case SymbolTable_DefImpSym:
    7849                 :           0 :         Lists_IncludeItemIntoList (pSym->DefImp.EnumerationScopeList, Sym);
    7850                 :           0 :         break;
    7851                 :             : 
    7852                 :       18834 :       case SymbolTable_ModuleSym:
    7853                 :       18834 :         Lists_IncludeItemIntoList (pSym->Module.EnumerationScopeList, Sym);
    7854                 :       18834 :         break;
    7855                 :             : 
    7856                 :             : 
    7857                 :           0 :       default:
    7858                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
    7859                 :       18834 :         break;
    7860                 :             :     }
    7861                 :       18834 : }
    7862                 :             : 
    7863                 :             : 
    7864                 :             : /*
    7865                 :             :    MakeVariableForParam -
    7866                 :             : */
    7867                 :             : 
    7868                 :     8923563 : static unsigned int MakeVariableForParam (unsigned int tok, NameKey_Name ParamName, unsigned int ProcSym, SymbolTable_ProcedureKind kind, unsigned int no, unsigned int ParmType, unsigned int typetok)
    7869                 :             : {
    7870                 :     8923563 :   SymbolTable_PtrToSymbol pSym;
    7871                 :     8923563 :   unsigned int VariableSym;
    7872                 :             : 
    7873                 :     8923563 :   tok = CheckTok (tok, (const char *) "parameter", 9);
    7874                 :     8923563 :   VariableSym = SymbolTable_MakeVar (tok, ParamName);
    7875                 :     8923563 :   pSym = GetPsym (VariableSym);
    7876                 :     8923563 :   switch (pSym->SymbolType)
    7877                 :             :     {
    7878                 :             :       case SymbolTable_ErrorSym:
    7879                 :             :         return SymbolTable_NulSym;
    7880                 :     8923563 :         break;
    7881                 :             : 
    7882                 :     8923563 :       case SymbolTable_VarSym:
    7883                 :     8923563 :         pSym->Var.IsParam = true;  /* Variable is really a parameter.  */
    7884                 :     8923563 :         break;
    7885                 :             : 
    7886                 :             : 
    7887                 :           0 :       default:
    7888                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
    7889                 :     8923563 :         break;
    7890                 :             :     }
    7891                 :             :   /* Note that the parameter is now treated as a local variable.  */
    7892                 :     8923563 :   SymbolTable_PutVarTok (VariableSym, ParmType, typetok);
    7893                 :     8923563 :   SymbolTable_PutDeclared (tok, VariableSym);
    7894                 :             :   /* 
    7895                 :             :       Normal VAR parameters have LeftValue,
    7896                 :             :       however Unbounded VAR parameters have RightValue.
    7897                 :             :       Non VAR parameters always have RightValue.
    7898                 :             :   */
    7899                 :     8923563 :   if ((SymbolTable_IsVarParam (ProcSym, kind, no)) && (! (SymbolTable_IsUnboundedParam (ProcSym, kind, no))))
    7900                 :             :     {
    7901                 :      266950 :       SymbolTable_PutMode (VariableSym, SymbolTable_LeftValue);
    7902                 :             :     }
    7903                 :             :   else
    7904                 :             :     {
    7905                 :     8656613 :       SymbolTable_PutMode (VariableSym, SymbolTable_RightValue);
    7906                 :             :     }
    7907                 :             :   return VariableSym;
    7908                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    7909                 :             :   __builtin_unreachable ();
    7910                 :             : }
    7911                 :             : 
    7912                 :             : 
    7913                 :             : /*
    7914                 :             :    AddParameter - adds a parameter ParSym to a procedure Sym.
    7915                 :             : */
    7916                 :             : 
    7917                 :    20322671 : static void AddParameter (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParSym)
    7918                 :             : {
    7919                 :    20322671 :   SymbolTable_PtrToSymbol pSym;
    7920                 :             : 
    7921                 :    20322671 :   pSym = GetPsym (Sym);
    7922                 :    20322671 :   switch (pSym->SymbolType)
    7923                 :             :     {
    7924                 :             :       case SymbolTable_ErrorSym:
    7925                 :             :         break;
    7926                 :             : 
    7927                 :    11313775 :       case SymbolTable_ProcedureSym:
    7928                 :    11313775 :         Lists_PutItemIntoList (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam, ParSym);
    7929                 :    11313775 :         break;
    7930                 :             : 
    7931                 :     9008896 :       case SymbolTable_ProcTypeSym:
    7932                 :     9008896 :         Lists_PutItemIntoList (pSym->ProcType.ListOfParam, ParSym);
    7933                 :     9008896 :         break;
    7934                 :             : 
    7935                 :             : 
    7936                 :           0 :       default:
    7937                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
    7938                 :    20322671 :         break;
    7939                 :             :     }
    7940                 :    20322671 : }
    7941                 :             : 
    7942                 :             : 
    7943                 :             : /*
    7944                 :             :    AddProcedureProcTypeParam - adds ParamType to the parameter ProcType
    7945                 :             :                                associated with procedure Sym.
    7946                 :             : */
    7947                 :             : 
    7948                 :    11313775 : static void AddProcedureProcTypeParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded, bool isVarParam)
    7949                 :             : {
    7950                 :    11313775 :   SymbolTable_PtrToSymbol pSym;
    7951                 :             : 
    7952                 :    11313775 :   pSym = GetPsym (Sym);
    7953                 :    11313775 :   switch (pSym->SymbolType)
    7954                 :             :     {
    7955                 :    11313775 :       case SymbolTable_ProcedureSym:
    7956                 :    11313775 :         if (pSym->Procedure.BuildProcType)
    7957                 :             :           {
    7958                 :             :             /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    7959                 :     8923563 :             if (isVarParam)
    7960                 :             :               {
    7961                 :      760713 :                 SymbolTable_PutProcTypeVarParam (tok, pSym->Procedure.ProcedureType, ParamType, isUnbounded);
    7962                 :             :               }
    7963                 :             :             else
    7964                 :             :               {
    7965                 :     8162850 :                 SymbolTable_PutProcTypeParam (tok, pSym->Procedure.ProcedureType, ParamType, isUnbounded);
    7966                 :             :               }
    7967                 :             :           }
    7968                 :    11313775 :         break;
    7969                 :             : 
    7970                 :             : 
    7971                 :           0 :       default:
    7972                 :           0 :         M2Error_InternalError ((const char *) "expecting Sym to be a procedure", 31);
    7973                 :    11313775 :         break;
    7974                 :             :     }
    7975                 :    11313775 : }
    7976                 :             : 
    7977                 :             : 
    7978                 :             : /*
    7979                 :             :    IsNthParamVar - returns true if the n th parameter of the parameter list,
    7980                 :             :                    List, is a VAR parameter.
    7981                 :             : */
    7982                 :             : 
    7983                 :    21224457 : static bool IsNthParamVar (Lists_List Head, unsigned int n)
    7984                 :             : {
    7985                 :    21224457 :   SymbolTable_PtrToSymbol pSym;
    7986                 :    21224457 :   unsigned int p;
    7987                 :             : 
    7988                 :    21224457 :   p = static_cast<unsigned int> (Lists_GetItemFromList (Head, n));
    7989                 :    21224457 :   if (p == SymbolTable_NulSym)
    7990                 :             :     {
    7991                 :           0 :       M2Error_InternalError ((const char *) "parameter does not exist", 24);
    7992                 :             :     }
    7993                 :             :   else
    7994                 :             :     {
    7995                 :    21224457 :       pSym = GetPsym (p);
    7996                 :    21224457 :       switch (pSym->SymbolType)
    7997                 :             :         {
    7998                 :             :           case SymbolTable_ErrorSym:
    7999                 :             :             return false;
    8000                 :     1294755 :             break;
    8001                 :             : 
    8002                 :     1294755 :           case SymbolTable_VarParamSym:
    8003                 :     1294755 :             return true;
    8004                 :             :             break;
    8005                 :             : 
    8006                 :             :           case SymbolTable_ParamSym:
    8007                 :             :             return false;
    8008                 :           0 :             break;
    8009                 :             : 
    8010                 :             : 
    8011                 :           0 :           default:
    8012                 :           0 :             M2Error_InternalError ((const char *) "expecting Param or VarParam symbol", 34);
    8013                 :             :             break;
    8014                 :             :         }
    8015                 :             :     }
    8016                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    8017                 :             :   __builtin_unreachable ();
    8018                 :             : }
    8019                 :             : 
    8020                 :             : 
    8021                 :             : /*
    8022                 :             :    MakeParameterHeapVar - create a heap variable if sym is a pointer.
    8023                 :             : */
    8024                 :             : 
    8025                 :      533939 : static unsigned int MakeParameterHeapVar (unsigned int tok, unsigned int type, SymbolTable_ModeOfAddr mode)
    8026                 :             : {
    8027                 :      533939 :   unsigned int heapvar;
    8028                 :             : 
    8029                 :      533939 :   tok = CheckTok (tok, (const char *) "parameter heap var", 18);
    8030                 :      533939 :   heapvar = SymbolTable_NulSym;
    8031                 :      533939 :   type = SymbolTable_SkipType (type);
    8032                 :      533939 :   if (SymbolTable_IsPointer (type))
    8033                 :             :     {
    8034                 :       51144 :       heapvar = SymbolTable_MakeTemporary (tok, mode);
    8035                 :       51144 :       SymbolTable_PutVar (heapvar, type);
    8036                 :       51144 :       SymbolTable_PutVarHeap (heapvar, true);
    8037                 :             :     }
    8038                 :      533939 :   return heapvar;
    8039                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8040                 :             :   __builtin_unreachable ();
    8041                 :             : }
    8042                 :             : 
    8043                 :             : 
    8044                 :             : /*
    8045                 :             :    PutParameterHeapVar - creates a heap variable associated with parameter sym.
    8046                 :             : */
    8047                 :             : 
    8048                 :     5884443 : static void PutParameterHeapVar (unsigned int sym)
    8049                 :             : {
    8050                 :     5884443 :   SymbolTable_PtrToSymbol pSym;
    8051                 :             : 
    8052                 :     5884443 :   pSym = GetPsym (sym);
    8053                 :     5884443 :   switch (pSym->SymbolType)
    8054                 :             :     {
    8055                 :             :       case SymbolTable_ParamSym:
    8056                 :             :         break;
    8057                 :             : 
    8058                 :      533939 :       case SymbolTable_VarParamSym:
    8059                 :      533939 :         pSym->VarParam.HeapVar = MakeParameterHeapVar (SymbolTable_GetDeclaredMod (sym), pSym->VarParam.Type, SymbolTable_LeftValue);  /* Nothing to do for the non var parameter.  */
    8060                 :      533939 :         break;
    8061                 :             : 
    8062                 :             : 
    8063                 :           0 :       default:
    8064                 :           0 :         M2Error_InternalError ((const char *) "Param or VarParam symbol expected", 33);
    8065                 :     5884443 :         break;
    8066                 :             :     }
    8067                 :     5884443 : }
    8068                 :             : 
    8069                 :             : 
    8070                 :             : /*
    8071                 :             :    IsProcedureAnyBoolean - returns the boolean result from p
    8072                 :             :                            for any of procedure kind which is defined.
    8073                 :             : */
    8074                 :             : 
    8075                 :        8617 : static bool IsProcedureAnyBoolean (unsigned int sym, SymbolTable_ProcAnyBoolean p)
    8076                 :             : {
    8077                 :        8617 :   SymbolTable_ProcedureKind kind;
    8078                 :             : 
    8079                 :       25839 :   for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
    8080                 :             :     {
    8081                 :       25839 :       if (SymbolTable_GetProcedureDefined (sym, kind))
    8082                 :             :         {
    8083                 :        8617 :           return (*p.proc) (sym, kind);
    8084                 :             :         }
    8085                 :             :     }
    8086                 :           0 :   M2Error_InternalError ((const char *) "no procedure kind exists", 24);
    8087                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    8088                 :             :   __builtin_unreachable ();
    8089                 :             : }
    8090                 :             : 
    8091                 :             : 
    8092                 :             : /*
    8093                 :             :    IsProcedureAnyDefaultBoolean - returns the boolean result from p
    8094                 :             :                                   for any of procedure kind which is defined.
    8095                 :             : */
    8096                 :             : 
    8097                 :     3923332 : static bool IsProcedureAnyDefaultBoolean (unsigned int sym, bool default_, SymbolTable_ProcAnyBoolean p)
    8098                 :             : {
    8099                 :     3923332 :   SymbolTable_ProcedureKind kind;
    8100                 :             : 
    8101                 :     9263214 :   for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
    8102                 :             :     {
    8103                 :     8865190 :       if (SymbolTable_GetProcedureDefined (sym, kind))
    8104                 :             :         {
    8105                 :     3525308 :           return (*p.proc) (sym, kind);
    8106                 :             :         }
    8107                 :             :     }
    8108                 :             :   return default_;
    8109                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8110                 :             :   __builtin_unreachable ();
    8111                 :             : }
    8112                 :             : 
    8113                 :             : 
    8114                 :             : /*
    8115                 :             :    FillInUnknownFields -
    8116                 :             : */
    8117                 :             : 
    8118                 :    11013377 : static void FillInUnknownFields (unsigned int tok, unsigned int sym, NameKey_Name SymName)
    8119                 :             : {
    8120                 :    11013377 :   SymbolTable_PtrToSymbol pSym;
    8121                 :             : 
    8122                 :    11013377 :   pSym = GetPsym (sym);
    8123                 :    11013377 :   pSym->SymbolType = SymbolTable_UndefinedSym;
    8124                 :    11013377 :   pSym->Undefined.name = SymName;
    8125                 :    11013377 :   pSym->Undefined.oafamily = SymbolTable_NulSym;
    8126                 :    11013377 :   pSym->Undefined.errorScope = M2Error_GetCurrentErrorScope ();
    8127                 :    11013377 :   InitWhereFirstUsedTok (tok, &pSym->Undefined.At);
    8128                 :    11013377 : }
    8129                 :             : 
    8130                 :             : 
    8131                 :             : /*
    8132                 :             :    FillInPointerFields - given a new symbol, sym, make it a pointer symbol
    8133                 :             :                          and initialize its fields.
    8134                 :             : */
    8135                 :             : 
    8136                 :      204182 : static void FillInPointerFields (unsigned int Sym, NameKey_Name PointerName, unsigned int scope, unsigned int oaf)
    8137                 :             : {
    8138                 :      204182 :   SymbolTable_PtrToSymbol pSym;
    8139                 :             : 
    8140                 :      204182 :   if (! (SymbolTable_IsError (Sym)))
    8141                 :             :     {
    8142                 :      204182 :       pSym = GetPsym (Sym);
    8143                 :      204182 :       pSym->SymbolType = SymbolTable_PointerSym;
    8144                 :      204182 :       switch (pSym->SymbolType)
    8145                 :             :         {
    8146                 :      204182 :           case SymbolTable_PointerSym:
    8147                 :      204182 :             pSym->Pointer.Type = SymbolTable_NulSym;
    8148                 :      204182 :             pSym->Pointer.name = PointerName;
    8149                 :      204182 :             pSym->Pointer.oafamily = oaf;  /* The unbounded for this  */
    8150                 :      204182 :             SymbolKey_InitTree (&pSym->Pointer.ConstLitTree);  /* constants of this type  */
    8151                 :      204182 :             pSym->Pointer.Scope = scope;  /* Which scope created it  */
    8152                 :      204182 :             pSym->Pointer.Size = M2ALU_InitValue ();  /* Which scope created it  */
    8153                 :      204182 :             pSym->Pointer.Align = SymbolTable_NulSym;  /* Alignment of this type  */
    8154                 :      204182 :             break;
    8155                 :             : 
    8156                 :             : 
    8157                 :             :           default:
    8158                 :             :             M2Error_InternalError ((const char *) "expecting a Pointer symbol", 26);  /* Alignment of this type  */
    8159                 :      204182 :             break;
    8160                 :             :         }
    8161                 :             :     }
    8162                 :      204182 : }
    8163                 :             : 
    8164                 :             : 
    8165                 :             : /*
    8166                 :             :    ForeachParameterDo -
    8167                 :             : */
    8168                 :             : 
    8169                 :       30948 : static void ForeachParameterDo (SymbolTable_CheckProcedure p)
    8170                 :             : {
    8171                 :       30948 :   unsigned int l;
    8172                 :       30948 :   unsigned int h;
    8173                 :             : 
    8174                 :       30948 :   l = Indexing_LowIndice (Symbols);
    8175                 :       30948 :   h = Indexing_HighIndice (Symbols);
    8176                 :    47523162 :   while (l <= h)
    8177                 :             :     {
    8178                 :    47461266 :       if (SymbolTable_IsParameter (l))
    8179                 :             :         {
    8180                 :     3334545 :           (*p.proc) (l);
    8181                 :             :         }
    8182                 :    47461266 :       l += 1;
    8183                 :             :     }
    8184                 :       30948 : }
    8185                 :             : 
    8186                 :             : 
    8187                 :             : /*
    8188                 :             :    CheckUnbounded - checks to see if parameter, Sym, is now an unbounded parameter.
    8189                 :             : */
    8190                 :             : 
    8191                 :     3334545 : static void CheckUnbounded (unsigned int Sym)
    8192                 :             : {
    8193                 :     3334545 :   SymbolTable_PtrToSymbol pSym;
    8194                 :             : 
    8195                 :     3334545 :   AssertInRange (Sym);
    8196                 :     3334545 :   pSym = GetPsym (Sym);
    8197                 :     3334545 :   switch (pSym->SymbolType)
    8198                 :             :     {
    8199                 :     2374461 :       case SymbolTable_ParamSym:
    8200                 :     2374461 :         if (SymbolTable_IsUnbounded (pSym->Param.Type))
    8201                 :             :           {
    8202                 :      430304 :             pSym->Param.IsUnbounded = true;
    8203                 :             :           }
    8204                 :             :         break;
    8205                 :             : 
    8206                 :      960084 :       case SymbolTable_VarParamSym:
    8207                 :      960084 :         if (SymbolTable_IsUnbounded (pSym->VarParam.Type))
    8208                 :             :           {
    8209                 :      946068 :             pSym->VarParam.IsUnbounded = true;
    8210                 :             :           }
    8211                 :             :         break;
    8212                 :             : 
    8213                 :             : 
    8214                 :           0 :       default:
    8215                 :           0 :         M2RTS_HALT (-1);
    8216                 :             :         __builtin_unreachable ();
    8217                 :     3334545 :         break;
    8218                 :             :     }
    8219                 :     3334545 : }
    8220                 :             : 
    8221                 :             : 
    8222                 :             : /*
    8223                 :             :    PutOAFamily - places the, oaf, into, SimpleType, oafamily field.
    8224                 :             : */
    8225                 :             : 
    8226                 :       30888 : static void PutOAFamily (unsigned int SimpleType, unsigned int oaf)
    8227                 :             : {
    8228                 :       30888 :   SymbolTable_PtrToSymbol pSym;
    8229                 :             : 
    8230                 :       30888 :   pSym = GetPsym (SimpleType);
    8231                 :       30888 :   switch (pSym->SymbolType)
    8232                 :             :     {
    8233                 :             :       case SymbolTable_ErrorSym:
    8234                 :             :         break;
    8235                 :             : 
    8236                 :          12 :       case SymbolTable_RecordSym:
    8237                 :          12 :         pSym->Record.oafamily = oaf;
    8238                 :          12 :         break;
    8239                 :             : 
    8240                 :           0 :       case SymbolTable_SubrangeSym:
    8241                 :           0 :         pSym->Subrange.oafamily = oaf;
    8242                 :           0 :         break;
    8243                 :             : 
    8244                 :          18 :       case SymbolTable_EnumerationSym:
    8245                 :          18 :         pSym->Enumeration.oafamily = oaf;
    8246                 :          18 :         break;
    8247                 :             : 
    8248                 :           6 :       case SymbolTable_ArraySym:
    8249                 :           6 :         pSym->Array.oafamily = oaf;
    8250                 :           6 :         break;
    8251                 :             : 
    8252                 :           0 :       case SymbolTable_ProcTypeSym:
    8253                 :           0 :         pSym->ProcType.oafamily = oaf;
    8254                 :           0 :         break;
    8255                 :             : 
    8256                 :       30852 :       case SymbolTable_TypeSym:
    8257                 :       30852 :         pSym->Type.oafamily = oaf;
    8258                 :       30852 :         break;
    8259                 :             : 
    8260                 :           0 :       case SymbolTable_PointerSym:
    8261                 :           0 :         pSym->Pointer.oafamily = oaf;
    8262                 :           0 :         break;
    8263                 :             : 
    8264                 :           0 :       case SymbolTable_SetSym:
    8265                 :           0 :         pSym->Set.oafamily = oaf;
    8266                 :           0 :         break;
    8267                 :             : 
    8268                 :           0 :       case SymbolTable_UndefinedSym:
    8269                 :           0 :         pSym->Undefined.oafamily = oaf;
    8270                 :           0 :         break;
    8271                 :             : 
    8272                 :             : 
    8273                 :           0 :       default:
    8274                 :           0 :         M2Error_InternalError ((const char *) "not expecting this SimpleType", 29);
    8275                 :       30888 :         break;
    8276                 :             :     }
    8277                 :       30888 : }
    8278                 :             : 
    8279                 :             : 
    8280                 :             : /*
    8281                 :             :    doFillInOAFamily -
    8282                 :             : */
    8283                 :             : 
    8284                 :           0 : static void doFillInOAFamily (unsigned int oaf, unsigned int i, unsigned int unbounded)
    8285                 :             : {
    8286                 :           0 :   unsigned int SimpleType;
    8287                 :             : 
    8288                 :           0 :   SimpleType = SymbolTable_GetType (oaf);
    8289                 :           0 :   if (unbounded != SymbolTable_NulSym)
    8290                 :             :     {
    8291                 :           0 :       FillInUnboundedFields (M2LexBuf_GetTokenNo (), unbounded, SimpleType, i);
    8292                 :             :     }
    8293                 :           0 : }
    8294                 :             : 
    8295                 :             : 
    8296                 :             : /*
    8297                 :             :    FillInUnboundedFields -
    8298                 :             : */
    8299                 :             : 
    8300                 :       30948 : static void FillInUnboundedFields (unsigned int tok, unsigned int sym, unsigned int SimpleType, unsigned int ndim)
    8301                 :             : {
    8302                 :       30948 :   SymbolTable_PtrToSymbol pSym;
    8303                 :       30948 :   unsigned int Contents;
    8304                 :       30948 :   unsigned int i;
    8305                 :             : 
    8306                 :       30948 :   if (sym != SymbolTable_NulSym)
    8307                 :             :     {
    8308                 :       30948 :       pSym = GetPsym (sym);
    8309                 :       30948 :       pSym->SymbolType = SymbolTable_UnboundedSym;
    8310                 :       30948 :       pSym->Unbounded.Type = SimpleType;  /* Index to a simple type.  */
    8311                 :       30948 :       pSym->Unbounded.Size = M2ALU_InitValue ();  /* Size in bytes for this sym  */
    8312                 :       30948 :       pSym->Unbounded.Scope = SymbolTable_GetScope (SimpleType);  /* Which scope will create it  */
    8313                 :       30948 :       InitWhereDeclaredTok (tok, &pSym->Unbounded.At);  /* Declared here  */
    8314                 :       30948 :       NewSym (&pSym->Unbounded.RecordType);  /* Declared here  */
    8315                 :       30948 :       FillInRecordFields (tok, pSym->Unbounded.RecordType, NameKey_NulName, SymbolTable_GetScope (SimpleType), SymbolTable_NulSym);
    8316                 :       30948 :       NewSym (&Contents);
    8317                 :       30948 :       FillInPointerFields (Contents, NameKey_NulName, SymbolTable_GetScope (SimpleType), SymbolTable_NulSym);
    8318                 :       30948 :       SymbolTable_PutPointer (Contents, SimpleType);
    8319                 :             :       /* create the contents field for the unbounded array.  */
    8320                 :       30948 :       M2Debug_Assert ((SymbolTable_PutFieldRecord (pSym->Unbounded.RecordType, NameKey_MakeKey ((const char *) "_m2_contents", 12), Contents, SymbolTable_NulSym)) != SymbolTable_NulSym);
    8321                 :             :       /* create all the high fields for the unbounded array.  */
    8322                 :       30948 :       i = 1;
    8323                 :       62040 :       while (i <= ndim)
    8324                 :             :         {
    8325                 :       31092 :           M2Debug_Assert ((SymbolTable_PutFieldRecord (pSym->Unbounded.RecordType, NameKey_makekey (DynamicStrings_string (DynamicStrings_Mark (FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_m2_high_%d", 11)), (const unsigned char *) &i, (sizeof (i)-1))))), M2Base_Cardinal, SymbolTable_NulSym)) != SymbolTable_NulSym);
    8326                 :       31092 :           i += 1;
    8327                 :             :         }
    8328                 :       30948 :       pSym->Unbounded.Dimensions = ndim;
    8329                 :       30948 :       ForeachParameterDo ((SymbolTable_CheckProcedure) {(SymbolTable_CheckProcedure_t) CheckUnbounded});
    8330                 :             :     }
    8331                 :       30948 : }
    8332                 :             : 
    8333                 :             : 
    8334                 :             : /*
    8335                 :             :    PutUnbounded - associates the unbounded symbol, open, with
    8336                 :             :                   SimpleType.
    8337                 :             : */
    8338                 :             : 
    8339                 :       30948 : static void PutUnbounded (unsigned int oaf, unsigned int sym, unsigned int ndim)
    8340                 :             : {
    8341                 :       30948 :   SymbolTable_PtrToSymbol pSym;
    8342                 :             : 
    8343                 :       30948 :   pSym = GetPsym (oaf);
    8344                 :       30948 :   switch (pSym->SymbolType)
    8345                 :             :     {
    8346                 :             :       case SymbolTable_OAFamilySym:
    8347                 :             :         /* need to check to see if we need to add NulSym for all dimensions < ndim
    8348                 :             :                           which have not been used.  */
    8349                 :       61980 :         while (pSym->OAFamily.MaxDimensions < ndim)
    8350                 :             :           {
    8351                 :       31032 :             pSym->OAFamily.MaxDimensions += 1;
    8352                 :       31032 :             if (pSym->OAFamily.MaxDimensions < ndim)
    8353                 :             :               {
    8354                 :             :                 /* add NulSym to an unused dimension.  */
    8355                 :          84 :                 PutIntoIndex (&pSym->OAFamily.Dimensions, pSym->OAFamily.MaxDimensions, SymbolTable_NulSym);
    8356                 :             :               }
    8357                 :             :           }
    8358                 :             :         /* and finally add the known sym.  */
    8359                 :       30948 :         PutIntoIndex (&pSym->OAFamily.Dimensions, ndim, sym);
    8360                 :       30948 :         break;
    8361                 :             : 
    8362                 :             : 
    8363                 :           0 :       default:
    8364                 :           0 :         M2Error_InternalError ((const char *) "expecting OAFamily symbol", 25);
    8365                 :       30948 :         break;
    8366                 :             :     }
    8367                 :       30948 : }
    8368                 :             : 
    8369                 :             : 
    8370                 :             : /*
    8371                 :             :    GetArrayDimension - returns the number of dimensions defined.
    8372                 :             : */
    8373                 :             : 
    8374                 :        6888 : static unsigned int GetArrayDimension (unsigned int sym)
    8375                 :             : {
    8376                 :        6888 :   unsigned int n;
    8377                 :             : 
    8378                 :        6888 :   n = 0;
    8379                 :       13950 :   while (SymbolTable_IsArray (sym))
    8380                 :             :     {
    8381                 :        7062 :       sym = SymbolTable_SkipType (SymbolTable_GetType (sym));
    8382                 :        7062 :       n += 1;
    8383                 :             :     }
    8384                 :        6888 :   return n;
    8385                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8386                 :             :   __builtin_unreachable ();
    8387                 :             : }
    8388                 :             : 
    8389                 :             : 
    8390                 :             : /*
    8391                 :             :    ResolveConstructorType - if, sym, has an unresolved constructor type
    8392                 :             :                             then attempt to resolve it by examining the
    8393                 :             :                             from, type.
    8394                 :             : */
    8395                 :             : 
    8396                 :       36506 : static void ResolveConstructorType (unsigned int sym, unsigned int *type, unsigned int *from, bool *unres)
    8397                 :             : {
    8398                 :       36506 :   if ((*unres))
    8399                 :             :     {
    8400                 :             :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    8401                 :       36506 :       if (SymbolTable_IsConstructor ((*from)))
    8402                 :             :         {
    8403                 :             :           /* avoid dangling else.  */
    8404                 :           0 :           if (IsConstructorResolved ((*from)))
    8405                 :             :             {
    8406                 :           0 :               (*unres) = false;
    8407                 :           0 :               (*type) = SymbolTable_GetType ((*from));
    8408                 :           0 :               if (((*type) != SymbolTable_NulSym) && (SymbolTable_IsSet (SymbolTable_SkipType ((*type)))))
    8409                 :             :                 {
    8410                 :           0 :                   SymbolTable_PutConstSet (sym);
    8411                 :             :                 }
    8412                 :             :             }
    8413                 :             :         }
    8414                 :       36506 :       else if (((*from) != SymbolTable_NulSym) && (SymbolTable_IsSet (SymbolTable_SkipType ((*from)))))
    8415                 :             :         {
    8416                 :             :           /* avoid dangling else.  */
    8417                 :       33274 :           (*unres) = false;
    8418                 :       33274 :           (*type) = (*from);
    8419                 :       33274 :           SymbolTable_PutConstSet (sym);
    8420                 :             :         }
    8421                 :        3232 :       else if (((*from) != SymbolTable_NulSym) && ((SymbolTable_IsRecord (SymbolTable_SkipType ((*from)))) || (SymbolTable_IsArray (SymbolTable_SkipType ((*from))))))
    8422                 :             :         {
    8423                 :             :           /* avoid dangling else.  */
    8424                 :        3226 :           (*unres) = false;
    8425                 :        3226 :           (*type) = (*from);
    8426                 :             :         }
    8427                 :             :     }
    8428                 :       36506 : }
    8429                 :             : 
    8430                 :             : 
    8431                 :             : /*
    8432                 :             :    IsConstructorResolved - returns TRUE if the constructor does not
    8433                 :             :                            have an unresolved type.
    8434                 :             : */
    8435                 :             : 
    8436                 :       73012 : static bool IsConstructorResolved (unsigned int sym)
    8437                 :             : {
    8438                 :       73012 :   SymbolTable_PtrToSymbol pSym;
    8439                 :             : 
    8440                 :       73012 :   pSym = GetPsym (sym);
    8441                 :       73012 :   switch (pSym->SymbolType)
    8442                 :             :     {
    8443                 :       73012 :       case SymbolTable_ConstVarSym:
    8444                 :       73012 :         return ! pSym->ConstVar.UnresFromType;
    8445                 :           0 :         break;
    8446                 :             : 
    8447                 :           0 :       case SymbolTable_ConstLitSym:
    8448                 :           0 :         return ! pSym->ConstLit.UnresFromType;
    8449                 :           0 :         break;
    8450                 :             : 
    8451                 :             : 
    8452                 :           0 :       default:
    8453                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstVar or ConstLit symbol", 37);
    8454                 :             :         break;
    8455                 :             :     }
    8456                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    8457                 :             :   __builtin_unreachable ();
    8458                 :             : }
    8459                 :             : 
    8460                 :             : 
    8461                 :             : /*
    8462                 :             :    CanResolveConstructor - returns TRUE if the type of the constructor,
    8463                 :             :                            sym, is known.
    8464                 :             : */
    8465                 :             : 
    8466                 :       36506 : static bool CanResolveConstructor (unsigned int sym)
    8467                 :             : {
    8468                 :       36506 :   SymbolTable_PtrToSymbol pSym;
    8469                 :             : 
    8470                 :       36506 :   if (! (IsConstructorResolved (sym)))
    8471                 :             :     {
    8472                 :       36506 :       pSym = GetPsym (sym);
    8473                 :       36506 :       switch (pSym->SymbolType)
    8474                 :             :         {
    8475                 :       36506 :           case SymbolTable_ConstVarSym:
    8476                 :       36506 :             ResolveConstructorType (sym, &pSym->ConstVar.Type, &pSym->ConstVar.FromType, &pSym->ConstVar.UnresFromType);
    8477                 :       36506 :             break;
    8478                 :             : 
    8479                 :           0 :           case SymbolTable_ConstLitSym:
    8480                 :           0 :             ResolveConstructorType (sym, &pSym->ConstLit.Type, &pSym->ConstLit.FromType, &pSym->ConstLit.UnresFromType);
    8481                 :           0 :             break;
    8482                 :             : 
    8483                 :             : 
    8484                 :           0 :           default:
    8485                 :           0 :             M2Error_InternalError ((const char *) "expecting ConstVar or ConstLit symbol", 37);
    8486                 :             :             break;
    8487                 :             :         }
    8488                 :             :     }
    8489                 :       36506 :   return IsConstructorResolved (sym);
    8490                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8491                 :             :   __builtin_unreachable ();
    8492                 :             : }
    8493                 :             : 
    8494                 :             : 
    8495                 :             : /*
    8496                 :             :    CheckAllConstructorsResolved - checks to see that the
    8497                 :             :                                   UnresolvedConstructorType list is
    8498                 :             :                                   empty and if it is not then it
    8499                 :             :                                   generates error messages.
    8500                 :             : */
    8501                 :             : 
    8502                 :       15219 : static void CheckAllConstructorsResolved (void)
    8503                 :             : {
    8504                 :       15219 :   unsigned int i;
    8505                 :       15219 :   unsigned int n;
    8506                 :       15219 :   unsigned int s;
    8507                 :       15219 :   M2Error_Error e;
    8508                 :             : 
    8509                 :       15219 :   n = Lists_NoOfItemsInList (UnresolvedConstructorType);
    8510                 :       15219 :   if (n > 0)
    8511                 :             :     {
    8512                 :          12 :       for (i=1; i<=n; i++)
    8513                 :             :         {
    8514                 :           6 :           s = static_cast<unsigned int> (Lists_GetItemFromList (UnresolvedConstructorType, i));
    8515                 :           6 :           e = M2Error_NewError (SymbolTable_GetDeclaredMod (s));
    8516                 :           6 :           M2Error_ErrorFormat0 (e, (const char *) "constructor has an unknown type", 31);
    8517                 :             :         }
    8518                 :           6 :       M2Error_FlushErrors ();
    8519                 :             :     }
    8520                 :       15213 : }
    8521                 :             : 
    8522                 :             : 
    8523                 :             : /*
    8524                 :             :    SanityCheckParameters -
    8525                 :             : */
    8526                 :             : 
    8527                 :     4936872 : static void SanityCheckParameters (unsigned int sym)
    8528                 :             : {
    8529                 :     4936872 :   unsigned int p;
    8530                 :     4936872 :   unsigned int i;
    8531                 :     4936872 :   unsigned int n;
    8532                 :             : 
    8533                 :     4936872 :   i = 1;
    8534                 :     4936872 :   n = SymbolTable_NoOfParamAny (sym);
    8535                 :    18513174 :   while (i <= n)
    8536                 :             :     {
    8537                 :     8639430 :       p = SymbolTable_GetType (SymbolTable_GetParam (sym, i));
    8538                 :     8639430 :       if (SymbolTable_IsConst (p))
    8539                 :             :         {
    8540                 :           0 :           M2MetaError_MetaError3 ((const char *) "the {%1N} formal parameter in procedure {%2Dad} should have a type rather than a constant {%3Dad}", 97, i, sym, p);
    8541                 :             :         }
    8542                 :     8639430 :       i += 1;
    8543                 :             :     }
    8544                 :     4936872 : }
    8545                 :             : 
    8546                 :             : 
    8547                 :             : /*
    8548                 :             :    SanityCheckArray - checks to see that an array has a correct subrange type.
    8549                 :             : */
    8550                 :             : 
    8551                 :    61132271 : static void SanityCheckArray (unsigned int sym)
    8552                 :             : {
    8553                 :    61132271 :   unsigned int type;
    8554                 :    61132271 :   unsigned int subscript;
    8555                 :             : 
    8556                 :    61132271 :   if (SymbolTable_IsArray (sym))
    8557                 :             :     {
    8558                 :      101450 :       subscript = SymbolTable_GetArraySubscript (sym);
    8559                 :      101450 :       if (subscript != SymbolTable_NulSym)
    8560                 :             :         {
    8561                 :      101450 :           type = SymbolTable_SkipType (SymbolTable_GetType (subscript));
    8562                 :      101450 :           if (SymbolTable_IsAModula2Type (type))
    8563                 :             :             {}  /* empty.  */
    8564                 :             :           else
    8565                 :             :             {
    8566                 :             :               /* Ok all is good.  */
    8567                 :           0 :               M2MetaError_MetaError2 ((const char *) "the array {%1Dad} must be declared with a simpletype in the [..] component rather than a {%2dv}", 95, sym, type);
    8568                 :             :             }
    8569                 :             :         }
    8570                 :             :     }
    8571                 :    61132271 : }
    8572                 :             : 
    8573                 :             : 
    8574                 :             : /*
    8575                 :             :    ForeachSymbolDo - foreach symbol, call, P(sym).
    8576                 :             : */
    8577                 :             : 
    8578                 :       15213 : static void ForeachSymbolDo (SymbolKey_PerformOperation P)
    8579                 :             : {
    8580                 :       15213 :   unsigned int i;
    8581                 :       15213 :   unsigned int n;
    8582                 :             : 
    8583                 :       15213 :   i = Indexing_LowIndice (Symbols);
    8584                 :       15213 :   n = Indexing_HighIndice (Symbols);
    8585                 :    53010226 :   while (i <= n)
    8586                 :             :     {
    8587                 :    52979800 :       (*P.proc) (i);
    8588                 :    52979800 :       i += 1;
    8589                 :             :     }
    8590                 :       15213 : }
    8591                 :             : 
    8592                 :             : 
    8593                 :             : /*
    8594                 :             :    SanityCheckProcedure - check to see that procedure parameters do not use constants
    8595                 :             :                           instead of types in their formal parameter section.
    8596                 :             : */
    8597                 :             : 
    8598                 :     4936872 : static void SanityCheckProcedure (unsigned int sym)
    8599                 :             : {
    8600                 :     4936872 :   SanityCheckParameters (sym);
    8601                 :     4936872 : }
    8602                 :             : 
    8603                 :             : 
    8604                 :             : /*
    8605                 :             :    SanityCheckModule -
    8606                 :             : */
    8607                 :             : 
    8608                 :      190767 : static void SanityCheckModule (unsigned int sym)
    8609                 :             : {
    8610                 :      190767 :   SymbolTable_ForeachInnerModuleDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SanityCheckModule});
    8611                 :      190767 :   SymbolTable_ForeachProcedureDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SanityCheckProcedure});
    8612                 :      190767 :   SymbolTable_ForeachLocalSymDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SanityCheckArray});
    8613                 :      190767 : }
    8614                 :             : 
    8615                 :             : 
    8616                 :             : /*
    8617                 :             :    AddNameTo - adds Name, n, to tree, s.
    8618                 :             : */
    8619                 :             : 
    8620                 :     7933363 : static void AddNameTo (SymbolKey_SymbolTree s, unsigned int o)
    8621                 :             : {
    8622                 :     7933363 :   if ((SymbolKey_GetSymKey (s, SymbolTable_GetSymName (o))) == SymbolKey_NulKey)
    8623                 :             :     {
    8624                 :     6650005 :       SymbolKey_PutSymKey (s, SymbolTable_GetSymName (o), o);
    8625                 :             :     }
    8626                 :     7933363 : }
    8627                 :             : 
    8628                 :             : 
    8629                 :             : /*
    8630                 :             :    CollectSymbolFrom -
    8631                 :             : */
    8632                 :             : 
    8633                 :         132 : static unsigned int CollectSymbolFrom (unsigned int tok, unsigned int scope, NameKey_Name n)
    8634                 :             : {
    8635                 :         132 :   NameKey_Name n1;
    8636                 :         132 :   unsigned int sym;
    8637                 :             : 
    8638                 :         132 :   n1 = SymbolTable_GetSymName (scope);
    8639                 :         132 :   if (DebugUnknowns)
    8640                 :             :     {
    8641                 :             :       M2Printf_printf2 ((const char *) "declaring %a in %a", 18, (const unsigned char *) &n, (sizeof (n)-1), (const unsigned char *) &n1, (sizeof (n1)-1));
    8642                 :             :     }
    8643                 :         132 :   sym = CheckScopeForSym (scope, n);
    8644                 :         132 :   if (sym == SymbolTable_NulSym)
    8645                 :             :     {
    8646                 :          54 :       sym = FetchUnknownFrom (tok, scope, n);
    8647                 :             :     }
    8648                 :         132 :   if (DebugUnknowns)
    8649                 :             :     {
    8650                 :             :       M2Printf_printf1 ((const char *) " symbol created (%d)\\n", 22, (const unsigned char *) &sym, (sizeof (sym)-1));
    8651                 :             :     }
    8652                 :         132 :   return sym;
    8653                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8654                 :             :   __builtin_unreachable ();
    8655                 :             : }
    8656                 :             : 
    8657                 :             : 
    8658                 :             : /*
    8659                 :             :    CollectUnknown -
    8660                 :             : */
    8661                 :             : 
    8662                 :         168 : static unsigned int CollectUnknown (unsigned int tok, unsigned int sym, NameKey_Name n)
    8663                 :             : {
    8664                 :         228 :   SymbolTable_PtrToSymbol pSym;
    8665                 :         228 :   unsigned int s;
    8666                 :             : 
    8667                 :         228 :   s = SymbolTable_NulSym;
    8668                 :         228 :   if ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)))
    8669                 :             :     {
    8670                 :         114 :       return CollectSymbolFrom (tok, sym, n);
    8671                 :             :     }
    8672                 :         114 :   else if (SymbolTable_IsProcedure (sym))
    8673                 :             :     {
    8674                 :             :       /* avoid dangling else.  */
    8675                 :         114 :       s = CheckScopeForSym (sym, n);
    8676                 :         114 :       if (s == SymbolTable_NulSym)
    8677                 :             :         {
    8678                 :          78 :           pSym = GetPsym (sym);
    8679                 :          78 :           switch (pSym->SymbolType)
    8680                 :             :             {
    8681                 :          78 :               case SymbolTable_ProcedureSym:
    8682                 :          78 :                 if ((SymbolKey_GetSymKey (pSym->Procedure.NamedObjects, n)) != SymbolKey_NulKey)
    8683                 :             :                   {
    8684                 :          18 :                     return CollectSymbolFrom (tok, sym, n);
    8685                 :             :                   }
    8686                 :          60 :                 break;
    8687                 :             : 
    8688                 :             : 
    8689                 :           0 :               default:
    8690                 :           0 :                 M2Error_InternalError ((const char *) "expecting - Procedure symbol", 28);
    8691                 :          60 :                 break;
    8692                 :             :             }
    8693                 :          60 :           s = CollectUnknown (tok, SymbolTable_GetScope (sym), n);
    8694                 :             :         }
    8695                 :             :     }
    8696                 :             :   return s;
    8697                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8698                 :             :   __builtin_unreachable ();
    8699                 :             : }
    8700                 :             : 
    8701                 :             : 
    8702                 :             : /*
    8703                 :             :    ResolveImport -
    8704                 :             : */
    8705                 :             : 
    8706                 :         168 : static void ResolveImport (unsigned int o)
    8707                 :             : {
    8708                 :         168 :   NameKey_Name n1;
    8709                 :         168 :   NameKey_Name n2;
    8710                 :         168 :   unsigned int tok;
    8711                 :         168 :   unsigned int sym;
    8712                 :             : 
    8713                 :         168 :   if (DebugUnknowns)
    8714                 :             :     {
    8715                 :             :       n1 = SymbolTable_GetSymName (o);
    8716                 :             :       M2Printf_printf1 ((const char *) "attempting to find out where %a was declared\\n", 46, (const unsigned char *) &n1, (sizeof (n1)-1));
    8717                 :             :       n1 = SymbolTable_GetSymName (ResolveModule);
    8718                 :             :       n2 = SymbolTable_GetSymName (SymbolTable_GetScope (ResolveModule));
    8719                 :             :       M2Printf_printf2 ((const char *) "scope of module %a is %a\\n", 26, (const unsigned char *) &n1, (sizeof (n1)-1), (const unsigned char *) &n2, (sizeof (n2)-1));
    8720                 :             :     }
    8721                 :         168 :   tok = SymbolTable_GetFirstUsed (o);
    8722                 :         168 :   sym = CollectUnknown (tok, SymbolTable_GetScope (ResolveModule), SymbolTable_GetSymName (o));
    8723                 :         168 :   if (sym == SymbolTable_NulSym)
    8724                 :             :     {
    8725                 :           0 :       M2MetaError_MetaError2 ((const char *) "unknown symbol {%1Uad} found in import list of module {%2a}", 59, o, ResolveModule);
    8726                 :             :     }
    8727                 :             :   else
    8728                 :             :     {
    8729                 :         168 :       SymbolTable_AddSymToModuleScope (ResolveModule, sym);
    8730                 :             :     }
    8731                 :         168 : }
    8732                 :             : 
    8733                 :             : 
    8734                 :             : /*
    8735                 :             :    ResolveRelativeImport -
    8736                 :             : */
    8737                 :             : 
    8738                 :     1913814 : static void ResolveRelativeImport (unsigned int sym)
    8739                 :             : {
    8740                 :     1913814 :   SymbolTable_PtrToSymbol pSym;
    8741                 :             : 
    8742                 :     1913814 :   if (SymbolTable_IsModule (sym))
    8743                 :             :     {
    8744                 :         426 :       ResolveModule = sym;
    8745                 :         426 :       pSym = GetPsym (sym);
    8746                 :         426 :       switch (pSym->SymbolType)
    8747                 :             :         {
    8748                 :         426 :           case SymbolTable_ModuleSym:
    8749                 :         426 :             SymbolKey_ForeachNodeDo (pSym->Module.NamedImports, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) ResolveImport});
    8750                 :         426 :             break;
    8751                 :             : 
    8752                 :             : 
    8753                 :           0 :           default:
    8754                 :           0 :             M2Error_InternalError ((const char *) "expecting - Module symbol", 25);
    8755                 :         426 :             break;
    8756                 :             :         }
    8757                 :             :     }
    8758                 :     1913814 :   SymbolTable_ForeachProcedureDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) ResolveRelativeImport});
    8759                 :     1913814 :   SymbolTable_ForeachInnerModuleDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) ResolveRelativeImport});
    8760                 :     1913814 : }
    8761                 :             : 
    8762                 :             : 
    8763                 :             : /*
    8764                 :             :    Max -
    8765                 :             : */
    8766                 :             : 
    8767                 :           0 : static unsigned int Max (unsigned int a, unsigned int b)
    8768                 :             : {
    8769                 :           0 :   if (a > b)
    8770                 :             :     {
    8771                 :             :       return a;
    8772                 :             :     }
    8773                 :             :   else
    8774                 :             :     {
    8775                 :             :       return b;
    8776                 :             :     }
    8777                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8778                 :             :   __builtin_unreachable ();
    8779                 :             : }
    8780                 :             : 
    8781                 :             : 
    8782                 :             : /*
    8783                 :             :    Min -
    8784                 :             : */
    8785                 :             : 
    8786                 :           0 : static unsigned int Min (unsigned int a, unsigned int b)
    8787                 :             : {
    8788                 :           0 :   if (a < b)
    8789                 :             :     {
    8790                 :             :       return a;
    8791                 :             :     }
    8792                 :             :   else
    8793                 :             :     {
    8794                 :             :       return b;
    8795                 :             :     }
    8796                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    8797                 :             :   __builtin_unreachable ();
    8798                 :             : }
    8799                 :             : 
    8800                 :             : 
    8801                 :             : /*
    8802                 :             :    DoFindLimits - assigns, Start, and, End, to the start and end
    8803                 :             :                   limits contained in the list, l.  It ensures that
    8804                 :             :                   Start and End are within StartLimit..EndLimit.
    8805                 :             :                   If StartLimit or EndLimit are 0 then Start is
    8806                 :             :                   is set to the first value and End to the last.
    8807                 :             : */
    8808                 :             : 
    8809                 :          30 : static void DoFindLimits (unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End, Lists_List l)
    8810                 :             : {
    8811                 :          30 :   unsigned int i;
    8812                 :          30 :   unsigned int j;
    8813                 :          30 :   unsigned int n;
    8814                 :             : 
    8815                 :          30 :   (*End) = 0;
    8816                 :          30 :   (*Start) = 0;
    8817                 :          30 :   i = 1;
    8818                 :          30 :   n = Lists_NoOfItemsInList (l);
    8819                 :          90 :   while (i <= n)
    8820                 :             :     {
    8821                 :          30 :       j = static_cast<unsigned int> (Lists_GetItemFromList (l, i));
    8822                 :          30 :       if (((j > (*End)) && (j >= StartLimit)) && ((j <= EndLimit) || (EndLimit == 0)))
    8823                 :             :         {
    8824                 :          24 :           (*End) = j;
    8825                 :             :         }
    8826                 :          30 :       if ((((((*Start) == 0) || (j < (*Start))) && (j != 0)) && (j >= StartLimit)) && ((j <= EndLimit) || (EndLimit == 0)))
    8827                 :             :         {
    8828                 :          24 :           (*Start) = j;
    8829                 :             :         }
    8830                 :          30 :       i += 1;
    8831                 :             :     }
    8832                 :          30 : }
    8833                 :             : 
    8834                 :             : 
    8835                 :             : /*
    8836                 :             :    PutDeclaredDefinition - associates the current tokenno with
    8837                 :             :                            the symbols declaration in the definition
    8838                 :             :                            module.
    8839                 :             : */
    8840                 :             : 
    8841                 :    18679167 : static void PutDeclaredDefinition (unsigned int tok, unsigned int Sym)
    8842                 :             : {
    8843                 :    18679167 :   SymbolTable_PtrToSymbol pSym;
    8844                 :             : 
    8845                 :    18679167 :   pSym = GetPsym (Sym);
    8846                 :    18679167 :   switch (pSym->SymbolType)
    8847                 :             :     {
    8848                 :           0 :       case SymbolTable_ErrorSym:
    8849                 :           0 :         pSym->Error.At.DefDeclared = tok;
    8850                 :           0 :         break;
    8851                 :             : 
    8852                 :           0 :       case SymbolTable_ObjectSym:
    8853                 :           0 :         pSym->Object.At.DefDeclared = tok;
    8854                 :           0 :         break;
    8855                 :             : 
    8856                 :           0 :       case SymbolTable_VarientSym:
    8857                 :           0 :         pSym->Varient.At.DefDeclared = tok;
    8858                 :           0 :         break;
    8859                 :             : 
    8860                 :           0 :       case SymbolTable_RecordSym:
    8861                 :           0 :         pSym->Record.At.DefDeclared = tok;
    8862                 :           0 :         break;
    8863                 :             : 
    8864                 :           0 :       case SymbolTable_SubrangeSym:
    8865                 :           0 :         pSym->Subrange.At.DefDeclared = tok;
    8866                 :           0 :         break;
    8867                 :             : 
    8868                 :           0 :       case SymbolTable_EnumerationSym:
    8869                 :           0 :         pSym->Enumeration.At.DefDeclared = tok;
    8870                 :           0 :         break;
    8871                 :             : 
    8872                 :        1196 :       case SymbolTable_ArraySym:
    8873                 :        1196 :         pSym->Array.At.DefDeclared = tok;
    8874                 :        1196 :         break;
    8875                 :             : 
    8876                 :           0 :       case SymbolTable_SubscriptSym:
    8877                 :           0 :         pSym->Subscript.At.DefDeclared = tok;
    8878                 :           0 :         break;
    8879                 :             : 
    8880                 :           0 :       case SymbolTable_UnboundedSym:
    8881                 :           0 :         pSym->Unbounded.At.DefDeclared = tok;
    8882                 :           0 :         break;
    8883                 :             : 
    8884                 :     3312947 :       case SymbolTable_ProcedureSym:
    8885                 :     3312947 :         pSym->Procedure.At.DefDeclared = tok;
    8886                 :     3312947 :         break;
    8887                 :             : 
    8888                 :           0 :       case SymbolTable_ProcTypeSym:
    8889                 :           0 :         pSym->ProcType.At.DefDeclared = tok;
    8890                 :           0 :         break;
    8891                 :             : 
    8892                 :           0 :       case SymbolTable_ConstStringSym:
    8893                 :           0 :         pSym->ConstString.At.DefDeclared = tok;
    8894                 :           0 :         break;
    8895                 :             : 
    8896                 :           0 :       case SymbolTable_ConstLitSym:
    8897                 :           0 :         pSym->ConstLit.At.DefDeclared = tok;
    8898                 :           0 :         break;
    8899                 :             : 
    8900                 :        3940 :       case SymbolTable_ConstVarSym:
    8901                 :        3940 :         pSym->ConstVar.At.DefDeclared = tok;
    8902                 :        3940 :         break;
    8903                 :             : 
    8904                 :     7074737 :       case SymbolTable_VarSym:
    8905                 :     7074737 :         pSym->Var.At.DefDeclared = tok;
    8906                 :     7074737 :         break;
    8907                 :             : 
    8908                 :           0 :       case SymbolTable_TypeSym:
    8909                 :           0 :         pSym->Type.At.DefDeclared = tok;
    8910                 :           0 :         break;
    8911                 :             : 
    8912                 :           0 :       case SymbolTable_PointerSym:
    8913                 :           0 :         pSym->Pointer.At.DefDeclared = tok;
    8914                 :           0 :         break;
    8915                 :             : 
    8916                 :       95618 :       case SymbolTable_RecordFieldSym:
    8917                 :       95618 :         pSym->RecordField.At.DefDeclared = tok;
    8918                 :       95618 :         break;
    8919                 :             : 
    8920                 :           0 :       case SymbolTable_VarientFieldSym:
    8921                 :           0 :         pSym->VarientField.At.DefDeclared = tok;
    8922                 :           0 :         break;
    8923                 :             : 
    8924                 :           0 :       case SymbolTable_EnumerationFieldSym:
    8925                 :           0 :         pSym->EnumerationField.At.DefDeclared = tok;
    8926                 :           0 :         break;
    8927                 :             : 
    8928                 :           0 :       case SymbolTable_SetSym:
    8929                 :           0 :         pSym->Set.At.DefDeclared = tok;
    8930                 :           0 :         break;
    8931                 :             : 
    8932                 :     8190543 :       case SymbolTable_DefImpSym:
    8933                 :     8190543 :         pSym->DefImp.At.DefDeclared = tok;
    8934                 :     8190543 :         break;
    8935                 :             : 
    8936                 :         186 :       case SymbolTable_ModuleSym:
    8937                 :         186 :         pSym->Module.At.DefDeclared = tok;
    8938                 :         186 :         break;
    8939                 :             : 
    8940                 :             :       case SymbolTable_UndefinedSym:
    8941                 :             :         break;
    8942                 :             : 
    8943                 :           0 :       case SymbolTable_PartialUnboundedSym:
    8944                 :           0 :         PutDeclaredDefinition (tok, pSym->PartialUnbounded.Type);
    8945                 :           0 :         break;
    8946                 :             : 
    8947                 :             : 
    8948                 :           0 :       default:
    8949                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type of symbol", 33);
    8950                 :    18679167 :         break;
    8951                 :             :     }
    8952                 :    18679167 : }
    8953                 :             : 
    8954                 :             : 
    8955                 :             : /*
    8956                 :             :    PutDeclaredModule - returns the token where this symbol was declared
    8957                 :             :                        in an implementation or program module.
    8958                 :             : */
    8959                 :             : 
    8960                 :    12907010 : static void PutDeclaredModule (unsigned int tok, unsigned int Sym)
    8961                 :             : {
    8962                 :    12907010 :   SymbolTable_PtrToSymbol pSym;
    8963                 :             : 
    8964                 :    12907010 :   pSym = GetPsym (Sym);
    8965                 :    12907010 :   switch (pSym->SymbolType)
    8966                 :             :     {
    8967                 :           0 :       case SymbolTable_ErrorSym:
    8968                 :           0 :         pSym->Error.At.ModDeclared = tok;
    8969                 :           0 :         break;
    8970                 :             : 
    8971                 :           0 :       case SymbolTable_ObjectSym:
    8972                 :           0 :         pSym->Object.At.ModDeclared = tok;
    8973                 :           0 :         break;
    8974                 :             : 
    8975                 :           0 :       case SymbolTable_VarientSym:
    8976                 :           0 :         pSym->Varient.At.ModDeclared = tok;
    8977                 :           0 :         break;
    8978                 :             : 
    8979                 :           0 :       case SymbolTable_RecordSym:
    8980                 :           0 :         pSym->Record.At.ModDeclared = tok;
    8981                 :           0 :         break;
    8982                 :             : 
    8983                 :           0 :       case SymbolTable_SubrangeSym:
    8984                 :           0 :         pSym->Subrange.At.ModDeclared = tok;
    8985                 :           0 :         break;
    8986                 :             : 
    8987                 :           0 :       case SymbolTable_EnumerationSym:
    8988                 :           0 :         pSym->Enumeration.At.ModDeclared = tok;
    8989                 :           0 :         break;
    8990                 :             : 
    8991                 :       98978 :       case SymbolTable_ArraySym:
    8992                 :       98978 :         pSym->Array.At.ModDeclared = tok;
    8993                 :       98978 :         break;
    8994                 :             : 
    8995                 :           0 :       case SymbolTable_SubscriptSym:
    8996                 :           0 :         pSym->Subscript.At.ModDeclared = tok;
    8997                 :           0 :         break;
    8998                 :             : 
    8999                 :           0 :       case SymbolTable_UnboundedSym:
    9000                 :           0 :         pSym->Unbounded.At.ModDeclared = tok;
    9001                 :           0 :         break;
    9002                 :             : 
    9003                 :     3143226 :       case SymbolTable_ProcedureSym:
    9004                 :     3143226 :         pSym->Procedure.At.ModDeclared = tok;
    9005                 :     3143226 :         break;
    9006                 :             : 
    9007                 :           0 :       case SymbolTable_ProcTypeSym:
    9008                 :           0 :         pSym->ProcType.At.ModDeclared = tok;
    9009                 :           0 :         break;
    9010                 :             : 
    9011                 :           0 :       case SymbolTable_ConstStringSym:
    9012                 :           0 :         pSym->ConstString.At.ModDeclared = tok;
    9013                 :           0 :         break;
    9014                 :             : 
    9015                 :           0 :       case SymbolTable_ConstLitSym:
    9016                 :           0 :         pSym->ConstLit.At.ModDeclared = tok;
    9017                 :           0 :         break;
    9018                 :             : 
    9019                 :        7096 :       case SymbolTable_ConstVarSym:
    9020                 :        7096 :         pSym->ConstVar.At.ModDeclared = tok;
    9021                 :        7096 :         break;
    9022                 :             : 
    9023                 :     3539810 :       case SymbolTable_VarSym:
    9024                 :     3539810 :         pSym->Var.At.ModDeclared = tok;
    9025                 :     3539810 :         break;
    9026                 :             : 
    9027                 :           0 :       case SymbolTable_TypeSym:
    9028                 :           0 :         pSym->Type.At.ModDeclared = tok;
    9029                 :           0 :         break;
    9030                 :             : 
    9031                 :           0 :       case SymbolTable_PointerSym:
    9032                 :           0 :         pSym->Pointer.At.ModDeclared = tok;
    9033                 :           0 :         break;
    9034                 :             : 
    9035                 :      248878 :       case SymbolTable_RecordFieldSym:
    9036                 :      248878 :         pSym->RecordField.At.ModDeclared = tok;
    9037                 :      248878 :         break;
    9038                 :             : 
    9039                 :           0 :       case SymbolTable_VarientFieldSym:
    9040                 :           0 :         pSym->VarientField.At.ModDeclared = tok;
    9041                 :           0 :         break;
    9042                 :             : 
    9043                 :           0 :       case SymbolTable_EnumerationFieldSym:
    9044                 :           0 :         pSym->EnumerationField.At.ModDeclared = tok;
    9045                 :           0 :         break;
    9046                 :             : 
    9047                 :           0 :       case SymbolTable_SetSym:
    9048                 :           0 :         pSym->Set.At.ModDeclared = tok;
    9049                 :           0 :         break;
    9050                 :             : 
    9051                 :     5810378 :       case SymbolTable_DefImpSym:
    9052                 :     5810378 :         pSym->DefImp.At.ModDeclared = tok;
    9053                 :     5810378 :         break;
    9054                 :             : 
    9055                 :       58644 :       case SymbolTable_ModuleSym:
    9056                 :       58644 :         pSym->Module.At.ModDeclared = tok;
    9057                 :       58644 :         break;
    9058                 :             : 
    9059                 :             :       case SymbolTable_UndefinedSym:
    9060                 :             :         break;
    9061                 :             : 
    9062                 :           0 :       case SymbolTable_PartialUnboundedSym:
    9063                 :           0 :         PutDeclaredModule (tok, pSym->PartialUnbounded.Type);
    9064                 :           0 :         break;
    9065                 :             : 
    9066                 :             : 
    9067                 :           0 :       default:
    9068                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type of symbol", 33);
    9069                 :    12907010 :         break;
    9070                 :             :     }
    9071                 :    12907010 : }
    9072                 :             : 
    9073                 :             : 
    9074                 :             : /*
    9075                 :             :    DoIsConst - returns TRUE if Sym is defined as a constant
    9076                 :             :                or is an enumeration field or string.
    9077                 :             : */
    9078                 :             : 
    9079                 :   233618663 : static bool DoIsConst (unsigned int Sym)
    9080                 :             : {
    9081                 :   233618663 :   SymbolTable_PtrToSymbol pSym;
    9082                 :             : 
    9083                 :   233618663 :   pSym = GetPsym (Sym);
    9084                 :   233618663 :   return ((((pSym->SymbolType == SymbolTable_ConstVarSym) || (pSym->SymbolType == SymbolTable_ConstLitSym)) || (pSym->SymbolType == SymbolTable_ConstStringSym)) || ((pSym->SymbolType == SymbolTable_VarSym) && (pSym->Var.AddrMode == SymbolTable_ImmediateValue))) || (pSym->SymbolType == SymbolTable_EnumerationFieldSym);
    9085                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9086                 :             :   __builtin_unreachable ();
    9087                 :             : }
    9088                 :             : 
    9089                 :             : 
    9090                 :             : /*
    9091                 :             :    GetFromIndex - return a value from list, i, at position, n.
    9092                 :             : */
    9093                 :             : 
    9094                 :     7675929 : static unsigned int GetFromIndex (Indexing_Index i, unsigned int n)
    9095                 :             : {
    9096                 :     7675929 :   typedef unsigned int *GetFromIndex__T2;
    9097                 :             : 
    9098                 :     7675929 :   GetFromIndex__T2 p;
    9099                 :             : 
    9100                 :     6625408 :   p = static_cast<GetFromIndex__T2> (Indexing_GetIndice (i, n));
    9101                 :     6625408 :   return (*p);
    9102                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9103                 :             :   __builtin_unreachable ();
    9104                 :             : }
    9105                 :             : 
    9106                 :             : 
    9107                 :             : /*
    9108                 :             :    PutIntoIndex - places value, v, into list, i, at position, n.
    9109                 :             : */
    9110                 :             : 
    9111                 :      332908 : static void PutIntoIndex (Indexing_Index *i, unsigned int n, unsigned int v)
    9112                 :             : {
    9113                 :      332908 :   typedef unsigned int *PutIntoIndex__T3;
    9114                 :             : 
    9115                 :      332908 :   PutIntoIndex__T3 p;
    9116                 :             : 
    9117                 :      332908 :   Storage_ALLOCATE ((void **) &p, sizeof (unsigned int));
    9118                 :      332908 :   (*p) = v;
    9119                 :      332908 :   Indexing_PutIndice ((*i), n, reinterpret_cast <void *> (p));
    9120                 :      332908 : }
    9121                 :             : 
    9122                 :             : 
    9123                 :             : /*
    9124                 :             :    PushConstString - pushes the character string onto the ALU stack.
    9125                 :             :                      It assumes that the character string is only
    9126                 :             :                      one character long.
    9127                 :             : */
    9128                 :             : 
    9129                 :       32952 : static void PushConstString (unsigned int Sym)
    9130                 :             : {
    9131                 :       32952 :   typedef struct PushConstString__T7_a PushConstString__T7;
    9132                 :             : 
    9133                 :       32952 :   struct PushConstString__T7_a { char array[10+1]; };
    9134                 :       32952 :   SymbolTable_PtrToSymbol pSym;
    9135                 :       32952 :   PushConstString__T7 a;
    9136                 :             : 
    9137                 :       32952 :   AssertInRange (Sym);
    9138                 :       32952 :   pSym = GetPsym (Sym);
    9139                 :       32952 :   switch (pSym->SymbolType)
    9140                 :             :     {
    9141                 :       32952 :       case SymbolTable_ConstStringSym:
    9142                 :       32952 :         if (pSym->ConstString.Length == 0)
    9143                 :             :           {
    9144                 :           6 :             M2ALU_PushChar (ASCII_nul);
    9145                 :             :           }
    9146                 :       32946 :         else if (pSym->ConstString.Length == 1)
    9147                 :             :           {
    9148                 :             :             /* avoid dangling else.  */
    9149                 :       32946 :             NameKey_GetKey (pSym->ConstString.Contents, (char *) &a.array[0], 10);
    9150                 :       32946 :             M2ALU_PushChar (a.array[0]);
    9151                 :             :           }
    9152                 :             :         else
    9153                 :             :           {
    9154                 :             :             /* avoid dangling else.  */
    9155                 :           0 :             M2Error_WriteFormat0 ((const char *) "ConstString must be length 0 or 1", 33);
    9156                 :             :           }
    9157                 :       32952 :         break;
    9158                 :             : 
    9159                 :             : 
    9160                 :           0 :       default:
    9161                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
    9162                 :       32952 :         break;
    9163                 :             :     }
    9164                 :       32952 : }
    9165                 :             : 
    9166                 :             : 
    9167                 :             : /*
    9168                 :             :    FinalSymbol - returns the highest number symbol used.
    9169                 :             : */
    9170                 :             : 
    9171                 :  5438989322 : extern "C" unsigned int SymbolTable_FinalSymbol (void)
    9172                 :             : {
    9173                 :  5438989322 :   return FreeSymbol-1;
    9174                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9175                 :             :   __builtin_unreachable ();
    9176                 :             : }
    9177                 :             : 
    9178                 :             : 
    9179                 :             : /*
    9180                 :             :    MakeComponentRecord - make a temporary which will be used to reference and field
    9181                 :             :                          (or sub field) of record.
    9182                 :             : */
    9183                 :             : 
    9184                 :      147866 : extern "C" unsigned int SymbolTable_MakeComponentRecord (unsigned int tok, SymbolTable_ModeOfAddr Mode, unsigned int record)
    9185                 :             : {
    9186                 :      147866 :   return buildTemporary (tok, Mode, true, record);
    9187                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9188                 :             :   __builtin_unreachable ();
    9189                 :             : }
    9190                 :             : 
    9191                 :             : 
    9192                 :             : /*
    9193                 :             :    MakeComponentRef - use, sym, to reference, field, sym is returned.
    9194                 :             : */
    9195                 :             : 
    9196                 :      147866 : extern "C" unsigned int SymbolTable_MakeComponentRef (unsigned int sym, unsigned int field)
    9197                 :             : {
    9198                 :      147866 :   SymbolTable_PtrToSymbol pSym;
    9199                 :      147866 :   unsigned int high;
    9200                 :             : 
    9201                 :      147866 :   pSym = GetPsym (sym);
    9202                 :      147866 :   switch (pSym->SymbolType)
    9203                 :             :     {
    9204                 :      147866 :       case SymbolTable_VarSym:
    9205                 :      147866 :         if (! pSym->Var.IsTemp)
    9206                 :             :           {
    9207                 :           0 :             M2Error_InternalError ((const char *) "variable must be a temporary", 28);
    9208                 :             :           }
    9209                 :      147866 :         else if (pSym->Var.IsComponentRef)
    9210                 :             :           {
    9211                 :             :             /* avoid dangling else.  */
    9212                 :      147866 :             high = Indexing_HighIndice (pSym->Var.list);
    9213                 :      147866 :             PutIntoIndex (&pSym->Var.list, high+1, field);
    9214                 :             :           }
    9215                 :             :         else
    9216                 :             :           {
    9217                 :             :             /* avoid dangling else.  */
    9218                 :           0 :             M2Error_InternalError ((const char *) "temporary is not a component reference", 38);
    9219                 :             :           }
    9220                 :      147866 :         break;
    9221                 :             : 
    9222                 :             : 
    9223                 :           0 :       default:
    9224                 :           0 :         M2Error_InternalError ((const char *) "expecting a variable symbol", 27);
    9225                 :      147866 :         break;
    9226                 :             :     }
    9227                 :      147866 :   return sym;
    9228                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9229                 :             :   __builtin_unreachable ();
    9230                 :             : }
    9231                 :             : 
    9232                 :             : 
    9233                 :             : /*
    9234                 :             :    IsComponent - returns TRUE if symbol, sym, is a temporary and a component
    9235                 :             :                  reference.
    9236                 :             : */
    9237                 :             : 
    9238                 :   416237892 : extern "C" bool SymbolTable_IsComponent (unsigned int sym)
    9239                 :             : {
    9240                 :   416237892 :   SymbolTable_PtrToSymbol pSym;
    9241                 :             : 
    9242                 :   416237892 :   pSym = GetPsym (sym);
    9243                 :   416237892 :   switch (pSym->SymbolType)
    9244                 :             :     {
    9245                 :     2711881 :       case SymbolTable_VarSym:
    9246                 :     2711881 :         return pSym->Var.IsComponentRef;
    9247                 :             :         break;
    9248                 :             : 
    9249                 :             : 
    9250                 :             :       default:
    9251                 :             :         return false;
    9252                 :             :         break;
    9253                 :             :     }
    9254                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9255                 :             :   __builtin_unreachable ();
    9256                 :             : }
    9257                 :             : 
    9258                 :             : 
    9259                 :             : /*
    9260                 :             :    MakeTemporary - Makes a new temporary variable at the highest real scope.
    9261                 :             :                    The addressing mode of the temporary is set to NoValue.
    9262                 :             : */
    9263                 :             : 
    9264                 :     1023549 : extern "C" unsigned int SymbolTable_MakeTemporary (unsigned int tok, SymbolTable_ModeOfAddr Mode)
    9265                 :             : {
    9266                 :     1023549 :   tok = CheckTok (tok, (const char *) "temporary", 9);
    9267                 :     1023549 :   return buildTemporary (tok, Mode, false, SymbolTable_NulSym);
    9268                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9269                 :             :   __builtin_unreachable ();
    9270                 :             : }
    9271                 :             : 
    9272                 :             : 
    9273                 :             : /*
    9274                 :             :    MakeTemporaryFromExpression - makes a new temporary variable at the
    9275                 :             :                                  highest real scope.  The addressing
    9276                 :             :                                  mode of the temporary is set and the
    9277                 :             :                                  type is determined by expressions, e.
    9278                 :             : */
    9279                 :             : 
    9280                 :           0 : extern "C" unsigned int SymbolTable_MakeTemporaryFromExpression (unsigned int tok, unsigned int e, SymbolTable_ModeOfAddr mode)
    9281                 :             : {
    9282                 :           0 :   return SymbolTable_MakeTemporaryFromExpressions (tok, e, e, mode);
    9283                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9284                 :             :   __builtin_unreachable ();
    9285                 :             : }
    9286                 :             : 
    9287                 :             : 
    9288                 :             : /*
    9289                 :             :    MakeTemporaryFromExpressions - makes a new temporary variable at the
    9290                 :             :                                   highest real scope.  The addressing
    9291                 :             :                                   mode of the temporary is set and the
    9292                 :             :                                   type is determined by expressions,
    9293                 :             :                                   e1 and e2.
    9294                 :             : */
    9295                 :             : 
    9296                 :       77804 : extern "C" unsigned int SymbolTable_MakeTemporaryFromExpressions (unsigned int tok, unsigned int e1, unsigned int e2, SymbolTable_ModeOfAddr mode)
    9297                 :             : {
    9298                 :       77804 :   SymbolTable_PtrToSymbol pSym;
    9299                 :       77804 :   DynamicStrings_String s;
    9300                 :       77804 :   unsigned int t;
    9301                 :       77804 :   unsigned int Sym;
    9302                 :             : 
    9303                 :       77804 :   TemporaryNo += 1;
    9304                 :             :   /* Make the name  */
    9305                 :       77804 :   s = FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_T%d", 4)), (const unsigned char *) &TemporaryNo, (sizeof (TemporaryNo)-1));
    9306                 :       77804 :   if (mode == SymbolTable_ImmediateValue)
    9307                 :             :     {
    9308                 :       34500 :       Sym = SymbolTable_MakeConstVar (tok, NameKey_makekey (DynamicStrings_string (s)));
    9309                 :       34500 :       if (SymbolTable_IsConstructor (e1))
    9310                 :             :         {
    9311                 :         218 :           SymbolTable_PutConstructor (Sym);
    9312                 :         218 :           SymbolTable_PutConstructorFrom (Sym, e1);
    9313                 :             :         }
    9314                 :       34282 :       else if (SymbolTable_IsConstructor (e2))
    9315                 :             :         {
    9316                 :             :           /* avoid dangling else.  */
    9317                 :          12 :           SymbolTable_PutConstructor (Sym);
    9318                 :          12 :           SymbolTable_PutConstructorFrom (Sym, e2);
    9319                 :             :         }
    9320                 :             :       else
    9321                 :             :         {
    9322                 :             :           /* avoid dangling else.  */
    9323                 :       34270 :           SymbolTable_PutVar (Sym, M2Base_MixTypes (SymbolTable_GetType (e1), SymbolTable_GetType (e2), tok));
    9324                 :             :         }
    9325                 :       34500 :       PutConstVarTemporary (Sym);
    9326                 :             :     }
    9327                 :             :   else
    9328                 :             :     {
    9329                 :       43304 :       Sym = SymbolTable_MakeVar (tok, NameKey_makekey (DynamicStrings_string (s)));
    9330                 :       43304 :       pSym = GetPsym (Sym);
    9331                 :       43304 :       switch (pSym->SymbolType)
    9332                 :             :         {
    9333                 :       43304 :           case SymbolTable_VarSym:
    9334                 :       43304 :             pSym->Var.AddrMode = mode;
    9335                 :       43304 :             pSym->Var.IsComponentRef = false;
    9336                 :       43304 :             pSym->Var.IsTemp = true;  /* Variable is a temporary var  */
    9337                 :             :             /* Declared here  */
    9338                 :       43304 :             InitWhereDeclaredTok (tok, &pSym->Var.At);
    9339                 :       43304 :             break;
    9340                 :             : 
    9341                 :             : 
    9342                 :           0 :           default:
    9343                 :           0 :             M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
    9344                 :       43304 :             break;
    9345                 :             :         }
    9346                 :       43304 :       t = M2Base_MixTypesDecl (e1, e2, SymbolTable_GetType (e1), SymbolTable_GetType (e2), tok);
    9347                 :       43196 :       if (t != SymbolTable_NulSym)
    9348                 :             :         {
    9349                 :       43184 :           M2Debug_Assert (! (SymbolTable_IsConstructor (t)));
    9350                 :       43184 :           SymbolTable_PutVar (Sym, t);
    9351                 :             :         }
    9352                 :             :     }
    9353                 :       77696 :   s = DynamicStrings_KillString (s);
    9354                 :       77696 :   return Sym;
    9355                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9356                 :             :   __builtin_unreachable ();
    9357                 :             : }
    9358                 :             : 
    9359                 :             : 
    9360                 :             : /*
    9361                 :             :    PutMode - Puts the addressing mode, SymMode, into symbol Sym.
    9362                 :             :              The mode may only be altered if the mode
    9363                 :             :              is None.
    9364                 :             : */
    9365                 :             : 
    9366                 :     8923617 : extern "C" void SymbolTable_PutMode (unsigned int Sym, SymbolTable_ModeOfAddr SymMode)
    9367                 :             : {
    9368                 :     8923617 :   SymbolTable_PtrToSymbol pSym;
    9369                 :             : 
    9370                 :     8923617 :   pSym = GetPsym (Sym);
    9371                 :     8923617 :   switch (pSym->SymbolType)
    9372                 :             :     {
    9373                 :             :       case SymbolTable_ErrorSym:
    9374                 :             :         break;
    9375                 :             : 
    9376                 :     8923617 :       case SymbolTable_VarSym:
    9377                 :     8923617 :         pSym->Var.AddrMode = SymMode;
    9378                 :     8923617 :         break;
    9379                 :             : 
    9380                 :             : 
    9381                 :           0 :       default:
    9382                 :           0 :         M2Error_InternalError ((const char *) "Expecting VarSym", 16);
    9383                 :     8923617 :         break;
    9384                 :             :     }
    9385                 :     8923617 : }
    9386                 :             : 
    9387                 :             : 
    9388                 :             : /*
    9389                 :             :    GetMode - Returns the addressing mode of a symbol.
    9390                 :             : */
    9391                 :             : 
    9392                 :    10561120 : extern "C" SymbolTable_ModeOfAddr SymbolTable_GetMode (unsigned int Sym)
    9393                 :             : {
    9394                 :    10561120 :   SymbolTable_PtrToSymbol pSym;
    9395                 :             : 
    9396                 :    10561120 :   pSym = GetPsym (Sym);
    9397                 :    10561120 :   switch (pSym->SymbolType)
    9398                 :             :     {
    9399                 :           6 :       case SymbolTable_ErrorSym:
    9400                 :           6 :         M2Error_ErrorAbort0 ((const char *) "", 0);
    9401                 :     8554801 :         break;
    9402                 :             : 
    9403                 :     8554801 :       case SymbolTable_VarSym:
    9404                 :     8554801 :         return pSym->Var.AddrMode;
    9405                 :             :         break;
    9406                 :             : 
    9407                 :             :       case SymbolTable_ConstLitSym:
    9408                 :             :         return SymbolTable_ImmediateValue;
    9409                 :             :         break;
    9410                 :             : 
    9411                 :             :       case SymbolTable_ConstVarSym:
    9412                 :             :         return SymbolTable_ImmediateValue;
    9413                 :             :         break;
    9414                 :             : 
    9415                 :             :       case SymbolTable_ConstStringSym:
    9416                 :             :         return SymbolTable_ImmediateValue;
    9417                 :             :         break;
    9418                 :             : 
    9419                 :             :       case SymbolTable_EnumerationFieldSym:
    9420                 :             :         return SymbolTable_ImmediateValue;
    9421                 :             :         break;
    9422                 :             : 
    9423                 :             :       case SymbolTable_ProcedureSym:
    9424                 :             :         return SymbolTable_ImmediateValue;
    9425                 :             :         break;
    9426                 :             : 
    9427                 :             :       case SymbolTable_RecordFieldSym:
    9428                 :             :         return SymbolTable_ImmediateValue;
    9429                 :             :         break;
    9430                 :             : 
    9431                 :             :       case SymbolTable_VarientFieldSym:
    9432                 :             :         return SymbolTable_ImmediateValue;
    9433                 :             :         break;
    9434                 :             : 
    9435                 :             :       case SymbolTable_TypeSym:
    9436                 :             :         return SymbolTable_NoValue;
    9437                 :             :         break;
    9438                 :             : 
    9439                 :             :       case SymbolTable_ArraySym:
    9440                 :             :         return SymbolTable_NoValue;
    9441                 :             :         break;
    9442                 :             : 
    9443                 :             :       case SymbolTable_SubrangeSym:
    9444                 :             :         return SymbolTable_NoValue;
    9445                 :             :         break;
    9446                 :             : 
    9447                 :             :       case SymbolTable_EnumerationSym:
    9448                 :             :         return SymbolTable_NoValue;
    9449                 :             :         break;
    9450                 :             : 
    9451                 :             :       case SymbolTable_RecordSym:
    9452                 :             :         return SymbolTable_NoValue;
    9453                 :             :         break;
    9454                 :             : 
    9455                 :             :       case SymbolTable_PointerSym:
    9456                 :             :         return SymbolTable_NoValue;
    9457                 :             :         break;
    9458                 :             : 
    9459                 :             :       case SymbolTable_SetSym:
    9460                 :             :         return SymbolTable_NoValue;
    9461                 :             :         break;
    9462                 :             : 
    9463                 :             :       case SymbolTable_ProcTypeSym:
    9464                 :             :         return SymbolTable_NoValue;
    9465                 :             :         break;
    9466                 :             : 
    9467                 :             :       case SymbolTable_UnboundedSym:
    9468                 :             :         return SymbolTable_NoValue;
    9469                 :             :         break;
    9470                 :             : 
    9471                 :             :       case SymbolTable_UndefinedSym:
    9472                 :             :         return SymbolTable_NoValue;
    9473                 :           0 :         break;
    9474                 :             : 
    9475                 :             : 
    9476                 :           0 :       default:
    9477                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type", 23);
    9478                 :             :         break;
    9479                 :             :     }
    9480                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    9481                 :             :   __builtin_unreachable ();
    9482                 :             : }
    9483                 :             : 
    9484                 :             : 
    9485                 :             : /*
    9486                 :             :    StartScope - starts a block scope at Sym. Transparent determines
    9487                 :             :                 whether the search for a symbol will look at the
    9488                 :             :                 previous ScopeCallFrame if Sym does not contain the
    9489                 :             :                 symbol that GetSym is searching.
    9490                 :             : 
    9491                 :             :                 WITH statements are partially implemented by calling
    9492                 :             :                 StartScope. Therefore we must retain the old Main from
    9493                 :             :                 the previous ScopePtr when a record is added to the scope
    9494                 :             :                 stack. (Main contains the symbol where all identifiers
    9495                 :             :                 should be added.)
    9496                 :             : */
    9497                 :             : 
    9498                 :    31372988 : extern "C" void SymbolTable_StartScope (unsigned int Sym)
    9499                 :             : {
    9500                 :    31372988 :   SymbolTable_PtrToCallFrame oCall;
    9501                 :    31372988 :   SymbolTable_PtrToCallFrame pCall;
    9502                 :             : 
    9503                 :    31372988 :   Sym = SymbolTable_SkipType (Sym);
    9504                 :             :   /* 
    9505                 :             :    WriteString('New scope is: ') ; WriteKey(GetSymName(Sym)) ; WriteLn ;
    9506                 :             :   */
    9507                 :    31372988 :   ScopePtr += 1;
    9508                 :    31372988 :   if (Indexing_InBounds (ScopeCallFrame, ScopePtr))
    9509                 :             :     {
    9510                 :    31306022 :       pCall = GetPcall (ScopePtr);
    9511                 :             :     }
    9512                 :             :   else
    9513                 :             :     {
    9514                 :       66966 :       Storage_ALLOCATE ((void **) &pCall, sizeof (SymbolTable_CallFrame));
    9515                 :       66966 :       Indexing_PutIndice (ScopeCallFrame, ScopePtr, reinterpret_cast <void *> (pCall));
    9516                 :             :     }
    9517                 :    31372988 :   pCall->Start = ScopePtr-1;  /* Previous ScopePtr value before StartScope  */
    9518                 :    31372988 :   pCall->Search = Sym;
    9519                 :             :   /* new symbols to ie temporary variables.  */
    9520                 :    31372988 :   if (SymbolTable_IsRecord (Sym))
    9521                 :             :     {
    9522                 :       32982 :       oCall = GetPcall (ScopePtr-1);
    9523                 :       32982 :       pCall->Main = oCall->Main;
    9524                 :             :     }
    9525                 :             :   else
    9526                 :             :     {
    9527                 :    31340000 :       pCall->Main = Sym;
    9528                 :    31340000 :       PlaceMajorScopesEnumerationListOntoStack (Sym);
    9529                 :             :     }
    9530                 :    31372981 : }
    9531                 :             : 
    9532                 :             : 
    9533                 :             : /*
    9534                 :             :    EndScope - ends a block scope started by StartScope. The current
    9535                 :             :               head of the symbol scope reverts back to the symbol
    9536                 :             :               which was the Head of the symbol scope before the
    9537                 :             :               last StartScope was called.
    9538                 :             : */
    9539                 :             : 
    9540                 :    31357138 : extern "C" void SymbolTable_EndScope (void)
    9541                 :             : {
    9542                 :    31357138 :   SymbolTable_PtrToCallFrame pCall;
    9543                 :             : 
    9544                 :             :   /* 
    9545                 :             :    ; WriteString('EndScope - ending scope: ') ;
    9546                 :             :    pCall := GetPcall(ScopePtr) ;
    9547                 :             :    ; WriteKey(GetSymName(pCall^.Search)) ; WriteLn ;
    9548                 :             :   */
    9549                 :    31357138 :   pCall = GetPcall (ScopePtr);
    9550                 :             :   /* ; DisplayScopes  */
    9551                 :    31357138 :   ScopePtr = pCall->Start;
    9552                 :    31357138 : }
    9553                 :             : 
    9554                 :             : 
    9555                 :             : /*
    9556                 :             :    PseudoScope - starts a pseudo scope at Sym.
    9557                 :             :                  We always connect parent up to the last scope,
    9558                 :             :                  to determine the transparancy of a scope we call
    9559                 :             :                  TransparentScope.
    9560                 :             : 
    9561                 :             :                  A Pseudo scope has no end block,
    9562                 :             :                  but is terminated when the next EndScope is used.
    9563                 :             :                  The function of the pseudo scope is to provide an
    9564                 :             :                  automatic mechanism to solve enumeration types.
    9565                 :             :                  A declared enumeration type is a Pseudo scope and
    9566                 :             :                  identifiers used with the name of an enumeration
    9567                 :             :                  type field will find the enumeration symbol by
    9568                 :             :                  the scoping algorithm.
    9569                 :             : */
    9570                 :             : 
    9571                 :      634016 : extern "C" void SymbolTable_PseudoScope (unsigned int Sym)
    9572                 :             : {
    9573                 :      634016 :   SymbolTable_PtrToCallFrame oCall;
    9574                 :      634016 :   SymbolTable_PtrToCallFrame pCall;
    9575                 :             : 
    9576                 :      634016 :   if (SymbolTable_IsEnumeration (Sym))
    9577                 :             :     {
    9578                 :      634016 :       ScopePtr += 1;
    9579                 :      634016 :       if (Indexing_InBounds (ScopeCallFrame, ScopePtr))
    9580                 :             :         {
    9581                 :      614622 :           pCall = GetPcall (ScopePtr);
    9582                 :             :         }
    9583                 :             :       else
    9584                 :             :         {
    9585                 :       19394 :           Storage_ALLOCATE ((void **) &pCall, sizeof (SymbolTable_CallFrame));
    9586                 :       19394 :           Indexing_PutIndice (ScopeCallFrame, ScopePtr, reinterpret_cast <void *> (pCall));
    9587                 :             :         }
    9588                 :      634016 :       oCall = GetPcall (ScopePtr-1);
    9589                 :      634016 :       pCall->Main = oCall->Main;
    9590                 :      634016 :       pCall->Start = oCall->Start;
    9591                 :      634016 :       pCall->Search = Sym;
    9592                 :             :     }
    9593                 :             :   else
    9594                 :             :     {
    9595                 :           0 :       M2Error_InternalError ((const char *) "expecting EnumerationSym", 24);
    9596                 :             :     }
    9597                 :      634016 : }
    9598                 :             : 
    9599                 :             : 
    9600                 :             : /*
    9601                 :             :    GetCurrentScope - returns the symbol who is responsible for the current
    9602                 :             :                      scope. Note that it ignore pseudo scopes.
    9603                 :             : */
    9604                 :             : 
    9605                 :    40268803 : extern "C" unsigned int SymbolTable_GetCurrentScope (void)
    9606                 :             : {
    9607                 :    40268803 :   SymbolTable_PtrToCallFrame pCall;
    9608                 :             : 
    9609                 :    40268803 :   pCall = GetPcall (ScopePtr);
    9610                 :    40268803 :   return pCall->Main;
    9611                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9612                 :             :   __builtin_unreachable ();
    9613                 :             : }
    9614                 :             : 
    9615                 :             : 
    9616                 :             : /*
    9617                 :             :    IsDeclaredIn - returns TRUE if a symbol was declared in, scope.
    9618                 :             : */
    9619                 :             : 
    9620                 :      253882 : extern "C" bool SymbolTable_IsDeclaredIn (unsigned int scope, unsigned int sym)
    9621                 :             : {
    9622                 :      253882 :   unsigned int s;
    9623                 :             : 
    9624                 :      253882 :   s = SymbolTable_GetScope (sym);
    9625                 :      507764 :   while (s != scope)
    9626                 :             :     {
    9627                 :        1462 :       if ((((s == SymbolTable_NulSym) || (SymbolTable_IsProcedure (s))) || (SymbolTable_IsModule (s))) || (SymbolTable_IsDefImp (s)))
    9628                 :             :         {
    9629                 :        1462 :           return false;
    9630                 :             :         }
    9631                 :             :       else
    9632                 :             :         {
    9633                 :           0 :           s = SymbolTable_GetScope (s);
    9634                 :             :         }
    9635                 :             :     }
    9636                 :             :   return true;
    9637                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9638                 :             :   __builtin_unreachable ();
    9639                 :             : }
    9640                 :             : 
    9641                 :             : 
    9642                 :             : /*
    9643                 :             :    SetCurrentModule - Used to set the CurrentModule to a symbol, Sym.
    9644                 :             :                       This Sym must represent the module name of the
    9645                 :             :                       file currently being compiled.
    9646                 :             : */
    9647                 :             : 
    9648                 :     1283880 : extern "C" void SymbolTable_SetCurrentModule (unsigned int Sym)
    9649                 :             : {
    9650                 :     1283880 :   CurrentModule = Sym;
    9651                 :     1283880 : }
    9652                 :             : 
    9653                 :             : 
    9654                 :             : /*
    9655                 :             :    SetFileModule - Used to set the FileModule to a symbol, Sym.
    9656                 :             :                    This Sym must represent the current program module
    9657                 :             :                    file which is being parsed.
    9658                 :             : */
    9659                 :             : 
    9660                 :     1235670 : extern "C" void SymbolTable_SetFileModule (unsigned int Sym)
    9661                 :             : {
    9662                 :     1235670 :   FileModule = Sym;
    9663                 :     1235670 : }
    9664                 :             : 
    9665                 :             : 
    9666                 :             : /*
    9667                 :             :    SetMainModule - Used to set the MainModule to a symbol, Sym.
    9668                 :             :                    This Sym must represent the main module which was
    9669                 :             :                    envoked by the user to be compiled.
    9670                 :             : */
    9671                 :             : 
    9672                 :       15499 : extern "C" void SymbolTable_SetMainModule (unsigned int Sym)
    9673                 :             : {
    9674                 :       15499 :   MainModule = Sym;
    9675                 :       15499 : }
    9676                 :             : 
    9677                 :             : 
    9678                 :             : /*
    9679                 :             :    CheckAnonymous - checks to see whether the name is NulName and if so
    9680                 :             :                     it creates a unique anonymous name.
    9681                 :             : */
    9682                 :             : 
    9683                 :     1477925 : extern "C" NameKey_Name SymbolTable_CheckAnonymous (NameKey_Name name)
    9684                 :             : {
    9685                 :     1477925 :   if (name == NameKey_NulName)
    9686                 :             :     {
    9687                 :       64945 :       AnonymousName += 1;
    9688                 :       64945 :       name = NameKey_makekey (DynamicStrings_string (DynamicStrings_Mark (FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "__anon%d", 8)), (const unsigned char *) &AnonymousName, (sizeof (AnonymousName)-1)))));
    9689                 :             :     }
    9690                 :     1477925 :   return name;
    9691                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9692                 :             :   __builtin_unreachable ();
    9693                 :             : }
    9694                 :             : 
    9695                 :             : 
    9696                 :             : /*
    9697                 :             :    IsNameAnonymous - returns TRUE if the symbol, sym, has an anonymous name
    9698                 :             :                      or no name.
    9699                 :             : */
    9700                 :             : 
    9701                 :       56252 : extern "C" bool SymbolTable_IsNameAnonymous (unsigned int sym)
    9702                 :             : {
    9703                 :       56252 :   typedef struct IsNameAnonymous__T8_a IsNameAnonymous__T8;
    9704                 :             : 
    9705                 :       56252 :   struct IsNameAnonymous__T8_a { char array[5+1]; };
    9706                 :       56252 :   IsNameAnonymous__T8 a;
    9707                 :       56252 :   NameKey_Name n;
    9708                 :             : 
    9709                 :       56252 :   n = SymbolTable_GetSymName (sym);
    9710                 :       56252 :   if (n == NameKey_NulName)
    9711                 :             :     {
    9712                 :             :       return true;
    9713                 :             :     }
    9714                 :             :   else
    9715                 :             :     {
    9716                 :       55004 :       NameKey_GetKey (n, (char *) &a.array[0], 5);
    9717                 :       55004 :       return StrLib_StrEqual ((const char *) &a.array[0], 5, (const char *) "__anon", 6);
    9718                 :             :     }
    9719                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9720                 :             :   __builtin_unreachable ();
    9721                 :             : }
    9722                 :             : 
    9723                 :             : 
    9724                 :             : /*
    9725                 :             :    NoOfVariables - returns the number of variables in scope.  The scope maybe
    9726                 :             :                    a procedure, module or defimp scope.
    9727                 :             : */
    9728                 :             : 
    9729                 :          30 : extern "C" unsigned int SymbolTable_NoOfVariables (unsigned int scope)
    9730                 :             : {
    9731                 :          30 :   SymbolTable_PtrToSymbol pSym;
    9732                 :             : 
    9733                 :          30 :   if (SymbolTable_IsProcedure (scope))
    9734                 :             :     {
    9735                 :          30 :       return SymbolTable_NoOfLocalVar (scope);
    9736                 :             :     }
    9737                 :           0 :   else if (SymbolTable_IsModule (scope))
    9738                 :             :     {
    9739                 :             :       /* avoid dangling else.  */
    9740                 :           0 :       pSym = GetPsym (scope);
    9741                 :           0 :       switch (pSym->SymbolType)
    9742                 :             :         {
    9743                 :           0 :           case SymbolTable_ModuleSym:
    9744                 :           0 :             return Lists_NoOfItemsInList (pSym->Module.ListOfVars);
    9745                 :           0 :             break;
    9746                 :             : 
    9747                 :             : 
    9748                 :           0 :           default:
    9749                 :           0 :             M2Error_InternalError ((const char *) "expecting module symbol", 23);
    9750                 :           0 :             break;
    9751                 :             :         }
    9752                 :             :     }
    9753                 :           0 :   else if (SymbolTable_IsDefImp (scope))
    9754                 :             :     {
    9755                 :             :       /* avoid dangling else.  */
    9756                 :           0 :       pSym = GetPsym (scope);
    9757                 :           0 :       switch (pSym->SymbolType)
    9758                 :             :         {
    9759                 :           0 :           case SymbolTable_DefImpSym:
    9760                 :           0 :             return Lists_NoOfItemsInList (pSym->DefImp.ListOfVars);
    9761                 :           0 :             break;
    9762                 :             : 
    9763                 :             : 
    9764                 :           0 :           default:
    9765                 :           0 :             M2Error_InternalError ((const char *) "expecting defimp symbol", 23);
    9766                 :           0 :             break;
    9767                 :             :         }
    9768                 :             :     }
    9769                 :             :   else
    9770                 :             :     {
    9771                 :             :       /* avoid dangling else.  */
    9772                 :           0 :       M2Error_InternalError ((const char *) "expecting procedure, module or defimp symbol", 44);
    9773                 :             :     }
    9774                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
    9775                 :             :   __builtin_unreachable ();
    9776                 :             : }
    9777                 :             : 
    9778                 :             : 
    9779                 :             : /*
    9780                 :             :    MakeModule - creates a module sym with ModuleName. It returns the
    9781                 :             :                 symbol index.
    9782                 :             : */
    9783                 :             : 
    9784                 :       27338 : extern "C" unsigned int SymbolTable_MakeModule (unsigned int tok, NameKey_Name ModuleName)
    9785                 :             : {
    9786                 :       27338 :   SymbolTable_PtrToSymbol pSym;
    9787                 :       27338 :   SymbolTable_PtrToCallFrame pCall;
    9788                 :       27338 :   unsigned int Sym;
    9789                 :             : 
    9790                 :             :   /* 
    9791                 :             :       Make a new symbol since we are at the outer scope level.
    9792                 :             :       DeclareSym examines the current scope level for any symbols
    9793                 :             :       that have the correct name, but are yet undefined.
    9794                 :             :       Therefore we must not call DeclareSym but create a symbol
    9795                 :             :       directly.
    9796                 :             :   */
    9797                 :       27338 :   NewSym (&Sym);
    9798                 :       27338 :   pSym = GetPsym (Sym);
    9799                 :       27338 :   pSym->SymbolType = SymbolTable_ModuleSym;
    9800                 :       27338 :   pSym->Module.name = ModuleName;  /* Index into name array, name  */
    9801                 :             :   /* of record field.  */
    9802                 :       27338 :   pSym->Module.libname = NameKey_NulName;  /* Library association.  */
    9803                 :       27338 :   InitCtor (&pSym->Module.ctors);  /* Init all ctor functions.  */
    9804                 :       27338 :   Lists_InitList (&pSym->Module.ModListOfDep);  /* Vector of SymDependency.  */
    9805                 :       27338 :   SymbolKey_InitTree (&pSym->Module.LocalSymbols);  /* The LocalSymbols hold all the  */
    9806                 :             :   /* END WeAreHere.  */
    9807                 :       27338 :   SymbolKey_InitTree (&pSym->Module.ExportTree);  /* Holds all the exported  */
    9808                 :             :   /* deleted at the end of Pass 1.  */
    9809                 :       27338 :   SymbolKey_InitTree (&pSym->Module.ImportTree);  /* Contains all IMPORTed  */
    9810                 :             :   /* identifiers.  */
    9811                 :       27338 :   Lists_InitList (&pSym->Module.IncludeList);  /* Contains all included symbols  */
    9812                 :             :   /* modulename.Symbol  */
    9813                 :       27338 :   SymbolKey_InitTree (&pSym->Module.ExportUndeclared);  /* ExportUndeclared contains all  */
    9814                 :             :   /* been declared.  */
    9815                 :       27338 :   Lists_InitList (&pSym->Module.EnumerationScopeList);  /* Enumeration scope list which  */
    9816                 :             :   /* Outer Module.  */
    9817                 :       27338 :   SymbolKey_InitTree (&pSym->Module.NamedObjects);  /* Names of all items declared.  */
    9818                 :       27338 :   SymbolKey_InitTree (&pSym->Module.NamedImports);  /* Names of items imported.  */
    9819                 :       27338 :   SymbolKey_InitTree (&pSym->Module.WhereImported);  /* Sym to TokenNo where import  */
    9820                 :             :   /* occurs. Error message use.  */
    9821                 :       27338 :   pSym->Module.Priority = SymbolTable_NulSym;  /* Priority of the module. This  */
    9822                 :             :   /* is an index to a constant.  */
    9823                 :       27338 :   SymbolKey_InitTree (&pSym->Module.Unresolved);  /* All symbols currently  */
    9824                 :             :   /* unresolved in this module.  */
    9825                 :       27338 :   pSym->Module.StartQuad = 0;  /* Signify the initialization  */
    9826                 :             :   /* code.  */
    9827                 :       27338 :   pSym->Module.EndQuad = 0;  /* EndQuad should point to a  */
    9828                 :             :   /* goto quad.  */
    9829                 :       27338 :   pSym->Module.StartFinishQuad = 0;  /* Signify the finalization  */
    9830                 :             :   /* code.  */
    9831                 :       27338 :   pSym->Module.EndFinishQuad = 0;  /* should point to a finish  */
    9832                 :       27338 :   pSym->Module.FinallyFunction = NULL;  /* The GCC function for finally  */
    9833                 :       27338 :   pSym->Module.ExceptionFinally = false;  /* does it have an exception?  */
    9834                 :       27338 :   pSym->Module.ExceptionBlock = false;  /* does it have an exception?  */
    9835                 :       27338 :   pSym->Module.ModLink = GetLink ();  /* Is this parsed for linkage?  */
    9836                 :       27338 :   pSym->Module.Builtin = false;  /* Is the module builtin?  */
    9837                 :       27338 :   Lists_InitList (&pSym->Module.ListOfVars);  /* List of variables in this  */
    9838                 :             :   /* scope.  */
    9839                 :       27338 :   Lists_InitList (&pSym->Module.ListOfProcs);  /* List of all procedures  */
    9840                 :             :   /* declared within this module.  */
    9841                 :       27338 :   Lists_InitList (&pSym->Module.ListOfModules);  /* List of all inner modules.  */
    9842                 :       27338 :   InitWhereDeclaredTok (tok, &pSym->Module.At);  /* Where symbol declared.  */
    9843                 :       27338 :   InitWhereFirstUsedTok (tok, &pSym->Module.At);  /* Where symbol first used.  */
    9844                 :       27338 :   pCall = GetPcall (ScopePtr);  /* Where symbol first used.  */
    9845                 :       27338 :   if (pCall->Main == (SymbolTable_GetBaseModule ()))
    9846                 :             :     {
    9847                 :       27338 :       pSym->Module.Scope = SymbolTable_NulSym;
    9848                 :             :     }
    9849                 :             :   else
    9850                 :             :     {
    9851                 :           0 :       pSym->Module.Scope = pCall->Main;
    9852                 :             :     }
    9853                 :       27338 :   pSym->Module.errorScope = M2Error_GetCurrentErrorScope ();  /* Title error scope.  */
    9854                 :       27338 :   SymbolKey_PutSymKey (ModuleTree, ModuleName, Sym);  /* Title error scope.  */
    9855                 :       27338 :   return Sym;
    9856                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9857                 :             :   __builtin_unreachable ();
    9858                 :             : }
    9859                 :             : 
    9860                 :             : 
    9861                 :             : /*
    9862                 :             :    MakeDefImp - creates a definition and implementation module sym
    9863                 :             :                 with name DefImpName.  It returns the symbol index.
    9864                 :             : */
    9865                 :             : 
    9866                 :      176795 : extern "C" unsigned int SymbolTable_MakeDefImp (unsigned int tok, NameKey_Name DefImpName)
    9867                 :             : {
    9868                 :      176795 :   SymbolTable_PtrToSymbol pSym;
    9869                 :      176795 :   unsigned int Sym;
    9870                 :             : 
    9871                 :             :   /* tok := CheckTok (tok, 'defimp') ;  */
    9872                 :      176795 :   NewSym (&Sym);
    9873                 :      176795 :   pSym = GetPsym (Sym);
    9874                 :      176795 :   pSym->SymbolType = SymbolTable_DefImpSym;
    9875                 :      176795 :   pSym->DefImp.name = DefImpName;  /* Index into name array, name  */
    9876                 :             :   /* of record field.  */
    9877                 :      176795 :   pSym->DefImp.libname = NameKey_NulName;  /* Library association.  */
    9878                 :      176795 :   InitCtor (&pSym->DefImp.ctors);
    9879                 :             :   /* Init all ctor functions.  */
    9880                 :      176795 :   Lists_InitList (&pSym->DefImp.DefListOfDep);  /* Vector of SymDependency.  */
    9881                 :      176795 :   Lists_InitList (&pSym->DefImp.ModListOfDep);  /* Vector of SymDependency.  */
    9882                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.ExportQualifiedTree);
    9883                 :             :   /* deleted at the end of Pass 1.  */
    9884                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.ExportUnQualifiedTree);
    9885                 :             :   /* deleted at the end of Pass 1.  */
    9886                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.ExportRequest);  /* Contains all identifiers that  */
    9887                 :             :   /* this list.  */
    9888                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.ImportTree);  /* Contains all IMPORTed  */
    9889                 :             :   /* identifiers.  */
    9890                 :      176795 :   Lists_InitList (&pSym->DefImp.IncludeList);  /* Contains all included symbols  */
    9891                 :             :   /* modulename.Symbol  */
    9892                 :      176795 :   Lists_InitList (&pSym->DefImp.DefIncludeList);  /* Contains all included symbols  */
    9893                 :             :   /* in the definition module only  */
    9894                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.ExportUndeclared);  /* ExportUndeclared contains all  */
    9895                 :             :   /* been declared.  */
    9896                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.NeedToBeImplemented);
    9897                 :             :   /* implemented.  */
    9898                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.LocalSymbols);  /* The LocalSymbols hold all the  */
    9899                 :             :   /* END WeAreHere.  */
    9900                 :      176795 :   Lists_InitList (&pSym->DefImp.EnumerationScopeList);
    9901                 :             :   /* visable within this scope.  */
    9902                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.NamedObjects);  /* names of all items declared.  */
    9903                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.NamedImports);  /* Names of items imported.  */
    9904                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.WhereImported);  /* Sym to TokenNo where import  */
    9905                 :             :   /* occurs. Error message use.  */
    9906                 :      176795 :   pSym->DefImp.Priority = SymbolTable_NulSym;  /* Priority of the module. This  */
    9907                 :             :   /* is an index to a constant.  */
    9908                 :      176795 :   SymbolKey_InitTree (&pSym->DefImp.Unresolved);  /* All symbols currently  */
    9909                 :             :   /* unresolved in this module.  */
    9910                 :      176795 :   pSym->DefImp.StartQuad = 0;  /* Signify the initialization  */
    9911                 :             :   /* code.  */
    9912                 :      176795 :   pSym->DefImp.EndQuad = 0;  /* EndQuad should point to a  */
    9913                 :             :   /* goto quad.  */
    9914                 :      176795 :   pSym->DefImp.StartFinishQuad = 0;  /* Signify the finalization  */
    9915                 :             :   /* code.  */
    9916                 :      176795 :   pSym->DefImp.EndFinishQuad = 0;  /* should point to a finish  */
    9917                 :      176795 :   pSym->DefImp.FinallyFunction = NULL;  /* The GCC function for finally  */
    9918                 :      176795 :   pSym->DefImp.ExceptionFinally = false;  /* does it have an exception?  */
    9919                 :      176795 :   pSym->DefImp.ExceptionBlock = false;  /* does it have an exception?  */
    9920                 :      176795 :   pSym->DefImp.ContainsHiddenType = false;  /* True if this module  */
    9921                 :             :   /* implements a hidden type.  */
    9922                 :      176795 :   pSym->DefImp.ContainsBuiltin = false;  /* Does module define a builtin  */
    9923                 :             :   /* procedure?  */
    9924                 :      176795 :   pSym->DefImp.ForC = false;  /* Is it a definition for "C"  */
    9925                 :      176795 :   pSym->DefImp.NeedExportList = false;  /* Must user supply export list?  */
    9926                 :      176795 :   pSym->DefImp.DefLink = GetLink ();  /* Is the def/mod file only  */
    9927                 :      176795 :   pSym->DefImp.ModLink = GetLink ();  /* parsed for linkage?  */
    9928                 :      176795 :   pSym->DefImp.Builtin = false;  /* Is the module builtin?  */
    9929                 :      176795 :   Lists_InitList (&pSym->DefImp.ListOfVars);  /* List of variables in this  */
    9930                 :             :   /* scope.  */
    9931                 :      176795 :   Lists_InitList (&pSym->DefImp.ListOfProcs);  /* List of all procedures  */
    9932                 :             :   /* declared within this module.  */
    9933                 :      176795 :   Lists_InitList (&pSym->DefImp.ListOfModules);  /* List of all inner modules.  */
    9934                 :      176795 :   InitWhereDeclaredTok (tok, &pSym->DefImp.At);  /* Where symbol declared.  */
    9935                 :      176795 :   InitWhereFirstUsedTok (tok, &pSym->DefImp.At);  /* Where symbol first used.  */
    9936                 :      176795 :   pSym->DefImp.errorScope = M2Error_GetCurrentErrorScope ();  /* Title error scope.  */
    9937                 :      176795 :   SymbolKey_PutSymKey (ModuleTree, DefImpName, Sym);  /* Title error scope.  */
    9938                 :      176795 :   return Sym;
    9939                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    9940                 :             :   __builtin_unreachable ();
    9941                 :             : }
    9942                 :             : 
    9943                 :             : 
    9944                 :             : /*
    9945                 :             :    MakeInnerModule - creates an inner module sym with ModuleName. It returns the
    9946                 :             :                      symbol index.
    9947                 :             : */
    9948                 :             : 
    9949                 :         426 : extern "C" unsigned int SymbolTable_MakeInnerModule (unsigned int tok, NameKey_Name ModuleName)
    9950                 :             : {
    9951                 :         426 :   SymbolTable_PtrToSymbol pSym;
    9952                 :         426 :   unsigned int Sym;
    9953                 :             : 
    9954                 :         426 :   Sym = DeclareSym (tok, ModuleName);
    9955                 :         426 :   if (! (SymbolTable_IsError (Sym)))
    9956                 :             :     {
    9957                 :         426 :       pSym = GetPsym (Sym);
    9958                 :         426 :       pSym->SymbolType = SymbolTable_ModuleSym;
    9959                 :         426 :       pSym->Module.name = ModuleName;  /* Index into name array, name  */
    9960                 :             :       /* of record field.  */
    9961                 :         426 :       pSym->Module.libname = NameKey_NulName;  /* Library association.  */
    9962                 :         426 :       InitCtor (&pSym->Module.ctors);  /* Init all ctor functions.  */
    9963                 :         426 :       SymbolKey_InitTree (&pSym->Module.LocalSymbols);  /* The LocalSymbols hold all the  */
    9964                 :             :       /* END WeAreHere.  */
    9965                 :         426 :       SymbolKey_InitTree (&pSym->Module.ExportTree);  /* Holds all the exported  */
    9966                 :             :       /* deleted at the end of Pass 1.  */
    9967                 :         426 :       SymbolKey_InitTree (&pSym->Module.ImportTree);  /* Contains all IMPORTed  */
    9968                 :             :       /* identifiers.  */
    9969                 :         426 :       Lists_InitList (&pSym->Module.IncludeList);  /* Contains all included symbols  */
    9970                 :             :       /* modulename.Symbol  */
    9971                 :         426 :       SymbolKey_InitTree (&pSym->Module.ExportUndeclared);  /* ExportUndeclared contains all  */
    9972                 :             :       /* been declared.  */
    9973                 :         426 :       Lists_InitList (&pSym->Module.EnumerationScopeList);  /* Enumeration scope list which  */
    9974                 :             :       /* visable within this scope.  */
    9975                 :         426 :       SymbolKey_InitTree (&pSym->Module.NamedObjects);  /* Names of all items declared.  */
    9976                 :         426 :       SymbolKey_InitTree (&pSym->Module.NamedImports);  /* Names of items imported.  */
    9977                 :         426 :       SymbolKey_InitTree (&pSym->Module.WhereImported);  /* Sym to TokenNo where import  */
    9978                 :             :       /* occurs. Error message use.  */
    9979                 :         426 :       pSym->Module.Priority = SymbolTable_NulSym;  /* Priority of the module. This  */
    9980                 :             :       /* is an index to a constant.  */
    9981                 :         426 :       SymbolKey_InitTree (&pSym->Module.Unresolved);  /* All symbols currently  */
    9982                 :             :       /* unresolved in this module.  */
    9983                 :         426 :       pSym->Module.StartQuad = 0;  /* Signify the initialization  */
    9984                 :             :       /* code.  */
    9985                 :         426 :       pSym->Module.EndQuad = 0;  /* EndQuad should point to a  */
    9986                 :             :       /* goto quad.  */
    9987                 :         426 :       pSym->Module.StartFinishQuad = 0;  /* Signify the finalization  */
    9988                 :             :       /* code.  */
    9989                 :         426 :       pSym->Module.EndFinishQuad = 0;  /* should point to a finish  */
    9990                 :         426 :       pSym->Module.FinallyFunction = NULL;  /* The GCC function for finally  */
    9991                 :         426 :       pSym->Module.ExceptionFinally = false;  /* does it have an exception?  */
    9992                 :         426 :       pSym->Module.ExceptionBlock = false;  /* does it have an exception?  */
    9993                 :         426 :       pSym->Module.ModLink = GetLink ();  /* Is this parsed for linkage?  */
    9994                 :         426 :       Lists_InitList (&pSym->Module.ListOfVars);  /* List of variables in this  */
    9995                 :             :       /* scope.  */
    9996                 :         426 :       Lists_InitList (&pSym->Module.ListOfProcs);  /* List of all procedures  */
    9997                 :             :       /* declared within this module.  */
    9998                 :         426 :       Lists_InitList (&pSym->Module.ListOfModules);  /* List of all inner modules.  */
    9999                 :         426 :       InitWhereDeclaredTok (tok, &pSym->Module.At);  /* Where symbol declared.  */
   10000                 :         426 :       InitWhereFirstUsedTok (tok, &pSym->Module.At);  /* Where symbol first used.  */
   10001                 :         426 :       if ((SymbolTable_GetCurrentScope ()) == (SymbolTable_GetBaseModule ()))  /* Where symbol first used.  */
   10002                 :             :         {
   10003                 :           0 :           pSym->Module.Scope = SymbolTable_NulSym;
   10004                 :             :         }
   10005                 :             :       else
   10006                 :             :         {
   10007                 :         426 :           pSym->Module.Scope = SymbolTable_GetCurrentScope ();
   10008                 :         426 :           AddModuleToParent (Sym, pSym->Module.Scope);
   10009                 :             :         }
   10010                 :         426 :       pSym->Module.errorScope = M2Error_GetCurrentErrorScope ();  /* Title error scope.  */
   10011                 :         426 :       AddSymToScope (Sym, ModuleName);  /* Title error scope.  */
   10012                 :             :     }
   10013                 :         426 :   return Sym;
   10014                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10015                 :             :   __builtin_unreachable ();
   10016                 :             : }
   10017                 :             : 
   10018                 :             : 
   10019                 :             : /*
   10020                 :             :    MakeProcedure - creates a procedure sym with name. It returns
   10021                 :             :                    the symbol index.
   10022                 :             : */
   10023                 :             : 
   10024                 :     5091130 : extern "C" unsigned int SymbolTable_MakeProcedure (unsigned int tok, NameKey_Name ProcedureName)
   10025                 :             : {
   10026                 :     5091130 :   SymbolTable_PtrToSymbol pSym;
   10027                 :     5091130 :   unsigned int Sym;
   10028                 :     5091130 :   SymbolTable_ProcedureKind kind;
   10029                 :             : 
   10030                 :     5091130 :   tok = CheckTok (tok, (const char *) "procedure", 9);
   10031                 :     5091130 :   Sym = DeclareSym (tok, ProcedureName);
   10032                 :     5091130 :   CheckBreak (Sym);
   10033                 :     5091130 :   if (! (SymbolTable_IsError (Sym)))
   10034                 :             :     {
   10035                 :     5091130 :       pSym = GetPsym (Sym);
   10036                 :     5091130 :       pSym->SymbolType = SymbolTable_ProcedureSym;
   10037                 :     5091130 :       pSym->Procedure.name = ProcedureName;
   10038                 :    20364520 :       for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   10039                 :             :         {
   10040                 :    15273390 :           InitProcedureDeclaration (&pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure]);
   10041                 :    15273390 :           Lists_InitList (&pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam);
   10042                 :             :         }
   10043                 :     5091130 :       pSym->Procedure.OptArgInit = SymbolTable_NulSym;  /* The optional arg default  */
   10044                 :             :       /* value.  */
   10045                 :     5091130 :       pSym->Procedure.IsExtern = false;  /* Make this procedure external.  */
   10046                 :     5091130 :       pSym->Procedure.IsPublic = false;  /* Make this procedure visible.  */
   10047                 :     5091130 :       pSym->Procedure.IsCtor = false;  /* Is this procedure a ctor?  */
   10048                 :     5091130 :       pSym->Procedure.IsMonoName = false;  /* Overrides module name prefix.  */
   10049                 :     5091130 :       pSym->Procedure.BuildProcType = true;  /* Are we building the  */
   10050                 :             :       /* proctype associated with sym?  */
   10051                 :     5091130 :       pSym->Procedure.Scope = SymbolTable_GetCurrentScope ();  /* Scope of procedure.  */
   10052                 :     5091130 :       SymbolKey_InitTree (&pSym->Procedure.Unresolved);  /* All symbols currently  */
   10053                 :             :       /* unresolved in this procedure.  */
   10054                 :     5091130 :       pSym->Procedure.ScopeQuad = 0;  /* Index into list of quads,  */
   10055                 :     5091130 :       pSym->Procedure.StartQuad = 0;  /* defining the scope, start and  */
   10056                 :     5091130 :       pSym->Procedure.EndQuad = 0;  /* end of the procedure.  */
   10057                 :     5091130 :       pSym->Procedure.Reachable = false;  /* Procedure not known to be  */
   10058                 :             :       /* reachable.  */
   10059                 :     5091130 :       pSym->Procedure.SavePriority = false;  /* Does procedure need to save  */
   10060                 :             :       /* and restore interrupts?  */
   10061                 :     5091130 :       pSym->Procedure.ReturnType = SymbolTable_NulSym;  /* Not a function yet!  */
   10062                 :             :       /* The ProcType equivalent.  */
   10063                 :     5091130 :       pSym->Procedure.ProcedureType = SymbolTable_MakeProcType (tok, NameKey_NulName);
   10064                 :     5091130 :       SymbolKey_InitTree (&pSym->Procedure.LocalSymbols);
   10065                 :     5091130 :       Lists_InitList (&pSym->Procedure.EnumerationScopeList);
   10066                 :             :       /* visable within this scope.  */
   10067                 :     5091130 :       SymbolKey_InitTree (&pSym->Procedure.NamedObjects);  /* Names of all items declared.  */
   10068                 :     5091130 :       Lists_InitList (&pSym->Procedure.ListOfVars);  /* List of variables in this  */
   10069                 :             :       /* scope.  */
   10070                 :     5091130 :       Lists_InitList (&pSym->Procedure.ListOfProcs);  /* List of all procedures  */
   10071                 :             :       /* procedure.  */
   10072                 :     5091130 :       Lists_InitList (&pSym->Procedure.ListOfModules);  /* List of all inner modules.  */
   10073                 :     5091130 :       pSym->Procedure.ExceptionFinally = false;  /* does it have an exception?  */
   10074                 :     5091130 :       pSym->Procedure.ExceptionBlock = false;  /* does it have an exception?  */
   10075                 :     5091130 :       pSym->Procedure.IsBuiltin = false;  /* Was it declared __BUILTIN__ ?  */
   10076                 :     5091130 :       pSym->Procedure.BuiltinName = NameKey_NulName;  /* name of equivalent builtin  */
   10077                 :     5091130 :       pSym->Procedure.IsInline = false;  /* Was is declared __INLINE__ ?  */
   10078                 :     5091130 :       pSym->Procedure.Size = M2ALU_InitValue ();  /* Activation record size.  */
   10079                 :     5091130 :       pSym->Procedure.TotalParamSize = M2ALU_InitValue ();  /* size of all parameters.  */
   10080                 :     5091130 :       pSym->Procedure.Begin = 0;  /* token number for BEGIN  */
   10081                 :     5091130 :       pSym->Procedure.End = 0;  /* token number for END  */
   10082                 :     5091130 :       InitWhereDeclaredTok (tok, &pSym->Procedure.At);  /* Where the symbol was declared.  */
   10083                 :     5091130 :       pSym->Procedure.errorScope = M2Error_GetCurrentErrorScope ();  /* Title error scope.  */
   10084                 :             :       /* Now add this procedure to the symbol table of the current scope  */
   10085                 :     5091130 :       AddSymToScope (Sym, ProcedureName);
   10086                 :     5091130 :       AddProcedureToList (SymbolTable_GetCurrentScope (), Sym);
   10087                 :             :     }
   10088                 :     5091130 :   return Sym;
   10089                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10090                 :             :   __builtin_unreachable ();
   10091                 :             : }
   10092                 :             : 
   10093                 :             : 
   10094                 :             : /*
   10095                 :             :    MakeProcedureCtorExtern - creates an extern ctor procedure
   10096                 :             : */
   10097                 :             : 
   10098                 :           0 : extern "C" unsigned int SymbolTable_MakeProcedureCtorExtern (unsigned int tokenno, NameKey_Name libname, NameKey_Name modulename)
   10099                 :             : {
   10100                 :           0 :   unsigned int ctor;
   10101                 :             : 
   10102                 :           0 :   ctor = SymbolTable_MakeProcedure (tokenno, GenName (libname, (const char *) "_M2_", 4, modulename, (const char *) "_ctor", 5));
   10103                 :           0 :   SymbolTable_PutExtern (ctor, true);
   10104                 :           0 :   return ctor;
   10105                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10106                 :             :   __builtin_unreachable ();
   10107                 :             : }
   10108                 :             : 
   10109                 :             : 
   10110                 :             : /*
   10111                 :             :    PutLibName - places libname into defimp or module sym.
   10112                 :             : */
   10113                 :             : 
   10114                 :      248335 : extern "C" void SymbolTable_PutLibName (unsigned int sym, NameKey_Name libname)
   10115                 :             : {
   10116                 :      248335 :   SymbolTable_PtrToSymbol pSym;
   10117                 :             : 
   10118                 :      496670 :   M2Debug_Assert ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)));
   10119                 :      248335 :   pSym = GetPsym (sym);
   10120                 :      248335 :   switch (pSym->SymbolType)
   10121                 :             :     {
   10122                 :      236503 :       case SymbolTable_DefImpSym:
   10123                 :      236503 :         pSym->DefImp.libname = libname;
   10124                 :      236503 :         break;
   10125                 :             : 
   10126                 :       11832 :       case SymbolTable_ModuleSym:
   10127                 :       11832 :         pSym->Module.libname = libname;
   10128                 :       11832 :         break;
   10129                 :             : 
   10130                 :             : 
   10131                 :           0 :       default:
   10132                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   10133                 :      248335 :         break;
   10134                 :             :     }
   10135                 :      248335 : }
   10136                 :             : 
   10137                 :             : 
   10138                 :             : /*
   10139                 :             :    GetLibName - returns libname associated with a defimp or module sym.
   10140                 :             : */
   10141                 :             : 
   10142                 :     5438506 : extern "C" NameKey_Name SymbolTable_GetLibName (unsigned int sym)
   10143                 :             : {
   10144                 :     5438506 :   SymbolTable_PtrToSymbol pSym;
   10145                 :             : 
   10146                 :    10877012 :   M2Debug_Assert ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)));
   10147                 :     5438506 :   pSym = GetPsym (sym);
   10148                 :     5438506 :   switch (pSym->SymbolType)
   10149                 :             :     {
   10150                 :     5345473 :       case SymbolTable_DefImpSym:
   10151                 :     5345473 :         return pSym->DefImp.libname;
   10152                 :       93033 :         break;
   10153                 :             : 
   10154                 :       93033 :       case SymbolTable_ModuleSym:
   10155                 :       93033 :         return pSym->Module.libname;
   10156                 :           0 :         break;
   10157                 :             : 
   10158                 :             : 
   10159                 :           0 :       default:
   10160                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   10161                 :             :         break;
   10162                 :             :     }
   10163                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10164                 :             :   __builtin_unreachable ();
   10165                 :             : }
   10166                 :             : 
   10167                 :             : 
   10168                 :             : /*
   10169                 :             :    PutMonoName - changes the IsMonoName boolean inside the procedure.
   10170                 :             : */
   10171                 :             : 
   10172                 :      456723 : extern "C" void SymbolTable_PutMonoName (unsigned int sym, bool value)
   10173                 :             : {
   10174                 :      456723 :   SymbolTable_PtrToSymbol pSym;
   10175                 :             : 
   10176                 :      456723 :   pSym = GetPsym (sym);
   10177                 :      456723 :   switch (pSym->SymbolType)
   10178                 :             :     {
   10179                 :      456723 :       case SymbolTable_ProcedureSym:
   10180                 :      456723 :         pSym->Procedure.IsMonoName = value;
   10181                 :      456723 :         break;
   10182                 :             : 
   10183                 :             : 
   10184                 :           0 :       default:
   10185                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10186                 :      456723 :         break;
   10187                 :             :     }
   10188                 :      456723 : }
   10189                 :             : 
   10190                 :             : 
   10191                 :             : /*
   10192                 :             :    IsMonoName - returns the public boolean associated with a procedure.
   10193                 :             : */
   10194                 :             : 
   10195                 :     3710985 : extern "C" bool SymbolTable_IsMonoName (unsigned int sym)
   10196                 :             : {
   10197                 :     3710985 :   SymbolTable_PtrToSymbol pSym;
   10198                 :             : 
   10199                 :     3710985 :   pSym = GetPsym (sym);
   10200                 :     3710985 :   switch (pSym->SymbolType)
   10201                 :             :     {
   10202                 :     3710985 :       case SymbolTable_ProcedureSym:
   10203                 :     3710985 :         return pSym->Procedure.IsMonoName;
   10204                 :           0 :         break;
   10205                 :             : 
   10206                 :             : 
   10207                 :           0 :       default:
   10208                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10209                 :             :         break;
   10210                 :             :     }
   10211                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10212                 :             :   __builtin_unreachable ();
   10213                 :             : }
   10214                 :             : 
   10215                 :             : 
   10216                 :             : /*
   10217                 :             :    PutExtern - changes the extern boolean inside the procedure.
   10218                 :             : */
   10219                 :             : 
   10220                 :      701603 : extern "C" void SymbolTable_PutExtern (unsigned int sym, bool value)
   10221                 :             : {
   10222                 :      701603 :   SymbolTable_PtrToSymbol pSym;
   10223                 :             : 
   10224                 :      701603 :   pSym = GetPsym (sym);
   10225                 :      701603 :   switch (pSym->SymbolType)
   10226                 :             :     {
   10227                 :      701603 :       case SymbolTable_ProcedureSym:
   10228                 :      701603 :         pSym->Procedure.IsExtern = value;
   10229                 :      701603 :         break;
   10230                 :             : 
   10231                 :             : 
   10232                 :           0 :       default:
   10233                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10234                 :      701603 :         break;
   10235                 :             :     }
   10236                 :      701603 : }
   10237                 :             : 
   10238                 :             : 
   10239                 :             : /*
   10240                 :             :    IsExtern - returns the public boolean associated with a procedure.
   10241                 :             : */
   10242                 :             : 
   10243                 :     5149112 : extern "C" bool SymbolTable_IsExtern (unsigned int sym)
   10244                 :             : {
   10245                 :     5149112 :   SymbolTable_PtrToSymbol pSym;
   10246                 :             : 
   10247                 :     5149112 :   pSym = GetPsym (sym);
   10248                 :     5149112 :   switch (pSym->SymbolType)
   10249                 :             :     {
   10250                 :     5149112 :       case SymbolTable_ProcedureSym:
   10251                 :     5149112 :         return pSym->Procedure.IsExtern;
   10252                 :           0 :         break;
   10253                 :             : 
   10254                 :             : 
   10255                 :           0 :       default:
   10256                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10257                 :             :         break;
   10258                 :             :     }
   10259                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10260                 :             :   __builtin_unreachable ();
   10261                 :             : }
   10262                 :             : 
   10263                 :             : 
   10264                 :             : /*
   10265                 :             :    PutPublic - changes the public boolean inside the procedure.
   10266                 :             : */
   10267                 :             : 
   10268                 :      716738 : extern "C" void SymbolTable_PutPublic (unsigned int sym, bool value)
   10269                 :             : {
   10270                 :      716738 :   SymbolTable_PtrToSymbol pSym;
   10271                 :             : 
   10272                 :      716738 :   pSym = GetPsym (sym);
   10273                 :      716738 :   switch (pSym->SymbolType)
   10274                 :             :     {
   10275                 :      716738 :       case SymbolTable_ProcedureSym:
   10276                 :      716738 :         pSym->Procedure.IsPublic = value;
   10277                 :      716738 :         break;
   10278                 :             : 
   10279                 :             : 
   10280                 :           0 :       default:
   10281                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10282                 :      716738 :         break;
   10283                 :             :     }
   10284                 :      716738 : }
   10285                 :             : 
   10286                 :             : 
   10287                 :             : /*
   10288                 :             :    IsPublic - returns the public boolean associated with a procedure.
   10289                 :             : */
   10290                 :             : 
   10291                 :      109192 : extern "C" bool SymbolTable_IsPublic (unsigned int sym)
   10292                 :             : {
   10293                 :      109192 :   SymbolTable_PtrToSymbol pSym;
   10294                 :             : 
   10295                 :      109192 :   pSym = GetPsym (sym);
   10296                 :      109192 :   switch (pSym->SymbolType)
   10297                 :             :     {
   10298                 :      109192 :       case SymbolTable_ProcedureSym:
   10299                 :      109192 :         return pSym->Procedure.IsPublic;
   10300                 :           0 :         break;
   10301                 :             : 
   10302                 :             : 
   10303                 :           0 :       default:
   10304                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10305                 :             :         break;
   10306                 :             :     }
   10307                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10308                 :             :   __builtin_unreachable ();
   10309                 :             : }
   10310                 :             : 
   10311                 :             : 
   10312                 :             : /*
   10313                 :             :    PutCtor - changes the ctor boolean inside the procedure.
   10314                 :             : */
   10315                 :             : 
   10316                 :      195689 : extern "C" void SymbolTable_PutCtor (unsigned int sym, bool value)
   10317                 :             : {
   10318                 :      195689 :   SymbolTable_PtrToSymbol pSym;
   10319                 :             : 
   10320                 :      195689 :   pSym = GetPsym (sym);
   10321                 :      195689 :   switch (pSym->SymbolType)
   10322                 :             :     {
   10323                 :      195689 :       case SymbolTable_ProcedureSym:
   10324                 :      195689 :         pSym->Procedure.IsCtor = value;
   10325                 :      195689 :         break;
   10326                 :             : 
   10327                 :             : 
   10328                 :           0 :       default:
   10329                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10330                 :      195689 :         break;
   10331                 :             :     }
   10332                 :      195689 : }
   10333                 :             : 
   10334                 :             : 
   10335                 :             : /*
   10336                 :             :    IsCtor - returns the ctor boolean associated with a procedure.
   10337                 :             : */
   10338                 :             : 
   10339                 :      157636 : extern "C" bool SymbolTable_IsCtor (unsigned int sym)
   10340                 :             : {
   10341                 :      157636 :   SymbolTable_PtrToSymbol pSym;
   10342                 :             : 
   10343                 :      157636 :   pSym = GetPsym (sym);
   10344                 :      157636 :   switch (pSym->SymbolType)
   10345                 :             :     {
   10346                 :      157636 :       case SymbolTable_ProcedureSym:
   10347                 :      157636 :         return pSym->Procedure.IsCtor;
   10348                 :           0 :         break;
   10349                 :             : 
   10350                 :             : 
   10351                 :           0 :       default:
   10352                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   10353                 :             :         break;
   10354                 :             :     }
   10355                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10356                 :             :   __builtin_unreachable ();
   10357                 :             : }
   10358                 :             : 
   10359                 :             : 
   10360                 :             : /*
   10361                 :             :    GetModuleCtors - mod can be a DefImp or Module symbol.  ctor, init and fini
   10362                 :             :                     are assigned for this module.  An inner module ctor value will
   10363                 :             :                     be NulSym.
   10364                 :             : */
   10365                 :             : 
   10366                 :      158079 : extern "C" void SymbolTable_GetModuleCtors (unsigned int mod, unsigned int *ctor, unsigned int *init, unsigned int *fini, unsigned int *dep)
   10367                 :             : {
   10368                 :      158079 :   SymbolTable_PtrToSymbol pSym;
   10369                 :             : 
   10370                 :      158079 :   pSym = GetPsym (mod);
   10371                 :      158079 :   switch (pSym->SymbolType)
   10372                 :             :     {
   10373                 :       83124 :       case SymbolTable_ModuleSym:
   10374                 :       83124 :         (*ctor) = pSym->Module.ctors.ctor;
   10375                 :       83124 :         (*init) = pSym->Module.ctors.init;
   10376                 :       83124 :         (*fini) = pSym->Module.ctors.fini;
   10377                 :       83124 :         (*dep) = pSym->Module.ctors.dep;
   10378                 :       83124 :         break;
   10379                 :             : 
   10380                 :       74955 :       case SymbolTable_DefImpSym:
   10381                 :       74955 :         (*ctor) = pSym->DefImp.ctors.ctor;
   10382                 :       74955 :         (*init) = pSym->DefImp.ctors.init;
   10383                 :       74955 :         (*fini) = pSym->DefImp.ctors.fini;
   10384                 :       74955 :         (*dep) = pSym->DefImp.ctors.dep;
   10385                 :       74955 :         break;
   10386                 :             : 
   10387                 :             : 
   10388                 :           0 :       default:
   10389                 :           0 :         M2Error_InternalError ((const char *) "expecting Module or DefImp symbol", 33);
   10390                 :      158079 :         break;
   10391                 :             :     }
   10392                 :      158079 : }
   10393                 :             : 
   10394                 :             : 
   10395                 :             : /*
   10396                 :             :    MakeModuleCtor - for a defimp or module symbol create all the ctor
   10397                 :             :                     related procedures.
   10398                 :             : */
   10399                 :             : 
   10400                 :       83355 : extern "C" void SymbolTable_MakeModuleCtor (unsigned int moduleTok, unsigned int beginTok, unsigned int finallyTok, unsigned int moduleSym)
   10401                 :             : {
   10402                 :       83355 :   SymbolTable_PtrToSymbol pSym;
   10403                 :             : 
   10404                 :      166710 :   M2Debug_Assert ((SymbolTable_IsDefImp (moduleSym)) || (SymbolTable_IsModule (moduleSym)));
   10405                 :       83355 :   pSym = GetPsym (moduleSym);
   10406                 :       83355 :   if (SymbolTable_IsDefImp (moduleSym))
   10407                 :             :     {
   10408                 :       71241 :       InitCtorFields (moduleTok, beginTok, finallyTok, moduleSym, &pSym->DefImp.ctors, SymbolTable_GetSymName (moduleSym), false, true);
   10409                 :             :     }
   10410                 :             :   else
   10411                 :             :     {
   10412                 :       12114 :       InitCtorFields (moduleTok, beginTok, finallyTok, moduleSym, &pSym->Module.ctors, SymbolTable_GetSymName (moduleSym), SymbolTable_IsInnerModule (moduleSym), true);
   10413                 :             :     }
   10414                 :       83355 : }
   10415                 :             : 
   10416                 :             : 
   10417                 :             : /*
   10418                 :             :    PutModuleCtorExtern - for every ctor related procedure in module sym.
   10419                 :             :                          Make it external.  It will create any missing
   10420                 :             :                          init/fini procedures but not any missing dep/ctor
   10421                 :             :                          procedures.
   10422                 :             : */
   10423                 :             : 
   10424                 :      113068 : extern "C" void SymbolTable_PutModuleCtorExtern (unsigned int tok, unsigned int sym, bool external)
   10425                 :             : {
   10426                 :      113068 :   SymbolTable_PtrToSymbol pSym;
   10427                 :             : 
   10428                 :      226136 :   M2Debug_Assert ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)));
   10429                 :      113068 :   pSym = GetPsym (sym);
   10430                 :      113068 :   switch (pSym->SymbolType)
   10431                 :             :     {
   10432                 :      113068 :       case SymbolTable_DefImpSym:
   10433                 :      113068 :         PutCtorExtern (tok, sym, &pSym->DefImp.ctors, external);
   10434                 :      113068 :         break;
   10435                 :             : 
   10436                 :           0 :       case SymbolTable_ModuleSym:
   10437                 :           0 :         PutCtorExtern (tok, sym, &pSym->Module.ctors, external);
   10438                 :           0 :         break;
   10439                 :             : 
   10440                 :             : 
   10441                 :           0 :       default:
   10442                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   10443                 :      113068 :         break;
   10444                 :             :     }
   10445                 :      113068 : }
   10446                 :             : 
   10447                 :             : 
   10448                 :             : /*
   10449                 :             :    PutVarHeap - assigns ArrayRef field with value.
   10450                 :             : */
   10451                 :             : 
   10452                 :       52418 : extern "C" void SymbolTable_PutVarHeap (unsigned int sym, bool value)
   10453                 :             : {
   10454                 :       52418 :   SymbolTable_PtrToSymbol pSym;
   10455                 :             : 
   10456                 :       52418 :   pSym = GetPsym (sym);
   10457                 :       52418 :   switch (pSym->SymbolType)
   10458                 :             :     {
   10459                 :       52418 :       case SymbolTable_VarSym:
   10460                 :       52418 :         pSym->Var.Heap = value;
   10461                 :       52418 :         break;
   10462                 :             : 
   10463                 :             : 
   10464                 :           0 :       default:
   10465                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   10466                 :       52418 :         break;
   10467                 :             :     }
   10468                 :       52418 : }
   10469                 :             : 
   10470                 :             : 
   10471                 :             : /*
   10472                 :             :    IsVarHeap - returns ArrayRef field value.
   10473                 :             : */
   10474                 :             : 
   10475                 :      639087 : extern "C" bool SymbolTable_IsVarHeap (unsigned int sym)
   10476                 :             : {
   10477                 :      639087 :   SymbolTable_PtrToSymbol pSym;
   10478                 :             : 
   10479                 :      639087 :   pSym = GetPsym (sym);
   10480                 :      639087 :   switch (pSym->SymbolType)
   10481                 :             :     {
   10482                 :      639087 :       case SymbolTable_VarSym:
   10483                 :      639087 :         return pSym->Var.Heap;
   10484                 :           0 :         break;
   10485                 :             : 
   10486                 :             : 
   10487                 :           0 :       default:
   10488                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   10489                 :             :         break;
   10490                 :             :     }
   10491                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   10492                 :             :   __builtin_unreachable ();
   10493                 :             : }
   10494                 :             : 
   10495                 :             : 
   10496                 :             : /*
   10497                 :             :    MakeVar - creates a variable sym with VarName. It returns the
   10498                 :             :              symbol index.
   10499                 :             : */
   10500                 :             : 
   10501                 :    11414264 : extern "C" unsigned int SymbolTable_MakeVar (unsigned int tok, NameKey_Name VarName)
   10502                 :             : {
   10503                 :    11414264 :   SymbolTable_PtrToSymbol pSym;
   10504                 :    11414264 :   unsigned int Sym;
   10505                 :             : 
   10506                 :    11414264 :   Sym = DeclareSym (tok, VarName);
   10507                 :    11414264 :   if (! (SymbolTable_IsError (Sym)))
   10508                 :             :     {
   10509                 :    11414252 :       pSym = GetPsym (Sym);
   10510                 :    11414252 :       pSym->SymbolType = SymbolTable_VarSym;
   10511                 :    11414252 :       pSym->Var.name = VarName;
   10512                 :    11414252 :       pSym->Var.Type = SymbolTable_NulSym;
   10513                 :    11414252 :       pSym->Var.BackType = SymbolTable_NulSym;
   10514                 :    11414252 :       pSym->Var.Size = M2ALU_InitValue ();
   10515                 :    11414252 :       pSym->Var.Offset = M2ALU_InitValue ();
   10516                 :    11414252 :       pSym->Var.AddrMode = SymbolTable_RightValue;
   10517                 :    11414252 :       pSym->Var.Scope = SymbolTable_GetCurrentScope ();  /* Procedure or Module?  */
   10518                 :    11414252 :       pSym->Var.AtAddress = false;  /* Procedure or Module?  */
   10519                 :    11414252 :       pSym->Var.Address = SymbolTable_NulSym;  /* Address at which declared.  */
   10520                 :    11414252 :       pSym->Var.IsConditional = false;  /* Address at which declared.  */
   10521                 :    11414252 :       pSym->Var.IsTemp = false;
   10522                 :    11414252 :       pSym->Var.IsComponentRef = false;
   10523                 :    11414252 :       pSym->Var.IsParam = false;
   10524                 :    11414252 :       pSym->Var.IsPointerCheck = false;
   10525                 :    11414252 :       pSym->Var.IsWritten = false;
   10526                 :    11414252 :       pSym->Var.IsSSA = false;
   10527                 :    11414252 :       pSym->Var.IsConst = false;
   10528                 :    11414252 :       pSym->Var.ArrayRef = false;
   10529                 :    11414252 :       pSym->Var.Heap = false;
   10530                 :    11414252 :       InitVarDecl (&pSym->Var.Declared, tok);
   10531                 :    11414252 :       InitWhereDeclaredTok (tok, &pSym->Var.At);
   10532                 :    11414252 :       InitWhereFirstUsedTok (tok, &pSym->Var.At);  /* Where symbol first used.  */
   10533                 :    11414252 :       Lists_InitList (&pSym->Var.ReadUsageList.array[SymbolTable_RightValue-SymbolTable_RightValue]);  /* Where symbol first used.  */
   10534                 :    11414252 :       Lists_InitList (&pSym->Var.WriteUsageList.array[SymbolTable_RightValue-SymbolTable_RightValue]);
   10535                 :    11414252 :       Lists_InitList (&pSym->Var.ReadUsageList.array[SymbolTable_LeftValue-SymbolTable_RightValue]);
   10536                 :    11414252 :       Lists_InitList (&pSym->Var.WriteUsageList.array[SymbolTable_LeftValue-SymbolTable_RightValue]);
   10537                 :    11414252 :       pSym->Var.InitState.array[SymbolTable_LeftValue-SymbolTable_RightValue] = M2SymInit_InitSymInit ();
   10538                 :    11414252 :       pSym->Var.InitState.array[SymbolTable_RightValue-SymbolTable_RightValue] = M2SymInit_InitSymInit ();
   10539                 :             :       /* Add Var to Procedure or Module variable list.  */
   10540                 :    11414252 :       AddVarToList (Sym);
   10541                 :             :       /* Now add this Var to the symbol table of the current scope.  */
   10542                 :    11414252 :       AddSymToScope (Sym, VarName);
   10543                 :             :     }
   10544                 :    11414264 :   return Sym;
   10545                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10546                 :             :   __builtin_unreachable ();
   10547                 :             : }
   10548                 :             : 
   10549                 :             : 
   10550                 :             : /*
   10551                 :             :    PutVarConditional - assign IsConditional to value.
   10552                 :             : */
   10553                 :             : 
   10554                 :       17334 : extern "C" void SymbolTable_PutVarConditional (unsigned int sym, bool value)
   10555                 :             : {
   10556                 :       17334 :   SymbolTable_PtrToSymbol pSym;
   10557                 :             : 
   10558                 :       17334 :   pSym = GetPsym (sym);
   10559                 :       17334 :   switch (pSym->SymbolType)
   10560                 :             :     {
   10561                 :       17052 :       case SymbolTable_VarSym:
   10562                 :       17052 :         pSym->Var.IsConditional = value;
   10563                 :       17052 :         break;
   10564                 :             : 
   10565                 :         282 :       case SymbolTable_ConstVarSym:
   10566                 :         282 :         pSym->ConstVar.IsConditional = value;
   10567                 :         282 :         break;
   10568                 :             : 
   10569                 :             : 
   10570                 :           0 :       default:
   10571                 :           0 :         M2Error_InternalError ((const char *) "expecting Var", 13);
   10572                 :       17334 :         break;
   10573                 :             :     }
   10574                 :       17334 : }
   10575                 :             : 
   10576                 :             : 
   10577                 :             : /*
   10578                 :             :    IsVarConditional - return TRUE if the symbol is a var symbol
   10579                 :             :                       containing the result of a boolean conditional.
   10580                 :             : */
   10581                 :             : 
   10582                 :      319494 : extern "C" bool SymbolTable_IsVarConditional (unsigned int sym)
   10583                 :             : {
   10584                 :      319494 :   SymbolTable_PtrToSymbol pSym;
   10585                 :             : 
   10586                 :      319494 :   pSym = GetPsym (sym);
   10587                 :      319494 :   switch (pSym->SymbolType)
   10588                 :             :     {
   10589                 :       19814 :       case SymbolTable_VarSym:
   10590                 :       19814 :         return pSym->Var.IsConditional;
   10591                 :      298296 :         break;
   10592                 :             : 
   10593                 :      298296 :       case SymbolTable_ConstVarSym:
   10594                 :      298296 :         return pSym->ConstVar.IsConditional;
   10595                 :             :         break;
   10596                 :             : 
   10597                 :             : 
   10598                 :             :       default:
   10599                 :             :         return false;
   10600                 :             :         break;
   10601                 :             :     }
   10602                 :             :   return false;
   10603                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10604                 :             :   __builtin_unreachable ();
   10605                 :             : }
   10606                 :             : 
   10607                 :             : 
   10608                 :             : /*
   10609                 :             :    MakeRecord - makes a Record symbol with name RecordName.
   10610                 :             : */
   10611                 :             : 
   10612                 :       71573 : extern "C" unsigned int SymbolTable_MakeRecord (unsigned int tok, NameKey_Name RecordName)
   10613                 :             : {
   10614                 :       71573 :   unsigned int oaf;
   10615                 :       71573 :   unsigned int sym;
   10616                 :             : 
   10617                 :       71573 :   tok = CheckTok (tok, (const char *) "record", 6);
   10618                 :       71573 :   sym = HandleHiddenOrDeclare (tok, RecordName, &oaf);
   10619                 :       71573 :   FillInRecordFields (tok, sym, RecordName, SymbolTable_GetCurrentScope (), oaf);
   10620                 :       71573 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   10621                 :       71573 :   return sym;
   10622                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10623                 :             :   __builtin_unreachable ();
   10624                 :             : }
   10625                 :             : 
   10626                 :             : 
   10627                 :             : /*
   10628                 :             :    MakeVarient - creates a new symbol, a varient symbol for record or varient field
   10629                 :             :                  symbol, RecOrVarFieldSym.
   10630                 :             : */
   10631                 :             : 
   10632                 :        2982 : extern "C" unsigned int SymbolTable_MakeVarient (unsigned int tok, unsigned int RecOrVarFieldSym)
   10633                 :             : {
   10634                 :        2982 :   SymbolTable_PtrToSymbol pSym;
   10635                 :        2982 :   unsigned int Sym;
   10636                 :             : 
   10637                 :        2982 :   tok = CheckTok (tok, (const char *) "varient", 7);
   10638                 :        2982 :   NewSym (&Sym);
   10639                 :        2982 :   pSym = GetPsym (Sym);
   10640                 :        2982 :   pSym->SymbolType = SymbolTable_VarientSym;
   10641                 :        2982 :   pSym->Varient.Size = M2ALU_InitValue ();
   10642                 :        2982 :   pSym->Varient.Parent = RecOrVarFieldSym;  /* GetRecord(RecOrVarFieldSym) ;  */
   10643                 :        2982 :   if (SymbolTable_IsRecord (RecOrVarFieldSym))  /* GetRecord(RecOrVarFieldSym) ;  */
   10644                 :             :     {
   10645                 :        2946 :       pSym->Varient.Varient = SymbolTable_NulSym;
   10646                 :             :     }
   10647                 :             :   else
   10648                 :             :     {
   10649                 :          36 :       pSym->Varient.Varient = RecOrVarFieldSym;
   10650                 :             :     }
   10651                 :        2982 :   pSym->Varient.tag = SymbolTable_NulSym;
   10652                 :        2982 :   pSym->Varient.DeclPacked = false;
   10653                 :        2982 :   pSym->Varient.Scope = SymbolTable_GetCurrentScope ();
   10654                 :        2982 :   Lists_InitList (&pSym->Varient.ListOfSons);
   10655                 :        2982 :   InitWhereDeclaredTok (tok, &pSym->Varient.At);
   10656                 :             :   /* Now add Sym to the record RecSym field list  */
   10657                 :        2982 :   pSym = GetPsym (RecOrVarFieldSym);
   10658                 :        2982 :   switch (pSym->SymbolType)
   10659                 :             :     {
   10660                 :        2946 :       case SymbolTable_RecordSym:
   10661                 :        2946 :         Lists_PutItemIntoList (pSym->Record.ListOfSons, Sym);
   10662                 :        2946 :         break;
   10663                 :             : 
   10664                 :          36 :       case SymbolTable_VarientFieldSym:
   10665                 :          36 :         Lists_PutItemIntoList (pSym->VarientField.ListOfSons, Sym);
   10666                 :          36 :         break;
   10667                 :             : 
   10668                 :             : 
   10669                 :           0 :       default:
   10670                 :           0 :         M2Error_InternalError ((const char *) "expecting Record or VarientField symbol", 39);
   10671                 :        2982 :         break;
   10672                 :             :     }
   10673                 :        2982 :   return Sym;
   10674                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10675                 :             :   __builtin_unreachable ();
   10676                 :             : }
   10677                 :             : 
   10678                 :             : 
   10679                 :             : /*
   10680                 :             :    MakeFieldVarient - returns a FieldVarient symbol which has been
   10681                 :             :                       assigned to the Varient symbol, Sym.
   10682                 :             : */
   10683                 :             : 
   10684                 :        6078 : extern "C" unsigned int SymbolTable_MakeFieldVarient (NameKey_Name n, unsigned int Sym)
   10685                 :             : {
   10686                 :        6078 :   SymbolTable_PtrToSymbol pSym;
   10687                 :        6078 :   unsigned int SonSym;
   10688                 :             : 
   10689                 :        6078 :   NewSym (&SonSym);
   10690                 :             :   /* Fill in Sym  */
   10691                 :        6078 :   pSym = GetPsym (SonSym);
   10692                 :        6078 :   pSym->SymbolType = SymbolTable_VarientFieldSym;
   10693                 :        6078 :   pSym->VarientField.name = n;
   10694                 :        6078 :   Lists_InitList (&pSym->VarientField.ListOfSons);
   10695                 :        6078 :   pSym->VarientField.Parent = SymbolTable_GetRecord (Sym);
   10696                 :        6078 :   pSym->VarientField.Varient = SymbolTable_NulSym;
   10697                 :        6078 :   pSym->VarientField.Size = M2ALU_InitValue ();
   10698                 :        6078 :   pSym->VarientField.Offset = M2ALU_InitValue ();
   10699                 :        6078 :   pSym->VarientField.DeclPacked = false;
   10700                 :        6078 :   pSym->VarientField.DeclResolved = false;
   10701                 :        6078 :   pSym->VarientField.Scope = SymbolTable_GetCurrentScope ();
   10702                 :        6078 :   InitWhereDeclared (&pSym->VarientField.At);
   10703                 :        6078 :   return SonSym;
   10704                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10705                 :             :   __builtin_unreachable ();
   10706                 :             : }
   10707                 :             : 
   10708                 :             : 
   10709                 :             : /*
   10710                 :             :    MakeEnumeration - places a new symbol in the current scope, the symbol
   10711                 :             :                      is an enumeration symbol. The symbol index is returned.
   10712                 :             : */
   10713                 :             : 
   10714                 :       49678 : extern "C" unsigned int SymbolTable_MakeEnumeration (unsigned int tok, NameKey_Name EnumerationName)
   10715                 :             : {
   10716                 :       49678 :   SymbolTable_PtrToSymbol pSym;
   10717                 :       49678 :   unsigned int sym;
   10718                 :       49678 :   unsigned int oaf;
   10719                 :             : 
   10720                 :       49678 :   tok = CheckTok (tok, (const char *) "enumeration", 11);
   10721                 :       49678 :   sym = CheckForHiddenType (EnumerationName);
   10722                 :       49678 :   if (sym == SymbolTable_NulSym)
   10723                 :             :     {
   10724                 :             :       /* avoid dangling else.  */
   10725                 :       49678 :       sym = DeclareSym (tok, EnumerationName);
   10726                 :       49678 :       oaf = SymbolTable_GetOAFamily (sym);
   10727                 :       49678 :       if (! (SymbolTable_IsError (sym)))
   10728                 :             :         {
   10729                 :       49678 :           pSym = GetPsym (sym);
   10730                 :       49678 :           pSym->SymbolType = SymbolTable_EnumerationSym;  /* To satisfy AddSymToScope  */
   10731                 :             :           /* Now add this type to the symbol table of the current scope  */
   10732                 :       49678 :           AddSymToScope (sym, EnumerationName);
   10733                 :             :         }
   10734                 :             :     }
   10735                 :             :   else
   10736                 :             :     {
   10737                 :           0 :       oaf = SymbolTable_GetOAFamily (sym);
   10738                 :             :     }
   10739                 :       49678 :   if (! (SymbolTable_IsError (sym)))
   10740                 :             :     {
   10741                 :       49678 :       pSym = GetPsym (sym);
   10742                 :       49678 :       pSym->SymbolType = SymbolTable_EnumerationSym;
   10743                 :       49678 :       pSym->Enumeration.name = EnumerationName;  /* Name of enumeration.  */
   10744                 :       49678 :       pSym->Enumeration.NoOfElements = 0;  /* No of elements in the  */
   10745                 :             :       /* enumeration type.  */
   10746                 :       49678 :       pSym->Enumeration.Size = M2ALU_InitValue ();  /* Size at runtime of sym  */
   10747                 :       49678 :       SymbolKey_InitTree (&pSym->Enumeration.LocalSymbols);  /* Enumeration fields.  */
   10748                 :       49678 :       Lists_InitList (&pSym->Enumeration.ListOfFields);  /* Ordered as declared.  */
   10749                 :       49678 :       InitPacked (&pSym->Enumeration.packedInfo);  /* not packed and no  */
   10750                 :             :       /* equivalent (yet).  */
   10751                 :       49678 :       pSym->Enumeration.oafamily = oaf;  /* The open array family  */
   10752                 :       49678 :       pSym->Enumeration.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   10753                 :       49678 :       InitWhereDeclaredTok (tok, &pSym->Enumeration.At);  /* Declared here  */
   10754                 :       49678 :       CheckIfEnumerationExported (sym, ScopePtr);
   10755                 :             :     }
   10756                 :       49678 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   10757                 :       49678 :   return sym;
   10758                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10759                 :             :   __builtin_unreachable ();
   10760                 :             : }
   10761                 :             : 
   10762                 :             : 
   10763                 :             : /*
   10764                 :             :    MakeType - makes a type symbol with name TypeName.
   10765                 :             : */
   10766                 :             : 
   10767                 :      626876 : extern "C" unsigned int SymbolTable_MakeType (unsigned int tok, NameKey_Name TypeName)
   10768                 :             : {
   10769                 :      626876 :   SymbolTable_PtrToSymbol pSym;
   10770                 :      626876 :   unsigned int sym;
   10771                 :      626876 :   unsigned int oaf;
   10772                 :             : 
   10773                 :      626876 :   sym = HandleHiddenOrDeclare (tok, TypeName, &oaf);
   10774                 :      626876 :   if (! (SymbolTable_IsError (sym)))
   10775                 :             :     {
   10776                 :      626870 :       pSym = GetPsym (sym);
   10777                 :      626870 :       pSym->SymbolType = SymbolTable_TypeSym;
   10778                 :      626870 :       pSym->Type.name = TypeName;  /* Index into name array, name  */
   10779                 :             :       /* of type.  */
   10780                 :      626870 :       pSym->Type.Type = SymbolTable_NulSym;  /* Index to a type symbol.  */
   10781                 :      626870 :       pSym->Type.IsHidden = false;  /* Was it declared as hidden?  */
   10782                 :      626870 :       SymbolKey_InitTree (&pSym->Type.ConstLitTree);  /* constants of this type.  */
   10783                 :      626870 :       pSym->Type.Size = M2ALU_InitValue ();  /* Runtime size of symbol.  */
   10784                 :      626870 :       pSym->Type.Align = SymbolTable_NulSym;  /* Alignment of this type.  */
   10785                 :      626870 :       InitPacked (&pSym->Type.packedInfo);  /* not packed and no  */
   10786                 :             :       /* equivalent yet.  */
   10787                 :      626870 :       pSym->Type.oafamily = oaf;  /* The open array family.  */
   10788                 :      626870 :       pSym->Type.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   10789                 :      626870 :       InitWhereDeclaredTok (tok, &pSym->Type.At);  /* Declared here  */
   10790                 :             :     }
   10791                 :      626876 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   10792                 :      626876 :   return sym;
   10793                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10794                 :             :   __builtin_unreachable ();
   10795                 :             : }
   10796                 :             : 
   10797                 :             : 
   10798                 :             : /*
   10799                 :             :    MakeHiddenType - makes a type symbol that is hidden from the
   10800                 :             :                     definition module.
   10801                 :             :                     This symbol is placed into the UnImplemented list of
   10802                 :             :                     the definition/implementation module.
   10803                 :             :                     The type will be filled in when the implementation module
   10804                 :             :                     is reached.
   10805                 :             : */
   10806                 :             : 
   10807                 :       29095 : extern "C" unsigned int SymbolTable_MakeHiddenType (unsigned int tok, NameKey_Name TypeName)
   10808                 :             : {
   10809                 :       29095 :   SymbolTable_PtrToSymbol pSym;
   10810                 :       29095 :   unsigned int Sym;
   10811                 :             : 
   10812                 :       29095 :   tok = CheckTok (tok, (const char *) "hidden", 6);
   10813                 :       29095 :   Sym = DeclareSym (tok, TypeName);
   10814                 :       29095 :   if (! (SymbolTable_IsError (Sym)))
   10815                 :             :     {
   10816                 :       29095 :       pSym = GetPsym (Sym);
   10817                 :       29095 :       pSym->SymbolType = SymbolTable_TypeSym;
   10818                 :       29095 :       pSym->Type.name = TypeName;  /* Index into name array, name  */
   10819                 :             :       /* of type.  */
   10820                 :       29095 :       pSym->Type.IsHidden = (SymbolTable_GetMainModule ()) != (SymbolTable_GetCurrentScope ());
   10821                 :       29095 :       if (M2Options_ExtendedOpaque || ! pSym->Type.IsHidden)
   10822                 :             :         {
   10823                 :        1496 :           pSym->Type.Type = SymbolTable_NulSym;  /* will be filled in later  */
   10824                 :             :         }
   10825                 :             :       else
   10826                 :             :         {
   10827                 :       27599 :           pSym->Type.Type = M2System_Address;
   10828                 :             :         }
   10829                 :       29095 :       pSym->Type.Align = SymbolTable_NulSym;  /* Alignment of this type.  */
   10830                 :       29095 :       pSym->Type.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   10831                 :       29095 :       pSym->Type.oafamily = SymbolTable_NulSym;  /* Which scope created it  */
   10832                 :       29095 :       if (! M2Options_ExtendedOpaque)
   10833                 :             :         {
   10834                 :       27699 :           Lists_IncludeItemIntoList (AddressTypes, Sym);
   10835                 :             :         }
   10836                 :       29095 :       pSym->Type.Size = M2ALU_InitValue ();  /* Runtime size of symbol.  */
   10837                 :       29095 :       InitWhereDeclaredTok (tok, &pSym->Type.At);  /* Declared here  */
   10838                 :       29095 :       SymbolTable_PutExportUnImplemented (tok, Sym);
   10839                 :       29095 :       if (M2Options_ExtendedOpaque || ((SymbolTable_GetMainModule ()) == (SymbolTable_GetCurrentScope ())))
   10840                 :             :         {
   10841                 :        1496 :           SymbolTable_PutHiddenTypeDeclared ();
   10842                 :             :         }
   10843                 :             :       /* Now add this type to the symbol table of the current scope  */
   10844                 :       29095 :       AddSymToScope (Sym, TypeName);
   10845                 :             :     }
   10846                 :       29095 :   return Sym;
   10847                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10848                 :             :   __builtin_unreachable ();
   10849                 :             : }
   10850                 :             : 
   10851                 :             : 
   10852                 :             : /*
   10853                 :             :    MakeConstant - create a constant cardinal and return the symbol.
   10854                 :             : */
   10855                 :             : 
   10856                 :      102472 : extern "C" unsigned int SymbolTable_MakeConstant (unsigned int tok, unsigned int value)
   10857                 :             : {
   10858                 :      102472 :   DynamicStrings_String str;
   10859                 :      102472 :   unsigned int sym;
   10860                 :             : 
   10861                 :      102472 :   tok = CheckTok (tok, (const char *) "constant", 8);
   10862                 :      102472 :   str = FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%d", 2)), (const unsigned char *) &value, (sizeof (value)-1));
   10863                 :      102472 :   sym = SymbolTable_MakeConstLit (tok, NameKey_makekey (DynamicStrings_string (str)), M2Base_Cardinal);
   10864                 :      102472 :   str = DynamicStrings_KillString (str);
   10865                 :      102472 :   return sym;
   10866                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10867                 :             :   __builtin_unreachable ();
   10868                 :             : }
   10869                 :             : 
   10870                 :             : 
   10871                 :             : /*
   10872                 :             :    MakeConstLit - returns a constant literal of type, constType, with a constName,
   10873                 :             :                   at location, tok.
   10874                 :             : */
   10875                 :             : 
   10876                 :     1651733 : extern "C" unsigned int SymbolTable_MakeConstLit (unsigned int tok, NameKey_Name constName, unsigned int constType)
   10877                 :             : {
   10878                 :     1651733 :   unsigned int sym;
   10879                 :             : 
   10880                 :     1651733 :   tok = CheckTok (tok, (const char *) "constlit", 8);
   10881                 :     1651733 :   sym = LookupConstLitPoolEntry (tok, constName, constType);
   10882                 :     1651733 :   if (sym == SymbolTable_NulSym)
   10883                 :             :     {
   10884                 :      618106 :       sym = CreateConstLit (tok, constName, constType);
   10885                 :      618106 :       AddConstLitPoolEntry (sym, tok, constName, constType);
   10886                 :             :     }
   10887                 :     1651733 :   return sym;
   10888                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10889                 :             :   __builtin_unreachable ();
   10890                 :             : }
   10891                 :             : 
   10892                 :             : 
   10893                 :             : /*
   10894                 :             :    MakeConstVar - makes a ConstVar type with
   10895                 :             :                   name ConstVarName.
   10896                 :             : */
   10897                 :             : 
   10898                 :     1299248 : extern "C" unsigned int SymbolTable_MakeConstVar (unsigned int tok, NameKey_Name ConstVarName)
   10899                 :             : {
   10900                 :     1299248 :   SymbolTable_PtrToSymbol pSym;
   10901                 :     1299248 :   unsigned int Sym;
   10902                 :     1299248 :   bool temp;
   10903                 :             : 
   10904                 :     1299248 :   temp = ConstVarName == NameKey_NulName;
   10905                 :     1299248 :   ConstVarName = SymbolTable_CheckAnonymous (ConstVarName);
   10906                 :     1299248 :   Sym = DeclareSym (tok, ConstVarName);
   10907                 :     1299248 :   if (! (SymbolTable_IsError (Sym)))
   10908                 :             :     {
   10909                 :     1299242 :       pSym = GetPsym (Sym);
   10910                 :     1299242 :       pSym->SymbolType = SymbolTable_ConstVarSym;
   10911                 :     1299242 :       pSym->ConstVar.name = ConstVarName;
   10912                 :     1299242 :       pSym->ConstVar.Value = M2ALU_InitValue ();
   10913                 :     1299242 :       pSym->ConstVar.Type = SymbolTable_NulSym;
   10914                 :     1299242 :       pSym->ConstVar.IsSet = false;
   10915                 :     1299242 :       pSym->ConstVar.IsConditional = false;
   10916                 :     1299242 :       pSym->ConstVar.IsConstructor = false;
   10917                 :     1299242 :       pSym->ConstVar.FromType = SymbolTable_NulSym;  /* type is determined FromType  */
   10918                 :     1299242 :       pSym->ConstVar.UnresFromType = false;  /* is Type resolved?  */
   10919                 :     1299242 :       pSym->ConstVar.IsTemp = temp;  /* is Type resolved?  */
   10920                 :     1299242 :       pSym->ConstVar.Scope = SymbolTable_GetCurrentScope ();
   10921                 :     1299242 :       InitWhereDeclaredTok (tok, &pSym->ConstVar.At);
   10922                 :             :       /* Now add this constant to the symbol table of the current scope  */
   10923                 :     1299242 :       AddSymToScope (Sym, ConstVarName);
   10924                 :             :     }
   10925                 :     1299248 :   return Sym;
   10926                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10927                 :             :   __builtin_unreachable ();
   10928                 :             : }
   10929                 :             : 
   10930                 :             : 
   10931                 :             : /*
   10932                 :             :    MakeConstString - create a string constant in the symboltable.
   10933                 :             : */
   10934                 :             : 
   10935                 :      328900 : extern "C" unsigned int SymbolTable_MakeConstString (unsigned int tok, NameKey_Name ConstName)
   10936                 :             : {
   10937                 :      328900 :   unsigned int newstr;
   10938                 :             : 
   10939                 :      328900 :   NewSym (&newstr);
   10940                 :      328900 :   InitConstString (tok, newstr, ConstName, ConstName, SymbolTable_m2nulstr, false, true);
   10941                 :      328900 :   return newstr;
   10942                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10943                 :             :   __builtin_unreachable ();
   10944                 :             : }
   10945                 :             : 
   10946                 :             : 
   10947                 :             : /*
   10948                 :             :    MakeConstStringCnul - creates a constant string nul terminated string suitable for C.
   10949                 :             :                          If known is TRUE then name is assigned to the contents
   10950                 :             :                          and the escape sequences will be converted into characters.
   10951                 :             : */
   10952                 :             : 
   10953                 :        9613 : extern "C" unsigned int SymbolTable_MakeConstStringCnul (unsigned int tok, NameKey_Name name, bool known)
   10954                 :             : {
   10955                 :        9613 :   unsigned int newstr;
   10956                 :             : 
   10957                 :        9613 :   tok = CheckTok (tok, (const char *) "conststringcnul", 15);
   10958                 :        9613 :   NewSym (&newstr);
   10959                 :        9613 :   InitConstString (tok, newstr, name, name, SymbolTable_cnulstr, true, known);
   10960                 :        9613 :   return newstr;
   10961                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10962                 :             :   __builtin_unreachable ();
   10963                 :             : }
   10964                 :             : 
   10965                 :             : 
   10966                 :             : /*
   10967                 :             :    MakeConstStringM2nul - creates a constant string nul terminated string suitable for M2.
   10968                 :             :                           If known is TRUE then name is assigned to the contents
   10969                 :             :                           however the escape sequences are not converted into characters.
   10970                 :             : */
   10971                 :             : 
   10972                 :       34697 : extern "C" unsigned int SymbolTable_MakeConstStringM2nul (unsigned int tok, NameKey_Name name, bool known)
   10973                 :             : {
   10974                 :       34697 :   unsigned int newstr;
   10975                 :             : 
   10976                 :       34697 :   NewSym (&newstr);
   10977                 :       34697 :   InitConstString (tok, newstr, name, name, SymbolTable_m2nulstr, false, known);
   10978                 :       34697 :   return newstr;
   10979                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   10980                 :             :   __builtin_unreachable ();
   10981                 :             : }
   10982                 :             : 
   10983                 :             : 
   10984                 :             : /*
   10985                 :             :    PutConstStringKnown - if sym is a constvar then convert it into a conststring.
   10986                 :             :                          If known is FALSE then contents is ignored and NulName is
   10987                 :             :                          stored.  If escape is TRUE then the contents will have
   10988                 :             :                          any escape sequences converted into single characters.
   10989                 :             : */
   10990                 :             : 
   10991                 :      430696 : extern "C" void SymbolTable_PutConstStringKnown (unsigned int tok, unsigned int sym, NameKey_Name contents, bool escape, bool known)
   10992                 :             : {
   10993                 :      430696 :   SymbolTable_PtrToSymbol pSym;
   10994                 :      430696 :   DynamicStrings_String s;
   10995                 :             : 
   10996                 :      430696 :   pSym = GetPsym (sym);
   10997                 :      430696 :   switch (pSym->SymbolType)
   10998                 :             :     {
   10999                 :      429282 :       case SymbolTable_ConstStringSym:
   11000                 :      429282 :         if (known)
   11001                 :             :           {
   11002                 :      383078 :             if (escape)
   11003                 :             :               {
   11004                 :        9589 :                 s = FormatStrings_HandleEscape (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (contents)));
   11005                 :        9589 :                 contents = NameKey_makekey (DynamicStrings_string (s));
   11006                 :        9589 :                 s = DynamicStrings_KillString (s);
   11007                 :             :               }
   11008                 :      383078 :             pSym->ConstString.Length = NameKey_LengthKey (contents);
   11009                 :      383078 :             pSym->ConstString.Contents = contents;
   11010                 :             :           }
   11011                 :             :         else
   11012                 :             :           {
   11013                 :       46204 :             pSym->ConstString.Length = 0;
   11014                 :       46204 :             pSym->ConstString.Contents = NameKey_NulName;
   11015                 :             :           }
   11016                 :      429282 :         pSym->ConstString.Known = known;
   11017                 :      429282 :         InitWhereDeclaredTok (tok, &pSym->ConstString.At);
   11018                 :      429282 :         InitWhereFirstUsedTok (tok, &pSym->ConstString.At);
   11019                 :      429282 :         break;
   11020                 :             : 
   11021                 :        1414 :       case SymbolTable_ConstVarSym:
   11022                 :        1414 :         InitConstString (tok, sym, pSym->ConstVar.name, contents, SymbolTable_m2str, escape, known);  /* Change a ConstVar to a ConstString copy name
   11023                 :             :                          and alter symboltype.  */
   11024                 :        1414 :         break;
   11025                 :             : 
   11026                 :             : 
   11027                 :           0 :       default:
   11028                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
   11029                 :      430696 :         break;
   11030                 :             :     }
   11031                 :      430696 : }
   11032                 :             : 
   11033                 :             : 
   11034                 :             : /*
   11035                 :             :    CopyConstString - copies string contents from expr to des
   11036                 :             :                      and retain the kind of string.
   11037                 :             : */
   11038                 :             : 
   11039                 :        1408 : extern "C" void SymbolTable_CopyConstString (unsigned int tok, unsigned int des, unsigned int expr)
   11040                 :             : {
   11041                 :        1408 :   SymbolTable_PtrToSymbol pSym;
   11042                 :             : 
   11043                 :        1408 :   M2Debug_Assert (SymbolTable_IsConstStringKnown (expr));
   11044                 :        1408 :   pSym = GetPsym (des);
   11045                 :        1408 :   switch (pSym->SymbolType)
   11046                 :             :     {
   11047                 :        1384 :       case SymbolTable_ConstStringSym:
   11048                 :        1384 :         InitConstString (tok, des, pSym->ConstString.name, SymbolTable_GetString (expr), GetConstStringKind (expr), false, true);
   11049                 :        1384 :         break;
   11050                 :             : 
   11051                 :          24 :       case SymbolTable_ConstVarSym:
   11052                 :          24 :         InitConstString (tok, des, pSym->ConstVar.name, SymbolTable_GetString (expr), GetConstStringKind (expr), false, true);  /* Change a ConstVar to a ConstString copy name
   11053                 :             :                          and alter symboltype.  */
   11054                 :          24 :         break;
   11055                 :             : 
   11056                 :             : 
   11057                 :           0 :       default:
   11058                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
   11059                 :        1408 :         break;
   11060                 :             :     }
   11061                 :        1408 : }
   11062                 :             : 
   11063                 :             : 
   11064                 :             : /*
   11065                 :             :    IsConstStringKnown - returns TRUE if sym is a const string
   11066                 :             :                         and the contents are known.
   11067                 :             : */
   11068                 :             : 
   11069                 :      921052 : extern "C" bool SymbolTable_IsConstStringKnown (unsigned int sym)
   11070                 :             : {
   11071                 :      921052 :   SymbolTable_PtrToSymbol pSym;
   11072                 :             : 
   11073                 :      921052 :   pSym = GetPsym (sym);
   11074                 :      921052 :   switch (pSym->SymbolType)
   11075                 :             :     {
   11076                 :      921028 :       case SymbolTable_ConstStringSym:
   11077                 :      921028 :         return pSym->ConstString.Known;
   11078                 :             :         break;
   11079                 :             : 
   11080                 :             : 
   11081                 :             :       default:
   11082                 :             :         return false;
   11083                 :             :         break;
   11084                 :             :     }
   11085                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11086                 :             :   __builtin_unreachable ();
   11087                 :             : }
   11088                 :             : 
   11089                 :             : 
   11090                 :             : /*
   11091                 :             :    IsConstStringM2 - returns whether this conststring is a
   11092                 :             :                      Modula-2 string.
   11093                 :             : */
   11094                 :             : 
   11095                 :           0 : extern "C" bool SymbolTable_IsConstStringM2 (unsigned int sym)
   11096                 :             : {
   11097                 :           0 :   return (GetConstStringKind (sym)) == SymbolTable_m2str;
   11098                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11099                 :             :   __builtin_unreachable ();
   11100                 :             : }
   11101                 :             : 
   11102                 :             : 
   11103                 :             : /*
   11104                 :             :    IsConstStringC - returns whether this conststring is a C style string
   11105                 :             :                     which will have any escape translated.
   11106                 :             : */
   11107                 :             : 
   11108                 :           0 : extern "C" bool SymbolTable_IsConstStringC (unsigned int sym)
   11109                 :             : {
   11110                 :           0 :   return (GetConstStringKind (sym)) == SymbolTable_cstr;
   11111                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11112                 :             :   __builtin_unreachable ();
   11113                 :             : }
   11114                 :             : 
   11115                 :             : 
   11116                 :             : /*
   11117                 :             :    IsConstStringM2nul - returns whether this conststring is a Modula-2 string which
   11118                 :             :                         contains a nul terminator.
   11119                 :             : */
   11120                 :             : 
   11121                 :      288024 : extern "C" bool SymbolTable_IsConstStringM2nul (unsigned int sym)
   11122                 :             : {
   11123                 :      288024 :   return (GetConstStringKind (sym)) == SymbolTable_m2nulstr;
   11124                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11125                 :             :   __builtin_unreachable ();
   11126                 :             : }
   11127                 :             : 
   11128                 :             : 
   11129                 :             : /*
   11130                 :             :    IsConstStringCnul - returns whether this conststring is a C style string
   11131                 :             :                        which will have any escape translated and also contains
   11132                 :             :                        a nul terminator.
   11133                 :             : */
   11134                 :             : 
   11135                 :        9249 : extern "C" bool SymbolTable_IsConstStringCnul (unsigned int sym)
   11136                 :             : {
   11137                 :        9249 :   return (GetConstStringKind (sym)) == SymbolTable_cnulstr;
   11138                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11139                 :             :   __builtin_unreachable ();
   11140                 :             : }
   11141                 :             : 
   11142                 :             : 
   11143                 :             : /*
   11144                 :             :    MakeSubrange - makes a new symbol into a subrange type with
   11145                 :             :                   name SubrangeName.
   11146                 :             : */
   11147                 :             : 
   11148                 :      229430 : extern "C" unsigned int SymbolTable_MakeSubrange (unsigned int tok, NameKey_Name SubrangeName)
   11149                 :             : {
   11150                 :      229430 :   SymbolTable_PtrToSymbol pSym;
   11151                 :      229430 :   unsigned int sym;
   11152                 :      229430 :   unsigned int oaf;
   11153                 :             : 
   11154                 :      229430 :   tok = CheckTok (tok, (const char *) "subrange", 8);
   11155                 :      229430 :   sym = HandleHiddenOrDeclare (tok, SubrangeName, &oaf);
   11156                 :      229430 :   if (! (SymbolTable_IsError (sym)))
   11157                 :             :     {
   11158                 :      229430 :       pSym = GetPsym (sym);
   11159                 :      229430 :       pSym->SymbolType = SymbolTable_SubrangeSym;
   11160                 :      229430 :       pSym->Subrange.name = SubrangeName;
   11161                 :      229430 :       pSym->Subrange.Low = SymbolTable_NulSym;  /* Index to a symbol determining  */
   11162                 :             :       /* ConstExpression.  */
   11163                 :      229430 :       pSym->Subrange.High = SymbolTable_NulSym;  /* Index to a symbol determining  */
   11164                 :             :       /* ConstExpression.  */
   11165                 :      229430 :       pSym->Subrange.Type = SymbolTable_NulSym;  /* Index to a type. Determines  */
   11166                 :             :       /* the type of subrange.  */
   11167                 :      229430 :       pSym->Subrange.Align = SymbolTable_NulSym;  /* The alignment of this type.  */
   11168                 :      229430 :       InitPacked (&pSym->Subrange.packedInfo);  /* not packed and no equivalent  */
   11169                 :      229430 :       SymbolKey_InitTree (&pSym->Subrange.ConstLitTree);  /* constants of this type.  */
   11170                 :      229430 :       pSym->Subrange.Size = M2ALU_InitValue ();  /* Size determines the type size  */
   11171                 :      229430 :       pSym->Subrange.oafamily = oaf;  /* The unbounded sym for this  */
   11172                 :      229430 :       pSym->Subrange.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   11173                 :      229430 :       InitWhereDeclaredTok (tok, &pSym->Subrange.At);  /* Declared here  */
   11174                 :             :     }
   11175                 :      229430 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   11176                 :      229430 :   return sym;
   11177                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11178                 :             :   __builtin_unreachable ();
   11179                 :             : }
   11180                 :             : 
   11181                 :             : 
   11182                 :             : /*
   11183                 :             :    MakeSet - makes a set Symbol with name, SetName.
   11184                 :             : */
   11185                 :             : 
   11186                 :       66782 : extern "C" unsigned int SymbolTable_MakeSet (unsigned int tok, NameKey_Name SetName)
   11187                 :             : {
   11188                 :       66782 :   SymbolTable_PtrToSymbol pSym;
   11189                 :       66782 :   unsigned int oaf;
   11190                 :       66782 :   unsigned int sym;
   11191                 :             : 
   11192                 :       66782 :   tok = CheckTok (tok, (const char *) "set", 3);
   11193                 :       66782 :   sym = HandleHiddenOrDeclare (tok, SetName, &oaf);
   11194                 :       66782 :   if (! (SymbolTable_IsError (sym)))
   11195                 :             :     {
   11196                 :       66782 :       pSym = GetPsym (sym);
   11197                 :       66782 :       pSym->SymbolType = SymbolTable_SetSym;
   11198                 :       66782 :       pSym->Set.name = SetName;  /* The name of the set.  */
   11199                 :       66782 :       pSym->Set.Type = SymbolTable_NulSym;  /* Index to a subrange symbol.  */
   11200                 :       66782 :       pSym->Set.Size = M2ALU_InitValue ();  /* Size of this set  */
   11201                 :       66782 :       InitPacked (&pSym->Set.packedInfo);  /* not packed and no  */
   11202                 :             :       /* equivalent (yet).  */
   11203                 :       66782 :       pSym->Set.ispacked = false;  /* Not yet known to be packed.  */
   11204                 :       66782 :       pSym->Set.SetInWord = true;  /* Can the set be stored in a  */
   11205                 :             :       /* single word?  */
   11206                 :       66782 :       pSym->Set.SetArray = SymbolTable_NulSym;  /* Set used for large sets.  */
   11207                 :       66782 :       pSym->Set.Align = SymbolTable_NulSym;  /* Set used for large sets.  */
   11208                 :       66782 :       pSym->Set.oafamily = oaf;  /* The unbounded sym for this  */
   11209                 :       66782 :       pSym->Set.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   11210                 :       66782 :       InitWhereDeclaredTok (tok, &pSym->Set.At);  /* Declared here  */
   11211                 :             :     }
   11212                 :       66782 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   11213                 :       66782 :   return sym;
   11214                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11215                 :             :   __builtin_unreachable ();
   11216                 :             : }
   11217                 :             : 
   11218                 :             : 
   11219                 :             : /*
   11220                 :             :    GetSetArray - return the set array for a large set.
   11221                 :             : */
   11222                 :             : 
   11223                 :     1677604 : extern "C" unsigned int SymbolTable_GetSetArray (unsigned int sym)
   11224                 :             : {
   11225                 :     1677604 :   SymbolTable_PtrToSymbol pSym;
   11226                 :             : 
   11227                 :     1677604 :   AssertInRange (sym);
   11228                 :     1677604 :   pSym = GetPsym (sym);
   11229                 :     1677604 :   switch (pSym->SymbolType)
   11230                 :             :     {
   11231                 :     1677604 :       case SymbolTable_SetSym:
   11232                 :     1677604 :         return pSym->Set.SetArray;
   11233                 :             :         break;
   11234                 :             : 
   11235                 :             : 
   11236                 :             :       default:
   11237                 :             :         return SymbolTable_NulSym;
   11238                 :             :         break;
   11239                 :             :     }
   11240                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11241                 :             :   __builtin_unreachable ();
   11242                 :             : }
   11243                 :             : 
   11244                 :             : 
   11245                 :             : /*
   11246                 :             :    PutSetArray - places array into the setarray field.
   11247                 :             : */
   11248                 :             : 
   11249                 :       62740 : extern "C" void SymbolTable_PutSetArray (unsigned int Sym, unsigned int array)
   11250                 :             : {
   11251                 :       62740 :   SymbolTable_PtrToSymbol pSym;
   11252                 :             : 
   11253                 :       62740 :   pSym = GetPsym (Sym);
   11254                 :       62740 :   switch (pSym->SymbolType)
   11255                 :             :     {
   11256                 :             :       case SymbolTable_ErrorSym:
   11257                 :             :         break;
   11258                 :             : 
   11259                 :       62740 :       case SymbolTable_SetSym:
   11260                 :       62740 :         pSym->Set.SetArray = array;
   11261                 :       62740 :         break;
   11262                 :             : 
   11263                 :             : 
   11264                 :           0 :       default:
   11265                 :           0 :         M2Error_InternalError ((const char *) "expecting a Set symbol", 22);
   11266                 :       62740 :         break;
   11267                 :             :     }
   11268                 :       62740 : }
   11269                 :             : 
   11270                 :             : 
   11271                 :             : /*
   11272                 :             :    MakeSetArray - create an ARRAY simpletype OF BOOLEAN.
   11273                 :             : */
   11274                 :             : 
   11275                 :       62740 : extern "C" unsigned int SymbolTable_MakeSetArray (unsigned int token, unsigned int subrangetype)
   11276                 :             : {
   11277                 :       62740 :   unsigned int array;
   11278                 :       62740 :   unsigned int subscript;
   11279                 :             : 
   11280                 :       62740 :   array = SymbolTable_MakeArray (token, SymbolTable_NulSym);
   11281                 :       62740 :   SymbolTable_PutArray (array, M2System_Byte);
   11282                 :       62740 :   subscript = SymbolTable_MakeSubscript ();
   11283                 :       62740 :   SymbolTable_PutSubscript (subscript, subrangetype);
   11284                 :       62740 :   SymbolTable_PutArraySubscript (array, subscript);
   11285                 :       62740 :   return array;
   11286                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11287                 :             :   __builtin_unreachable ();
   11288                 :             : }
   11289                 :             : 
   11290                 :             : 
   11291                 :             : /*
   11292                 :             :    PutSetInWord - set the SetInWord boolean to value.
   11293                 :             : */
   11294                 :             : 
   11295                 :       67420 : extern "C" void SymbolTable_PutSetInWord (unsigned int sym, bool value)
   11296                 :             : {
   11297                 :       67420 :   SymbolTable_PtrToSymbol pSym;
   11298                 :             : 
   11299                 :       67420 :   AssertInRange (sym);
   11300                 :       67420 :   pSym = GetPsym (sym);
   11301                 :       67420 :   switch (pSym->SymbolType)
   11302                 :             :     {
   11303                 :       67420 :       case SymbolTable_SetSym:
   11304                 :       67420 :         pSym->Set.SetInWord = value;
   11305                 :       67420 :         if (value)
   11306                 :             :           {
   11307                 :       65842 :             pSym->Set.Align = SymbolTable_MakeConstant (SymbolTable_GetDeclaredMod (sym), 0);
   11308                 :       65842 :             pSym->Set.ispacked = true;
   11309                 :             :           }
   11310                 :       67420 :         break;
   11311                 :             : 
   11312                 :             : 
   11313                 :           0 :       default:
   11314                 :           0 :         M2Error_InternalError ((const char *) "expecting a set symbol", 22);
   11315                 :       67420 :         break;
   11316                 :             :     }
   11317                 :       67420 : }
   11318                 :             : 
   11319                 :             : 
   11320                 :             : /*
   11321                 :             :    GetSetInWord - return SetInWord.
   11322                 :             : */
   11323                 :             : 
   11324                 :       20406 : extern "C" bool SymbolTable_GetSetInWord (unsigned int sym)
   11325                 :             : {
   11326                 :       20406 :   SymbolTable_PtrToSymbol pSym;
   11327                 :             : 
   11328                 :       20406 :   AssertInRange (sym);
   11329                 :       20406 :   pSym = GetPsym (sym);
   11330                 :       20406 :   switch (pSym->SymbolType)
   11331                 :             :     {
   11332                 :       20406 :       case SymbolTable_SetSym:
   11333                 :       20406 :         return pSym->Set.SetInWord;
   11334                 :           0 :         break;
   11335                 :             : 
   11336                 :             : 
   11337                 :           0 :       default:
   11338                 :           0 :         M2Error_InternalError ((const char *) "expecting a Set symbol", 22);
   11339                 :             :         break;
   11340                 :             :     }
   11341                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11342                 :             :   __builtin_unreachable ();
   11343                 :             : }
   11344                 :             : 
   11345                 :             : 
   11346                 :             : /*
   11347                 :             :    MakeArray - makes an Array symbol with name ArrayName.
   11348                 :             : */
   11349                 :             : 
   11350                 :      165592 : extern "C" unsigned int SymbolTable_MakeArray (unsigned int tok, NameKey_Name ArrayName)
   11351                 :             : {
   11352                 :      165592 :   SymbolTable_PtrToSymbol pSym;
   11353                 :      165592 :   unsigned int sym;
   11354                 :      165592 :   unsigned int oaf;
   11355                 :             : 
   11356                 :      165592 :   sym = HandleHiddenOrDeclare (tok, ArrayName, &oaf);
   11357                 :      165592 :   if (! (SymbolTable_IsError (sym)))
   11358                 :             :     {
   11359                 :      165592 :       pSym = GetPsym (sym);
   11360                 :      165592 :       pSym->SymbolType = SymbolTable_ArraySym;
   11361                 :      165592 :       pSym->Array.name = ArrayName;
   11362                 :      165592 :       pSym->Array.Subscript = SymbolTable_NulSym;  /* Contains the array subscripts.  */
   11363                 :      165592 :       pSym->Array.Size = M2ALU_InitValue ();  /* Size of array.  */
   11364                 :      165592 :       pSym->Array.Offset = M2ALU_InitValue ();  /* Offset of array.  */
   11365                 :      165592 :       pSym->Array.Type = SymbolTable_NulSym;  /* The Array Type. ARRAY OF Type.  */
   11366                 :      165592 :       pSym->Array.Align = SymbolTable_NulSym;  /* Alignment of this type.  */
   11367                 :      165592 :       pSym->Array.Large = false;  /* is this array large?  */
   11368                 :      165592 :       pSym->Array.oafamily = oaf;  /* The unbounded for this array  */
   11369                 :      165592 :       pSym->Array.Scope = SymbolTable_GetCurrentScope ();  /* Which scope created it  */
   11370                 :      165592 :       InitWhereDeclaredTok (tok, &pSym->Array.At);  /* Declared here  */
   11371                 :             :     }
   11372                 :      165592 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   11373                 :      165592 :   return sym;
   11374                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11375                 :             :   __builtin_unreachable ();
   11376                 :             : }
   11377                 :             : 
   11378                 :             : 
   11379                 :             : /*
   11380                 :             :    PutArrayLarge - indicates that this is a large array in which case
   11381                 :             :                    the interface to gcc maps this array from 0..high-low,
   11382                 :             :                    using an integer indice.
   11383                 :             : */
   11384                 :             : 
   11385                 :          24 : extern "C" void SymbolTable_PutArrayLarge (unsigned int array)
   11386                 :             : {
   11387                 :          24 :   SymbolTable_PtrToSymbol pSym;
   11388                 :             : 
   11389                 :          24 :   if (! (SymbolTable_IsError (array)))
   11390                 :             :     {
   11391                 :          24 :       M2Debug_Assert (SymbolTable_IsArray (array));
   11392                 :          24 :       pSym = GetPsym (array);
   11393                 :          24 :       pSym->Array.Large = true;
   11394                 :             :     }
   11395                 :          24 : }
   11396                 :             : 
   11397                 :             : 
   11398                 :             : /*
   11399                 :             :    IsArrayLarge - returns TRUE if we need to treat this as a large array.
   11400                 :             : */
   11401                 :             : 
   11402                 :       47636 : extern "C" bool SymbolTable_IsArrayLarge (unsigned int array)
   11403                 :             : {
   11404                 :       47636 :   SymbolTable_PtrToSymbol pSym;
   11405                 :             : 
   11406                 :       47636 :   M2Debug_Assert (SymbolTable_IsArray (array));
   11407                 :       47636 :   pSym = GetPsym (array);
   11408                 :       47636 :   return pSym->Array.Large;
   11409                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11410                 :             :   __builtin_unreachable ();
   11411                 :             : }
   11412                 :             : 
   11413                 :             : 
   11414                 :             : /*
   11415                 :             :    PutPriority - places a interrupt, priority, value into module, module.
   11416                 :             : */
   11417                 :             : 
   11418                 :          38 : extern "C" void SymbolTable_PutPriority (unsigned int module, unsigned int priority)
   11419                 :             : {
   11420                 :          38 :   SymbolTable_PtrToSymbol pSym;
   11421                 :             : 
   11422                 :          38 :   M2Debug_Assert (module != SymbolTable_NulSym);
   11423                 :          38 :   pSym = GetPsym (module);
   11424                 :          38 :   switch (pSym->SymbolType)
   11425                 :             :     {
   11426                 :          14 :       case SymbolTable_DefImpSym:
   11427                 :          14 :         pSym->DefImp.Priority = priority;
   11428                 :          14 :         break;
   11429                 :             : 
   11430                 :          24 :       case SymbolTable_ModuleSym:
   11431                 :          24 :         pSym->Module.Priority = priority;
   11432                 :          24 :         break;
   11433                 :             : 
   11434                 :             : 
   11435                 :           0 :       default:
   11436                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   11437                 :          38 :         break;
   11438                 :             :     }
   11439                 :          38 : }
   11440                 :             : 
   11441                 :             : 
   11442                 :             : /*
   11443                 :             :    GetPriority - returns the interrupt priority which was assigned to
   11444                 :             :                  module, module.
   11445                 :             : */
   11446                 :             : 
   11447                 :      458984 : extern "C" unsigned int SymbolTable_GetPriority (unsigned int module)
   11448                 :             : {
   11449                 :      458984 :   SymbolTable_PtrToSymbol pSym;
   11450                 :             : 
   11451                 :      458984 :   M2Debug_Assert (module != SymbolTable_NulSym);
   11452                 :      458984 :   pSym = GetPsym (module);
   11453                 :      458984 :   switch (pSym->SymbolType)
   11454                 :             :     {
   11455                 :      323009 :       case SymbolTable_DefImpSym:
   11456                 :      323009 :         return pSym->DefImp.Priority;
   11457                 :      135975 :         break;
   11458                 :             : 
   11459                 :      135975 :       case SymbolTable_ModuleSym:
   11460                 :      135975 :         return pSym->Module.Priority;
   11461                 :           0 :         break;
   11462                 :             : 
   11463                 :             : 
   11464                 :           0 :       default:
   11465                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   11466                 :             :         break;
   11467                 :             :     }
   11468                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11469                 :             :   __builtin_unreachable ();
   11470                 :             : }
   11471                 :             : 
   11472                 :             : 
   11473                 :             : /*
   11474                 :             :    PutNeedSavePriority - set a boolean flag indicating that this procedure
   11475                 :             :                          needs to save and restore interrupts.
   11476                 :             : */
   11477                 :             : 
   11478                 :         162 : extern "C" void SymbolTable_PutNeedSavePriority (unsigned int sym)
   11479                 :             : {
   11480                 :         162 :   SymbolTable_PtrToSymbol pSym;
   11481                 :             : 
   11482                 :         162 :   pSym = GetPsym (sym);
   11483                 :         162 :   switch (pSym->SymbolType)
   11484                 :             :     {
   11485                 :         162 :       case SymbolTable_ProcedureSym:
   11486                 :         162 :         pSym->Procedure.SavePriority = true;
   11487                 :         162 :         break;
   11488                 :             : 
   11489                 :             : 
   11490                 :           0 :       default:
   11491                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   11492                 :         162 :         break;
   11493                 :             :     }
   11494                 :         162 : }
   11495                 :             : 
   11496                 :             : 
   11497                 :             : /*
   11498                 :             :    GetNeedSavePriority - returns the boolean flag indicating whether this procedure
   11499                 :             :                          needs to save and restore interrupts.
   11500                 :             : */
   11501                 :             : 
   11502                 :         680 : extern "C" bool SymbolTable_GetNeedSavePriority (unsigned int sym)
   11503                 :             : {
   11504                 :         680 :   SymbolTable_PtrToSymbol pSym;
   11505                 :             : 
   11506                 :         680 :   pSym = GetPsym (sym);
   11507                 :         680 :   switch (pSym->SymbolType)
   11508                 :             :     {
   11509                 :         680 :       case SymbolTable_ProcedureSym:
   11510                 :         680 :         return pSym->Procedure.SavePriority;
   11511                 :           0 :         break;
   11512                 :             : 
   11513                 :             : 
   11514                 :           0 :       default:
   11515                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   11516                 :             :         break;
   11517                 :             :     }
   11518                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11519                 :             :   __builtin_unreachable ();
   11520                 :             : }
   11521                 :             : 
   11522                 :             : 
   11523                 :             : /*
   11524                 :             :    PutVariableAtAddress - determines that a variable, sym, is declared at
   11525                 :             :                           a specific address.
   11526                 :             : */
   11527                 :             : 
   11528                 :         108 : extern "C" void SymbolTable_PutVariableAtAddress (unsigned int sym, unsigned int address)
   11529                 :             : {
   11530                 :         108 :   SymbolTable_PtrToSymbol pSym;
   11531                 :             : 
   11532                 :         108 :   M2Debug_Assert (sym != SymbolTable_NulSym);
   11533                 :         108 :   pSym = GetPsym (sym);
   11534                 :         108 :   switch (pSym->SymbolType)
   11535                 :             :     {
   11536                 :         108 :       case SymbolTable_VarSym:
   11537                 :         108 :         pSym->Var.AtAddress = true;
   11538                 :         108 :         pSym->Var.Address = address;
   11539                 :         108 :         break;
   11540                 :             : 
   11541                 :             : 
   11542                 :           0 :       default:
   11543                 :           0 :         M2Error_InternalError ((const char *) "expecting a variable symbol", 27);
   11544                 :         108 :         break;
   11545                 :             :     }
   11546                 :         108 : }
   11547                 :             : 
   11548                 :             : 
   11549                 :             : /*
   11550                 :             :    GetVariableAtAddress - returns the address at which variable, sym, is declared.
   11551                 :             : */
   11552                 :             : 
   11553                 :          54 : extern "C" unsigned int SymbolTable_GetVariableAtAddress (unsigned int sym)
   11554                 :             : {
   11555                 :          54 :   SymbolTable_PtrToSymbol pSym;
   11556                 :             : 
   11557                 :          54 :   M2Debug_Assert (sym != SymbolTable_NulSym);
   11558                 :          54 :   pSym = GetPsym (sym);
   11559                 :          54 :   switch (pSym->SymbolType)
   11560                 :             :     {
   11561                 :          54 :       case SymbolTable_VarSym:
   11562                 :          54 :         return pSym->Var.Address;
   11563                 :           0 :         break;
   11564                 :             : 
   11565                 :             : 
   11566                 :           0 :       default:
   11567                 :           0 :         M2Error_InternalError ((const char *) "expecting a variable symbol", 27);
   11568                 :             :         break;
   11569                 :             :     }
   11570                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11571                 :             :   __builtin_unreachable ();
   11572                 :             : }
   11573                 :             : 
   11574                 :             : 
   11575                 :             : /*
   11576                 :             :    IsVariableAtAddress - returns TRUE if a variable, sym, was declared at
   11577                 :             :                          a specific address.
   11578                 :             : */
   11579                 :             : 
   11580                 :      338277 : extern "C" bool SymbolTable_IsVariableAtAddress (unsigned int sym)
   11581                 :             : {
   11582                 :      338277 :   SymbolTable_PtrToSymbol pSym;
   11583                 :             : 
   11584                 :      338277 :   M2Debug_Assert (sym != SymbolTable_NulSym);
   11585                 :      338277 :   pSym = GetPsym (sym);
   11586                 :      338277 :   switch (pSym->SymbolType)
   11587                 :             :     {
   11588                 :      338277 :       case SymbolTable_VarSym:
   11589                 :      338277 :         return pSym->Var.AtAddress;
   11590                 :           0 :         break;
   11591                 :             : 
   11592                 :             : 
   11593                 :           0 :       default:
   11594                 :           0 :         M2Error_InternalError ((const char *) "expecting a variable symbol", 27);
   11595                 :             :         break;
   11596                 :             :     }
   11597                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11598                 :             :   __builtin_unreachable ();
   11599                 :             : }
   11600                 :             : 
   11601                 :             : 
   11602                 :             : /*
   11603                 :             :    PutVariableSSA - assigns value to the SSA field within variable sym.
   11604                 :             : */
   11605                 :             : 
   11606                 :           0 : extern "C" void SymbolTable_PutVariableSSA (unsigned int sym, bool value)
   11607                 :             : {
   11608                 :           0 :   SymbolTable_PtrToSymbol pSym;
   11609                 :             : 
   11610                 :           0 :   M2Debug_Assert (sym != SymbolTable_NulSym);
   11611                 :           0 :   pSym = GetPsym (sym);
   11612                 :           0 :   switch (pSym->SymbolType)
   11613                 :             :     {
   11614                 :           0 :       case SymbolTable_VarSym:
   11615                 :           0 :         pSym->Var.IsSSA = value;
   11616                 :           0 :         break;
   11617                 :             : 
   11618                 :             : 
   11619                 :           0 :       default:
   11620                 :           0 :         M2Error_InternalError ((const char *) "expecting a variable symbol", 27);
   11621                 :           0 :         break;
   11622                 :             :     }
   11623                 :           0 : }
   11624                 :             : 
   11625                 :             : 
   11626                 :             : /*
   11627                 :             :    IsVariableSSA - returns TRUE if variable is known to be a SSA.
   11628                 :             : */
   11629                 :             : 
   11630                 :      197081 : extern "C" bool SymbolTable_IsVariableSSA (unsigned int sym)
   11631                 :             : {
   11632                 :      197081 :   SymbolTable_PtrToSymbol pSym;
   11633                 :             : 
   11634                 :      197081 :   M2Debug_Assert (sym != SymbolTable_NulSym);
   11635                 :      197081 :   pSym = GetPsym (sym);
   11636                 :      197081 :   switch (pSym->SymbolType)
   11637                 :             :     {
   11638                 :      197081 :       case SymbolTable_VarSym:
   11639                 :      197081 :         return pSym->Var.IsSSA;
   11640                 :             :         break;
   11641                 :             : 
   11642                 :             : 
   11643                 :             :       default:
   11644                 :             :         return false;
   11645                 :             :         break;
   11646                 :             :     }
   11647                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11648                 :             :   __builtin_unreachable ();
   11649                 :             : }
   11650                 :             : 
   11651                 :             : 
   11652                 :             : /*
   11653                 :             :    PutVarConst - sets the IsConst field to value indicating the variable is read only.
   11654                 :             : */
   11655                 :             : 
   11656                 :      195796 : extern "C" void SymbolTable_PutVarConst (unsigned int sym, bool value)
   11657                 :             : {
   11658                 :      195796 :   SymbolTable_PtrToSymbol pSym;
   11659                 :             : 
   11660                 :      195796 :   if (SymbolTable_IsVar (sym))
   11661                 :             :     {
   11662                 :      195796 :       pSym = GetPsym (sym);
   11663                 :      195796 :       pSym->Var.IsConst = value;
   11664                 :             :     }
   11665                 :      195796 : }
   11666                 :             : 
   11667                 :             : 
   11668                 :             : /*
   11669                 :             :    MakeGnuAsm - create a GnuAsm symbol.
   11670                 :             : */
   11671                 :             : 
   11672                 :          27 : extern "C" unsigned int SymbolTable_MakeGnuAsm (void)
   11673                 :             : {
   11674                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11675                 :          27 :   unsigned int Sym;
   11676                 :             : 
   11677                 :          27 :   NewSym (&Sym);
   11678                 :          27 :   pSym = GetPsym (Sym);
   11679                 :          27 :   pSym->SymbolType = SymbolTable_GnuAsmSym;
   11680                 :          27 :   pSym->GnuAsm.String = SymbolTable_NulSym;
   11681                 :          27 :   InitWhereDeclared (&pSym->GnuAsm.At);
   11682                 :          27 :   pSym->GnuAsm.Inputs = SymbolTable_NulSym;
   11683                 :          27 :   pSym->GnuAsm.Outputs = SymbolTable_NulSym;
   11684                 :          27 :   pSym->GnuAsm.Trashed = SymbolTable_NulSym;
   11685                 :          27 :   pSym->GnuAsm.Volatile = false;
   11686                 :          27 :   pSym->GnuAsm.Simple = false;
   11687                 :          27 :   return Sym;
   11688                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11689                 :             :   __builtin_unreachable ();
   11690                 :             : }
   11691                 :             : 
   11692                 :             : 
   11693                 :             : /*
   11694                 :             :    PutGnuAsm - places the instruction textual name into the GnuAsm symbol.
   11695                 :             : */
   11696                 :             : 
   11697                 :          27 : extern "C" void SymbolTable_PutGnuAsm (unsigned int sym, unsigned int string)
   11698                 :             : {
   11699                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11700                 :             : 
   11701                 :          27 :   M2Debug_Assert (SymbolTable_IsConstString (string));
   11702                 :          27 :   pSym = GetPsym (sym);
   11703                 :          27 :   switch (pSym->SymbolType)
   11704                 :             :     {
   11705                 :          27 :       case SymbolTable_GnuAsmSym:
   11706                 :          27 :         pSym->GnuAsm.String = string;
   11707                 :          27 :         break;
   11708                 :             : 
   11709                 :             : 
   11710                 :           0 :       default:
   11711                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11712                 :          27 :         break;
   11713                 :             :     }
   11714                 :          27 : }
   11715                 :             : 
   11716                 :             : 
   11717                 :             : /*
   11718                 :             :    PutGnuAsmOutput - places the interface object, out, into GnuAsm symbol, sym.
   11719                 :             : */
   11720                 :             : 
   11721                 :          21 : extern "C" void SymbolTable_PutGnuAsmOutput (unsigned int sym, unsigned int out)
   11722                 :             : {
   11723                 :          21 :   SymbolTable_PtrToSymbol pSym;
   11724                 :             : 
   11725                 :          21 :   pSym = GetPsym (sym);
   11726                 :          21 :   switch (pSym->SymbolType)
   11727                 :             :     {
   11728                 :          21 :       case SymbolTable_GnuAsmSym:
   11729                 :          21 :         pSym->GnuAsm.Outputs = out;
   11730                 :          21 :         break;
   11731                 :             : 
   11732                 :             : 
   11733                 :           0 :       default:
   11734                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11735                 :          21 :         break;
   11736                 :             :     }
   11737                 :          21 : }
   11738                 :             : 
   11739                 :             : 
   11740                 :             : /*
   11741                 :             :    PutGnuAsmInput - places the interface object, in, into GnuAsm symbol, sym.
   11742                 :             : */
   11743                 :             : 
   11744                 :          15 : extern "C" void SymbolTable_PutGnuAsmInput (unsigned int sym, unsigned int in)
   11745                 :             : {
   11746                 :          15 :   SymbolTable_PtrToSymbol pSym;
   11747                 :             : 
   11748                 :          15 :   pSym = GetPsym (sym);
   11749                 :          15 :   switch (pSym->SymbolType)
   11750                 :             :     {
   11751                 :          15 :       case SymbolTable_GnuAsmSym:
   11752                 :          15 :         pSym->GnuAsm.Inputs = in;
   11753                 :          15 :         break;
   11754                 :             : 
   11755                 :             : 
   11756                 :           0 :       default:
   11757                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11758                 :          15 :         break;
   11759                 :             :     }
   11760                 :          15 : }
   11761                 :             : 
   11762                 :             : 
   11763                 :             : /*
   11764                 :             :    PutGnuAsmTrash - places the interface object, trash, into GnuAsm symbol, sym.
   11765                 :             : */
   11766                 :             : 
   11767                 :           9 : extern "C" void SymbolTable_PutGnuAsmTrash (unsigned int sym, unsigned int trash)
   11768                 :             : {
   11769                 :           9 :   SymbolTable_PtrToSymbol pSym;
   11770                 :             : 
   11771                 :           9 :   pSym = GetPsym (sym);
   11772                 :           9 :   switch (pSym->SymbolType)
   11773                 :             :     {
   11774                 :           9 :       case SymbolTable_GnuAsmSym:
   11775                 :           9 :         pSym->GnuAsm.Trashed = trash;
   11776                 :           9 :         break;
   11777                 :             : 
   11778                 :             : 
   11779                 :           0 :       default:
   11780                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11781                 :           9 :         break;
   11782                 :             :     }
   11783                 :           9 : }
   11784                 :             : 
   11785                 :             : 
   11786                 :             : /*
   11787                 :             :    GetGnuAsm - returns the string symbol, representing the instruction textual
   11788                 :             :                of the GnuAsm symbol. It will return a ConstString.
   11789                 :             : */
   11790                 :             : 
   11791                 :          27 : extern "C" unsigned int SymbolTable_GetGnuAsm (unsigned int sym)
   11792                 :             : {
   11793                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11794                 :             : 
   11795                 :          27 :   pSym = GetPsym (sym);
   11796                 :          27 :   switch (pSym->SymbolType)
   11797                 :             :     {
   11798                 :          27 :       case SymbolTable_GnuAsmSym:
   11799                 :          27 :         return pSym->GnuAsm.String;
   11800                 :           0 :         break;
   11801                 :             : 
   11802                 :             : 
   11803                 :           0 :       default:
   11804                 :           0 :         M2Error_InternalError ((const char *) "expecting GnuAsm symbol", 23);
   11805                 :             :         break;
   11806                 :             :     }
   11807                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11808                 :             :   __builtin_unreachable ();
   11809                 :             : }
   11810                 :             : 
   11811                 :             : 
   11812                 :             : /*
   11813                 :             :    GetGnuAsmInput - returns the input list of registers.
   11814                 :             : */
   11815                 :             : 
   11816                 :          27 : extern "C" unsigned int SymbolTable_GetGnuAsmInput (unsigned int sym)
   11817                 :             : {
   11818                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11819                 :             : 
   11820                 :          27 :   pSym = GetPsym (sym);
   11821                 :          27 :   switch (pSym->SymbolType)
   11822                 :             :     {
   11823                 :          27 :       case SymbolTable_GnuAsmSym:
   11824                 :          27 :         return pSym->GnuAsm.Inputs;
   11825                 :           0 :         break;
   11826                 :             : 
   11827                 :             : 
   11828                 :           0 :       default:
   11829                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11830                 :             :         break;
   11831                 :             :     }
   11832                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11833                 :             :   __builtin_unreachable ();
   11834                 :             : }
   11835                 :             : 
   11836                 :             : 
   11837                 :             : /*
   11838                 :             :    GetGnuAsmOutput - returns the output list of registers.
   11839                 :             : */
   11840                 :             : 
   11841                 :          27 : extern "C" unsigned int SymbolTable_GetGnuAsmOutput (unsigned int sym)
   11842                 :             : {
   11843                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11844                 :             : 
   11845                 :          27 :   pSym = GetPsym (sym);
   11846                 :          27 :   switch (pSym->SymbolType)
   11847                 :             :     {
   11848                 :          27 :       case SymbolTable_GnuAsmSym:
   11849                 :          27 :         return pSym->GnuAsm.Outputs;
   11850                 :           0 :         break;
   11851                 :             : 
   11852                 :             : 
   11853                 :           0 :       default:
   11854                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11855                 :             :         break;
   11856                 :             :     }
   11857                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11858                 :             :   __builtin_unreachable ();
   11859                 :             : }
   11860                 :             : 
   11861                 :             : 
   11862                 :             : /*
   11863                 :             :    GetGnuAsmTrash - returns the list of trashed registers.
   11864                 :             : */
   11865                 :             : 
   11866                 :          27 : extern "C" unsigned int SymbolTable_GetGnuAsmTrash (unsigned int sym)
   11867                 :             : {
   11868                 :          27 :   SymbolTable_PtrToSymbol pSym;
   11869                 :             : 
   11870                 :          27 :   pSym = GetPsym (sym);
   11871                 :          27 :   switch (pSym->SymbolType)
   11872                 :             :     {
   11873                 :          27 :       case SymbolTable_GnuAsmSym:
   11874                 :          27 :         return pSym->GnuAsm.Trashed;
   11875                 :           0 :         break;
   11876                 :             : 
   11877                 :             : 
   11878                 :           0 :       default:
   11879                 :           0 :         M2Error_InternalError ((const char *) "expecting PutGnuAsm symbol", 26);
   11880                 :             :         break;
   11881                 :             :     }
   11882                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   11883                 :             :   __builtin_unreachable ();
   11884                 :             : }
   11885                 :             : 
   11886                 :             : 
   11887                 :             : /*
   11888                 :             :    PutGnuAsmVolatile - defines a GnuAsm symbol as VOLATILE.
   11889                 :             : */
   11890                 :             : 
   11891                 :          15 : extern "C" void SymbolTable_PutGnuAsmVolatile (unsigned int Sym)
   11892                 :             : {
   11893                 :          15 :   SymbolTable_PtrToSymbol pSym;
   11894                 :             : 
   11895                 :          15 :   pSym = GetPsym (Sym);
   11896                 :          15 :   switch (pSym->SymbolType)
   11897                 :             :     {
   11898                 :          15 :       case SymbolTable_GnuAsmSym:
   11899                 :          15 :         pSym->GnuAsm.Volatile = true;
   11900                 :          15 :         break;
   11901                 :             : 
   11902                 :             : 
   11903                 :           0 :       default:
   11904                 :           0 :         M2Error_InternalError ((const char *) "expecting GnuAsm symbol", 23);
   11905                 :          15 :         break;
   11906                 :             :     }
   11907                 :          15 : }
   11908                 :             : 
   11909                 :             : 
   11910                 :             : /*
   11911                 :             :    PutGnuAsmSimple - defines a GnuAsm symbol as a simple kind.
   11912                 :             : */
   11913                 :             : 
   11914                 :           6 : extern "C" void SymbolTable_PutGnuAsmSimple (unsigned int Sym)
   11915                 :             : {
   11916                 :           6 :   SymbolTable_PtrToSymbol pSym;
   11917                 :             : 
   11918                 :           6 :   pSym = GetPsym (Sym);
   11919                 :           6 :   switch (pSym->SymbolType)
   11920                 :             :     {
   11921                 :           6 :       case SymbolTable_GnuAsmSym:
   11922                 :           6 :         pSym->GnuAsm.Simple = true;
   11923                 :           6 :         break;
   11924                 :             : 
   11925                 :             : 
   11926                 :           0 :       default:
   11927                 :           0 :         M2Error_InternalError ((const char *) "expecting GnuAsm symbol", 23);
   11928                 :           6 :         break;
   11929                 :             :     }
   11930                 :           6 : }
   11931                 :             : 
   11932                 :             : 
   11933                 :             : /*
   11934                 :             :    MakeRegInterface - creates and returns a register interface symbol.
   11935                 :             : */
   11936                 :             : 
   11937                 :          33 : extern "C" unsigned int SymbolTable_MakeRegInterface (void)
   11938                 :             : {
   11939                 :          33 :   SymbolTable_PtrToSymbol pSym;
   11940                 :          33 :   unsigned int Sym;
   11941                 :             : 
   11942                 :          33 :   NewSym (&Sym);
   11943                 :          33 :   pSym = GetPsym (Sym);
   11944                 :          33 :   pSym->SymbolType = SymbolTable_InterfaceSym;
   11945                 :          33 :   pSym->Interface.Parameters = Indexing_InitIndex (1);
   11946                 :          33 :   InitWhereDeclared (&pSym->Interface.At);
   11947                 :          33 :   return Sym;
   11948                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   11949                 :             :   __builtin_unreachable ();
   11950                 :             : }
   11951                 :             : 
   11952                 :             : 
   11953                 :             : /*
   11954                 :             :    PutRegInterface - places a, name, string, and, object, into the interface array,
   11955                 :             :                      sym, at position, i.
   11956                 :             :                      The string symbol will either be a register name or a constraint.
   11957                 :             :                      The object is an optional Modula-2 variable or constant symbol.
   11958                 :             :                      read and write are the quadruple numbers representing any read
   11959                 :             :                      or write operation.
   11960                 :             : */
   11961                 :             : 
   11962                 :          36 : extern "C" void SymbolTable_PutRegInterface (unsigned int tok, unsigned int sym, unsigned int i, NameKey_Name n, unsigned int string, unsigned int object, unsigned int read_, unsigned int write_)
   11963                 :             : {
   11964                 :          36 :   SymbolTable_PtrToSymbol pSym;
   11965                 :          36 :   SymbolTable_PtrToAsmConstraint p;
   11966                 :             : 
   11967                 :          36 :   pSym = GetPsym (sym);
   11968                 :          36 :   switch (pSym->SymbolType)
   11969                 :             :     {
   11970                 :          36 :       case SymbolTable_InterfaceSym:
   11971                 :          36 :         if (Indexing_InBounds (pSym->Interface.Parameters, i))
   11972                 :             :           {
   11973                 :           0 :             p = static_cast<SymbolTable_PtrToAsmConstraint> (Indexing_GetIndice (pSym->Interface.Parameters, i));
   11974                 :             :           }
   11975                 :          36 :         else if (i == ((Indexing_HighIndice (pSym->Interface.Parameters))+1))
   11976                 :             :           {
   11977                 :             :             /* avoid dangling else.  */
   11978                 :          36 :             Storage_ALLOCATE ((void **) &p, sizeof (SymbolTable__T5));
   11979                 :          36 :             Indexing_PutIndice (pSym->Interface.Parameters, i, reinterpret_cast <void *> (p));
   11980                 :             :           }
   11981                 :             :         else
   11982                 :             :           {
   11983                 :             :             /* avoid dangling else.  */
   11984                 :           0 :             M2Error_InternalError ((const char *) "expecting to add parameters sequentially", 40);
   11985                 :             :           }
   11986                 :          36 :         p->tokpos = tok;
   11987                 :          36 :         p->name = n;
   11988                 :          36 :         p->str = string;
   11989                 :          36 :         p->obj = object;
   11990                 :          36 :         PutFirstUsed (object, tok, read_, write_);
   11991                 :          36 :         break;
   11992                 :             : 
   11993                 :             : 
   11994                 :           0 :       default:
   11995                 :           0 :         M2Error_InternalError ((const char *) "expecting Interface symbol", 26);
   11996                 :          36 :         break;
   11997                 :             :     }
   11998                 :          36 : }
   11999                 :             : 
   12000                 :             : 
   12001                 :             : /*
   12002                 :             :    GetRegInterface - gets a, name, string, and, object, from the interface array,
   12003                 :             :                      sym, from position, i.
   12004                 :             : */
   12005                 :             : 
   12006                 :          69 : extern "C" void SymbolTable_GetRegInterface (unsigned int sym, unsigned int i, unsigned int *tok, NameKey_Name *n, unsigned int *string, unsigned int *object)
   12007                 :             : {
   12008                 :          69 :   SymbolTable_PtrToSymbol pSym;
   12009                 :          69 :   SymbolTable_PtrToAsmConstraint p;
   12010                 :             : 
   12011                 :          69 :   pSym = GetPsym (sym);
   12012                 :          69 :   switch (pSym->SymbolType)
   12013                 :             :     {
   12014                 :          69 :       case SymbolTable_InterfaceSym:
   12015                 :          69 :         if (Indexing_InBounds (pSym->Interface.Parameters, i))
   12016                 :             :           {
   12017                 :          36 :             p = static_cast<SymbolTable_PtrToAsmConstraint> (Indexing_GetIndice (pSym->Interface.Parameters, i));
   12018                 :          36 :             (*tok) = p->tokpos;
   12019                 :          36 :             (*n) = p->name;
   12020                 :          36 :             (*string) = p->str;
   12021                 :          36 :             (*object) = p->obj;
   12022                 :             :           }
   12023                 :             :         else
   12024                 :             :           {
   12025                 :          33 :             (*tok) = M2LexBuf_UnknownTokenNo;
   12026                 :          33 :             (*n) = NameKey_NulName;
   12027                 :          33 :             (*string) = SymbolTable_NulSym;
   12028                 :          33 :             (*object) = SymbolTable_NulSym;
   12029                 :             :           }
   12030                 :          69 :         break;
   12031                 :             : 
   12032                 :             : 
   12033                 :           0 :       default:
   12034                 :           0 :         M2Error_InternalError ((const char *) "expecting Interface symbol", 26);
   12035                 :          69 :         break;
   12036                 :             :     }
   12037                 :          69 : }
   12038                 :             : 
   12039                 :             : 
   12040                 :             : /*
   12041                 :             :    GetModule - Returns the Module symbol for the module with name, name.
   12042                 :             : */
   12043                 :             : 
   12044                 :      408936 : extern "C" unsigned int SymbolTable_GetModule (NameKey_Name name)
   12045                 :             : {
   12046                 :      408936 :   return static_cast<unsigned int> (SymbolKey_GetSymKey (ModuleTree, name));
   12047                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12048                 :             :   __builtin_unreachable ();
   12049                 :             : }
   12050                 :             : 
   12051                 :             : 
   12052                 :             : /*
   12053                 :             :    GetCurrentModule - returns the current module Sym that is being
   12054                 :             :                       compiled.
   12055                 :             : */
   12056                 :             : 
   12057                 :    59815770 : extern "C" unsigned int SymbolTable_GetCurrentModule (void)
   12058                 :             : {
   12059                 :    59815770 :   return CurrentModule;
   12060                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12061                 :             :   __builtin_unreachable ();
   12062                 :             : }
   12063                 :             : 
   12064                 :             : 
   12065                 :             : /*
   12066                 :             :    GetFileModule - returns the FileModule symbol that was requested by
   12067                 :             :                    the user to be compiled.
   12068                 :             : */
   12069                 :             : 
   12070                 :      280530 : extern "C" unsigned int SymbolTable_GetFileModule (void)
   12071                 :             : {
   12072                 :      280530 :   return FileModule;
   12073                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12074                 :             :   __builtin_unreachable ();
   12075                 :             : }
   12076                 :             : 
   12077                 :             : 
   12078                 :             : /*
   12079                 :             :    GetBaseModule - returns the base module symbol that contains Modula-2
   12080                 :             :                    base types, procedures and functions.
   12081                 :             : */
   12082                 :             : 
   12083                 :     8504305 : extern "C" unsigned int SymbolTable_GetBaseModule (void)
   12084                 :             : {
   12085                 :     8504305 :   return BaseModule;
   12086                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12087                 :             :   __builtin_unreachable ();
   12088                 :             : }
   12089                 :             : 
   12090                 :             : 
   12091                 :             : /*
   12092                 :             :    GetMainModule - returns the main module symbol that was requested by
   12093                 :             :                    the user to be compiled.
   12094                 :             : */
   12095                 :             : 
   12096                 :    20215358 : extern "C" unsigned int SymbolTable_GetMainModule (void)
   12097                 :             : {
   12098                 :    20215358 :   return MainModule;
   12099                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12100                 :             :   __builtin_unreachable ();
   12101                 :             : }
   12102                 :             : 
   12103                 :             : 
   12104                 :             : /*
   12105                 :             :    GetCurrentModuleScope - returns the module symbol which forms the
   12106                 :             :                            current (possibly inner most) module.
   12107                 :             : */
   12108                 :             : 
   12109                 :     2279957 : extern "C" unsigned int SymbolTable_GetCurrentModuleScope (void)
   12110                 :             : {
   12111                 :     2279957 :   SymbolTable_PtrToCallFrame pCall;
   12112                 :     2279957 :   unsigned int i;
   12113                 :             : 
   12114                 :     2279957 :   i = ScopePtr;
   12115                 :     2279957 :   pCall = GetPcall (i);
   12116                 :     5329979 :   while ((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search))))
   12117                 :             :     {
   12118                 :      770065 :       M2Debug_Assert (i > 0);
   12119                 :      770065 :       i -= 1;
   12120                 :      770065 :       pCall = GetPcall (i);
   12121                 :             :     }
   12122                 :     2279957 :   return pCall->Search;
   12123                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12124                 :             :   __builtin_unreachable ();
   12125                 :             : }
   12126                 :             : 
   12127                 :             : 
   12128                 :             : /*
   12129                 :             :    GetLastModuleScope - returns the last module scope encountered,
   12130                 :             :                         the module scope before the Current Module Scope.
   12131                 :             : */
   12132                 :             : 
   12133                 :           0 : extern "C" unsigned int SymbolTable_GetLastModuleScope (void)
   12134                 :             : {
   12135                 :           0 :   SymbolTable_PtrToCallFrame pCall;
   12136                 :           0 :   unsigned int i;
   12137                 :             : 
   12138                 :           0 :   i = ScopePtr;
   12139                 :           0 :   pCall = GetPcall (i);
   12140                 :           0 :   while ((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search))))
   12141                 :             :     {
   12142                 :           0 :       M2Debug_Assert (i > 0);
   12143                 :           0 :       i -= 1;
   12144                 :           0 :       pCall = GetPcall (i);
   12145                 :             :     }
   12146                 :             :   /* Found module at position, i.  */
   12147                 :           0 :   i -= 1;  /* Move to an outer level module scope  */
   12148                 :           0 :   pCall = GetPcall (i);  /* Move to an outer level module scope  */
   12149                 :           0 :   while ((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search))))
   12150                 :             :     {
   12151                 :           0 :       M2Debug_Assert (i > 0);
   12152                 :           0 :       i -= 1;
   12153                 :           0 :       pCall = GetPcall (i);
   12154                 :             :     }
   12155                 :             :   /* Found module at position, i.  */
   12156                 :           0 :   return pCall->Search;
   12157                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12158                 :             :   __builtin_unreachable ();
   12159                 :             : }
   12160                 :             : 
   12161                 :             : 
   12162                 :             : /*
   12163                 :             :    AddSymToModuleScope - adds a symbol, Sym, to the scope of the module
   12164                 :             :                          ModSym.
   12165                 :             : */
   12166                 :             : 
   12167                 :     1006425 : extern "C" void SymbolTable_AddSymToModuleScope (unsigned int ModSym, unsigned int Sym)
   12168                 :             : {
   12169                 :     1006425 :   SymbolTable_PtrToSymbol pSym;
   12170                 :             : 
   12171                 :     1006425 :   pSym = GetPsym (ModSym);
   12172                 :     1006425 :   switch (pSym->SymbolType)
   12173                 :             :     {
   12174                 :      888489 :       case SymbolTable_DefImpSym:
   12175                 :      888489 :         if ((SymbolKey_GetSymKey (pSym->DefImp.LocalSymbols, SymbolTable_GetSymName (Sym))) == SymbolKey_NulKey)
   12176                 :             :           {
   12177                 :      888489 :             SymbolKey_PutSymKey (pSym->DefImp.LocalSymbols, SymbolTable_GetSymName (Sym), Sym);
   12178                 :             :           }
   12179                 :             :         else
   12180                 :             :           {
   12181                 :           0 :             M2MetaError_MetaError1 ((const char *) "{%kIMPORT} name clash with symbol {%1Ead} symbol already declared ", 66, Sym);
   12182                 :             :           }
   12183                 :             :         break;
   12184                 :             : 
   12185                 :      117876 :       case SymbolTable_ModuleSym:
   12186                 :      117876 :         if ((SymbolKey_GetSymKey (pSym->Module.LocalSymbols, SymbolTable_GetSymName (Sym))) == SymbolKey_NulKey)
   12187                 :             :           {
   12188                 :      117876 :             SymbolKey_PutSymKey (pSym->Module.LocalSymbols, SymbolTable_GetSymName (Sym), Sym);
   12189                 :             :           }
   12190                 :             :         else
   12191                 :             :           {
   12192                 :           0 :             M2MetaError_MetaError1 ((const char *) "{%kIMPORT} name clash with symbol {%1Ead} symbol already declared ", 66, Sym);
   12193                 :             :           }
   12194                 :             :         break;
   12195                 :             : 
   12196                 :          60 :       case SymbolTable_ProcedureSym:
   12197                 :          60 :         if ((SymbolKey_GetSymKey (pSym->Procedure.LocalSymbols, SymbolTable_GetSymName (Sym))) == SymbolKey_NulKey)
   12198                 :             :           {
   12199                 :          60 :             SymbolKey_PutSymKey (pSym->Procedure.LocalSymbols, SymbolTable_GetSymName (Sym), Sym);
   12200                 :             :           }
   12201                 :             :         else
   12202                 :             :           {
   12203                 :           0 :             M2MetaError_MetaError1 ((const char *) "{%kIMPORT} name clash with symbol {%1Ead} symbol already declared ", 66, Sym);
   12204                 :             :           }
   12205                 :             :         break;
   12206                 :             : 
   12207                 :             : 
   12208                 :           0 :       default:
   12209                 :           0 :         M2Error_InternalError ((const char *) "expecting Module or DefImp symbol", 33);
   12210                 :     1006425 :         break;
   12211                 :             :     }
   12212                 :     1006425 : }
   12213                 :             : 
   12214                 :             : 
   12215                 :             : /*
   12216                 :             :    GetType - Returns the symbol that is the TYPE symbol to Sym.
   12217                 :             :              If zero is returned then we assume type unknown.
   12218                 :             : */
   12219                 :             : 
   12220                 :   748101370 : extern "C" unsigned int SymbolTable_GetType (unsigned int Sym)
   12221                 :             : {
   12222                 :   748101370 :   SymbolTable_PtrToSymbol pSym;
   12223                 :   748101370 :   unsigned int type;
   12224                 :             : 
   12225                 :   748101370 :   M2Debug_Assert (Sym != SymbolTable_NulSym);
   12226                 :   748101364 :   pSym = GetPsym (Sym);
   12227                 :   748101364 :   switch (pSym->SymbolType)
   12228                 :             :     {
   12229                 :           0 :       case SymbolTable_OAFamilySym:
   12230                 :           0 :         type = pSym->OAFamily.SimpleType;
   12231                 :           0 :         break;
   12232                 :             : 
   12233                 :    89978452 :       case SymbolTable_VarSym:
   12234                 :    89978452 :         type = GetTypeOfVar (Sym);
   12235                 :    89978452 :         break;
   12236                 :             : 
   12237                 :    22347852 :       case SymbolTable_ConstLitSym:
   12238                 :    22347852 :         type = pSym->ConstLit.Type;
   12239                 :    22347852 :         break;
   12240                 :             : 
   12241                 :    21808687 :       case SymbolTable_ConstVarSym:
   12242                 :    21808687 :         type = pSym->ConstVar.Type;
   12243                 :    21808687 :         break;
   12244                 :             : 
   12245                 :     5921822 :       case SymbolTable_ConstStringSym:
   12246                 :     5921822 :         if (pSym->ConstString.Length == 1)
   12247                 :             :           {
   12248                 :     1037352 :             type = M2Base_Char;
   12249                 :             :           }
   12250                 :             :         else
   12251                 :             :           {
   12252                 :             :             type = SymbolTable_NulSym;  /* No type for a string  */
   12253                 :             :           }
   12254                 :             :         break;
   12255                 :             : 
   12256                 :   110585569 :       case SymbolTable_TypeSym:
   12257                 :   110585569 :         type = pSym->Type.Type;
   12258                 :   110585569 :         break;
   12259                 :             : 
   12260                 :   244335934 :       case SymbolTable_RecordFieldSym:
   12261                 :   244335934 :         type = pSym->RecordField.Type;
   12262                 :   244335934 :         break;
   12263                 :             : 
   12264                 :             :       case SymbolTable_RecordSym:
   12265                 :             :         type = SymbolTable_NulSym;  /* No type for a record  */
   12266                 :             :         break;
   12267                 :             : 
   12268                 :             :       case SymbolTable_VarientSym:
   12269                 :             :         type = SymbolTable_NulSym;  /* No type for a record  */
   12270                 :             :         break;
   12271                 :             : 
   12272                 :    44979576 :       case SymbolTable_EnumerationFieldSym:
   12273                 :    44979576 :         type = pSym->EnumerationField.Type;  /* No type for a record  */
   12274                 :    44979576 :         break;
   12275                 :             : 
   12276                 :             :       case SymbolTable_EnumerationSym:
   12277                 :             :         type = SymbolTable_NulSym;  /* No type for enumeration  */
   12278                 :             :         break;
   12279                 :             : 
   12280                 :   104523863 :       case SymbolTable_PointerSym:
   12281                 :   104523863 :         type = pSym->Pointer.Type;  /* No type for enumeration  */
   12282                 :   104523863 :         break;
   12283                 :             : 
   12284                 :    18037547 :       case SymbolTable_ProcedureSym:
   12285                 :    18037547 :         type = pSym->Procedure.ReturnType;
   12286                 :    18037547 :         break;
   12287                 :             : 
   12288                 :     5301789 :       case SymbolTable_ProcTypeSym:
   12289                 :     5301789 :         type = pSym->ProcType.ReturnType;
   12290                 :     5301789 :         break;
   12291                 :             : 
   12292                 :    21291354 :       case SymbolTable_ParamSym:
   12293                 :    21291354 :         type = pSym->Param.Type;
   12294                 :    21291354 :         break;
   12295                 :             : 
   12296                 :     3507108 :       case SymbolTable_VarParamSym:
   12297                 :     3507108 :         type = pSym->VarParam.Type;
   12298                 :     3507108 :         break;
   12299                 :             : 
   12300                 :    12115763 :       case SymbolTable_SubrangeSym:
   12301                 :    12115763 :         type = pSym->Subrange.Type;
   12302                 :    12115763 :         break;
   12303                 :             : 
   12304                 :     5430372 :       case SymbolTable_ArraySym:
   12305                 :     5430372 :         type = pSym->Array.Type;
   12306                 :     5430372 :         break;
   12307                 :             : 
   12308                 :     5436260 :       case SymbolTable_SubscriptSym:
   12309                 :     5436260 :         type = pSym->Subscript.Type;
   12310                 :     5436260 :         break;
   12311                 :             : 
   12312                 :      574222 :       case SymbolTable_SetSym:
   12313                 :      574222 :         type = pSym->Set.Type;
   12314                 :      574222 :         break;
   12315                 :             : 
   12316                 :    29725066 :       case SymbolTable_UnboundedSym:
   12317                 :    29725066 :         type = pSym->Unbounded.Type;
   12318                 :    29725066 :         break;
   12319                 :             : 
   12320                 :             :       case SymbolTable_UndefinedSym:
   12321                 :             :         type = SymbolTable_NulSym;
   12322                 :             :         break;
   12323                 :             : 
   12324                 :           0 :       case SymbolTable_PartialUnboundedSym:
   12325                 :           0 :         type = pSym->PartialUnbounded.Type;
   12326                 :           0 :         break;
   12327                 :             : 
   12328                 :             :       case SymbolTable_ObjectSym:
   12329                 :             :         type = SymbolTable_NulSym;
   12330                 :             :         break;
   12331                 :             : 
   12332                 :             : 
   12333                 :           0 :       default:
   12334                 :           0 :         M2Error_InternalError ((const char *) "not implemented yet", 19);
   12335                 :   748101364 :         break;
   12336                 :             :     }
   12337                 :   748101364 :   return type;
   12338                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12339                 :             :   __builtin_unreachable ();
   12340                 :             : }
   12341                 :             : 
   12342                 :             : 
   12343                 :             : /*
   12344                 :             :    SkipType - if sym is a TYPE foo = bar
   12345                 :             :               then call SkipType(bar)
   12346                 :             :               else return sym
   12347                 :             : 
   12348                 :             :               it does not skip over hidden types.
   12349                 :             : */
   12350                 :             : 
   12351                 :    58608132 : extern "C" unsigned int SymbolTable_SkipType (unsigned int Sym)
   12352                 :             : {
   12353                 :    58865382 :   if ((((Sym != SymbolTable_NulSym) && (SymbolTable_IsType (Sym))) && (! (SymbolTable_IsHiddenType (Sym)))) && ((SymbolTable_GetType (Sym)) != SymbolTable_NulSym))
   12354                 :             :     {
   12355                 :      257250 :       return SymbolTable_SkipType (SymbolTable_GetType (Sym));
   12356                 :             :     }
   12357                 :             :   else
   12358                 :             :     {
   12359                 :    58608132 :       return Sym;
   12360                 :             :     }
   12361                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12362                 :             :   __builtin_unreachable ();
   12363                 :             : }
   12364                 :             : 
   12365                 :             : 
   12366                 :             : /*
   12367                 :             :    SkipTypeAndSubrange - if sym is a TYPE foo = bar OR
   12368                 :             :                             sym is declared as a subrange of bar
   12369                 :             :                          then call SkipTypeAndSubrange(bar)
   12370                 :             :                          else return sym
   12371                 :             : 
   12372                 :             :                          it does not skip over hidden types.
   12373                 :             : */
   12374                 :             : 
   12375                 :        4312 : extern "C" unsigned int SymbolTable_SkipTypeAndSubrange (unsigned int Sym)
   12376                 :             : {
   12377                 :        4360 :   if ((((Sym != SymbolTable_NulSym) && ((SymbolTable_IsType (Sym)) || (SymbolTable_IsSubrange (Sym)))) && (! (SymbolTable_IsHiddenType (Sym)))) && ((SymbolTable_GetType (Sym)) != SymbolTable_NulSym))
   12378                 :             :     {
   12379                 :          48 :       return SymbolTable_SkipTypeAndSubrange (SymbolTable_GetType (Sym));
   12380                 :             :     }
   12381                 :             :   else
   12382                 :             :     {
   12383                 :        4312 :       return Sym;
   12384                 :             :     }
   12385                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12386                 :             :   __builtin_unreachable ();
   12387                 :             : }
   12388                 :             : 
   12389                 :             : 
   12390                 :             : /*
   12391                 :             :    GetLowestType - Returns the lowest type in the type chain of
   12392                 :             :                    symbol Sym.
   12393                 :             :                    If NulSym is returned then we assume type unknown or
   12394                 :             :                    you have reqested the type of a base type.
   12395                 :             : */
   12396                 :             : 
   12397                 :     1503830 : extern "C" unsigned int SymbolTable_GetLowestType (unsigned int Sym)
   12398                 :             : {
   12399                 :     2556627 :   SymbolTable_PtrToSymbol pSym;
   12400                 :     2556627 :   unsigned int type;
   12401                 :             : 
   12402                 :     2556627 :   M2Debug_Assert (Sym != SymbolTable_NulSym);
   12403                 :     2556627 :   pSym = GetPsym (Sym);
   12404                 :     2556627 :   switch (pSym->SymbolType)
   12405                 :             :     {
   12406                 :      469144 :       case SymbolTable_VarSym:
   12407                 :      469144 :         type = pSym->Var.Type;
   12408                 :      469144 :         break;
   12409                 :             : 
   12410                 :      279228 :       case SymbolTable_ConstLitSym:
   12411                 :      279228 :         type = pSym->ConstLit.Type;
   12412                 :      279228 :         break;
   12413                 :             : 
   12414                 :      387057 :       case SymbolTable_ConstVarSym:
   12415                 :      387057 :         type = pSym->ConstVar.Type;
   12416                 :      387057 :         break;
   12417                 :             : 
   12418                 :             :       case SymbolTable_ConstStringSym:
   12419                 :             :         type = SymbolTable_NulSym;  /* No type for a string  */
   12420                 :             :         break;
   12421                 :             : 
   12422                 :     1076787 :       case SymbolTable_TypeSym:
   12423                 :     1076787 :         type = pSym->Type.Type;  /* No type for a string  */
   12424                 :     1076787 :         break;
   12425                 :             : 
   12426                 :           0 :       case SymbolTable_RecordFieldSym:
   12427                 :           0 :         type = pSym->RecordField.Type;
   12428                 :           0 :         break;
   12429                 :             : 
   12430                 :             :       case SymbolTable_RecordSym:
   12431                 :             :         type = SymbolTable_NulSym;  /* No type for a record  */
   12432                 :             :         break;
   12433                 :             : 
   12434                 :       58077 :       case SymbolTable_EnumerationFieldSym:
   12435                 :       58077 :         type = pSym->EnumerationField.Type;  /* No type for a record  */
   12436                 :       58077 :         break;
   12437                 :             : 
   12438                 :             :       case SymbolTable_EnumerationSym:
   12439                 :             :         type = SymbolTable_NulSym;  /* No type for enumeration  */
   12440                 :             :         break;
   12441                 :             : 
   12442                 :             :       case SymbolTable_PointerSym:
   12443                 :       31292 :         type = Sym;  /* we don't go to Pointer.Type  */
   12444                 :             :         break;
   12445                 :             : 
   12446                 :       60037 :       case SymbolTable_ProcedureSym:
   12447                 :       60037 :         type = pSym->Procedure.ReturnType;  /* we don't go to Pointer.Type  */
   12448                 :       60037 :         break;
   12449                 :             : 
   12450                 :          12 :       case SymbolTable_ProcTypeSym:
   12451                 :          12 :         type = pSym->ProcType.ReturnType;
   12452                 :          12 :         break;
   12453                 :             : 
   12454                 :      134793 :       case SymbolTable_ParamSym:
   12455                 :      134793 :         type = pSym->Param.Type;
   12456                 :      134793 :         break;
   12457                 :             : 
   12458                 :        7202 :       case SymbolTable_VarParamSym:
   12459                 :        7202 :         type = pSym->VarParam.Type;
   12460                 :        7202 :         break;
   12461                 :             : 
   12462                 :          48 :       case SymbolTable_SubrangeSym:
   12463                 :          48 :         type = pSym->Subrange.Type;
   12464                 :          48 :         break;
   12465                 :             : 
   12466                 :          24 :       case SymbolTable_ArraySym:
   12467                 :          24 :         type = pSym->Array.Type;
   12468                 :          24 :         break;
   12469                 :             : 
   12470                 :       47726 :       case SymbolTable_SubscriptSym:
   12471                 :       47726 :         type = pSym->Subscript.Type;
   12472                 :       47726 :         break;
   12473                 :             : 
   12474                 :             :       case SymbolTable_SetSym:
   12475                 :       31292 :         type = Sym;  /* Stop at the set type.  */
   12476                 :             :         break;
   12477                 :             : 
   12478                 :           0 :       case SymbolTable_UnboundedSym:
   12479                 :           0 :         type = pSym->Unbounded.Type;  /* Stop at the set type.  */
   12480                 :           0 :         break;
   12481                 :             : 
   12482                 :             :       case SymbolTable_UndefinedSym:
   12483                 :             :         type = SymbolTable_NulSym;
   12484                 :             :         break;
   12485                 :             : 
   12486                 :             :       case SymbolTable_DummySym:
   12487                 :             :         type = SymbolTable_NulSym;
   12488                 :             :         break;
   12489                 :             : 
   12490                 :             : 
   12491                 :           6 :       default:
   12492                 :           6 :         M2Error_InternalError ((const char *) "not implemented yet", 19);
   12493                 :     2556621 :         break;
   12494                 :             :     }
   12495                 :     2556621 :   pSym = GetPsym (Sym);
   12496                 :     2556621 :   if ((pSym->SymbolType == SymbolTable_TypeSym) && (type == SymbolTable_NulSym))
   12497                 :             :     {
   12498                 :             :       type = Sym;  /* Base Type  */
   12499                 :             :     }
   12500                 :     1502102 :   else if (((type != SymbolTable_NulSym) && (SymbolTable_IsType (type))) && ((SymbolTable_GetAlignment (type)) == SymbolTable_NulSym))
   12501                 :             :     {
   12502                 :             :       /* avoid dangling else.  */
   12503                 :             :       type = SymbolTable_GetLowestType (type);  /* Type def  */
   12504                 :             :     }
   12505                 :     1503824 :   return type;
   12506                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12507                 :             :   __builtin_unreachable ();
   12508                 :             : }
   12509                 :             : 
   12510                 :             : 
   12511                 :             : /*
   12512                 :             :    GetLType - get lowest type.  It returns the lowest type
   12513                 :             :               of symbol, sym.  It skips over type equivalences.
   12514                 :             :               It will not skip over base types.
   12515                 :             : */
   12516                 :             : 
   12517                 :     8616609 : extern "C" unsigned int SymbolTable_GetLType (unsigned int sym)
   12518                 :             : {
   12519                 :             :   /* 
   12520                 :             :    Assert (doGetType (sym, TRUE, TRUE, TRUE, FALSE) = GetLowestType (sym)) ;
   12521                 :             :   */
   12522                 :     8616609 :   return doGetType (sym, true, true, true, false);
   12523                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12524                 :             :   __builtin_unreachable ();
   12525                 :             : }
   12526                 :             : 
   12527                 :             : 
   12528                 :             : /*
   12529                 :             :    GetSType - get source type.  It returns the type closest
   12530                 :             :               to the object.  It does not skip over type
   12531                 :             :               equivalences.  It will skip over base types.
   12532                 :             : */
   12533                 :             : 
   12534                 :   659669371 : extern "C" unsigned int SymbolTable_GetSType (unsigned int sym)
   12535                 :             : {
   12536                 :   659669371 :   M2Debug_Assert ((doGetType (sym, false, false, false, true)) == (SymbolTable_GetType (sym)));
   12537                 :   659669371 :   return doGetType (sym, false, false, false, true);
   12538                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12539                 :             :   __builtin_unreachable ();
   12540                 :             : }
   12541                 :             : 
   12542                 :             : 
   12543                 :             : /*
   12544                 :             :    GetDType - get gcc declared type.  It returns the type
   12545                 :             :               of the object which is declared to GCC.
   12546                 :             :               It does skip over type equivalences but only
   12547                 :             :               if they do not contain a user alignment.
   12548                 :             :               It does not skip over hidden types.
   12549                 :             :               It does not skip over base types.
   12550                 :             : */
   12551                 :             : 
   12552                 :    24127354 : extern "C" unsigned int SymbolTable_GetDType (unsigned int sym)
   12553                 :             : {
   12554                 :             :   /* 
   12555                 :             :    Assert (doGetType (sym, TRUE, FALSE, FALSE, FALSE) = SkipType(GetType(sym))) ;
   12556                 :             :   */
   12557                 :    24127354 :   return doGetType (sym, true, false, false, false);
   12558                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12559                 :             :   __builtin_unreachable ();
   12560                 :             : }
   12561                 :             : 
   12562                 :             : 
   12563                 :             : /*
   12564                 :             :    GetTypeMode - return the type of sym, it returns Address is the
   12565                 :             :                  symbol is a LValue.
   12566                 :             : */
   12567                 :             : 
   12568                 :       20842 : extern "C" unsigned int SymbolTable_GetTypeMode (unsigned int sym)
   12569                 :             : {
   12570                 :       20842 :   if ((SymbolTable_GetMode (sym)) == SymbolTable_LeftValue)
   12571                 :             :     {
   12572                 :          90 :       return M2System_Address;
   12573                 :             :     }
   12574                 :             :   else
   12575                 :             :     {
   12576                 :       20752 :       return SymbolTable_GetType (sym);
   12577                 :             :     }
   12578                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12579                 :             :   __builtin_unreachable ();
   12580                 :             : }
   12581                 :             : 
   12582                 :             : 
   12583                 :             : /*
   12584                 :             :    GetSym - searches the current scope (and previous scopes if the
   12585                 :             :             scope tranparent allows) for a symbol with name.
   12586                 :             : */
   12587                 :             : 
   12588                 :    70853860 : extern "C" unsigned int SymbolTable_GetSym (NameKey_Name name)
   12589                 :             : {
   12590                 :    70853860 :   unsigned int Sym;
   12591                 :    70853860 :   unsigned int OldScopePtr;
   12592                 :             : 
   12593                 :    70853860 :   Sym = GetScopeSym (name, true);
   12594                 :    70853860 :   if (Sym == SymbolTable_NulSym)
   12595                 :             :     {
   12596                 :             :       /* Check default base types for symbol  */
   12597                 :    25122730 :       OldScopePtr = ScopePtr;  /* Save ScopePtr  */
   12598                 :    25122730 :       ScopePtr = BaseScopePtr;  /* Alter ScopePtr to point to top of BaseModule  */
   12599                 :    25122730 :       Sym = GetScopeSym (name, false);  /* Search BaseModule for name  */
   12600                 :    25122730 :       ScopePtr = OldScopePtr;  /* Restored ScopePtr  */
   12601                 :             :     }
   12602                 :    70853860 :   return Sym;
   12603                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12604                 :             :   __builtin_unreachable ();
   12605                 :             : }
   12606                 :             : 
   12607                 :             : 
   12608                 :             : /*
   12609                 :             :    GetDeclareSym - searches for a symbol with a name SymName in the
   12610                 :             :                    current and previous scopes.
   12611                 :             :                    If the symbol is found then it is returned
   12612                 :             :                    else an unknown symbol is returned.
   12613                 :             :                    This procedure assumes that SymName is being
   12614                 :             :                    declared at this point and therefore it does
   12615                 :             :                    not examine the base scope (for pervasive
   12616                 :             :                    identifiers).
   12617                 :             : */
   12618                 :             : 
   12619                 :     9433093 : extern "C" unsigned int SymbolTable_GetDeclareSym (unsigned int tok, NameKey_Name SymName)
   12620                 :             : {
   12621                 :     9433093 :   unsigned int Sym;
   12622                 :             : 
   12623                 :     9433093 :   Sym = GetScopeSym (SymName, false);  /* must not be allowed to fetch a symbol through a procedure scope  */
   12624                 :     9433093 :   if (Sym == SymbolTable_NulSym)  /* must not be allowed to fetch a symbol through a procedure scope  */
   12625                 :             :     {
   12626                 :     3698045 :       Sym = GetSymFromUnknownTree (SymName);
   12627                 :     3698045 :       if (Sym == SymbolTable_NulSym)
   12628                 :             :         {
   12629                 :             :           /* Make unknown  */
   12630                 :     3698045 :           NewSym (&Sym);
   12631                 :     3698045 :           FillInUnknownFields (tok, Sym, SymName);
   12632                 :             :           /* 
   12633                 :             :            ; WriteKey(SymName) ; WriteString(' unknown demanded') ; WriteLn
   12634                 :             :   */
   12635                 :     3698045 :           AddSymToUnknownTree (static_cast<int> (ScopePtr), SymName, Sym);
   12636                 :             :         }
   12637                 :             :     }
   12638                 :     9433093 :   return Sym;
   12639                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12640                 :             :   __builtin_unreachable ();
   12641                 :             : }
   12642                 :             : 
   12643                 :             : 
   12644                 :             : /*
   12645                 :             :    GetLocalSym - only searches the scope Sym for a symbol with name
   12646                 :             :                  and returns the index to the symbol.
   12647                 :             : */
   12648                 :             : 
   12649                 :   204790653 : extern "C" unsigned int SymbolTable_GetLocalSym (unsigned int Sym, NameKey_Name name)
   12650                 :             : {
   12651                 :   204790653 :   SymbolTable_PtrToSymbol pSym;
   12652                 :   204790653 :   unsigned int LocalSym;
   12653                 :             : 
   12654                 :             :   /* 
   12655                 :             :    WriteString('Attempting to retrieve symbol from ') ; WriteKey(GetSymName(Sym)) ;
   12656                 :             :    WriteString(' local symbol table') ; WriteLn ;
   12657                 :             :   */
   12658                 :   204790653 :   pSym = GetPsym (Sym);
   12659                 :   204790653 :   switch (pSym->SymbolType)
   12660                 :             :     {
   12661                 :    50502293 :       case SymbolTable_EnumerationSym:
   12662                 :    50502293 :         LocalSym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Enumeration.LocalSymbols, name));
   12663                 :    50502293 :         break;
   12664                 :             : 
   12665                 :      635122 :       case SymbolTable_RecordSym:
   12666                 :      635122 :         LocalSym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Record.LocalSymbols, name));
   12667                 :      635122 :         break;
   12668                 :             : 
   12669                 :    54048525 :       case SymbolTable_ProcedureSym:
   12670                 :    54048525 :         LocalSym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Procedure.LocalSymbols, name));
   12671                 :    54048525 :         break;
   12672                 :             : 
   12673                 :    26406437 :       case SymbolTable_ModuleSym:
   12674                 :    26406437 :         LocalSym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Module.LocalSymbols, name));
   12675                 :    26406437 :         break;
   12676                 :             : 
   12677                 :    73198276 :       case SymbolTable_DefImpSym:
   12678                 :    73198276 :         LocalSym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.LocalSymbols, name));
   12679                 :    73198276 :         break;
   12680                 :             : 
   12681                 :             : 
   12682                 :           0 :       default:
   12683                 :           0 :         M2Error_InternalError ((const char *) "symbol does not have a LocalSymbols field", 41);
   12684                 :   204790653 :         break;
   12685                 :             :     }
   12686                 :   204790653 :   return LocalSym;
   12687                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12688                 :             :   __builtin_unreachable ();
   12689                 :             : }
   12690                 :             : 
   12691                 :             : 
   12692                 :             : /*
   12693                 :             :    GetRecord - fetches the record symbol from the parent of Sym.
   12694                 :             :                Sym maybe a varient symbol in which case its parent is searched
   12695                 :             :                etc.
   12696                 :             : */
   12697                 :             : 
   12698                 :       50146 : extern "C" unsigned int SymbolTable_GetRecord (unsigned int Sym)
   12699                 :             : {
   12700                 :       56478 :   SymbolTable_PtrToSymbol pSym;
   12701                 :             : 
   12702                 :       56478 :   pSym = GetPsym (Sym);
   12703                 :       56478 :   switch (pSym->SymbolType)
   12704                 :             :     {
   12705                 :             :       case SymbolTable_RecordSym:
   12706                 :             :         return Sym;
   12707                 :        6078 :         break;
   12708                 :             : 
   12709                 :        6078 :       case SymbolTable_VarientSym:
   12710                 :        6078 :         return SymbolTable_GetRecord (pSym->Varient.Parent);
   12711                 :         254 :         break;
   12712                 :             : 
   12713                 :         254 :       case SymbolTable_VarientFieldSym:
   12714                 :         254 :         return SymbolTable_GetRecord (pSym->VarientField.Parent);
   12715                 :           0 :         break;
   12716                 :             : 
   12717                 :             : 
   12718                 :           0 :       default:
   12719                 :           0 :         M2Error_InternalError ((const char *) "expecting Record or Varient symbol", 34);
   12720                 :             :         break;
   12721                 :             :     }
   12722                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   12723                 :             :   __builtin_unreachable ();
   12724                 :             : }
   12725                 :             : 
   12726                 :             : 
   12727                 :             : /*
   12728                 :             :    FromModuleGetSym - attempts to find a symbol of name, n, in the
   12729                 :             :                       module, mod, scope.  An unknown symbol is created
   12730                 :             :                       at token position tok if necessary.
   12731                 :             : */
   12732                 :             : 
   12733                 :     8144160 : extern "C" unsigned int SymbolTable_FromModuleGetSym (unsigned int tok, NameKey_Name n, unsigned int mod)
   12734                 :             : {
   12735                 :     8144160 :   NameKey_Name n1;
   12736                 :     8144160 :   unsigned int sym;
   12737                 :     8144160 :   unsigned int OldScopePtr;
   12738                 :             : 
   12739                 :     8144160 :   OldScopePtr = ScopePtr;
   12740                 :     8144160 :   SymbolTable_StartScope (mod);
   12741                 :     8144160 :   sym = SymbolTable_RequestSym (tok, n);
   12742                 :     8144160 :   SymbolTable_EndScope ();
   12743                 :     8144160 :   if (sym == SymbolTable_NulSym)
   12744                 :             :     {
   12745                 :             :       /* --fixme-- can sym ever be NulSym?  */
   12746                 :           0 :       n1 = SymbolTable_GetSymName (mod);
   12747                 :           0 :       M2Error_WriteFormat2 ((const char *) "cannot find procedure %a in module, %a", 38, (const unsigned char *) &n, (sizeof (n)-1), (const unsigned char *) &n1, (sizeof (n1)-1));
   12748                 :             :     }
   12749                 :     8144160 :   ScopePtr = OldScopePtr;
   12750                 :     8144160 :   return sym;
   12751                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12752                 :             :   __builtin_unreachable ();
   12753                 :             : }
   12754                 :             : 
   12755                 :             : 
   12756                 :             : /*
   12757                 :             :    GetNth - returns the n th symbol in the list associated with the scope
   12758                 :             :             of Sym.  Sym may be a Module, DefImp, Procedure, Record or
   12759                 :             :             Enumeration symbol.
   12760                 :             : */
   12761                 :             : 
   12762                 :   370153535 : extern "C" unsigned int SymbolTable_GetNth (unsigned int Sym, unsigned int n)
   12763                 :             : {
   12764                 :   370153535 :   SymbolTable_PtrToSymbol pSym;
   12765                 :   370153535 :   unsigned int i;
   12766                 :             : 
   12767                 :   370153535 :   pSym = GetPsym (Sym);
   12768                 :   370153535 :   switch (pSym->SymbolType)
   12769                 :             :     {
   12770                 :   283346872 :       case SymbolTable_RecordSym:
   12771                 :   283346872 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Record.ListOfSons, n));
   12772                 :   283346872 :         break;
   12773                 :             : 
   12774                 :     2869694 :       case SymbolTable_VarientSym:
   12775                 :     2869694 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Varient.ListOfSons, n));
   12776                 :     2869694 :         break;
   12777                 :             : 
   12778                 :     5167890 :       case SymbolTable_VarientFieldSym:
   12779                 :     5167890 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->VarientField.ListOfSons, n));
   12780                 :     5167890 :         break;
   12781                 :             : 
   12782                 :    77133366 :       case SymbolTable_ProcedureSym:
   12783                 :    77133366 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Procedure.ListOfVars, n));
   12784                 :    77133366 :         break;
   12785                 :             : 
   12786                 :      644079 :       case SymbolTable_DefImpSym:
   12787                 :      644079 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->DefImp.ListOfVars, n));
   12788                 :      644079 :         break;
   12789                 :             : 
   12790                 :      564548 :       case SymbolTable_ModuleSym:
   12791                 :      564548 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Module.ListOfVars, n));
   12792                 :      564548 :         break;
   12793                 :             : 
   12794                 :       48148 :       case SymbolTable_TupleSym:
   12795                 :       48148 :         i = GetFromIndex (pSym->Tuple.list, n);
   12796                 :       48148 :         break;
   12797                 :             : 
   12798                 :      378920 :       case SymbolTable_VarSym:
   12799                 :      378920 :         i = GetNthFromComponent (Sym, n);
   12800                 :      378920 :         break;
   12801                 :             : 
   12802                 :          18 :       case SymbolTable_EnumerationSym:
   12803                 :          18 :         i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Enumeration.ListOfFields, n));
   12804                 :          18 :         break;
   12805                 :             : 
   12806                 :             : 
   12807                 :           0 :       default:
   12808                 :           0 :         M2Error_InternalError ((const char *) "cannot GetNth from this symbol", 30);
   12809                 :   370153535 :         break;
   12810                 :             :     }
   12811                 :   370153535 :   return i;
   12812                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12813                 :             :   __builtin_unreachable ();
   12814                 :             : }
   12815                 :             : 
   12816                 :             : 
   12817                 :             : /*
   12818                 :             :    GetNthParam - returns the n th parameter of a procedure Sym.
   12819                 :             : */
   12820                 :             : 
   12821                 :    53490815 : extern "C" unsigned int SymbolTable_GetNthParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo)
   12822                 :             : {
   12823                 :    53490815 :   SymbolTable_PtrToSymbol pSym;
   12824                 :    53490815 :   unsigned int i;
   12825                 :             : 
   12826                 :    53490815 :   if (ParamNo == 0)
   12827                 :             :     {
   12828                 :             :       /* The return type of the function  */
   12829                 :           0 :       i = SymbolTable_GetType (Sym);
   12830                 :             :     }
   12831                 :             :   else
   12832                 :             :     {
   12833                 :    53490815 :       pSym = GetPsym (Sym);
   12834                 :    53490815 :       switch (pSym->SymbolType)
   12835                 :             :         {
   12836                 :    44558969 :           case SymbolTable_ProcedureSym:
   12837                 :    44558969 :             i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam, ParamNo));
   12838                 :    44558969 :             break;
   12839                 :             : 
   12840                 :     8931846 :           case SymbolTable_ProcTypeSym:
   12841                 :     8931846 :             i = static_cast<unsigned int> (Lists_GetItemFromList (pSym->ProcType.ListOfParam, ParamNo));
   12842                 :     8931846 :             break;
   12843                 :             : 
   12844                 :             : 
   12845                 :           0 :           default:
   12846                 :           0 :             M2Error_InternalError ((const char *) "expecting ProcedureSym or ProcTypeSym", 37);
   12847                 :    53490815 :             break;
   12848                 :             :         }
   12849                 :             :     }
   12850                 :    53490815 :   return i;
   12851                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12852                 :             :   __builtin_unreachable ();
   12853                 :             : }
   12854                 :             : 
   12855                 :             : 
   12856                 :             : /*
   12857                 :             :    GetVarScope - returns the symbol which is the scope of variable Sym.
   12858                 :             :                  ie a Module, DefImp or Procedure Symbol.
   12859                 :             : */
   12860                 :             : 
   12861                 :       20610 : extern "C" unsigned int SymbolTable_GetVarScope (unsigned int Sym)
   12862                 :             : {
   12863                 :       20610 :   SymbolTable_PtrToSymbol pSym;
   12864                 :             : 
   12865                 :       20610 :   pSym = GetPsym (Sym);
   12866                 :       20610 :   switch (pSym->SymbolType)
   12867                 :             :     {
   12868                 :             :       case SymbolTable_ErrorSym:
   12869                 :             :         return SymbolTable_NulSym;
   12870                 :       20610 :         break;
   12871                 :             : 
   12872                 :       20610 :       case SymbolTable_VarSym:
   12873                 :       20610 :         return pSym->Var.Scope;
   12874                 :           0 :         break;
   12875                 :             : 
   12876                 :             : 
   12877                 :           0 :       default:
   12878                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   12879                 :             :         break;
   12880                 :             :     }
   12881                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   12882                 :             :   __builtin_unreachable ();
   12883                 :             : }
   12884                 :             : 
   12885                 :             : 
   12886                 :             : /*
   12887                 :             :    GetSubrange - returns HighSym and LowSym - two constants which make up the
   12888                 :             :                  subrange.
   12889                 :             : */
   12890                 :             : 
   12891                 :    26297208 : extern "C" void SymbolTable_GetSubrange (unsigned int Sym, unsigned int *HighSym, unsigned int *LowSym)
   12892                 :             : {
   12893                 :    26297208 :   SymbolTable_PtrToSymbol pSym;
   12894                 :             : 
   12895                 :    26297208 :   pSym = GetPsym (Sym);
   12896                 :    26297208 :   switch (pSym->SymbolType)
   12897                 :             :     {
   12898                 :    26297208 :       case SymbolTable_SubrangeSym:
   12899                 :    26297208 :         (*HighSym) = pSym->Subrange.High;
   12900                 :    26297208 :         (*LowSym) = pSym->Subrange.Low;
   12901                 :    26297208 :         break;
   12902                 :             : 
   12903                 :             : 
   12904                 :           0 :       default:
   12905                 :           0 :         M2Error_InternalError ((const char *) "expecting Subrange symbol", 25);
   12906                 :    26297208 :         break;
   12907                 :             :     }
   12908                 :    26297208 : }
   12909                 :             : 
   12910                 :             : 
   12911                 :             : /*
   12912                 :             :    GetParam - returns the ParamNo parameter from procedure ProcSym
   12913                 :             : */
   12914                 :             : 
   12915                 :     9326893 : extern "C" unsigned int SymbolTable_GetParam (unsigned int Sym, unsigned int ParamNo)
   12916                 :             : {
   12917                 :     9326893 :   AssertInRange (Sym);
   12918                 :     9326893 :   if (ParamNo == 0)
   12919                 :             :     {
   12920                 :             :       /* Parameter Zero is the return argument for the Function  */
   12921                 :           0 :       return SymbolTable_GetType (Sym);
   12922                 :             :     }
   12923                 :             :   else
   12924                 :             :     {
   12925                 :     9326893 :       return SymbolTable_GetNthParamAny (Sym, ParamNo);
   12926                 :             :     }
   12927                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   12928                 :             :   __builtin_unreachable ();
   12929                 :             : }
   12930                 :             : 
   12931                 :             : 
   12932                 :             : /*
   12933                 :             :    GetString - returns the contents of the string symbol sym, note that
   12934                 :             :                this is not the same as GetName (unless it was a literal).
   12935                 :             : */
   12936                 :             : 
   12937                 :      497291 : extern "C" NameKey_Name SymbolTable_GetString (unsigned int Sym)
   12938                 :             : {
   12939                 :      497291 :   SymbolTable_PtrToSymbol pSym;
   12940                 :             : 
   12941                 :      497291 :   pSym = GetPsym (Sym);
   12942                 :      497291 :   switch (pSym->SymbolType)
   12943                 :             :     {
   12944                 :      497291 :       case SymbolTable_ConstStringSym:
   12945                 :      497291 :         if (pSym->ConstString.Known)
   12946                 :             :           {
   12947                 :      497291 :             return pSym->ConstString.Contents;
   12948                 :             :           }
   12949                 :             :         else
   12950                 :             :           {
   12951                 :           0 :             M2Error_InternalError ((const char *) "const string contents are unknown", 33);
   12952                 :             :           }
   12953                 :           0 :         break;
   12954                 :             : 
   12955                 :             : 
   12956                 :           0 :       default:
   12957                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
   12958                 :             :         break;
   12959                 :             :     }
   12960                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   12961                 :             :   __builtin_unreachable ();
   12962                 :             : }
   12963                 :             : 
   12964                 :             : 
   12965                 :             : /*
   12966                 :             :    GetStringLength - returns the length of the string symbol Sym.
   12967                 :             : */
   12968                 :             : 
   12969                 :      995038 : extern "C" unsigned int SymbolTable_GetStringLength (unsigned int tok, unsigned int sym)
   12970                 :             : {
   12971                 :      995038 :   SymbolTable_PtrToSymbol pSym;
   12972                 :             : 
   12973                 :      995038 :   pSym = GetPsym (sym);
   12974                 :      995038 :   switch (pSym->SymbolType)
   12975                 :             :     {
   12976                 :      995038 :       case SymbolTable_ConstStringSym:
   12977                 :      995038 :         if (pSym->ConstString.Known)
   12978                 :             :           {
   12979                 :      995038 :             return pSym->ConstString.Length;
   12980                 :             :           }
   12981                 :             :         else
   12982                 :             :           {
   12983                 :           0 :             M2MetaError_MetaErrorT0 (tok, (const char *) "const string contents are unknown", 33);
   12984                 :           0 :             return 0;
   12985                 :             :           }
   12986                 :           0 :         break;
   12987                 :             : 
   12988                 :             : 
   12989                 :           0 :       default:
   12990                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstString symbol", 28);
   12991                 :             :         break;
   12992                 :             :     }
   12993                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   12994                 :             :   __builtin_unreachable ();
   12995                 :             : }
   12996                 :             : 
   12997                 :             : 
   12998                 :             : /*
   12999                 :             :    GetProcedureBuiltin - returns the builtin name for the equivalent procedure, Sym.
   13000                 :             : */
   13001                 :             : 
   13002                 :       21466 : extern "C" NameKey_Name SymbolTable_GetProcedureBuiltin (unsigned int Sym)
   13003                 :             : {
   13004                 :       21466 :   SymbolTable_PtrToSymbol pSym;
   13005                 :             : 
   13006                 :       21466 :   pSym = GetPsym (Sym);
   13007                 :       21466 :   switch (pSym->SymbolType)
   13008                 :             :     {
   13009                 :       21466 :       case SymbolTable_ProcedureSym:
   13010                 :       21466 :         return pSym->Procedure.BuiltinName;
   13011                 :           0 :         break;
   13012                 :             : 
   13013                 :             : 
   13014                 :           0 :       default:
   13015                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   13016                 :             :         break;
   13017                 :             :     }
   13018                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13019                 :             :   __builtin_unreachable ();
   13020                 :             : }
   13021                 :             : 
   13022                 :             : 
   13023                 :             : /*
   13024                 :             :    PutProcedureBuiltin - assigns the builtin name for the equivalent procedure, Sym.
   13025                 :             : */
   13026                 :             : 
   13027                 :      879692 : extern "C" void SymbolTable_PutProcedureBuiltin (unsigned int Sym, NameKey_Name name)
   13028                 :             : {
   13029                 :      879692 :   SymbolTable_PtrToSymbol pSym;
   13030                 :             : 
   13031                 :      879692 :   pSym = GetPsym (Sym);
   13032                 :      879692 :   switch (pSym->SymbolType)
   13033                 :             :     {
   13034                 :      879692 :       case SymbolTable_ProcedureSym:
   13035                 :      879692 :         pSym->Procedure.BuiltinName = name;
   13036                 :      879692 :         pSym->Procedure.IsBuiltin = true;
   13037                 :             :         /* we use the same extra pass method as hidden types for builtins  */
   13038                 :      879692 :         SymbolTable_PutHiddenTypeDeclared ();
   13039                 :      879692 :         break;
   13040                 :             : 
   13041                 :             : 
   13042                 :           0 :       default:
   13043                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   13044                 :      879692 :         break;
   13045                 :             :     }
   13046                 :      879692 : }
   13047                 :             : 
   13048                 :             : 
   13049                 :             : /*
   13050                 :             :    IsProcedureBuiltin - returns TRUE if this procedure has a builtin equivalent.
   13051                 :             : */
   13052                 :             : 
   13053                 :     1215023 : extern "C" bool SymbolTable_IsProcedureBuiltin (unsigned int Sym)
   13054                 :             : {
   13055                 :     1215023 :   SymbolTable_PtrToSymbol pSym;
   13056                 :             : 
   13057                 :     1215023 :   pSym = GetPsym (Sym);
   13058                 :     1215023 :   switch (pSym->SymbolType)
   13059                 :             :     {
   13060                 :     1215023 :       case SymbolTable_ProcedureSym:
   13061                 :     1215023 :         return pSym->Procedure.IsBuiltin;
   13062                 :           0 :         break;
   13063                 :             : 
   13064                 :             : 
   13065                 :           0 :       default:
   13066                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   13067                 :             :         break;
   13068                 :             :     }
   13069                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13070                 :             :   __builtin_unreachable ();
   13071                 :             : }
   13072                 :             : 
   13073                 :             : 
   13074                 :             : /*
   13075                 :             :    PutProcedureInline - determines that procedure, Sym, has been requested to be inlined.
   13076                 :             : */
   13077                 :             : 
   13078                 :           0 : extern "C" void SymbolTable_PutProcedureInline (unsigned int Sym)
   13079                 :             : {
   13080                 :           0 :   SymbolTable_PtrToSymbol pSym;
   13081                 :             : 
   13082                 :           0 :   pSym = GetPsym (Sym);
   13083                 :           0 :   switch (pSym->SymbolType)
   13084                 :             :     {
   13085                 :           0 :       case SymbolTable_ProcedureSym:
   13086                 :           0 :         pSym->Procedure.IsInline = true;
   13087                 :           0 :         break;
   13088                 :             : 
   13089                 :             : 
   13090                 :           0 :       default:
   13091                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   13092                 :           0 :         break;
   13093                 :             :     }
   13094                 :           0 : }
   13095                 :             : 
   13096                 :       78830 : extern "C" bool SymbolTable_IsProcedureInline (unsigned int Sym)
   13097                 :             : {
   13098                 :       78830 :   SymbolTable_PtrToSymbol pSym;
   13099                 :             : 
   13100                 :             :   /* 
   13101                 :             :    IsProcedureBuiltin - returns TRUE if this procedure was declared as inlined.
   13102                 :             :   */
   13103                 :       78830 :   pSym = GetPsym (Sym);
   13104                 :       78830 :   switch (pSym->SymbolType)
   13105                 :             :     {
   13106                 :       78830 :       case SymbolTable_ProcedureSym:
   13107                 :       78830 :         return pSym->Procedure.IsInline;
   13108                 :           0 :         break;
   13109                 :             : 
   13110                 :             : 
   13111                 :           0 :       default:
   13112                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   13113                 :             :         break;
   13114                 :             :     }
   13115                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13116                 :             :   __builtin_unreachable ();
   13117                 :             : }
   13118                 :             : 
   13119                 :             : 
   13120                 :             : /*
   13121                 :             :    PutExceptionBlock - sets a BOOLEAN in block module/procedure/defimp,
   13122                 :             :                        sym, indicating that this block as an EXCEPT
   13123                 :             :                        statement sequence.
   13124                 :             : */
   13125                 :             : 
   13126                 :         222 : extern "C" void SymbolTable_PutExceptionBlock (unsigned int sym)
   13127                 :             : {
   13128                 :         222 :   SymbolTable_PtrToSymbol pSym;
   13129                 :             : 
   13130                 :         222 :   pSym = GetPsym (sym);
   13131                 :         222 :   switch (pSym->SymbolType)
   13132                 :             :     {
   13133                 :         168 :       case SymbolTable_ProcedureSym:
   13134                 :         168 :         pSym->Procedure.ExceptionBlock = true;
   13135                 :         168 :         break;
   13136                 :             : 
   13137                 :          54 :       case SymbolTable_ModuleSym:
   13138                 :          54 :         pSym->Module.ExceptionBlock = true;
   13139                 :          54 :         break;
   13140                 :             : 
   13141                 :           0 :       case SymbolTable_DefImpSym:
   13142                 :           0 :         pSym->DefImp.ExceptionBlock = true;
   13143                 :           0 :         break;
   13144                 :             : 
   13145                 :             : 
   13146                 :           0 :       default:
   13147                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure", 19);
   13148                 :         222 :         break;
   13149                 :             :     }
   13150                 :         222 : }
   13151                 :             : 
   13152                 :             : 
   13153                 :             : /*
   13154                 :             :    HasExceptionBlock - returns a BOOLEAN determining whether
   13155                 :             :                        module/procedure/defimp, sym, has
   13156                 :             :                        an EXCEPT statement sequence.
   13157                 :             : */
   13158                 :             : 
   13159                 :      327935 : extern "C" bool SymbolTable_HasExceptionBlock (unsigned int sym)
   13160                 :             : {
   13161                 :      327935 :   SymbolTable_PtrToSymbol pSym;
   13162                 :             : 
   13163                 :      327935 :   pSym = GetPsym (sym);
   13164                 :      327935 :   switch (pSym->SymbolType)
   13165                 :             :     {
   13166                 :      161886 :       case SymbolTable_ProcedureSym:
   13167                 :      161886 :         return pSym->Procedure.ExceptionBlock;
   13168                 :       23699 :         break;
   13169                 :             : 
   13170                 :       23699 :       case SymbolTable_ModuleSym:
   13171                 :       23699 :         return pSym->Module.ExceptionBlock;
   13172                 :      142350 :         break;
   13173                 :             : 
   13174                 :      142350 :       case SymbolTable_DefImpSym:
   13175                 :      142350 :         return pSym->DefImp.ExceptionBlock;
   13176                 :           0 :         break;
   13177                 :             : 
   13178                 :             : 
   13179                 :           0 :       default:
   13180                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure", 19);
   13181                 :             :         break;
   13182                 :             :     }
   13183                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13184                 :             :   __builtin_unreachable ();
   13185                 :             : }
   13186                 :             : 
   13187                 :             : 
   13188                 :             : /*
   13189                 :             :    PutExceptionFinally - sets a BOOLEAN in block module/defimp,
   13190                 :             :                          sym, indicating that this FINALLY block
   13191                 :             :                          as an EXCEPT statement sequence.
   13192                 :             : */
   13193                 :             : 
   13194                 :           0 : extern "C" void SymbolTable_PutExceptionFinally (unsigned int sym)
   13195                 :             : {
   13196                 :           0 :   SymbolTable_PtrToSymbol pSym;
   13197                 :             : 
   13198                 :           0 :   pSym = GetPsym (sym);
   13199                 :           0 :   switch (pSym->SymbolType)
   13200                 :             :     {
   13201                 :           0 :       case SymbolTable_ProcedureSym:
   13202                 :           0 :         pSym->Procedure.ExceptionFinally = true;
   13203                 :           0 :         break;
   13204                 :             : 
   13205                 :           0 :       case SymbolTable_ModuleSym:
   13206                 :           0 :         pSym->Module.ExceptionFinally = true;
   13207                 :           0 :         break;
   13208                 :             : 
   13209                 :           0 :       case SymbolTable_DefImpSym:
   13210                 :           0 :         pSym->DefImp.ExceptionFinally = true;
   13211                 :           0 :         break;
   13212                 :             : 
   13213                 :             : 
   13214                 :           0 :       default:
   13215                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   13216                 :           0 :         break;
   13217                 :             :     }
   13218                 :           0 : }
   13219                 :             : 
   13220                 :             : 
   13221                 :             : /*
   13222                 :             :    HasExceptionFinally - returns a BOOLEAN determining whether
   13223                 :             :                          module/defimp, sym, has
   13224                 :             :                          an EXCEPT statement sequence.
   13225                 :             : */
   13226                 :             : 
   13227                 :       31744 : extern "C" bool SymbolTable_HasExceptionFinally (unsigned int sym)
   13228                 :             : {
   13229                 :       31744 :   SymbolTable_PtrToSymbol pSym;
   13230                 :             : 
   13231                 :       31744 :   pSym = GetPsym (sym);
   13232                 :       31744 :   switch (pSym->SymbolType)
   13233                 :             :     {
   13234                 :           0 :       case SymbolTable_ProcedureSym:
   13235                 :           0 :         return pSym->Procedure.ExceptionFinally;
   13236                 :       23542 :         break;
   13237                 :             : 
   13238                 :       23542 :       case SymbolTable_ModuleSym:
   13239                 :       23542 :         return pSym->Module.ExceptionFinally;
   13240                 :        8202 :         break;
   13241                 :             : 
   13242                 :        8202 :       case SymbolTable_DefImpSym:
   13243                 :        8202 :         return pSym->DefImp.ExceptionFinally;
   13244                 :           0 :         break;
   13245                 :             : 
   13246                 :             : 
   13247                 :           0 :       default:
   13248                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   13249                 :             :         break;
   13250                 :             :     }
   13251                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13252                 :             :   __builtin_unreachable ();
   13253                 :             : }
   13254                 :             : 
   13255                 :             : 
   13256                 :             : /*
   13257                 :             :    PutVar - gives the VarSym symbol Sym a type Type.
   13258                 :             : */
   13259                 :             : 
   13260                 :     1477225 : extern "C" void SymbolTable_PutVar (unsigned int Sym, unsigned int VarType)
   13261                 :             : {
   13262                 :     1477225 :   SymbolTable_PtrToSymbol pSym;
   13263                 :             : 
   13264                 :     1477225 :   pSym = GetPsym (Sym);
   13265                 :     1477225 :   switch (pSym->SymbolType)
   13266                 :             :     {
   13267                 :      575685 :       case SymbolTable_VarSym:
   13268                 :      575685 :         pSym->Var.Type = VarType;
   13269                 :      575685 :         M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_LeftValue-SymbolTable_RightValue]), Sym);
   13270                 :      575685 :         M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_RightValue-SymbolTable_RightValue]), Sym);
   13271                 :      575685 :         break;
   13272                 :             : 
   13273                 :      901540 :       case SymbolTable_ConstVarSym:
   13274                 :      901540 :         pSym->ConstVar.Type = VarType;
   13275                 :      901540 :         break;
   13276                 :             : 
   13277                 :             : 
   13278                 :           0 :       default:
   13279                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym or ConstVarSym", 31);
   13280                 :     1477225 :         break;
   13281                 :             :     }
   13282                 :     1477225 : }
   13283                 :             : 
   13284                 :             : 
   13285                 :             : /*
   13286                 :             :    PutVarTok - gives the VarSym symbol Sym a type Type at typetok.
   13287                 :             : */
   13288                 :             : 
   13289                 :    10614485 : extern "C" void SymbolTable_PutVarTok (unsigned int Sym, unsigned int VarType, unsigned int typetok)
   13290                 :             : {
   13291                 :    10614485 :   SymbolTable_PtrToSymbol pSym;
   13292                 :             : 
   13293                 :    10614485 :   pSym = GetPsym (Sym);
   13294                 :    10614485 :   switch (pSym->SymbolType)
   13295                 :             :     {
   13296                 :    10614473 :       case SymbolTable_VarSym:
   13297                 :    10614473 :         pSym->Var.Type = VarType;
   13298                 :    10614473 :         pSym->Var.Declared.TypeTok = typetok;
   13299                 :    10614473 :         M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_LeftValue-SymbolTable_RightValue]), Sym);
   13300                 :    10614473 :         M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_RightValue-SymbolTable_RightValue]), Sym);
   13301                 :    10614473 :         break;
   13302                 :             : 
   13303                 :           0 :       case SymbolTable_ConstVarSym:
   13304                 :           0 :         pSym->ConstVar.Type = VarType;
   13305                 :           0 :         break;
   13306                 :             : 
   13307                 :             : 
   13308                 :          12 :       default:
   13309                 :          12 :         M2Error_InternalError ((const char *) "expecting VarSym or ConstVarSym", 31);
   13310                 :    10614473 :         break;
   13311                 :             :     }
   13312                 :    10614473 : }
   13313                 :             : 
   13314                 :             : 
   13315                 :             : /*
   13316                 :             :    PutLeftValueFrontBackType - gives the variable symbol a front and backend type.
   13317                 :             :                                The variable must be a LeftValue.
   13318                 :             : */
   13319                 :             : 
   13320                 :       76548 : extern "C" void SymbolTable_PutLeftValueFrontBackType (unsigned int Sym, unsigned int FrontType, unsigned int BackType)
   13321                 :             : {
   13322                 :       76548 :   SymbolTable_PtrToSymbol pSym;
   13323                 :             : 
   13324                 :       76548 :   M2Debug_Assert ((SymbolTable_GetMode (Sym)) == SymbolTable_LeftValue);
   13325                 :       76548 :   pSym = GetPsym (Sym);
   13326                 :       76548 :   switch (pSym->SymbolType)
   13327                 :             :     {
   13328                 :       76548 :       case SymbolTable_VarSym:
   13329                 :       76548 :         pSym->Var.Type = FrontType;
   13330                 :       76548 :         pSym->Var.BackType = BackType;
   13331                 :       76548 :         SymbolTable_PushSize (M2System_Address);
   13332                 :       76548 :         M2ALU_PopInto (pSym->Var.Size);
   13333                 :       76548 :         break;
   13334                 :             : 
   13335                 :             : 
   13336                 :           0 :       default:
   13337                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   13338                 :       76548 :         break;
   13339                 :             :     }
   13340                 :       76548 : }
   13341                 :             : 
   13342                 :             : 
   13343                 :             : /*
   13344                 :             :    GetVarBackEndType - returns the back end type if specified.
   13345                 :             : */
   13346                 :             : 
   13347                 :     1121742 : extern "C" unsigned int SymbolTable_GetVarBackEndType (unsigned int Sym)
   13348                 :             : {
   13349                 :     1121742 :   SymbolTable_PtrToSymbol pSym;
   13350                 :             : 
   13351                 :     1121742 :   M2Debug_Assert (Sym != SymbolTable_NulSym);
   13352                 :     1121742 :   pSym = GetPsym (Sym);
   13353                 :     1121742 :   switch (pSym->SymbolType)
   13354                 :             :     {
   13355                 :     1121742 :       case SymbolTable_VarSym:
   13356                 :     1121742 :         return pSym->Var.BackType;
   13357                 :             :         break;
   13358                 :             : 
   13359                 :             : 
   13360                 :             :       default:
   13361                 :             :         return SymbolTable_NulSym;
   13362                 :             :         break;
   13363                 :             :     }
   13364                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   13365                 :             :   __builtin_unreachable ();
   13366                 :             : }
   13367                 :             : 
   13368                 :             : 
   13369                 :             : /*
   13370                 :             :    PutVarPointerCheck - marks variable, sym, as requiring (or not
   13371                 :             :                         depending upon the, value), a NIL pointer check
   13372                 :             :                         when this symbol is dereferenced.
   13373                 :             : */
   13374                 :             : 
   13375                 :       39656 : extern "C" void SymbolTable_PutVarPointerCheck (unsigned int sym, bool value)
   13376                 :             : {
   13377                 :       39656 :   SymbolTable_PtrToSymbol pSym;
   13378                 :             : 
   13379                 :       39656 :   if (SymbolTable_IsVar (sym))
   13380                 :             :     {
   13381                 :       39650 :       pSym = GetPsym (sym);
   13382                 :       39650 :       pSym->Var.IsPointerCheck = value;
   13383                 :             :     }
   13384                 :       39656 : }
   13385                 :             : 
   13386                 :             : 
   13387                 :             : /*
   13388                 :             :    GetVarPointerCheck - returns TRUE if this symbol is a variable and
   13389                 :             :                         has been marked as needing a pointer via NIL check.
   13390                 :             : */
   13391                 :             : 
   13392                 :       80141 : extern "C" bool SymbolTable_GetVarPointerCheck (unsigned int sym)
   13393                 :             : {
   13394                 :       80141 :   SymbolTable_PtrToSymbol pSym;
   13395                 :             : 
   13396                 :       80141 :   if (SymbolTable_IsVar (sym))
   13397                 :             :     {
   13398                 :       80141 :       pSym = GetPsym (sym);
   13399                 :       80141 :       return pSym->Var.IsPointerCheck;
   13400                 :             :     }
   13401                 :             :   return false;
   13402                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   13403                 :             :   __builtin_unreachable ();
   13404                 :             : }
   13405                 :             : 
   13406                 :             : 
   13407                 :             : /*
   13408                 :             :    PutVarWritten - marks variable, sym, as being written to (or not
   13409                 :             :                    depending upon the, value).
   13410                 :             : */
   13411                 :             : 
   13412                 :       12610 : extern "C" void SymbolTable_PutVarWritten (unsigned int sym, bool value)
   13413                 :             : {
   13414                 :       12610 :   SymbolTable_PtrToSymbol pSym;
   13415                 :             : 
   13416                 :       12610 :   if (SymbolTable_IsVar (sym))
   13417                 :             :     {
   13418                 :       12610 :       pSym = GetPsym (sym);
   13419                 :       12610 :       pSym->Var.IsWritten = value;
   13420                 :             :     }
   13421                 :       12610 : }
   13422                 :             : 
   13423                 :             : 
   13424                 :             : /*
   13425                 :             :    GetVarWritten - returns TRUE if this symbol is a variable and
   13426                 :             :                    has been marked as being written.
   13427                 :             : */
   13428                 :             : 
   13429                 :       90669 : extern "C" bool SymbolTable_GetVarWritten (unsigned int sym)
   13430                 :             : {
   13431                 :       90669 :   SymbolTable_PtrToSymbol pSym;
   13432                 :             : 
   13433                 :       90669 :   pSym = GetPsym (sym);
   13434                 :       90669 :   switch (pSym->SymbolType)
   13435                 :             :     {
   13436                 :       90669 :       case SymbolTable_VarSym:
   13437                 :       90669 :         return pSym->Var.IsWritten;
   13438                 :           0 :         break;
   13439                 :             : 
   13440                 :             : 
   13441                 :           0 :       default:
   13442                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   13443                 :             :         break;
   13444                 :             :     }
   13445                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13446                 :             :   __builtin_unreachable ();
   13447                 :             : }
   13448                 :             : 
   13449                 :             : 
   13450                 :             : /*
   13451                 :             :    PutConst - gives the constant symbol Sym a type ConstType.
   13452                 :             : */
   13453                 :             : 
   13454                 :      430250 : extern "C" void SymbolTable_PutConst (unsigned int Sym, unsigned int ConstType)
   13455                 :             : {
   13456                 :      430250 :   SymbolTable_PtrToSymbol pSym;
   13457                 :             : 
   13458                 :      430250 :   pSym = GetPsym (Sym);
   13459                 :      430250 :   CheckBreak (Sym);
   13460                 :      430250 :   switch (pSym->SymbolType)
   13461                 :             :     {
   13462                 :      430250 :       case SymbolTable_ConstVarSym:
   13463                 :      430250 :         pSym->ConstVar.Type = ConstType;
   13464                 :      430250 :         break;
   13465                 :             : 
   13466                 :             : 
   13467                 :           0 :       default:
   13468                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstVarSym", 21);
   13469                 :      430250 :         break;
   13470                 :             :     }
   13471                 :      430250 : }
   13472                 :             : 
   13473                 :             : 
   13474                 :             : /*
   13475                 :             :    PutConstSet - informs the const var symbol, sym, that it is or will contain
   13476                 :             :                  a set value.
   13477                 :             : */
   13478                 :             : 
   13479                 :       49484 : extern "C" void SymbolTable_PutConstSet (unsigned int Sym)
   13480                 :             : {
   13481                 :       49484 :   SymbolTable_PtrToSymbol pSym;
   13482                 :             : 
   13483                 :       49484 :   pSym = GetPsym (Sym);
   13484                 :       49484 :   switch (pSym->SymbolType)
   13485                 :             :     {
   13486                 :       49484 :       case SymbolTable_ConstVarSym:
   13487                 :       49484 :         pSym->ConstVar.IsSet = true;
   13488                 :       49484 :         break;
   13489                 :             : 
   13490                 :           0 :       case SymbolTable_ConstLitSym:
   13491                 :           0 :         pSym->ConstLit.IsSet = true;
   13492                 :           0 :         break;
   13493                 :             : 
   13494                 :             : 
   13495                 :           0 :       default:
   13496                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstVar symbol", 25);
   13497                 :       49484 :         break;
   13498                 :             :     }
   13499                 :       49484 : }
   13500                 :             : 
   13501                 :             : 
   13502                 :             : /*
   13503                 :             :    IsConstSet - returns TRUE if the constant is declared as a set.
   13504                 :             : */
   13505                 :             : 
   13506                 :    81778403 : extern "C" bool SymbolTable_IsConstSet (unsigned int Sym)
   13507                 :             : {
   13508                 :    81778403 :   SymbolTable_PtrToSymbol pSym;
   13509                 :             : 
   13510                 :    81778403 :   pSym = GetPsym (Sym);
   13511                 :    81778403 :   switch (pSym->SymbolType)
   13512                 :             :     {
   13513                 :    13948554 :       case SymbolTable_ConstVarSym:
   13514                 :    13948554 :         return pSym->ConstVar.IsSet;
   13515                 :    20000268 :         break;
   13516                 :             : 
   13517                 :    20000268 :       case SymbolTable_ConstLitSym:
   13518                 :    20000268 :         return pSym->ConstLit.IsSet;
   13519                 :             :         break;
   13520                 :             : 
   13521                 :             : 
   13522                 :             :       default:
   13523                 :             :         return false;
   13524                 :             :         break;
   13525                 :             :     }
   13526                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   13527                 :             :   __builtin_unreachable ();
   13528                 :             : }
   13529                 :             : 
   13530                 :             : 
   13531                 :             : /*
   13532                 :             :    PutConstructor - informs the const var symbol, sym, that it is or
   13533                 :             :                     will contain a constructor (record, set or array)
   13534                 :             :                     value.
   13535                 :             : */
   13536                 :             : 
   13537                 :       41592 : extern "C" void SymbolTable_PutConstructor (unsigned int Sym)
   13538                 :             : {
   13539                 :       41592 :   SymbolTable_PtrToSymbol pSym;
   13540                 :             : 
   13541                 :       41592 :   pSym = GetPsym (Sym);
   13542                 :       41592 :   switch (pSym->SymbolType)
   13543                 :             :     {
   13544                 :       41592 :       case SymbolTable_ConstVarSym:
   13545                 :       41592 :         pSym->ConstVar.IsConstructor = true;
   13546                 :       41592 :         break;
   13547                 :             : 
   13548                 :           0 :       case SymbolTable_ConstLitSym:
   13549                 :           0 :         pSym->ConstLit.IsConstructor = true;
   13550                 :           0 :         break;
   13551                 :             : 
   13552                 :             : 
   13553                 :           0 :       default:
   13554                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstVar or ConstLit symbol", 37);
   13555                 :       41592 :         break;
   13556                 :             :     }
   13557                 :       41592 : }
   13558                 :             : 
   13559                 :             : 
   13560                 :             : /*
   13561                 :             :    PutConstructorFrom - sets the from type field in constructor,
   13562                 :             :                         Sym, to, from.
   13563                 :             : */
   13564                 :             : 
   13565                 :       36736 : extern "C" void SymbolTable_PutConstructorFrom (unsigned int Sym, unsigned int from)
   13566                 :             : {
   13567                 :       36736 :   SymbolTable_PtrToSymbol pSym;
   13568                 :             : 
   13569                 :       36736 :   pSym = GetPsym (Sym);
   13570                 :       36736 :   switch (pSym->SymbolType)
   13571                 :             :     {
   13572                 :       36736 :       case SymbolTable_ConstVarSym:
   13573                 :       36736 :         pSym->ConstVar.FromType = from;
   13574                 :       36736 :         pSym->ConstVar.UnresFromType = true;
   13575                 :       36736 :         break;
   13576                 :             : 
   13577                 :           0 :       case SymbolTable_ConstLitSym:
   13578                 :           0 :         pSym->ConstLit.FromType = from;
   13579                 :           0 :         pSym->ConstLit.UnresFromType = true;
   13580                 :           0 :         break;
   13581                 :             : 
   13582                 :             : 
   13583                 :           0 :       default:
   13584                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstVar or ConstLit symbol", 37);
   13585                 :       36736 :         break;
   13586                 :             :     }
   13587                 :       36736 :   Lists_IncludeItemIntoList (UnresolvedConstructorType, Sym);
   13588                 :       36736 : }
   13589                 :             : 
   13590                 :             : 
   13591                 :             : /*
   13592                 :             :    PutFieldRecord - places a field, FieldName and FieldType into a record, Sym.
   13593                 :             :                     VarSym is a optional varient symbol which can be returned
   13594                 :             :                     by a call to GetVarient(fieldsymbol).  The created field
   13595                 :             :                     is returned.
   13596                 :             : */
   13597                 :             : 
   13598                 :      409506 : extern "C" unsigned int SymbolTable_PutFieldRecord (unsigned int Sym, NameKey_Name FieldName, unsigned int FieldType, unsigned int VarSym)
   13599                 :             : {
   13600                 :      409506 :   SymbolTable_PtrToSymbol oSym;
   13601                 :      409506 :   SymbolTable_PtrToSymbol pSym;
   13602                 :      409506 :   unsigned int esym;
   13603                 :      409506 :   unsigned int ParSym;
   13604                 :      409506 :   unsigned int SonSym;
   13605                 :             : 
   13606                 :      409506 :   NewSym (&SonSym);  /* Cannot be used before declared since use occurs  */
   13607                 :             :   /* ensure that it is connected its parent.  */
   13608                 :      409506 :   pSym = GetPsym (Sym);
   13609                 :      409506 :   switch (pSym->SymbolType)
   13610                 :             :     {
   13611                 :      403428 :       case SymbolTable_RecordSym:
   13612                 :      403428 :         Lists_PutItemIntoList (pSym->Record.ListOfSons, SonSym);
   13613                 :      403428 :         M2Debug_Assert (Lists_IsItemInList (pSym->Record.ListOfSons, SonSym));
   13614                 :             :         /* Ensure that the Field is in the Parents Local Symbols  */
   13615                 :      403428 :         if (FieldName != NameKey_NulName)
   13616                 :             :           {
   13617                 :             :             /* avoid gcc warning by using compound statement even if not strictly necessary.  */
   13618                 :      403398 :             if ((SymbolKey_GetSymKey (pSym->Record.LocalSymbols, FieldName)) == SymbolKey_NulKey)
   13619                 :             :               {
   13620                 :      403398 :                 SymbolKey_PutSymKey (pSym->Record.LocalSymbols, FieldName, SonSym);
   13621                 :             :               }
   13622                 :             :             else
   13623                 :             :               {
   13624                 :           0 :                 esym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->Record.LocalSymbols, FieldName));
   13625                 :           0 :                 M2MetaError_MetaErrors1 ((const char *) "field record {%1Dad} has already been declared", 46, (const char *) "field record duplicate", 22, esym);
   13626                 :             :               }
   13627                 :             :           }
   13628                 :             :         CheckRecordConsistency (Sym);
   13629                 :             :         break;
   13630                 :             : 
   13631                 :        6078 :       case SymbolTable_VarientFieldSym:
   13632                 :        6078 :         Lists_PutItemIntoList (pSym->VarientField.ListOfSons, SonSym);
   13633                 :        6078 :         ParSym = SymbolTable_GetRecord (pSym->VarientField.Parent);
   13634                 :        6078 :         oSym = GetPsym (ParSym);
   13635                 :        6078 :         M2Debug_Assert (oSym->SymbolType == SymbolTable_RecordSym);
   13636                 :        6078 :         if (FieldName != NameKey_NulName)
   13637                 :             :           {
   13638                 :        6066 :             oSym = GetPsym (ParSym);
   13639                 :        6066 :             SymbolKey_PutSymKey (oSym->Record.LocalSymbols, FieldName, SonSym);
   13640                 :             :           }
   13641                 :             :         break;
   13642                 :             : 
   13643                 :             : 
   13644                 :           0 :       default:
   13645                 :           0 :         M2Error_InternalError ((const char *) "expecting Record symbol", 23);
   13646                 :      409506 :         break;
   13647                 :             :     }
   13648                 :             :   /* Fill in SonSym  */
   13649                 :      409506 :   oSym = GetPsym (SonSym);
   13650                 :      409506 :   oSym->SymbolType = SymbolTable_RecordFieldSym;
   13651                 :      409506 :   oSym->RecordField.Type = FieldType;
   13652                 :      409506 :   oSym->RecordField.name = FieldName;
   13653                 :      409506 :   oSym->RecordField.Tag = false;
   13654                 :      409506 :   oSym->RecordField.Parent = Sym;
   13655                 :      409506 :   oSym->RecordField.Varient = VarSym;
   13656                 :      409506 :   oSym->RecordField.Align = SymbolTable_NulSym;
   13657                 :      409506 :   oSym->RecordField.Used = true;
   13658                 :      409506 :   oSym->RecordField.DeclPacked = false;  /* not known as packed (yet).  */
   13659                 :      409506 :   oSym->RecordField.DeclResolved = false;  /* not known as packed (yet).  */
   13660                 :      409506 :   oSym->RecordField.Scope = SymbolTable_GetScope (Sym);
   13661                 :      409506 :   oSym->RecordField.Size = M2ALU_InitValue ();
   13662                 :      409506 :   oSym->RecordField.Offset = M2ALU_InitValue ();
   13663                 :      409506 :   InitWhereDeclared (&oSym->RecordField.At);
   13664                 :      409506 :   return SonSym;
   13665                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   13666                 :             :   __builtin_unreachable ();
   13667                 :             : }
   13668                 :             : 
   13669                 :             : 
   13670                 :             : /*
   13671                 :             :    PutFieldVarient - places the field varient, Field, as a brother to, the
   13672                 :             :                      varient symbol, sym, and also tells Field that its varient
   13673                 :             :                      parent is Sym.
   13674                 :             : */
   13675                 :             : 
   13676                 :       12060 : extern "C" void SymbolTable_PutFieldVarient (unsigned int Field, unsigned int Sym)
   13677                 :             : {
   13678                 :       12060 :   SymbolTable_PtrToSymbol pSym;
   13679                 :             : 
   13680                 :       12060 :   M2Debug_Assert (SymbolTable_IsVarient (Sym));
   13681                 :       12060 :   M2Debug_Assert (SymbolTable_IsFieldVarient (Field));
   13682                 :       12060 :   pSym = GetPsym (Sym);
   13683                 :       12060 :   switch (pSym->SymbolType)
   13684                 :             :     {
   13685                 :       12060 :       case SymbolTable_VarientSym:
   13686                 :       12060 :         Lists_IncludeItemIntoList (pSym->Varient.ListOfSons, Field);
   13687                 :       12060 :         break;
   13688                 :             : 
   13689                 :             : 
   13690                 :           0 :       default:
   13691                 :           0 :         M2Error_InternalError ((const char *) "expecting Varient symbol", 24);
   13692                 :       12060 :         break;
   13693                 :             :     }
   13694                 :       12060 :   pSym = GetPsym (Field);
   13695                 :       12060 :   switch (pSym->SymbolType)
   13696                 :             :     {
   13697                 :       12060 :       case SymbolTable_VarientFieldSym:
   13698                 :       12060 :         pSym->VarientField.Varient = Sym;
   13699                 :       12060 :         break;
   13700                 :             : 
   13701                 :             : 
   13702                 :           0 :       default:
   13703                 :           0 :         M2Error_InternalError ((const char *) "expecting VarientField symbol", 29);
   13704                 :       12060 :         break;
   13705                 :             :     }
   13706                 :       12060 : }
   13707                 :             : 
   13708                 :             : 
   13709                 :             : /*
   13710                 :             :    GetVarient - returns the varient symbol associated with the
   13711                 :             :                 record or varient field symbol, Field.
   13712                 :             : */
   13713                 :             : 
   13714                 :   234183954 : extern "C" unsigned int SymbolTable_GetVarient (unsigned int Field)
   13715                 :             : {
   13716                 :   234183954 :   SymbolTable_PtrToSymbol pSym;
   13717                 :             : 
   13718                 :   234183954 :   pSym = GetPsym (Field);
   13719                 :   234183954 :   switch (pSym->SymbolType)
   13720                 :             :     {
   13721                 :           0 :       case SymbolTable_VarientFieldSym:
   13722                 :           0 :         return pSym->VarientField.Varient;
   13723                 :   233650754 :         break;
   13724                 :             : 
   13725                 :   233650754 :       case SymbolTable_RecordFieldSym:
   13726                 :   233650754 :         return pSym->RecordField.Varient;
   13727                 :      533200 :         break;
   13728                 :             : 
   13729                 :      533200 :       case SymbolTable_VarientSym:
   13730                 :      533200 :         return pSym->Varient.Varient;
   13731                 :             :         break;
   13732                 :             : 
   13733                 :             : 
   13734                 :             :       default:
   13735                 :             :         return SymbolTable_NulSym;
   13736                 :             :         break;
   13737                 :             :     }
   13738                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   13739                 :             :   __builtin_unreachable ();
   13740                 :             : }
   13741                 :             : 
   13742                 :             : 
   13743                 :             : /*
   13744                 :             :    IsRecordFieldAVarientTag - returns TRUE if record field, sym, is
   13745                 :             :                               a varient tag.
   13746                 :             : */
   13747                 :             : 
   13748                 :     3422486 : extern "C" bool SymbolTable_IsRecordFieldAVarientTag (unsigned int sym)
   13749                 :             : {
   13750                 :     3422486 :   SymbolTable_PtrToSymbol pSym;
   13751                 :             : 
   13752                 :     3422486 :   if (SymbolTable_IsRecordField (sym))
   13753                 :             :     {
   13754                 :     3422486 :       pSym = GetPsym (sym);
   13755                 :     3422486 :       return pSym->RecordField.Tag;
   13756                 :             :     }
   13757                 :             :   else
   13758                 :             :     {
   13759                 :           0 :       M2Error_InternalError ((const char *) "record field symbol expected", 28);
   13760                 :             :     }
   13761                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13762                 :             :   __builtin_unreachable ();
   13763                 :             : }
   13764                 :             : 
   13765                 :             : 
   13766                 :             : /*
   13767                 :             :    IsEmptyFieldVarient - returns TRUE if the field variant has
   13768                 :             :                          no fields.  This will occur then the
   13769                 :             :                          compiler constructs 'else end' variants.
   13770                 :             : */
   13771                 :             : 
   13772                 :           0 : extern "C" bool SymbolTable_IsEmptyFieldVarient (unsigned int sym)
   13773                 :             : {
   13774                 :           0 :   SymbolTable_PtrToSymbol pSym;
   13775                 :             : 
   13776                 :           0 :   pSym = GetPsym (sym);
   13777                 :           0 :   switch (pSym->SymbolType)
   13778                 :             :     {
   13779                 :           0 :       case SymbolTable_VarientFieldSym:
   13780                 :           0 :         return (Lists_NoOfItemsInList (pSym->VarientField.ListOfSons)) == 0;
   13781                 :           0 :         break;
   13782                 :             : 
   13783                 :             : 
   13784                 :           0 :       default:
   13785                 :           0 :         M2Error_InternalError ((const char *) "varient field symbol expected", 29);
   13786                 :             :         break;
   13787                 :             :     }
   13788                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13789                 :             :   __builtin_unreachable ();
   13790                 :             : }
   13791                 :             : 
   13792                 :             : 
   13793                 :             : /*
   13794                 :             :    GetVarientTag - returns the varient tag from, Sym.
   13795                 :             : */
   13796                 :             : 
   13797                 :       12726 : extern "C" unsigned int SymbolTable_GetVarientTag (unsigned int Sym)
   13798                 :             : {
   13799                 :       12726 :   SymbolTable_PtrToSymbol pSym;
   13800                 :             : 
   13801                 :       12726 :   pSym = GetPsym (Sym);
   13802                 :       12726 :   switch (pSym->SymbolType)
   13803                 :             :     {
   13804                 :       12726 :       case SymbolTable_VarientSym:
   13805                 :       12726 :         return pSym->Varient.tag;
   13806                 :           0 :         break;
   13807                 :             : 
   13808                 :             : 
   13809                 :           0 :       default:
   13810                 :           0 :         M2Error_InternalError ((const char *) "varient symbol expected", 23);
   13811                 :             :         break;
   13812                 :             :     }
   13813                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   13814                 :             :   __builtin_unreachable ();
   13815                 :             : }
   13816                 :             : 
   13817                 :             : 
   13818                 :             : /*
   13819                 :             :    PutVarientTag - places, Tag, into varient, Sym.
   13820                 :             : */
   13821                 :             : 
   13822                 :        2982 : extern "C" void SymbolTable_PutVarientTag (unsigned int Sym, unsigned int Tag)
   13823                 :             : {
   13824                 :        2982 :   SymbolTable_PtrToSymbol pSym;
   13825                 :        2982 :   unsigned int parent;
   13826                 :             : 
   13827                 :        2982 :   pSym = GetPsym (Sym);
   13828                 :        2982 :   switch (pSym->SymbolType)
   13829                 :             :     {
   13830                 :        2982 :       case SymbolTable_VarientSym:
   13831                 :        2982 :         pSym->Varient.tag = Tag;
   13832                 :        2982 :         break;
   13833                 :             : 
   13834                 :             : 
   13835                 :           0 :       default:
   13836                 :           0 :         M2Error_InternalError ((const char *) "varient symbol expected", 23);
   13837                 :        2982 :         break;
   13838                 :             :     }
   13839                 :             :   /* now ensure that if Tag is a RecordField then it must be
   13840                 :             :       placed before the varient symbol in its parent ListOfSons.
   13841                 :             :       This allows M2GCCDeclare to declare record fields in order
   13842                 :             :       and preserve the order of fields.  Otherwise it will add the
   13843                 :             :       tag field after the C union.  */
   13844                 :        2982 :   if (SymbolTable_IsRecordField (Tag))
   13845                 :             :     {
   13846                 :        2970 :       pSym = GetPsym (Tag);
   13847                 :        2970 :       pSym->RecordField.Tag = true;
   13848                 :        2970 :       parent = SymbolTable_GetParent (Sym);
   13849                 :        2970 :       pSym = GetPsym (parent);
   13850                 :        2970 :       switch (pSym->SymbolType)
   13851                 :             :         {
   13852                 :             :           case SymbolTable_ErrorSym:
   13853                 :             :             break;
   13854                 :             : 
   13855                 :           0 :           case SymbolTable_VarientSym:
   13856                 :           0 :             EnsureOrder (pSym->Varient.ListOfSons, Tag, Sym);
   13857                 :           0 :             break;
   13858                 :             : 
   13859                 :          36 :           case SymbolTable_VarientFieldSym:
   13860                 :          36 :             EnsureOrder (pSym->VarientField.ListOfSons, Tag, Sym);
   13861                 :          36 :             break;
   13862                 :             : 
   13863                 :        2934 :           case SymbolTable_RecordSym:
   13864                 :        2934 :             EnsureOrder (pSym->Record.ListOfSons, Tag, Sym);
   13865                 :        2934 :             CheckRecordConsistency (parent);
   13866                 :        2934 :             break;
   13867                 :             : 
   13868                 :             : 
   13869                 :           0 :           default:
   13870                 :           0 :             M2Error_InternalError ((const char *) "not expecting this symbol type", 30);
   13871                 :             :             break;
   13872                 :             :         }
   13873                 :             :     }
   13874                 :        2982 : }
   13875                 :             : 
   13876                 :             : 
   13877                 :             : /*
   13878                 :             :    PutFieldEnumeration - places a field into the enumeration type
   13879                 :             :                          Sym. The field has a name FieldName and a
   13880                 :             :                          value FieldVal.
   13881                 :             : */
   13882                 :             : 
   13883                 :      494014 : extern "C" void SymbolTable_PutFieldEnumeration (unsigned int tok, unsigned int Sym, NameKey_Name FieldName)
   13884                 :             : {
   13885                 :      494014 :   SymbolTable_PtrToSymbol oSym;
   13886                 :      494014 :   SymbolTable_PtrToSymbol pSym;
   13887                 :      494014 :   DynamicStrings_String s;
   13888                 :      494014 :   unsigned int Field;
   13889                 :             : 
   13890                 :      494014 :   Field = CheckForHiddenType (FieldName);
   13891                 :      494014 :   if (Field == SymbolTable_NulSym)
   13892                 :             :     {
   13893                 :      494014 :       Field = DeclareSym (tok, FieldName);
   13894                 :             :     }
   13895                 :      494014 :   if (! (SymbolTable_IsError (Field)))
   13896                 :             :     {
   13897                 :      494008 :       pSym = GetPsym (Field);
   13898                 :      494008 :       pSym->SymbolType = SymbolTable_EnumerationFieldSym;
   13899                 :      494008 :       pSym->EnumerationField.name = FieldName;  /* Index into name array, name  */
   13900                 :             :       /* of type.  */
   13901                 :      494008 :       oSym = GetPsym (Sym);
   13902                 :      494008 :       M2ALU_PushCard (oSym->Enumeration.NoOfElements);
   13903                 :      494008 :       pSym->EnumerationField.Value = M2ALU_InitValue ();
   13904                 :      494008 :       M2ALU_PopInto (pSym->EnumerationField.Value);
   13905                 :      494008 :       pSym->EnumerationField.Type = Sym;
   13906                 :      494008 :       pSym->EnumerationField.Scope = SymbolTable_GetCurrentScope ();
   13907                 :      494008 :       InitWhereDeclaredTok (tok, &pSym->EnumerationField.At);  /* Declared here  */
   13908                 :      494008 :       pSym = GetPsym (Sym);
   13909                 :      494008 :       switch (pSym->SymbolType)
   13910                 :             :         {
   13911                 :      494008 :           case SymbolTable_EnumerationSym:
   13912                 :      494008 :             pSym->Enumeration.NoOfElements += 1;
   13913                 :      494008 :             if ((SymbolKey_GetSymKey (pSym->Enumeration.LocalSymbols, FieldName)) != SymbolTable_NulSym)
   13914                 :             :               {
   13915                 :           0 :                 s = DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (FieldName)));
   13916                 :           0 :                 AlreadyDeclaredError (FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "enumeration field (%s) is already declared elsewhere, use a different name or remove the declaration", 100)), (const unsigned char *) &s, (sizeof (s)-1)), FieldName, SymbolTable_GetDeclaredMod (SymbolKey_GetSymKey (pSym->Enumeration.LocalSymbols, FieldName)));
   13917                 :             :               }
   13918                 :             :             else
   13919                 :             :               {
   13920                 :      494008 :                 SymbolKey_PutSymKey (pSym->Enumeration.LocalSymbols, FieldName, Field);
   13921                 :      494008 :                 Lists_IncludeItemIntoList (pSym->Enumeration.ListOfFields, Field);
   13922                 :             :               }
   13923                 :             :             break;
   13924                 :             : 
   13925                 :             : 
   13926                 :           0 :           default:
   13927                 :           0 :             M2Error_InternalError ((const char *) "expecting Sym=Enumeration", 25);
   13928                 :             :             break;
   13929                 :             :         }
   13930                 :             :     }
   13931                 :      494014 : }
   13932                 :             : 
   13933                 :             : 
   13934                 :             : /*
   13935                 :             :    PutSubrange - places LowSym and HighSym as two symbols
   13936                 :             :                  which provide the limits of the range.
   13937                 :             : */
   13938                 :             : 
   13939                 :      331232 : extern "C" void SymbolTable_PutSubrange (unsigned int Sym, unsigned int LowSym, unsigned int HighSym, unsigned int TypeSymbol)
   13940                 :             : {
   13941                 :      331232 :   SymbolTable_PtrToSymbol pSym;
   13942                 :             : 
   13943                 :      331232 :   pSym = GetPsym (Sym);
   13944                 :      331232 :   switch (pSym->SymbolType)
   13945                 :             :     {
   13946                 :      331232 :       case SymbolTable_SubrangeSym:
   13947                 :      331232 :         pSym->Subrange.Low = LowSym;  /* Index to symbol for lower  */
   13948                 :      331232 :         pSym->Subrange.High = HighSym;  /* Index to symbol for higher  */
   13949                 :      331232 :         pSym->Subrange.Type = TypeSymbol;  /* Index to type symbol for  */
   13950                 :      331232 :         break;
   13951                 :             : 
   13952                 :             : 
   13953                 :           0 :       default:
   13954                 :             :         /* the type of subrange.  */
   13955                 :           0 :         M2Error_InternalError ((const char *) "expecting Subrange symbol", 25);
   13956                 :      331232 :         break;
   13957                 :             :     }
   13958                 :      331232 : }
   13959                 :             : 
   13960                 :             : 
   13961                 :             : /*
   13962                 :             :    PutSet - places SimpleType as the type for set, Sym.
   13963                 :             : */
   13964                 :             : 
   13965                 :       66782 : extern "C" void SymbolTable_PutSet (unsigned int Sym, unsigned int SimpleType, bool packed)
   13966                 :             : {
   13967                 :       66782 :   SymbolTable_PtrToSymbol pSym;
   13968                 :             : 
   13969                 :       66782 :   pSym = GetPsym (Sym);
   13970                 :       66782 :   switch (pSym->SymbolType)
   13971                 :             :     {
   13972                 :             :       case SymbolTable_ErrorSym:
   13973                 :             :         break;
   13974                 :             : 
   13975                 :       66782 :       case SymbolTable_SetSym:
   13976                 :       66782 :         pSym->Set.Type = SimpleType;  /* Index to a subrange symbol  */
   13977                 :             :         /* or an enumeration type.  */
   13978                 :       66782 :         pSym->Set.ispacked = packed;
   13979                 :       66782 :         break;
   13980                 :             : 
   13981                 :             : 
   13982                 :           0 :       default:
   13983                 :           0 :         M2Error_InternalError ((const char *) "expecting a Set symbol", 22);
   13984                 :       66782 :         break;
   13985                 :             :     }
   13986                 :       66782 : }
   13987                 :             : 
   13988                 :             : 
   13989                 :             : /*
   13990                 :             :    IsSetPacked - returns TRUE if Sym is packed.
   13991                 :             : */
   13992                 :             : 
   13993                 :           0 : extern "C" bool SymbolTable_IsSetPacked (unsigned int Sym)
   13994                 :             : {
   13995                 :           0 :   SymbolTable_PtrToSymbol pSym;
   13996                 :             : 
   13997                 :           0 :   AssertInRange (Sym);
   13998                 :           0 :   pSym = GetPsym (Sym);
   13999                 :           0 :   return (pSym->SymbolType == SymbolTable_SetSym) && pSym->Set.ispacked;
   14000                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   14001                 :             :   __builtin_unreachable ();
   14002                 :             : }
   14003                 :             : 
   14004                 :             : 
   14005                 :             : /*
   14006                 :             :    GetArraySubscript - returns the subscript symbol for array, Sym.
   14007                 :             : */
   14008                 :             : 
   14009                 :     6218410 : extern "C" unsigned int SymbolTable_GetArraySubscript (unsigned int Sym)
   14010                 :             : {
   14011                 :     6218410 :   SymbolTable_PtrToSymbol pSym;
   14012                 :             : 
   14013                 :     6218410 :   pSym = GetPsym (Sym);
   14014                 :     6218410 :   switch (pSym->SymbolType)
   14015                 :             :     {
   14016                 :             :       case SymbolTable_ErrorSym:
   14017                 :             :         return SymbolTable_NulSym;
   14018                 :     6218410 :         break;
   14019                 :             : 
   14020                 :     6218410 :       case SymbolTable_ArraySym:
   14021                 :     6218410 :         return pSym->Array.Subscript;
   14022                 :           0 :         break;
   14023                 :             : 
   14024                 :             : 
   14025                 :           0 :       default:
   14026                 :           0 :         M2Error_InternalError ((const char *) "expecting an Array symbol", 25);
   14027                 :             :         break;
   14028                 :             :     }
   14029                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14030                 :             :   __builtin_unreachable ();
   14031                 :             : }
   14032                 :             : 
   14033                 :             : 
   14034                 :             : /*
   14035                 :             :    PutArraySubscript - places an index field into the array Sym. The
   14036                 :             :                        index field is a subscript sym.
   14037                 :             : */
   14038                 :             : 
   14039                 :      165592 : extern "C" void SymbolTable_PutArraySubscript (unsigned int Sym, unsigned int SubscriptSymbol)
   14040                 :             : {
   14041                 :      165592 :   SymbolTable_PtrToSymbol pSym;
   14042                 :             : 
   14043                 :      165592 :   pSym = GetPsym (Sym);
   14044                 :      165592 :   switch (pSym->SymbolType)
   14045                 :             :     {
   14046                 :             :       case SymbolTable_ErrorSym:
   14047                 :             :         break;
   14048                 :             : 
   14049                 :      165592 :       case SymbolTable_ArraySym:
   14050                 :      165592 :         pSym->Array.Subscript = SubscriptSymbol;
   14051                 :      165592 :         break;
   14052                 :             : 
   14053                 :             : 
   14054                 :           0 :       default:
   14055                 :           0 :         M2Error_InternalError ((const char *) "expecting an Array symbol", 25);
   14056                 :      165592 :         break;
   14057                 :             :     }
   14058                 :      165592 : }
   14059                 :             : 
   14060                 :             : 
   14061                 :             : /*
   14062                 :             :    PutType - gives a type symbol Sym type TypeSymbol.
   14063                 :             : */
   14064                 :             : 
   14065                 :      626870 : extern "C" void SymbolTable_PutType (unsigned int Sym, unsigned int TypeSymbol)
   14066                 :             : {
   14067                 :      626870 :   SymbolTable_PtrToSymbol pSym;
   14068                 :             : 
   14069                 :      626870 :   if (TypeSymbol == Sym)
   14070                 :             :     {
   14071                 :           0 :       M2Error_InternalError ((const char *) "not expecting a type to be declared as itself", 45);
   14072                 :             :     }
   14073                 :      626870 :   pSym = GetPsym (Sym);
   14074                 :      626870 :   switch (pSym->SymbolType)
   14075                 :             :     {
   14076                 :             :       case SymbolTable_ErrorSym:
   14077                 :             :         break;
   14078                 :             : 
   14079                 :      626870 :       case SymbolTable_TypeSym:
   14080                 :      626870 :         pSym->Type.Type = TypeSymbol;
   14081                 :      626870 :         break;
   14082                 :             : 
   14083                 :             : 
   14084                 :           0 :       default:
   14085                 :           0 :         M2Error_InternalError ((const char *) "expecting a Type symbol", 23);
   14086                 :      626870 :         break;
   14087                 :             :     }
   14088                 :      626870 : }
   14089                 :             : 
   14090                 :             : 
   14091                 :             : /*
   14092                 :             :    PutFunction - Places a TypeSym as the return type to a procedure Sym.
   14093                 :             : */
   14094                 :             : 
   14095                 :     8346215 : extern "C" void SymbolTable_PutFunction (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int TypeSym)
   14096                 :             : {
   14097                 :    16684552 :   SymbolTable_PtrToSymbol pSym;
   14098                 :             : 
   14099                 :    16684552 :   pSym = GetPsym (Sym);
   14100                 :    16684552 :   switch (pSym->SymbolType)
   14101                 :             :     {
   14102                 :             :       case SymbolTable_ErrorSym:
   14103                 :             :         break;
   14104                 :             : 
   14105                 :     8338337 :       case SymbolTable_ProcedureSym:
   14106                 :     8338337 :         pSym->Procedure.ReturnType = TypeSym;
   14107                 :     8338337 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnTypeTok = tok;
   14108                 :     8338337 :         SymbolTable_PutFunction (tok, pSym->Procedure.ProcedureType, kind, TypeSym);
   14109                 :     8338337 :         break;
   14110                 :             : 
   14111                 :     8346215 :       case SymbolTable_ProcTypeSym:
   14112                 :     8346215 :         pSym->ProcType.ReturnType = TypeSym;
   14113                 :     8346215 :         pSym->ProcType.ReturnTypeTok = tok;
   14114                 :     8346215 :         break;
   14115                 :             : 
   14116                 :             : 
   14117                 :           0 :       default:
   14118                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   14119                 :     8346215 :         break;
   14120                 :             :     }
   14121                 :     8346215 : }
   14122                 :             : 
   14123                 :             : 
   14124                 :             : /*
   14125                 :             :    PutOptFunction - places a TypeSym as the optional return type to a procedure Sym.
   14126                 :             : */
   14127                 :             : 
   14128                 :      127954 : extern "C" void SymbolTable_PutOptFunction (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int TypeSym)
   14129                 :             : {
   14130                 :      255908 :   SymbolTable_PtrToSymbol pSym;
   14131                 :             : 
   14132                 :      255908 :   pSym = GetPsym (Sym);
   14133                 :      255908 :   switch (pSym->SymbolType)
   14134                 :             :     {
   14135                 :             :       case SymbolTable_ErrorSym:
   14136                 :             :         break;
   14137                 :             : 
   14138                 :      127954 :       case SymbolTable_ProcedureSym:
   14139                 :      127954 :         pSym->Procedure.ReturnType = TypeSym;
   14140                 :      127954 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnOptional = true;
   14141                 :      127954 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnTypeTok = tok;
   14142                 :      127954 :         SymbolTable_PutOptFunction (tok, pSym->Procedure.ProcedureType, kind, TypeSym);
   14143                 :      127954 :         break;
   14144                 :             : 
   14145                 :      127954 :       case SymbolTable_ProcTypeSym:
   14146                 :      127954 :         pSym->ProcType.ReturnType = TypeSym;
   14147                 :      127954 :         pSym->ProcType.ReturnTypeTok = tok;
   14148                 :      127954 :         break;
   14149                 :             : 
   14150                 :             : 
   14151                 :           0 :       default:
   14152                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   14153                 :      127954 :         break;
   14154                 :             :     }
   14155                 :      127954 : }
   14156                 :             : 
   14157                 :             : 
   14158                 :             : /*
   14159                 :             :    IsReturnOptional - returns TRUE if the return value for, sym, is
   14160                 :             :                       optional.
   14161                 :             : */
   14162                 :             : 
   14163                 :     1701965 : extern "C" bool SymbolTable_IsReturnOptional (unsigned int sym, SymbolTable_ProcedureKind kind)
   14164                 :             : {
   14165                 :     1701965 :   SymbolTable_PtrToSymbol pSym;
   14166                 :             : 
   14167                 :     1701965 :   pSym = GetPsym (sym);
   14168                 :     1701965 :   switch (pSym->SymbolType)
   14169                 :             :     {
   14170                 :     1670525 :       case SymbolTable_ProcedureSym:
   14171                 :     1670525 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnOptional;
   14172                 :       31440 :         break;
   14173                 :             : 
   14174                 :       31440 :       case SymbolTable_ProcTypeSym:
   14175                 :       31440 :         return pSym->ProcType.ReturnOptional;
   14176                 :           0 :         break;
   14177                 :             : 
   14178                 :             : 
   14179                 :           0 :       default:
   14180                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   14181                 :             :         break;
   14182                 :             :     }
   14183                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14184                 :             :   __builtin_unreachable ();
   14185                 :             : }
   14186                 :             : 
   14187                 :             : 
   14188                 :             : /*
   14189                 :             :    IsReturnOptionalAny - returns TRUE if the return value for sym is
   14190                 :             :                          optional.
   14191                 :             : */
   14192                 :             : 
   14193                 :        8617 : extern "C" bool SymbolTable_IsReturnOptionalAny (unsigned int sym)
   14194                 :             : {
   14195                 :        8617 :   SymbolTable_PtrToSymbol pSym;
   14196                 :             : 
   14197                 :        8617 :   pSym = GetPsym (sym);
   14198                 :        8617 :   switch (pSym->SymbolType)
   14199                 :             :     {
   14200                 :        8617 :       case SymbolTable_ProcedureSym:
   14201                 :        8617 :         return IsProcedureAnyBoolean (sym, (SymbolTable_ProcAnyBoolean) {(SymbolTable_ProcAnyBoolean_t) SymbolTable_IsReturnOptional});
   14202                 :           0 :         break;
   14203                 :             : 
   14204                 :           0 :       case SymbolTable_ProcTypeSym:
   14205                 :           0 :         return pSym->ProcType.ReturnOptional;
   14206                 :           0 :         break;
   14207                 :             : 
   14208                 :             : 
   14209                 :           0 :       default:
   14210                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   14211                 :             :         break;
   14212                 :             :     }
   14213                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14214                 :             :   __builtin_unreachable ();
   14215                 :             : }
   14216                 :             : 
   14217                 :             : 
   14218                 :             : /*
   14219                 :             :    PutParam - Places a Non VAR parameter ParamName with type ParamType into
   14220                 :             :               procedure Sym:kind.  The parameter number is ParamNo.
   14221                 :             :               If the procedure Sym already has this parameter then
   14222                 :             :               the parameter is checked for consistancy and the
   14223                 :             :               consistancy test is returned.
   14224                 :             : */
   14225                 :             : 
   14226                 :    10343434 : extern "C" bool SymbolTable_PutParam (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo, NameKey_Name ParamName, unsigned int ParamType, bool isUnbounded, unsigned int typetok)
   14227                 :             : {
   14228                 :    10343434 :   SymbolTable_PtrToSymbol pSym;
   14229                 :    10343434 :   unsigned int ParSym;
   14230                 :    10343434 :   unsigned int VariableSym;
   14231                 :             : 
   14232                 :    10343434 :   if (SymbolTable_GetProcedureParametersDefined (Sym, kind))
   14233                 :             :     {
   14234                 :             :       /* ParamNo <= NoOfParamAny (Sym)  */
   14235                 :           0 :       M2Error_InternalError ((const char *) "why are we trying to put parameters again", 41);
   14236                 :             :     }
   14237                 :             :   else
   14238                 :             :     {
   14239                 :             :       /* Add a new parameter  */
   14240                 :    10343434 :       NewSym (&ParSym);
   14241                 :    10343434 :       pSym = GetPsym (ParSym);
   14242                 :    10343434 :       pSym->SymbolType = SymbolTable_ParamSym;
   14243                 :    10343434 :       pSym->Param.name = ParamName;
   14244                 :    10343434 :       pSym->Param.Type = ParamType;
   14245                 :    10343434 :       pSym->Param.IsUnbounded = isUnbounded;
   14246                 :    10343434 :       pSym->Param.Scope = Sym;
   14247                 :    10343434 :       pSym->Param.ShadowVar = SymbolTable_NulSym;
   14248                 :    10343434 :       pSym->Param.FullTok = M2LexBuf_MakeVirtual2Tok (tok, typetok);
   14249                 :    10343434 :       pSym->Param.At = tok;
   14250                 :    10343434 :       AddParameter (Sym, kind, ParSym);
   14251                 :             :       /* Only declare a parameter as a local variable if it has not been done before.
   14252                 :             :          It might be declared during the definition module, forward declaration or
   14253                 :             :          proper procedure.  Name mismatches are checked in P2SymBuild.mod.  */
   14254                 :    10343434 :       if ((ParamName != NameKey_NulName) && ((SymbolTable_GetNth (Sym, ParamNo)) == SymbolTable_NulSym))
   14255                 :             :         {
   14256                 :     8162850 :           VariableSym = MakeVariableForParam (tok, ParamName, Sym, kind, ParamNo, ParamType, typetok);
   14257                 :     8162850 :           if (VariableSym == SymbolTable_NulSym)
   14258                 :             :             {
   14259                 :             :               return false;
   14260                 :             :             }
   14261                 :             :           else
   14262                 :             :             {
   14263                 :     8162850 :               pSym = GetPsym (ParSym);
   14264                 :     8162850 :               pSym->Param.ShadowVar = VariableSym;
   14265                 :             :             }
   14266                 :             :         }
   14267                 :    10343434 :       AddProcedureProcTypeParam (tok, Sym, ParamType, isUnbounded, false);
   14268                 :             :     }
   14269                 :    10343434 :   return true;
   14270                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   14271                 :             :   __builtin_unreachable ();
   14272                 :             : }
   14273                 :             : 
   14274                 :             : 
   14275                 :             : /*
   14276                 :             :    PutVarParam - Places a Non VAR parameter ParamName with type
   14277                 :             :                  ParamType into procedure Sym:kind.
   14278                 :             :                  The parameter number is ParamNo.
   14279                 :             :                  If the procedure Sym already has this parameter then
   14280                 :             :                  the parameter is checked for consistancy and the
   14281                 :             :                  consistancy test is returned.
   14282                 :             : */
   14283                 :             : 
   14284                 :      970341 : extern "C" bool SymbolTable_PutVarParam (unsigned int tok, unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo, NameKey_Name ParamName, unsigned int ParamType, bool isUnbounded, unsigned int typetok)
   14285                 :             : {
   14286                 :      970341 :   SymbolTable_PtrToSymbol pSym;
   14287                 :      970341 :   unsigned int ParSym;
   14288                 :      970341 :   unsigned int VariableSym;
   14289                 :             : 
   14290                 :      970341 :   if (SymbolTable_GetProcedureParametersDefined (Sym, kind))
   14291                 :             :     {
   14292                 :           0 :       M2Error_InternalError ((const char *) "why are we trying to put parameters again", 41);
   14293                 :             :     }
   14294                 :             :   else
   14295                 :             :     {
   14296                 :             :       /* Add a new parameter  */
   14297                 :      970341 :       NewSym (&ParSym);
   14298                 :      970341 :       pSym = GetPsym (ParSym);
   14299                 :      970341 :       pSym->SymbolType = SymbolTable_VarParamSym;
   14300                 :      970341 :       pSym->VarParam.name = ParamName;
   14301                 :      970341 :       pSym->VarParam.Type = ParamType;
   14302                 :      970341 :       pSym->VarParam.IsUnbounded = isUnbounded;
   14303                 :      970341 :       pSym->VarParam.Scope = Sym;
   14304                 :      970341 :       pSym->VarParam.ShadowVar = SymbolTable_NulSym;
   14305                 :      970341 :       pSym->VarParam.HeapVar = SymbolTable_NulSym;  /* Will contain a pointer value.  */
   14306                 :      970341 :       pSym->VarParam.FullTok = M2LexBuf_MakeVirtual2Tok (tok, typetok);  /* Will contain a pointer value.  */
   14307                 :      970341 :       pSym->VarParam.At = tok;
   14308                 :      970341 :       AddParameter (Sym, kind, ParSym);
   14309                 :             :       /* Only declare a parameter as a local variable if it has not been done before.
   14310                 :             :          It might be declared during the definition module, forward declaration or
   14311                 :             :          proper procedure.  Name mismatches are checked in P2SymBuild.mod.  */
   14312                 :      970341 :       if ((ParamName != NameKey_NulName) && ((SymbolTable_GetNth (Sym, ParamNo)) == SymbolTable_NulSym))
   14313                 :             :         {
   14314                 :      760713 :           VariableSym = MakeVariableForParam (tok, ParamName, Sym, kind, ParamNo, ParamType, typetok);
   14315                 :      760713 :           if (VariableSym == SymbolTable_NulSym)
   14316                 :             :             {
   14317                 :             :               return false;
   14318                 :             :             }
   14319                 :             :           else
   14320                 :             :             {
   14321                 :      760713 :               pSym = GetPsym (ParSym);
   14322                 :      760713 :               pSym->VarParam.ShadowVar = VariableSym;
   14323                 :             :             }
   14324                 :             :         }
   14325                 :      970341 :       AddProcedureProcTypeParam (tok, Sym, ParamType, isUnbounded, true);
   14326                 :             :     }
   14327                 :      970341 :   return true;
   14328                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   14329                 :             :   __builtin_unreachable ();
   14330                 :             : }
   14331                 :             : 
   14332                 :             : 
   14333                 :             : /*
   14334                 :             :    PutParamName - assigns a name to paramater no of procedure ProcSym:kind.
   14335                 :             : */
   14336                 :             : 
   14337                 :           0 : extern "C" void SymbolTable_PutParamName (unsigned int tok, unsigned int ProcSym, SymbolTable_ProcedureKind kind, unsigned int no, NameKey_Name name, unsigned int ParamType, unsigned int typetok)
   14338                 :             : {
   14339                 :           0 :   SymbolTable_PtrToSymbol pSym;
   14340                 :           0 :   unsigned int ParSym;
   14341                 :             : 
   14342                 :           0 :   pSym = GetPsym (ProcSym);
   14343                 :           0 :   ParSym = SymbolTable_NulSym;
   14344                 :           0 :   switch (pSym->SymbolType)
   14345                 :             :     {
   14346                 :             :       case SymbolTable_ErrorSym:
   14347                 :             :         return;
   14348                 :           0 :         break;
   14349                 :             : 
   14350                 :           0 :       case SymbolTable_ProcedureSym:
   14351                 :           0 :         ParSym = static_cast<unsigned int> (Lists_GetItemFromList (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam, no));
   14352                 :           0 :         break;
   14353                 :             : 
   14354                 :           0 :       case SymbolTable_ProcTypeSym:
   14355                 :           0 :         ParSym = static_cast<unsigned int> (Lists_GetItemFromList (pSym->ProcType.ListOfParam, no));
   14356                 :           0 :         break;
   14357                 :             : 
   14358                 :             : 
   14359                 :           0 :       default:
   14360                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   14361                 :           0 :         break;
   14362                 :             :     }
   14363                 :           0 :   pSym = GetPsym (ParSym);
   14364                 :           0 :   switch (pSym->SymbolType)
   14365                 :             :     {
   14366                 :           0 :       case SymbolTable_ParamSym:
   14367                 :           0 :         if (pSym->Param.name == NameKey_NulName)
   14368                 :             :           {
   14369                 :           0 :             pSym->Param.name = name;
   14370                 :           0 :             pSym->Param.ShadowVar = MakeVariableForParam (tok, name, ProcSym, kind, no, ParamType, typetok);
   14371                 :             :           }
   14372                 :             :         else
   14373                 :             :           {
   14374                 :           0 :             M2Error_InternalError ((const char *) "name of parameter has already been assigned", 43);
   14375                 :             :           }
   14376                 :           0 :         break;
   14377                 :             : 
   14378                 :           0 :       case SymbolTable_VarParamSym:
   14379                 :           0 :         if (pSym->VarParam.name == NameKey_NulName)
   14380                 :             :           {
   14381                 :           0 :             pSym->VarParam.name = name;
   14382                 :           0 :             pSym->VarParam.ShadowVar = MakeVariableForParam (tok, name, ProcSym, kind, no, ParamType, typetok);
   14383                 :             :           }
   14384                 :             :         else
   14385                 :             :           {
   14386                 :           0 :             M2Error_InternalError ((const char *) "name of parameter has already been assigned", 43);
   14387                 :             :           }
   14388                 :           0 :         break;
   14389                 :             : 
   14390                 :             : 
   14391                 :           0 :       default:
   14392                 :           0 :         M2Error_InternalError ((const char *) "expecting a VarParam or Param symbol", 36);
   14393                 :           0 :         break;
   14394                 :             :     }
   14395                 :             : }
   14396                 :             : 
   14397                 :             : 
   14398                 :             : /*
   14399                 :             :    PutProcedureReachable - Sets the procedure, Sym, to be reachable by the
   14400                 :             :                            main Module.
   14401                 :             : */
   14402                 :             : 
   14403                 :       71080 : extern "C" void SymbolTable_PutProcedureReachable (unsigned int Sym)
   14404                 :             : {
   14405                 :       71080 :   SymbolTable_PtrToSymbol pSym;
   14406                 :             : 
   14407                 :       71080 :   pSym = GetPsym (Sym);
   14408                 :       71080 :   switch (pSym->SymbolType)
   14409                 :             :     {
   14410                 :             :       case SymbolTable_ErrorSym:
   14411                 :             :         break;
   14412                 :             : 
   14413                 :       71080 :       case SymbolTable_ProcedureSym:
   14414                 :       71080 :         pSym->Procedure.Reachable = true;
   14415                 :       71080 :         break;
   14416                 :             : 
   14417                 :             : 
   14418                 :           0 :       default:
   14419                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure symbol", 26);
   14420                 :       71080 :         break;
   14421                 :             :     }
   14422                 :       71080 : }
   14423                 :             : 
   14424                 :             : 
   14425                 :             : /*
   14426                 :             :    IsProcedureReachable - Returns true if the procedure, Sym, is
   14427                 :             :                           reachable from the main Module.
   14428                 :             : */
   14429                 :             : 
   14430                 :      243988 : extern "C" bool SymbolTable_IsProcedureReachable (unsigned int Sym)
   14431                 :             : {
   14432                 :      243988 :   SymbolTable_PtrToSymbol pSym;
   14433                 :             : 
   14434                 :      243988 :   pSym = GetPsym (Sym);
   14435                 :      243988 :   switch (pSym->SymbolType)
   14436                 :             :     {
   14437                 :      243988 :       case SymbolTable_ProcedureSym:
   14438                 :      243988 :         return pSym->Procedure.Reachable;
   14439                 :           0 :         break;
   14440                 :             : 
   14441                 :             : 
   14442                 :           0 :       default:
   14443                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure symbol", 26);
   14444                 :             :         break;
   14445                 :             :     }
   14446                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14447                 :             :   __builtin_unreachable ();
   14448                 :             : }
   14449                 :             : 
   14450                 :             : 
   14451                 :             : /*
   14452                 :             :    PutProcedureNoReturn - places value into the no return attribute
   14453                 :             :                           field of procedure sym.
   14454                 :             : */
   14455                 :             : 
   14456                 :      501004 : extern "C" void SymbolTable_PutProcedureNoReturn (unsigned int Sym, SymbolTable_ProcedureKind kind, bool value)
   14457                 :             : {
   14458                 :      501004 :   SymbolTable_PtrToSymbol pSym;
   14459                 :             : 
   14460                 :      501004 :   pSym = GetPsym (Sym);
   14461                 :      501004 :   switch (pSym->SymbolType)
   14462                 :             :     {
   14463                 :      501004 :       case SymbolTable_ProcedureSym:
   14464                 :      501004 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].IsNoReturn = value;
   14465                 :      501004 :         break;
   14466                 :             : 
   14467                 :             : 
   14468                 :           0 :       default:
   14469                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   14470                 :      501004 :         break;
   14471                 :             :     }
   14472                 :      501004 : }
   14473                 :             : 
   14474                 :             : 
   14475                 :             : /*
   14476                 :             :    IsProcedureNoReturn - returns TRUE if this procedure never returns.
   14477                 :             : */
   14478                 :             : 
   14479                 :     3315631 : extern "C" bool SymbolTable_IsProcedureNoReturn (unsigned int Sym, SymbolTable_ProcedureKind kind)
   14480                 :             : {
   14481                 :     3315631 :   SymbolTable_PtrToSymbol pSym;
   14482                 :             : 
   14483                 :     3315631 :   pSym = GetPsym (Sym);
   14484                 :     3315631 :   switch (pSym->SymbolType)
   14485                 :             :     {
   14486                 :     3315631 :       case SymbolTable_ProcedureSym:
   14487                 :     3315631 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].IsNoReturn;
   14488                 :           0 :         break;
   14489                 :             : 
   14490                 :             : 
   14491                 :           0 :       default:
   14492                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   14493                 :             :         break;
   14494                 :             :     }
   14495                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14496                 :             :   __builtin_unreachable ();
   14497                 :             : }
   14498                 :             : 
   14499                 :             : 
   14500                 :             : /*
   14501                 :             :    GetProcedureProcType - returns the proctype matching procedure sym.
   14502                 :             : */
   14503                 :             : 
   14504                 :      760278 : extern "C" unsigned int SymbolTable_GetProcedureProcType (unsigned int sym)
   14505                 :             : {
   14506                 :      760278 :   SymbolTable_PtrToSymbol pSym;
   14507                 :             : 
   14508                 :      760278 :   pSym = GetPsym (sym);
   14509                 :      760278 :   switch (pSym->SymbolType)
   14510                 :             :     {
   14511                 :      760278 :       case SymbolTable_ProcedureSym:
   14512                 :      760278 :         return pSym->Procedure.ProcedureType;
   14513                 :           0 :         break;
   14514                 :             : 
   14515                 :             : 
   14516                 :           0 :       default:
   14517                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure symbol", 26);
   14518                 :             :         break;
   14519                 :             :     }
   14520                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14521                 :             :   __builtin_unreachable ();
   14522                 :             : }
   14523                 :             : 
   14524                 :             : 
   14525                 :             : /*
   14526                 :             :    PutModuleStartQuad - Places QuadNumber into the Module symbol, Sym.
   14527                 :             :                         QuadNumber is the start quad of Module,
   14528                 :             :                         Sym.
   14529                 :             : */
   14530                 :             : 
   14531                 :       83097 : extern "C" void SymbolTable_PutModuleStartQuad (unsigned int Sym, unsigned int QuadNumber)
   14532                 :             : {
   14533                 :       83097 :   SymbolTable_PtrToSymbol pSym;
   14534                 :             : 
   14535                 :       83097 :   pSym = GetPsym (Sym);
   14536                 :       83097 :   switch (pSym->SymbolType)
   14537                 :             :     {
   14538                 :       11922 :       case SymbolTable_ModuleSym:
   14539                 :       11922 :         pSym->Module.StartQuad = QuadNumber;
   14540                 :       11922 :         break;
   14541                 :             : 
   14542                 :       71175 :       case SymbolTable_DefImpSym:
   14543                 :       71175 :         pSym->DefImp.StartQuad = QuadNumber;
   14544                 :       71175 :         break;
   14545                 :             : 
   14546                 :             : 
   14547                 :           0 :       default:
   14548                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14549                 :       83097 :         break;
   14550                 :             :     }
   14551                 :       83097 : }
   14552                 :             : 
   14553                 :             : 
   14554                 :             : /*
   14555                 :             :    PutModuleEndQuad - Places QuadNumber into the Module symbol, Sym.
   14556                 :             :                       QuadNumber is the end quad of Module,
   14557                 :             :                       Sym.
   14558                 :             : */
   14559                 :             : 
   14560                 :       82952 : extern "C" void SymbolTable_PutModuleEndQuad (unsigned int Sym, unsigned int QuadNumber)
   14561                 :             : {
   14562                 :       82952 :   SymbolTable_PtrToSymbol pSym;
   14563                 :             : 
   14564                 :       82952 :   pSym = GetPsym (Sym);
   14565                 :       82952 :   switch (pSym->SymbolType)
   14566                 :             :     {
   14567                 :       11777 :       case SymbolTable_ModuleSym:
   14568                 :       11777 :         pSym->Module.EndQuad = QuadNumber;
   14569                 :       11777 :         break;
   14570                 :             : 
   14571                 :       71175 :       case SymbolTable_DefImpSym:
   14572                 :       71175 :         pSym->DefImp.EndQuad = QuadNumber;
   14573                 :       71175 :         break;
   14574                 :             : 
   14575                 :             : 
   14576                 :           0 :       default:
   14577                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14578                 :       82952 :         break;
   14579                 :             :     }
   14580                 :       82952 : }
   14581                 :             : 
   14582                 :             : 
   14583                 :             : /*
   14584                 :             :    PutModuleFinallyStartQuad - Places QuadNumber into the Module symbol, Sym.
   14585                 :             :                                QuadNumber is the finally start quad of
   14586                 :             :                                Module, Sym.
   14587                 :             : */
   14588                 :             : 
   14589                 :       15872 : extern "C" void SymbolTable_PutModuleFinallyStartQuad (unsigned int Sym, unsigned int QuadNumber)
   14590                 :             : {
   14591                 :       15872 :   SymbolTable_PtrToSymbol pSym;
   14592                 :             : 
   14593                 :       15872 :   pSym = GetPsym (Sym);
   14594                 :       15872 :   switch (pSym->SymbolType)
   14595                 :             :     {
   14596                 :       11771 :       case SymbolTable_ModuleSym:
   14597                 :       11771 :         pSym->Module.StartFinishQuad = QuadNumber;
   14598                 :       11771 :         break;
   14599                 :             : 
   14600                 :        4101 :       case SymbolTable_DefImpSym:
   14601                 :        4101 :         pSym->DefImp.StartFinishQuad = QuadNumber;
   14602                 :        4101 :         break;
   14603                 :             : 
   14604                 :             : 
   14605                 :           0 :       default:
   14606                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14607                 :       15872 :         break;
   14608                 :             :     }
   14609                 :       15872 : }
   14610                 :             : 
   14611                 :             : 
   14612                 :             : /*
   14613                 :             :    PutModuleFinallyEndQuad - Places QuadNumber into the Module symbol, Sym.
   14614                 :             :                              QuadNumber is the end quad of the finally block
   14615                 :             :                              in Module, Sym.
   14616                 :             : */
   14617                 :             : 
   14618                 :       15872 : extern "C" void SymbolTable_PutModuleFinallyEndQuad (unsigned int Sym, unsigned int QuadNumber)
   14619                 :             : {
   14620                 :       15872 :   SymbolTable_PtrToSymbol pSym;
   14621                 :             : 
   14622                 :       15872 :   pSym = GetPsym (Sym);
   14623                 :       15872 :   switch (pSym->SymbolType)
   14624                 :             :     {
   14625                 :       11771 :       case SymbolTable_ModuleSym:
   14626                 :       11771 :         pSym->Module.EndFinishQuad = QuadNumber;
   14627                 :       11771 :         break;
   14628                 :             : 
   14629                 :        4101 :       case SymbolTable_DefImpSym:
   14630                 :        4101 :         pSym->DefImp.EndFinishQuad = QuadNumber;
   14631                 :        4101 :         break;
   14632                 :             : 
   14633                 :             : 
   14634                 :           0 :       default:
   14635                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14636                 :       15872 :         break;
   14637                 :             :     }
   14638                 :       15872 : }
   14639                 :             : 
   14640                 :             : 
   14641                 :             : /*
   14642                 :             :    GetModuleQuads - Returns, StartInit EndInit StartFinish EndFinish,
   14643                 :             :                     Quads of a Module, Sym.
   14644                 :             :                     Start and End represent the initialization code
   14645                 :             :                     of the Module, Sym.
   14646                 :             : */
   14647                 :             : 
   14648                 :           0 : extern "C" void SymbolTable_GetModuleQuads (unsigned int Sym, unsigned int *StartInit, unsigned int *EndInit, unsigned int *StartFinish, unsigned int *EndFinish)
   14649                 :             : {
   14650                 :           0 :   SymbolTable_PtrToSymbol pSym;
   14651                 :             : 
   14652                 :           0 :   pSym = GetPsym (Sym);
   14653                 :           0 :   switch (pSym->SymbolType)
   14654                 :             :     {
   14655                 :           0 :       case SymbolTable_ModuleSym:
   14656                 :           0 :         (*StartInit) = pSym->Module.StartQuad;
   14657                 :           0 :         (*EndInit) = pSym->Module.EndQuad;
   14658                 :           0 :         (*StartFinish) = pSym->Module.StartFinishQuad;
   14659                 :           0 :         (*EndFinish) = pSym->Module.EndFinishQuad;
   14660                 :           0 :         break;
   14661                 :             : 
   14662                 :           0 :       case SymbolTable_DefImpSym:
   14663                 :           0 :         (*StartInit) = pSym->DefImp.StartQuad;
   14664                 :           0 :         (*EndInit) = pSym->DefImp.EndQuad;
   14665                 :           0 :         (*StartFinish) = pSym->DefImp.StartFinishQuad;
   14666                 :           0 :         (*EndFinish) = pSym->DefImp.EndFinishQuad;
   14667                 :           0 :         break;
   14668                 :             : 
   14669                 :             : 
   14670                 :           0 :       default:
   14671                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14672                 :           0 :         break;
   14673                 :             :     }
   14674                 :           0 : }
   14675                 :             : 
   14676                 :             : 
   14677                 :             : /*
   14678                 :             :    PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
   14679                 :             : */
   14680                 :             : 
   14681                 :           0 : extern "C" void SymbolTable_PutModuleFinallyFunction (unsigned int Sym, tree finally)
   14682                 :             : {
   14683                 :           0 :   SymbolTable_PtrToSymbol pSym;
   14684                 :             : 
   14685                 :           0 :   pSym = GetPsym (Sym);
   14686                 :           0 :   switch (pSym->SymbolType)
   14687                 :             :     {
   14688                 :           0 :       case SymbolTable_ModuleSym:
   14689                 :           0 :         pSym->Module.FinallyFunction = finally;
   14690                 :           0 :         break;
   14691                 :             : 
   14692                 :           0 :       case SymbolTable_DefImpSym:
   14693                 :           0 :         pSym->DefImp.FinallyFunction = finally;
   14694                 :           0 :         break;
   14695                 :             : 
   14696                 :             : 
   14697                 :           0 :       default:
   14698                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14699                 :           0 :         break;
   14700                 :             :     }
   14701                 :           0 : }
   14702                 :             : 
   14703                 :             : 
   14704                 :             : /*
   14705                 :             :    GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
   14706                 :             : */
   14707                 :             : 
   14708                 :           0 : extern "C" tree SymbolTable_GetModuleFinallyFunction (unsigned int Sym)
   14709                 :             : {
   14710                 :           0 :   SymbolTable_PtrToSymbol pSym;
   14711                 :             : 
   14712                 :           0 :   pSym = GetPsym (Sym);
   14713                 :           0 :   switch (pSym->SymbolType)
   14714                 :             :     {
   14715                 :           0 :       case SymbolTable_ModuleSym:
   14716                 :           0 :         return pSym->Module.FinallyFunction;
   14717                 :           0 :         break;
   14718                 :             : 
   14719                 :           0 :       case SymbolTable_DefImpSym:
   14720                 :           0 :         return pSym->DefImp.FinallyFunction;
   14721                 :           0 :         break;
   14722                 :             : 
   14723                 :             : 
   14724                 :           0 :       default:
   14725                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   14726                 :             :         break;
   14727                 :             :     }
   14728                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   14729                 :             :   __builtin_unreachable ();
   14730                 :             : }
   14731                 :             : 
   14732                 :             : 
   14733                 :             : /*
   14734                 :             :    PutProcedureScopeQuad - Places QuadNumber into the Procedure symbol, Sym.
   14735                 :             :                            QuadNumber is the start quad of scope for procedure,
   14736                 :             :                            Sym.
   14737                 :             : */
   14738                 :             : 
   14739                 :       80970 : extern "C" void SymbolTable_PutProcedureScopeQuad (unsigned int Sym, unsigned int QuadNumber)
   14740                 :             : {
   14741                 :       80970 :   SymbolTable_PtrToSymbol pSym;
   14742                 :             : 
   14743                 :       80970 :   pSym = GetPsym (Sym);
   14744                 :       80970 :   switch (pSym->SymbolType)
   14745                 :             :     {
   14746                 :       80970 :       case SymbolTable_ProcedureSym:
   14747                 :       80970 :         pSym->Procedure.ScopeQuad = QuadNumber;
   14748                 :       80970 :         break;
   14749                 :             : 
   14750                 :             : 
   14751                 :           0 :       default:
   14752                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   14753                 :       80970 :         break;
   14754                 :             :     }
   14755                 :       80970 : }
   14756                 :             : 
   14757                 :             : 
   14758                 :             : /*
   14759                 :             :    PutProcedureStartQuad - Places QuadNumber into the Procedure symbol, Sym.
   14760                 :             :                            QuadNumber is the start quad of procedure,
   14761                 :             :                            Sym.
   14762                 :             : */
   14763                 :             : 
   14764                 :       80958 : extern "C" void SymbolTable_PutProcedureStartQuad (unsigned int Sym, unsigned int QuadNumber)
   14765                 :             : {
   14766                 :       80958 :   SymbolTable_PtrToSymbol pSym;
   14767                 :             : 
   14768                 :       80958 :   pSym = GetPsym (Sym);
   14769                 :       80958 :   switch (pSym->SymbolType)
   14770                 :             :     {
   14771                 :       80958 :       case SymbolTable_ProcedureSym:
   14772                 :       80958 :         pSym->Procedure.StartQuad = QuadNumber;
   14773                 :       80958 :         break;
   14774                 :             : 
   14775                 :             : 
   14776                 :           0 :       default:
   14777                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   14778                 :       80958 :         break;
   14779                 :             :     }
   14780                 :       80958 : }
   14781                 :             : 
   14782                 :             : 
   14783                 :             : /*
   14784                 :             :    PutProcedureEndQuad - Places QuadNumber into the Procedure symbol, Sym.
   14785                 :             :                          QuadNumber is the end quad of procedure,
   14786                 :             :                          Sym.
   14787                 :             : */
   14788                 :             : 
   14789                 :       80928 : extern "C" void SymbolTable_PutProcedureEndQuad (unsigned int Sym, unsigned int QuadNumber)
   14790                 :             : {
   14791                 :       80928 :   SymbolTable_PtrToSymbol pSym;
   14792                 :             : 
   14793                 :       80928 :   pSym = GetPsym (Sym);
   14794                 :       80928 :   switch (pSym->SymbolType)
   14795                 :             :     {
   14796                 :       80928 :       case SymbolTable_ProcedureSym:
   14797                 :       80928 :         pSym->Procedure.EndQuad = QuadNumber;
   14798                 :       80928 :         break;
   14799                 :             : 
   14800                 :             : 
   14801                 :           0 :       default:
   14802                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   14803                 :       80928 :         break;
   14804                 :             :     }
   14805                 :       80928 : }
   14806                 :             : 
   14807                 :             : 
   14808                 :             : /*
   14809                 :             :    GetProcedureQuads - Returns, Start and End, Quads of a procedure, Sym.
   14810                 :             : */
   14811                 :             : 
   14812                 :      703915 : extern "C" void SymbolTable_GetProcedureQuads (unsigned int Sym, unsigned int *scope, unsigned int *start, unsigned int *end)
   14813                 :             : {
   14814                 :      703915 :   SymbolTable_PtrToSymbol pSym;
   14815                 :             : 
   14816                 :      703915 :   pSym = GetPsym (Sym);
   14817                 :      703915 :   switch (pSym->SymbolType)
   14818                 :             :     {
   14819                 :      703915 :       case SymbolTable_ProcedureSym:
   14820                 :      703915 :         (*scope) = pSym->Procedure.ScopeQuad;
   14821                 :      703915 :         (*start) = pSym->Procedure.StartQuad;
   14822                 :      703915 :         (*end) = pSym->Procedure.EndQuad;
   14823                 :      703915 :         break;
   14824                 :             : 
   14825                 :             : 
   14826                 :           0 :       default:
   14827                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   14828                 :      703915 :         break;
   14829                 :             :     }
   14830                 :      703915 : }
   14831                 :             : 
   14832                 :             : 
   14833                 :             : /*
   14834                 :             :    GetQuads - assigns Start and End to the beginning and end of
   14835                 :             :               symbol, Sym, usage.
   14836                 :             : */
   14837                 :             : 
   14838                 :           0 : extern "C" void SymbolTable_GetQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End)
   14839                 :             : {
   14840                 :           0 :   unsigned int StartRead;
   14841                 :           0 :   unsigned int EndRead;
   14842                 :           0 :   unsigned int StartWrite;
   14843                 :           0 :   unsigned int EndWrite;
   14844                 :             : 
   14845                 :           0 :   SymbolTable_GetReadQuads (Sym, m, &StartRead, &EndRead);
   14846                 :           0 :   SymbolTable_GetWriteQuads (Sym, m, &StartWrite, &EndWrite);
   14847                 :           0 :   if (StartRead == 0)
   14848                 :             :     {
   14849                 :           0 :       (*Start) = StartWrite;
   14850                 :             :     }
   14851                 :           0 :   else if (StartWrite == 0)
   14852                 :             :     {
   14853                 :             :       /* avoid dangling else.  */
   14854                 :           0 :       (*Start) = StartRead;
   14855                 :             :     }
   14856                 :             :   else
   14857                 :             :     {
   14858                 :             :       /* avoid dangling else.  */
   14859                 :           0 :       (*Start) = Min (StartRead, StartWrite);
   14860                 :             :     }
   14861                 :           0 :   if (EndRead == 0)
   14862                 :             :     {
   14863                 :           0 :       (*End) = EndWrite;
   14864                 :             :     }
   14865                 :           0 :   else if (EndWrite == 0)
   14866                 :             :     {
   14867                 :             :       /* avoid dangling else.  */
   14868                 :           0 :       (*End) = EndRead;
   14869                 :             :     }
   14870                 :             :   else
   14871                 :             :     {
   14872                 :             :       /* avoid dangling else.  */
   14873                 :           0 :       (*End) = Max (EndRead, EndWrite);
   14874                 :             :     }
   14875                 :           0 : }
   14876                 :             : 
   14877                 :             : 
   14878                 :             : /*
   14879                 :             :    GetReadQuads - assigns Start and End to the beginning and end of
   14880                 :             :                   symbol, Sym, read history usage.
   14881                 :             : */
   14882                 :             : 
   14883                 :           0 : extern "C" void SymbolTable_GetReadQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End)
   14884                 :             : {
   14885                 :           0 :   SymbolTable_GetReadLimitQuads (Sym, m, 0, 0, Start, End);
   14886                 :           0 : }
   14887                 :             : 
   14888                 :             : 
   14889                 :             : /*
   14890                 :             :    GetWriteQuads - assigns Start and End to the beginning and end of
   14891                 :             :                    symbol, Sym, usage.
   14892                 :             : */
   14893                 :             : 
   14894                 :           0 : extern "C" void SymbolTable_GetWriteQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int *Start, unsigned int *End)
   14895                 :             : {
   14896                 :           0 :   SymbolTable_GetWriteLimitQuads (Sym, m, 0, 0, Start, End);
   14897                 :           0 : }
   14898                 :             : 
   14899                 :             : 
   14900                 :             : /*
   14901                 :             :    PutReadQuad - places Quad into the list of symbol usage.
   14902                 :             : */
   14903                 :             : 
   14904                 :     1632774 : extern "C" void SymbolTable_PutReadQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad)
   14905                 :             : {
   14906                 :     1632774 :   SymbolTable_PtrToSymbol pSym;
   14907                 :             : 
   14908                 :     1632774 :   pSym = GetPsym (Sym);
   14909                 :     1632774 :   switch (pSym->SymbolType)
   14910                 :             :     {
   14911                 :     1632774 :       case SymbolTable_VarSym:
   14912                 :     1632774 :         Lists_IncludeItemIntoList (static_cast<Lists_List> (pSym->Var.ReadUsageList.array[m-SymbolTable_RightValue]), Quad);
   14913                 :     1632774 :         break;
   14914                 :             : 
   14915                 :             : 
   14916                 :           0 :       default:
   14917                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   14918                 :     1632774 :         break;
   14919                 :             :     }
   14920                 :     1632774 : }
   14921                 :             : 
   14922                 :             : 
   14923                 :             : /*
   14924                 :             :    RemoveReadQuad - places Quad into the list of symbol usage.
   14925                 :             : */
   14926                 :             : 
   14927                 :      135552 : extern "C" void SymbolTable_RemoveReadQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad)
   14928                 :             : {
   14929                 :      135552 :   SymbolTable_PtrToSymbol pSym;
   14930                 :             : 
   14931                 :      135552 :   pSym = GetPsym (Sym);
   14932                 :      135552 :   switch (pSym->SymbolType)
   14933                 :             :     {
   14934                 :      135552 :       case SymbolTable_VarSym:
   14935                 :      135552 :         Lists_RemoveItemFromList (static_cast<Lists_List> (pSym->Var.ReadUsageList.array[m-SymbolTable_RightValue]), Quad);
   14936                 :      135552 :         break;
   14937                 :             : 
   14938                 :             : 
   14939                 :           0 :       default:
   14940                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   14941                 :      135552 :         break;
   14942                 :             :     }
   14943                 :      135552 : }
   14944                 :             : 
   14945                 :             : 
   14946                 :             : /*
   14947                 :             :    PutWriteQuad - places Quad into the list of symbol usage.
   14948                 :             : */
   14949                 :             : 
   14950                 :     1061766 : extern "C" void SymbolTable_PutWriteQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad)
   14951                 :             : {
   14952                 :     1061766 :   SymbolTable_PtrToSymbol pSym;
   14953                 :             : 
   14954                 :     1061766 :   pSym = GetPsym (Sym);
   14955                 :     1061766 :   switch (pSym->SymbolType)
   14956                 :             :     {
   14957                 :     1061766 :       case SymbolTable_VarSym:
   14958                 :     1061766 :         Lists_IncludeItemIntoList (static_cast<Lists_List> (pSym->Var.WriteUsageList.array[m-SymbolTable_RightValue]), Quad);
   14959                 :     1061766 :         break;
   14960                 :             : 
   14961                 :             : 
   14962                 :           0 :       default:
   14963                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   14964                 :     1061766 :         break;
   14965                 :             :     }
   14966                 :     1061766 : }
   14967                 :             : 
   14968                 :             : 
   14969                 :             : /*
   14970                 :             :    RemoveWriteQuad - places Quad into the list of symbol usage.
   14971                 :             : */
   14972                 :             : 
   14973                 :      218047 : extern "C" void SymbolTable_RemoveWriteQuad (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int Quad)
   14974                 :             : {
   14975                 :      218047 :   SymbolTable_PtrToSymbol pSym;
   14976                 :             : 
   14977                 :      218047 :   pSym = GetPsym (Sym);
   14978                 :      218047 :   switch (pSym->SymbolType)
   14979                 :             :     {
   14980                 :      218047 :       case SymbolTable_VarSym:
   14981                 :      218047 :         Lists_RemoveItemFromList (static_cast<Lists_List> (pSym->Var.WriteUsageList.array[m-SymbolTable_RightValue]), Quad);
   14982                 :      218047 :         break;
   14983                 :             : 
   14984                 :             : 
   14985                 :           0 :       default:
   14986                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   14987                 :      218047 :         break;
   14988                 :             :     }
   14989                 :      218047 : }
   14990                 :             : 
   14991                 :             : 
   14992                 :             : /*
   14993                 :             :    GetReadLimitQuads - returns Start and End which have been assigned
   14994                 :             :                        the start and end of when the symbol was read
   14995                 :             :                        to within: StartLimit..EndLimit.
   14996                 :             : */
   14997                 :             : 
   14998                 :           0 : extern "C" void SymbolTable_GetReadLimitQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End)
   14999                 :             : {
   15000                 :           0 :   SymbolTable_PtrToSymbol pSym;
   15001                 :             : 
   15002                 :           0 :   pSym = GetPsym (Sym);
   15003                 :           0 :   switch (pSym->SymbolType)
   15004                 :             :     {
   15005                 :           0 :       case SymbolTable_VarSym:
   15006                 :           0 :         DoFindLimits (StartLimit, EndLimit, Start, End, static_cast<Lists_List> (pSym->Var.ReadUsageList.array[m-SymbolTable_RightValue]));
   15007                 :           0 :         break;
   15008                 :             : 
   15009                 :             : 
   15010                 :           0 :       default:
   15011                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   15012                 :           0 :         break;
   15013                 :             :     }
   15014                 :           0 : }
   15015                 :             : 
   15016                 :             : 
   15017                 :             : /*
   15018                 :             :    GetWriteLimitQuads - returns Start and End which have been assigned
   15019                 :             :                         the start and end of when the symbol was written
   15020                 :             :                         to within: StartLimit..EndLimit.
   15021                 :             : */
   15022                 :             : 
   15023                 :          30 : extern "C" void SymbolTable_GetWriteLimitQuads (unsigned int Sym, SymbolTable_ModeOfAddr m, unsigned int StartLimit, unsigned int EndLimit, unsigned int *Start, unsigned int *End)
   15024                 :             : {
   15025                 :          30 :   SymbolTable_PtrToSymbol pSym;
   15026                 :             : 
   15027                 :          30 :   pSym = GetPsym (Sym);
   15028                 :          30 :   switch (pSym->SymbolType)
   15029                 :             :     {
   15030                 :          30 :       case SymbolTable_VarSym:
   15031                 :          30 :         DoFindLimits (StartLimit, EndLimit, Start, End, static_cast<Lists_List> (pSym->Var.WriteUsageList.array[m-SymbolTable_RightValue]));
   15032                 :          30 :         break;
   15033                 :             : 
   15034                 :             : 
   15035                 :           0 :       default:
   15036                 :           0 :         M2Error_InternalError ((const char *) "expecting a Var symbol", 22);
   15037                 :          30 :         break;
   15038                 :             :     }
   15039                 :          30 : }
   15040                 :             : 
   15041                 :             : 
   15042                 :             : /*
   15043                 :             :    GetNthProcedure - Returns the Nth procedure in Module, Sym.
   15044                 :             : */
   15045                 :             : 
   15046                 :       12472 : extern "C" unsigned int SymbolTable_GetNthProcedure (unsigned int Sym, unsigned int n)
   15047                 :             : {
   15048                 :       12472 :   SymbolTable_PtrToSymbol pSym;
   15049                 :             : 
   15050                 :       12472 :   pSym = GetPsym (Sym);
   15051                 :       12472 :   switch (pSym->SymbolType)
   15052                 :             :     {
   15053                 :       12472 :       case SymbolTable_DefImpSym:
   15054                 :       12472 :         return static_cast<unsigned int> (Lists_GetItemFromList (pSym->DefImp.ListOfProcs, n));
   15055                 :           0 :         break;
   15056                 :             : 
   15057                 :           0 :       case SymbolTable_ModuleSym:
   15058                 :           0 :         return static_cast<unsigned int> (Lists_GetItemFromList (pSym->Module.ListOfProcs, n));
   15059                 :           0 :         break;
   15060                 :             : 
   15061                 :             : 
   15062                 :           0 :       default:
   15063                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   15064                 :             :         break;
   15065                 :             :     }
   15066                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15067                 :             :   __builtin_unreachable ();
   15068                 :             : }
   15069                 :             : 
   15070                 :             : 
   15071                 :             : /*
   15072                 :             :    GetDeclaredDef - returns the tokenno where the symbol was declared
   15073                 :             :                     in the definition module.  UnknownTokenNo is returned
   15074                 :             :                     if no declaration occurred.
   15075                 :             : */
   15076                 :             : 
   15077                 :          36 : extern "C" unsigned int SymbolTable_GetDeclaredDef (unsigned int Sym)
   15078                 :             : {
   15079                 :          36 :   return SymbolTable_GetDeclaredDefinition (Sym);
   15080                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15081                 :             :   __builtin_unreachable ();
   15082                 :             : }
   15083                 :             : 
   15084                 :             : 
   15085                 :             : /*
   15086                 :             :    GetDeclaredMod - returns the tokenno where the symbol was declared.
   15087                 :             :                     in the program or implementation module.
   15088                 :             :                     UnknownTokenNo is returned if no declaration occurred.
   15089                 :             : */
   15090                 :             : 
   15091                 :    35415467 : extern "C" unsigned int SymbolTable_GetDeclaredMod (unsigned int Sym)
   15092                 :             : {
   15093                 :    35415467 :   return SymbolTable_GetDeclaredModule (Sym);
   15094                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15095                 :             :   __builtin_unreachable ();
   15096                 :             : }
   15097                 :             : 
   15098                 :             : 
   15099                 :             : /*
   15100                 :             :    GetDeclaredFor - returns the token where this forward procedure symbol
   15101                 :             :                     was declared in the program or implementation module.
   15102                 :             :                     UnknownTokenNo is returned if no declaration occurred.
   15103                 :             : */
   15104                 :             : 
   15105                 :           0 : extern "C" unsigned int SymbolTable_GetDeclaredFor (unsigned int Sym)
   15106                 :             : {
   15107                 :           0 :   if (SymbolTable_IsProcedure (Sym))
   15108                 :             :     {
   15109                 :           0 :       return SymbolTable_GetProcedureDeclaredTok (Sym, SymbolTable_ForwardProcedure);
   15110                 :             :     }
   15111                 :             :   else
   15112                 :             :     {
   15113                 :             :       return M2LexBuf_UnknownTokenNo;
   15114                 :             :     }
   15115                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15116                 :             :   __builtin_unreachable ();
   15117                 :             : }
   15118                 :             : 
   15119                 :             : 
   15120                 :             : /*
   15121                 :             :    GetDeclaredDefinition - returns the token where this symbol
   15122                 :             :                            was declared in the definition module.
   15123                 :             : */
   15124                 :             : 
   15125                 :       23185 : extern "C" unsigned int SymbolTable_GetDeclaredDefinition (unsigned int Sym)
   15126                 :             : {
   15127                 :       23185 :   SymbolTable_PtrToSymbol pSym;
   15128                 :             : 
   15129                 :       23185 :   pSym = GetPsym (Sym);
   15130                 :       23185 :   switch (pSym->SymbolType)
   15131                 :             :     {
   15132                 :           0 :       case SymbolTable_ErrorSym:
   15133                 :           0 :         return pSym->Error.At.DefDeclared;
   15134                 :           0 :         break;
   15135                 :             : 
   15136                 :           0 :       case SymbolTable_ObjectSym:
   15137                 :           0 :         return pSym->Object.At.DefDeclared;
   15138                 :           0 :         break;
   15139                 :             : 
   15140                 :           0 :       case SymbolTable_VarientSym:
   15141                 :           0 :         return pSym->Varient.At.DefDeclared;
   15142                 :           6 :         break;
   15143                 :             : 
   15144                 :           6 :       case SymbolTable_RecordSym:
   15145                 :           6 :         return pSym->Record.At.DefDeclared;
   15146                 :           0 :         break;
   15147                 :             : 
   15148                 :           0 :       case SymbolTable_SubrangeSym:
   15149                 :           0 :         return pSym->Subrange.At.DefDeclared;
   15150                 :           0 :         break;
   15151                 :             : 
   15152                 :           0 :       case SymbolTable_EnumerationSym:
   15153                 :           0 :         return pSym->Enumeration.At.DefDeclared;
   15154                 :           0 :         break;
   15155                 :             : 
   15156                 :           0 :       case SymbolTable_ArraySym:
   15157                 :           0 :         return pSym->Array.At.DefDeclared;
   15158                 :           0 :         break;
   15159                 :             : 
   15160                 :           0 :       case SymbolTable_SubscriptSym:
   15161                 :           0 :         return pSym->Subscript.At.DefDeclared;
   15162                 :           0 :         break;
   15163                 :             : 
   15164                 :           0 :       case SymbolTable_UnboundedSym:
   15165                 :           0 :         return pSym->Unbounded.At.DefDeclared;
   15166                 :           0 :         break;
   15167                 :             : 
   15168                 :           0 :       case SymbolTable_ProcedureSym:
   15169                 :           0 :         return pSym->Procedure.At.DefDeclared;
   15170                 :           0 :         break;
   15171                 :             : 
   15172                 :           0 :       case SymbolTable_ProcTypeSym:
   15173                 :           0 :         return pSym->ProcType.At.DefDeclared;
   15174                 :          30 :         break;
   15175                 :             : 
   15176                 :          30 :       case SymbolTable_ParamSym:
   15177                 :          30 :         return pSym->Param.At;
   15178                 :           0 :         break;
   15179                 :             : 
   15180                 :           0 :       case SymbolTable_VarParamSym:
   15181                 :           0 :         return pSym->VarParam.At;
   15182                 :           0 :         break;
   15183                 :             : 
   15184                 :           0 :       case SymbolTable_ConstStringSym:
   15185                 :           0 :         return pSym->ConstString.At.DefDeclared;
   15186                 :           0 :         break;
   15187                 :             : 
   15188                 :           0 :       case SymbolTable_ConstLitSym:
   15189                 :           0 :         return pSym->ConstLit.At.DefDeclared;
   15190                 :           0 :         break;
   15191                 :             : 
   15192                 :           0 :       case SymbolTable_ConstVarSym:
   15193                 :           0 :         return pSym->ConstVar.At.DefDeclared;
   15194                 :           0 :         break;
   15195                 :             : 
   15196                 :           0 :       case SymbolTable_VarSym:
   15197                 :           0 :         return pSym->Var.At.DefDeclared;
   15198                 :           0 :         break;
   15199                 :             : 
   15200                 :           0 :       case SymbolTable_TypeSym:
   15201                 :           0 :         return pSym->Type.At.DefDeclared;
   15202                 :           0 :         break;
   15203                 :             : 
   15204                 :           0 :       case SymbolTable_PointerSym:
   15205                 :           0 :         return pSym->Pointer.At.DefDeclared;
   15206                 :           0 :         break;
   15207                 :             : 
   15208                 :           0 :       case SymbolTable_RecordFieldSym:
   15209                 :           0 :         return pSym->RecordField.At.DefDeclared;
   15210                 :           0 :         break;
   15211                 :             : 
   15212                 :           0 :       case SymbolTable_VarientFieldSym:
   15213                 :           0 :         return pSym->VarientField.At.DefDeclared;
   15214                 :           0 :         break;
   15215                 :             : 
   15216                 :           0 :       case SymbolTable_EnumerationFieldSym:
   15217                 :           0 :         return pSym->EnumerationField.At.DefDeclared;
   15218                 :           0 :         break;
   15219                 :             : 
   15220                 :           0 :       case SymbolTable_SetSym:
   15221                 :           0 :         return pSym->Set.At.DefDeclared;
   15222                 :           0 :         break;
   15223                 :             : 
   15224                 :           0 :       case SymbolTable_DefImpSym:
   15225                 :           0 :         return pSym->DefImp.At.DefDeclared;
   15226                 :           0 :         break;
   15227                 :             : 
   15228                 :           0 :       case SymbolTable_ModuleSym:
   15229                 :           0 :         return pSym->Module.At.DefDeclared;
   15230                 :           0 :         break;
   15231                 :             : 
   15232                 :           0 :       case SymbolTable_UndefinedSym:
   15233                 :           0 :         return SymbolTable_GetFirstUsed (Sym);
   15234                 :       23149 :         break;
   15235                 :             : 
   15236                 :       23149 :       case SymbolTable_ImportSym:
   15237                 :       23149 :         return pSym->Import.at.DefDeclared;
   15238                 :           0 :         break;
   15239                 :             : 
   15240                 :           0 :       case SymbolTable_ImportStatementSym:
   15241                 :           0 :         return pSym->ImportStatement.at.DefDeclared;
   15242                 :           0 :         break;
   15243                 :             : 
   15244                 :           0 :       case SymbolTable_PartialUnboundedSym:
   15245                 :           0 :         return SymbolTable_GetDeclaredDefinition (pSym->PartialUnbounded.Type);
   15246                 :           0 :         break;
   15247                 :             : 
   15248                 :             : 
   15249                 :           0 :       default:
   15250                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type of symbol", 33);
   15251                 :             :         break;
   15252                 :             :     }
   15253                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15254                 :             :   __builtin_unreachable ();
   15255                 :             : }
   15256                 :             : 
   15257                 :             : 
   15258                 :             : /*
   15259                 :             :    GetDeclaredModule - returns the token where this symbol was declared
   15260                 :             :                        in an implementation or program module.
   15261                 :             : */
   15262                 :             : 
   15263                 :    35436686 : extern "C" unsigned int SymbolTable_GetDeclaredModule (unsigned int Sym)
   15264                 :             : {
   15265                 :    35436686 :   SymbolTable_PtrToSymbol pSym;
   15266                 :             : 
   15267                 :    35436686 :   pSym = GetPsym (Sym);
   15268                 :    35436686 :   switch (pSym->SymbolType)
   15269                 :             :     {
   15270                 :           0 :       case SymbolTable_ErrorSym:
   15271                 :           0 :         return pSym->Error.At.ModDeclared;
   15272                 :           0 :         break;
   15273                 :             : 
   15274                 :           0 :       case SymbolTable_ObjectSym:
   15275                 :           0 :         return pSym->Object.At.ModDeclared;
   15276                 :        5964 :         break;
   15277                 :             : 
   15278                 :        5964 :       case SymbolTable_VarientSym:
   15279                 :        5964 :         return pSym->Varient.At.ModDeclared;
   15280                 :      301767 :         break;
   15281                 :             : 
   15282                 :      301767 :       case SymbolTable_RecordSym:
   15283                 :      301767 :         return pSym->Record.At.ModDeclared;
   15284                 :     6183556 :         break;
   15285                 :             : 
   15286                 :     6183556 :       case SymbolTable_SubrangeSym:
   15287                 :     6183556 :         return pSym->Subrange.At.ModDeclared;
   15288                 :       35000 :         break;
   15289                 :             : 
   15290                 :       35000 :       case SymbolTable_EnumerationSym:
   15291                 :       35000 :         return pSym->Enumeration.At.ModDeclared;
   15292                 :      170764 :         break;
   15293                 :             : 
   15294                 :      170764 :       case SymbolTable_ArraySym:
   15295                 :      170764 :         return pSym->Array.At.ModDeclared;
   15296                 :           0 :         break;
   15297                 :             : 
   15298                 :           0 :       case SymbolTable_SubscriptSym:
   15299                 :           0 :         return pSym->Subscript.At.ModDeclared;
   15300                 :       46764 :         break;
   15301                 :             : 
   15302                 :       46764 :       case SymbolTable_UnboundedSym:
   15303                 :       46764 :         return pSym->Unbounded.At.ModDeclared;
   15304                 :     5369003 :         break;
   15305                 :             : 
   15306                 :     5369003 :       case SymbolTable_ProcedureSym:
   15307                 :     5369003 :         return pSym->Procedure.At.ModDeclared;
   15308                 :       58640 :         break;
   15309                 :             : 
   15310                 :       58640 :       case SymbolTable_ProcTypeSym:
   15311                 :       58640 :         return pSym->ProcType.At.ModDeclared;
   15312                 :       76203 :         break;
   15313                 :             : 
   15314                 :       76203 :       case SymbolTable_ParamSym:
   15315                 :       76203 :         return pSym->Param.At;
   15316                 :      540441 :         break;
   15317                 :             : 
   15318                 :      540441 :       case SymbolTable_VarParamSym:
   15319                 :      540441 :         return pSym->VarParam.At;
   15320                 :      973061 :         break;
   15321                 :             : 
   15322                 :      973061 :       case SymbolTable_ConstStringSym:
   15323                 :      973061 :         return pSym->ConstString.At.ModDeclared;
   15324                 :     1271519 :         break;
   15325                 :             : 
   15326                 :     1271519 :       case SymbolTable_ConstLitSym:
   15327                 :     1271519 :         return pSym->ConstLit.At.ModDeclared;
   15328                 :      656116 :         break;
   15329                 :             : 
   15330                 :      656116 :       case SymbolTable_ConstVarSym:
   15331                 :      656116 :         return pSym->ConstVar.At.ModDeclared;
   15332                 :     8269464 :         break;
   15333                 :             : 
   15334                 :     8269464 :       case SymbolTable_VarSym:
   15335                 :     8269464 :         return pSym->Var.At.ModDeclared;
   15336                 :       38417 :         break;
   15337                 :             : 
   15338                 :       38417 :       case SymbolTable_TypeSym:
   15339                 :       38417 :         return pSym->Type.At.ModDeclared;
   15340                 :          12 :         break;
   15341                 :             : 
   15342                 :          12 :       case SymbolTable_PointerSym:
   15343                 :          12 :         return pSym->Pointer.At.ModDeclared;
   15344                 :      405334 :         break;
   15345                 :             : 
   15346                 :      405334 :       case SymbolTable_RecordFieldSym:
   15347                 :      405334 :         return pSym->RecordField.At.ModDeclared;
   15348                 :       12156 :         break;
   15349                 :             : 
   15350                 :       12156 :       case SymbolTable_VarientFieldSym:
   15351                 :       12156 :         return pSym->VarientField.At.ModDeclared;
   15352                 :    10625076 :         break;
   15353                 :             : 
   15354                 :    10625076 :       case SymbolTable_EnumerationFieldSym:
   15355                 :    10625076 :         return pSym->EnumerationField.At.ModDeclared;
   15356                 :      345832 :         break;
   15357                 :             : 
   15358                 :      345832 :       case SymbolTable_SetSym:
   15359                 :      345832 :         return pSym->Set.At.ModDeclared;
   15360                 :        8212 :         break;
   15361                 :             : 
   15362                 :        8212 :       case SymbolTable_DefImpSym:
   15363                 :        8212 :         return pSym->DefImp.At.ModDeclared;
   15364                 :       22172 :         break;
   15365                 :             : 
   15366                 :       22172 :       case SymbolTable_ModuleSym:
   15367                 :       22172 :         return pSym->Module.At.ModDeclared;
   15368                 :           0 :         break;
   15369                 :             : 
   15370                 :           0 :       case SymbolTable_UndefinedSym:
   15371                 :           0 :         return SymbolTable_GetFirstUsed (Sym);
   15372                 :       21213 :         break;
   15373                 :             : 
   15374                 :       21213 :       case SymbolTable_ImportSym:
   15375                 :       21213 :         return pSym->Import.at.ModDeclared;
   15376                 :           0 :         break;
   15377                 :             : 
   15378                 :           0 :       case SymbolTable_ImportStatementSym:
   15379                 :           0 :         return pSym->ImportStatement.at.ModDeclared;
   15380                 :           0 :         break;
   15381                 :             : 
   15382                 :           0 :       case SymbolTable_PartialUnboundedSym:
   15383                 :           0 :         return SymbolTable_GetDeclaredModule (pSym->PartialUnbounded.Type);
   15384                 :           0 :         break;
   15385                 :             : 
   15386                 :             : 
   15387                 :           0 :       default:
   15388                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type of symbol", 33);
   15389                 :             :         break;
   15390                 :             :     }
   15391                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15392                 :             :   __builtin_unreachable ();
   15393                 :             : }
   15394                 :             : 
   15395                 :             : 
   15396                 :             : /*
   15397                 :             :    PutDeclared - adds an entry to symbol, Sym, indicating that it
   15398                 :             :                  was declared at, tok.  This routine
   15399                 :             :                  may be called twice, once for definition module
   15400                 :             :                  partial declaration and once when parsing the
   15401                 :             :                  implementation module.
   15402                 :             : */
   15403                 :             : 
   15404                 :    31586177 : extern "C" void SymbolTable_PutDeclared (unsigned int tok, unsigned int Sym)
   15405                 :             : {
   15406                 :    31586177 :   if (M2Comp_CompilingDefinitionModule ())
   15407                 :             :     {
   15408                 :    18679167 :       PutDeclaredDefinition (tok, Sym);
   15409                 :             :     }
   15410                 :             :   else
   15411                 :             :     {
   15412                 :    12907010 :       PutDeclaredModule (tok, Sym);
   15413                 :             :     }
   15414                 :    31586177 : }
   15415                 :             : 
   15416                 :             : 
   15417                 :             : /*
   15418                 :             :    GetFirstUsed - returns the token where this symbol was first used.
   15419                 :             : */
   15420                 :             : 
   15421                 :         480 : extern "C" unsigned int SymbolTable_GetFirstUsed (unsigned int Sym)
   15422                 :             : {
   15423                 :         480 :   SymbolTable_PtrToSymbol pSym;
   15424                 :             : 
   15425                 :         480 :   pSym = GetPsym (Sym);
   15426                 :         480 :   switch (pSym->SymbolType)
   15427                 :             :     {
   15428                 :           0 :       case SymbolTable_ErrorSym:
   15429                 :           0 :         return pSym->Error.At.FirstUsed;
   15430                 :         168 :         break;
   15431                 :             : 
   15432                 :         168 :       case SymbolTable_ObjectSym:
   15433                 :         168 :         return pSym->Object.At.FirstUsed;
   15434                 :         300 :         break;
   15435                 :             : 
   15436                 :         300 :       case SymbolTable_UndefinedSym:
   15437                 :         300 :         return pSym->Undefined.At.FirstUsed;
   15438                 :           0 :         break;
   15439                 :             : 
   15440                 :           0 :       case SymbolTable_VarientSym:
   15441                 :           0 :         return pSym->Varient.At.FirstUsed;
   15442                 :           0 :         break;
   15443                 :             : 
   15444                 :           0 :       case SymbolTable_RecordSym:
   15445                 :           0 :         return pSym->Record.At.FirstUsed;
   15446                 :           0 :         break;
   15447                 :             : 
   15448                 :           0 :       case SymbolTable_SubrangeSym:
   15449                 :           0 :         return pSym->Subrange.At.FirstUsed;
   15450                 :           0 :         break;
   15451                 :             : 
   15452                 :           0 :       case SymbolTable_EnumerationSym:
   15453                 :           0 :         return pSym->Enumeration.At.FirstUsed;
   15454                 :           0 :         break;
   15455                 :             : 
   15456                 :           0 :       case SymbolTable_ArraySym:
   15457                 :           0 :         return pSym->Array.At.FirstUsed;
   15458                 :           0 :         break;
   15459                 :             : 
   15460                 :           0 :       case SymbolTable_SubscriptSym:
   15461                 :           0 :         return pSym->Subscript.At.FirstUsed;
   15462                 :           0 :         break;
   15463                 :             : 
   15464                 :           0 :       case SymbolTable_UnboundedSym:
   15465                 :           0 :         return pSym->Unbounded.At.FirstUsed;
   15466                 :           0 :         break;
   15467                 :             : 
   15468                 :           0 :       case SymbolTable_ProcedureSym:
   15469                 :           0 :         return pSym->Procedure.At.FirstUsed;
   15470                 :           0 :         break;
   15471                 :             : 
   15472                 :           0 :       case SymbolTable_ProcTypeSym:
   15473                 :           0 :         return pSym->ProcType.At.FirstUsed;
   15474                 :           0 :         break;
   15475                 :             : 
   15476                 :           0 :       case SymbolTable_ConstStringSym:
   15477                 :             :         /* 
   15478                 :             :       ParamSym           : RETURN( Param.At.FirstUsed ) |
   15479                 :             :       VarParamSym        : RETURN( VarParam.At.FirstUsed ) |
   15480                 :             :   */
   15481                 :           0 :         return pSym->ConstString.At.FirstUsed;
   15482                 :           0 :         break;
   15483                 :             : 
   15484                 :           0 :       case SymbolTable_ConstLitSym:
   15485                 :           0 :         return pSym->ConstLit.At.FirstUsed;
   15486                 :           6 :         break;
   15487                 :             : 
   15488                 :           6 :       case SymbolTable_ConstVarSym:
   15489                 :           6 :         return pSym->ConstVar.At.FirstUsed;
   15490                 :           6 :         break;
   15491                 :             : 
   15492                 :           6 :       case SymbolTable_VarSym:
   15493                 :           6 :         return pSym->Var.At.FirstUsed;
   15494                 :           0 :         break;
   15495                 :             : 
   15496                 :           0 :       case SymbolTable_TypeSym:
   15497                 :           0 :         return pSym->Type.At.FirstUsed;
   15498                 :           0 :         break;
   15499                 :             : 
   15500                 :           0 :       case SymbolTable_PointerSym:
   15501                 :           0 :         return pSym->Pointer.At.FirstUsed;
   15502                 :           0 :         break;
   15503                 :             : 
   15504                 :           0 :       case SymbolTable_RecordFieldSym:
   15505                 :           0 :         return pSym->RecordField.At.FirstUsed;
   15506                 :           0 :         break;
   15507                 :             : 
   15508                 :           0 :       case SymbolTable_VarientFieldSym:
   15509                 :           0 :         return pSym->VarientField.At.FirstUsed;
   15510                 :           0 :         break;
   15511                 :             : 
   15512                 :           0 :       case SymbolTable_EnumerationFieldSym:
   15513                 :           0 :         return pSym->EnumerationField.At.FirstUsed;
   15514                 :           0 :         break;
   15515                 :             : 
   15516                 :           0 :       case SymbolTable_SetSym:
   15517                 :           0 :         return pSym->Set.At.FirstUsed;
   15518                 :           0 :         break;
   15519                 :             : 
   15520                 :           0 :       case SymbolTable_DefImpSym:
   15521                 :           0 :         return pSym->DefImp.At.FirstUsed;
   15522                 :           0 :         break;
   15523                 :             : 
   15524                 :           0 :       case SymbolTable_ModuleSym:
   15525                 :           0 :         return pSym->Module.At.FirstUsed;
   15526                 :           0 :         break;
   15527                 :             : 
   15528                 :             : 
   15529                 :           0 :       default:
   15530                 :           0 :         M2Error_InternalError ((const char *) "not expecting this type of symbol", 33);
   15531                 :             :         break;
   15532                 :             :     }
   15533                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15534                 :             :   __builtin_unreachable ();
   15535                 :             : }
   15536                 :             : 
   15537                 :             : 
   15538                 :             : /*
   15539                 :             :    PutProcedureBegin - assigns begin as the token number matching the
   15540                 :             :                        procedure BEGIN.
   15541                 :             : */
   15542                 :             : 
   15543                 :       80958 : extern "C" void SymbolTable_PutProcedureBegin (unsigned int Sym, unsigned int begin)
   15544                 :             : {
   15545                 :       80958 :   SymbolTable_PtrToSymbol pSym;
   15546                 :             : 
   15547                 :       80958 :   pSym = GetPsym (Sym);
   15548                 :       80958 :   switch (pSym->SymbolType)
   15549                 :             :     {
   15550                 :       80958 :       case SymbolTable_ProcedureSym:
   15551                 :       80958 :         pSym->Procedure.Begin = begin;
   15552                 :       80958 :         break;
   15553                 :             : 
   15554                 :             : 
   15555                 :           0 :       default:
   15556                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   15557                 :       80958 :         break;
   15558                 :             :     }
   15559                 :       80958 : }
   15560                 :             : 
   15561                 :             : 
   15562                 :             : /*
   15563                 :             :    PutProcedureEnd - assigns end as the token number matching the
   15564                 :             :                      procedure END.
   15565                 :             : */
   15566                 :             : 
   15567                 :       80928 : extern "C" void SymbolTable_PutProcedureEnd (unsigned int Sym, unsigned int end)
   15568                 :             : {
   15569                 :       80928 :   SymbolTable_PtrToSymbol pSym;
   15570                 :             : 
   15571                 :       80928 :   pSym = GetPsym (Sym);
   15572                 :       80928 :   switch (pSym->SymbolType)
   15573                 :             :     {
   15574                 :       80928 :       case SymbolTable_ProcedureSym:
   15575                 :       80928 :         pSym->Procedure.End = end;
   15576                 :       80928 :         break;
   15577                 :             : 
   15578                 :             : 
   15579                 :           0 :       default:
   15580                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   15581                 :       80928 :         break;
   15582                 :             :     }
   15583                 :       80928 : }
   15584                 :             : 
   15585                 :             : 
   15586                 :             : /*
   15587                 :             :    GetProcedureBeginEnd - assigns, begin, end, to the stored token values.
   15588                 :             : */
   15589                 :             : 
   15590                 :     3947457 : extern "C" void SymbolTable_GetProcedureBeginEnd (unsigned int Sym, unsigned int *begin, unsigned int *end)
   15591                 :             : {
   15592                 :     3947457 :   SymbolTable_PtrToSymbol pSym;
   15593                 :             : 
   15594                 :     3947457 :   pSym = GetPsym (Sym);
   15595                 :     3947457 :   switch (pSym->SymbolType)
   15596                 :             :     {
   15597                 :     3947457 :       case SymbolTable_ProcedureSym:
   15598                 :     3947457 :         (*begin) = pSym->Procedure.Begin;
   15599                 :     3947457 :         (*end) = pSym->Procedure.End;
   15600                 :     3947457 :         break;
   15601                 :             : 
   15602                 :             : 
   15603                 :           0 :       default:
   15604                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   15605                 :     3947457 :         break;
   15606                 :             :     }
   15607                 :     3947457 : }
   15608                 :             : 
   15609                 :             : 
   15610                 :             : /*
   15611                 :             :    ForeachProcedureDo - for each procedure in module, Sym, do procedure, P.
   15612                 :             : */
   15613                 :             : 
   15614                 :     2845427 : extern "C" void SymbolTable_ForeachProcedureDo (unsigned int Sym, SymbolKey_PerformOperation P)
   15615                 :             : {
   15616                 :     2845427 :   SymbolTable_PtrToSymbol pSym;
   15617                 :             : 
   15618                 :     2845427 :   pSym = GetPsym (Sym);
   15619                 :     2845427 :   switch (pSym->SymbolType)
   15620                 :             :     {
   15621                 :      440302 :       case SymbolTable_DefImpSym:
   15622                 :      440302 :         Lists_ForeachItemInListDo (pSym->DefImp.ListOfProcs, P);
   15623                 :      440302 :         break;
   15624                 :             : 
   15625                 :      110742 :       case SymbolTable_ModuleSym:
   15626                 :      110742 :         Lists_ForeachItemInListDo (pSym->Module.ListOfProcs, P);
   15627                 :      110742 :         break;
   15628                 :             : 
   15629                 :     2294383 :       case SymbolTable_ProcedureSym:
   15630                 :     2294383 :         Lists_ForeachItemInListDo (pSym->Procedure.ListOfProcs, P);
   15631                 :     2294383 :         break;
   15632                 :             : 
   15633                 :             : 
   15634                 :           0 :       default:
   15635                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   15636                 :     2845409 :         break;
   15637                 :             :     }
   15638                 :     2845409 : }
   15639                 :             : 
   15640                 :             : 
   15641                 :             : /*
   15642                 :             :    ForeachModuleDo - for each module do procedure, P.
   15643                 :             : */
   15644                 :             : 
   15645                 :       48487 : extern "C" void SymbolTable_ForeachModuleDo (SymbolKey_PerformOperation P)
   15646                 :             : {
   15647                 :       48487 :   SymbolKey_ForeachNodeDo (ModuleTree, P);
   15648                 :       48487 : }
   15649                 :             : 
   15650                 :             : 
   15651                 :             : /*
   15652                 :             :    ForeachInnerModuleDo - for each inner module in module, Sym,
   15653                 :             :                           do procedure, P.
   15654                 :             : */
   15655                 :             : 
   15656                 :     3295691 : extern "C" void SymbolTable_ForeachInnerModuleDo (unsigned int Sym, SymbolKey_PerformOperation P)
   15657                 :             : {
   15658                 :     3295691 :   SymbolTable_PtrToSymbol pSym;
   15659                 :             : 
   15660                 :     3295691 :   pSym = GetPsym (Sym);
   15661                 :     3295691 :   switch (pSym->SymbolType)
   15662                 :             :     {
   15663                 :      448886 :       case SymbolTable_DefImpSym:
   15664                 :      448886 :         Lists_ForeachItemInListDo (pSym->DefImp.ListOfModules, P);
   15665                 :      448886 :         break;
   15666                 :             : 
   15667                 :      166028 :       case SymbolTable_ModuleSym:
   15668                 :      166028 :         Lists_ForeachItemInListDo (pSym->Module.ListOfModules, P);
   15669                 :      166028 :         break;
   15670                 :             : 
   15671                 :     2680777 :       case SymbolTable_ProcedureSym:
   15672                 :     2680777 :         Lists_ForeachItemInListDo (pSym->Procedure.ListOfModules, P);
   15673                 :     2680777 :         break;
   15674                 :             : 
   15675                 :             : 
   15676                 :           0 :       default:
   15677                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   15678                 :     3295691 :         break;
   15679                 :             :     }
   15680                 :     3295691 : }
   15681                 :             : 
   15682                 :             : 
   15683                 :             : /*
   15684                 :             :    IsVarParam - Returns a conditional depending whether parameter ParamNo
   15685                 :             :                 is a VAR parameter.
   15686                 :             : */
   15687                 :             : 
   15688                 :    11313769 : extern "C" bool SymbolTable_IsVarParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo)
   15689                 :             : {
   15690                 :    11313769 :   SymbolTable_PtrToSymbol pSym;
   15691                 :    11313769 :   bool IsVar;
   15692                 :             : 
   15693                 :    11313769 :   IsVar = false;
   15694                 :    11313769 :   pSym = GetPsym (Sym);
   15695                 :    11313769 :   switch (pSym->SymbolType)
   15696                 :             :     {
   15697                 :             :       case SymbolTable_ErrorSym:
   15698                 :             :         break;
   15699                 :             : 
   15700                 :    11313769 :       case SymbolTable_ProcedureSym:
   15701                 :    11313769 :         IsVar = IsNthParamVar (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam, ParamNo);
   15702                 :    11313769 :         break;
   15703                 :             : 
   15704                 :           0 :       case SymbolTable_ProcTypeSym:
   15705                 :           0 :         IsVar = IsNthParamVar (pSym->ProcType.ListOfParam, ParamNo);
   15706                 :           0 :         break;
   15707                 :             : 
   15708                 :             : 
   15709                 :           0 :       default:
   15710                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   15711                 :    11313769 :         break;
   15712                 :             :     }
   15713                 :    11313769 :   return IsVar;
   15714                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15715                 :             :   __builtin_unreachable ();
   15716                 :             : }
   15717                 :             : 
   15718                 :             : 
   15719                 :             : /*
   15720                 :             :    IsVarParamAny - Returns a conditional depending whether parameter ParamNo
   15721                 :             :                    is a VAR parameter.
   15722                 :             : */
   15723                 :             : 
   15724                 :    10751327 : extern "C" bool SymbolTable_IsVarParamAny (unsigned int Sym, unsigned int ParamNo)
   15725                 :             : {
   15726                 :    10751327 :   SymbolTable_PtrToSymbol pSym;
   15727                 :    10751327 :   SymbolTable_ProcedureKind kind;
   15728                 :             : 
   15729                 :    10751327 :   pSym = GetPsym (Sym);
   15730                 :    10751327 :   switch (pSym->SymbolType)
   15731                 :             :     {
   15732                 :             :       case SymbolTable_ErrorSym:
   15733                 :             :         break;
   15734                 :             : 
   15735                 :             :       case SymbolTable_ProcedureSym:
   15736                 :    23590715 :         for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   15737                 :             :           {
   15738                 :    22750076 :             if (SymbolTable_GetProcedureDefined (Sym, kind))
   15739                 :             :               {
   15740                 :     9334651 :                 return IsNthParamVar (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam, ParamNo);
   15741                 :             :               }
   15742                 :             :           }
   15743                 :             :         break;
   15744                 :             : 
   15745                 :      576037 :       case SymbolTable_ProcTypeSym:
   15746                 :      576037 :         return IsNthParamVar (pSym->ProcType.ListOfParam, ParamNo);
   15747                 :           0 :         break;
   15748                 :             : 
   15749                 :             : 
   15750                 :           0 :       default:
   15751                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   15752                 :             :         break;
   15753                 :             :     }
   15754                 :             :   return false;
   15755                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15756                 :             :   __builtin_unreachable ();
   15757                 :             : }
   15758                 :             : 
   15759                 :             : 
   15760                 :             : /*
   15761                 :             :    IsUnboundedParam - Returns a conditional depending whether parameter
   15762                 :             :                       ParamNo is an unbounded array procedure parameter.
   15763                 :             : */
   15764                 :             : 
   15765                 :    23100445 : extern "C" bool SymbolTable_IsUnboundedParam (unsigned int Sym, SymbolTable_ProcedureKind kind, unsigned int ParamNo)
   15766                 :             : {
   15767                 :    23100445 :   unsigned int param;
   15768                 :             : 
   15769                 :    23100445 :   param = SymbolTable_GetNthParam (Sym, kind, ParamNo);
   15770                 :    23100445 :   return SymbolTable_IsParameterUnbounded (param);
   15771                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15772                 :             :   __builtin_unreachable ();
   15773                 :             : }
   15774                 :             : 
   15775                 :    19949526 : extern "C" bool SymbolTable_IsUnboundedParamAny (unsigned int Sym, unsigned int ParamNo)
   15776                 :             : {
   15777                 :    19949526 :   SymbolTable_ProcedureKind kind;
   15778                 :             : 
   15779                 :    40777080 :   for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   15780                 :             :     {
   15781                 :             :       /* 
   15782                 :             :    IsUnboundedParam - Returns a conditional depending whether parameter
   15783                 :             :                       ParamNo is an unbounded array procedure parameter.
   15784                 :             :   */
   15785                 :    40777080 :       if (SymbolTable_GetProcedureParametersDefined (Sym, kind))
   15786                 :             :         {
   15787                 :    19949526 :           return SymbolTable_IsUnboundedParam (Sym, kind, ParamNo);
   15788                 :             :         }
   15789                 :             :     }
   15790                 :           0 :   M2Error_InternalError ((const char *) "no procedure kind exists", 24);
   15791                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15792                 :             :   __builtin_unreachable ();
   15793                 :             : }
   15794                 :             : 
   15795                 :             : 
   15796                 :             : /*
   15797                 :             :    IsParameterUnbounded - returns TRUE if parameter, Sym, is
   15798                 :             :                           unbounded.
   15799                 :             : */
   15800                 :             : 
   15801                 :    23100457 : extern "C" bool SymbolTable_IsParameterUnbounded (unsigned int Sym)
   15802                 :             : {
   15803                 :    23100457 :   SymbolTable_PtrToSymbol pSym;
   15804                 :             : 
   15805                 :    23100457 :   pSym = GetPsym (Sym);
   15806                 :    23100457 :   switch (pSym->SymbolType)
   15807                 :             :     {
   15808                 :    20546339 :       case SymbolTable_ParamSym:
   15809                 :    20546339 :         return pSym->Param.IsUnbounded;
   15810                 :     2554118 :         break;
   15811                 :             : 
   15812                 :     2554118 :       case SymbolTable_VarParamSym:
   15813                 :     2554118 :         return pSym->VarParam.IsUnbounded;
   15814                 :           0 :         break;
   15815                 :             : 
   15816                 :             : 
   15817                 :           0 :       default:
   15818                 :           0 :         M2Error_InternalError ((const char *) "expecting Param or VarParam symbol", 34);
   15819                 :             :         break;
   15820                 :             :     }
   15821                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15822                 :             :   __builtin_unreachable ();
   15823                 :             : }
   15824                 :             : 
   15825                 :             : 
   15826                 :             : /*
   15827                 :             :    IsParameterVar - returns true if parameter symbol Sym
   15828                 :             :                     was declared as a VAR.
   15829                 :             : */
   15830                 :             : 
   15831                 :         204 : extern "C" bool SymbolTable_IsParameterVar (unsigned int Sym)
   15832                 :             : {
   15833                 :         204 :   SymbolTable_PtrToSymbol pSym;
   15834                 :             : 
   15835                 :         204 :   pSym = GetPsym (Sym);
   15836                 :         204 :   switch (pSym->SymbolType)
   15837                 :             :     {
   15838                 :             :       case SymbolTable_ParamSym:
   15839                 :             :         return false;
   15840                 :          24 :         break;
   15841                 :             : 
   15842                 :          24 :       case SymbolTable_VarParamSym:
   15843                 :          24 :         return true;
   15844                 :           0 :         break;
   15845                 :             : 
   15846                 :             : 
   15847                 :           0 :       default:
   15848                 :           0 :         M2Error_InternalError ((const char *) "expecting Param or VarParam symbol", 34);
   15849                 :             :         break;
   15850                 :             :     }
   15851                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15852                 :             :   __builtin_unreachable ();
   15853                 :             : }
   15854                 :             : 
   15855                 :             : 
   15856                 :             : /*
   15857                 :             :    GetParameterShadowVar - returns the local variable associated with the
   15858                 :             :                            parameter symbol, sym.
   15859                 :             : */
   15860                 :             : 
   15861                 :       46548 : extern "C" unsigned int SymbolTable_GetParameterShadowVar (unsigned int sym)
   15862                 :             : {
   15863                 :       46548 :   SymbolTable_PtrToSymbol pSym;
   15864                 :             : 
   15865                 :       46548 :   pSym = GetPsym (sym);
   15866                 :       46548 :   switch (pSym->SymbolType)
   15867                 :             :     {
   15868                 :       39388 :       case SymbolTable_ParamSym:
   15869                 :       39388 :         return pSym->Param.ShadowVar;
   15870                 :        7160 :         break;
   15871                 :             : 
   15872                 :        7160 :       case SymbolTable_VarParamSym:
   15873                 :        7160 :         return pSym->VarParam.ShadowVar;
   15874                 :           0 :         break;
   15875                 :             : 
   15876                 :             : 
   15877                 :           0 :       default:
   15878                 :           0 :         M2Error_InternalError ((const char *) "expecting a ParamSym or VarParamSym", 35);
   15879                 :             :         break;
   15880                 :             :     }
   15881                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   15882                 :             :   __builtin_unreachable ();
   15883                 :             : }
   15884                 :             : 
   15885                 :             : 
   15886                 :             : /*
   15887                 :             :    NoOfParam - Returns the number of parameters that procedure Sym contains.
   15888                 :             : */
   15889                 :             : 
   15890                 :    26565169 : extern "C" unsigned int SymbolTable_NoOfParam (unsigned int Sym, SymbolTable_ProcedureKind kind)
   15891                 :             : {
   15892                 :    26565169 :   SymbolTable_PtrToSymbol pSym;
   15893                 :    26565169 :   unsigned int n;
   15894                 :             : 
   15895                 :    26565169 :   AssertInRange (Sym);
   15896                 :    26565169 :   pSym = GetPsym (Sym);
   15897                 :    26565169 :   switch (pSym->SymbolType)
   15898                 :             :     {
   15899                 :             :       case SymbolTable_ErrorSym:
   15900                 :             :         n = 0;
   15901                 :             :         break;
   15902                 :             : 
   15903                 :    26565169 :       case SymbolTable_ProcedureSym:
   15904                 :    26565169 :         n = Lists_NoOfItemsInList (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ListOfParam);
   15905                 :    26565169 :         break;
   15906                 :             : 
   15907                 :           0 :       case SymbolTable_ProcTypeSym:
   15908                 :           0 :         n = Lists_NoOfItemsInList (pSym->ProcType.ListOfParam);
   15909                 :           0 :         break;
   15910                 :             : 
   15911                 :             : 
   15912                 :           0 :       default:
   15913                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   15914                 :    26565169 :         break;
   15915                 :             :     }
   15916                 :    26565169 :   return n;
   15917                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15918                 :             :   __builtin_unreachable ();
   15919                 :             : }
   15920                 :             : 
   15921                 :             : 
   15922                 :             : /*
   15923                 :             :    HasVarParameters - returns TRUE if procedure, p, has any VAR parameters.
   15924                 :             : */
   15925                 :             : 
   15926                 :           0 : extern "C" bool SymbolTable_HasVarParameters (unsigned int p)
   15927                 :             : {
   15928                 :           0 :   unsigned int i;
   15929                 :           0 :   unsigned int n;
   15930                 :             : 
   15931                 :           0 :   n = SymbolTable_NoOfParamAny (p);
   15932                 :           0 :   i = 1;
   15933                 :           0 :   while (i <= n)
   15934                 :             :     {
   15935                 :           0 :       if (SymbolTable_IsParameterVar (SymbolTable_GetNthParamAny (p, i)))
   15936                 :             :         {
   15937                 :             :           return true;
   15938                 :             :         }
   15939                 :           0 :       i += 1;
   15940                 :             :     }
   15941                 :             :   return false;
   15942                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15943                 :             :   __builtin_unreachable ();
   15944                 :             : }
   15945                 :             : 
   15946                 :             : 
   15947                 :             : /*
   15948                 :             :    NoOfLocalVar - returns the number of local variables that exist in
   15949                 :             :                   procedure Sym. Parameters are NOT included in the
   15950                 :             :                   count.
   15951                 :             : */
   15952                 :             : 
   15953                 :          30 : extern "C" unsigned int SymbolTable_NoOfLocalVar (unsigned int Sym)
   15954                 :             : {
   15955                 :          30 :   SymbolTable_PtrToSymbol pSym;
   15956                 :          30 :   unsigned int n;
   15957                 :             : 
   15958                 :          30 :   pSym = GetPsym (Sym);
   15959                 :          30 :   switch (pSym->SymbolType)
   15960                 :             :     {
   15961                 :             :       case SymbolTable_ErrorSym:
   15962                 :             :         n = 0;
   15963                 :             :         break;
   15964                 :             : 
   15965                 :          30 :       case SymbolTable_ProcedureSym:
   15966                 :          30 :         n = Lists_NoOfItemsInList (pSym->Procedure.ListOfVars);
   15967                 :          30 :         break;
   15968                 :             : 
   15969                 :             : 
   15970                 :           0 :       default:
   15971                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   15972                 :          30 :         break;
   15973                 :             :     }
   15974                 :             :   /* 
   15975                 :             :       Parameters are actually included in the list of local varaibles,
   15976                 :             :       therefore we must subtract the Parameter Number from local variable
   15977                 :             :       total.
   15978                 :             :   */
   15979                 :          30 :   return n-(SymbolTable_NoOfParamAny (Sym));
   15980                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15981                 :             :   __builtin_unreachable ();
   15982                 :             : }
   15983                 :             : 
   15984                 :             : 
   15985                 :             : /*
   15986                 :             :    IsDefImp - returns true is the Sym is a DefImp symbol.
   15987                 :             :               Definition/Implementation module symbol.
   15988                 :             : */
   15989                 :             : 
   15990                 :   354998837 : extern "C" bool SymbolTable_IsDefImp (unsigned int Sym)
   15991                 :             : {
   15992                 :   354998837 :   SymbolTable_PtrToSymbol pSym;
   15993                 :             : 
   15994                 :   354998837 :   pSym = GetPsym (Sym);
   15995                 :   354998837 :   return pSym->SymbolType == SymbolTable_DefImpSym;
   15996                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   15997                 :             :   __builtin_unreachable ();
   15998                 :             : }
   15999                 :             : 
   16000                 :             : 
   16001                 :             : /*
   16002                 :             :    IsModule - returns true is the Sym is a Module symbol.
   16003                 :             :               Program module symbol.
   16004                 :             : */
   16005                 :             : 
   16006                 :   294359667 : extern "C" bool SymbolTable_IsModule (unsigned int Sym)
   16007                 :             : {
   16008                 :   294359667 :   SymbolTable_PtrToSymbol pSym;
   16009                 :             : 
   16010                 :   294359667 :   pSym = GetPsym (Sym);
   16011                 :   294359667 :   return pSym->SymbolType == SymbolTable_ModuleSym;
   16012                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16013                 :             :   __builtin_unreachable ();
   16014                 :             : }
   16015                 :             : 
   16016                 :             : 
   16017                 :             : /*
   16018                 :             :    IsInnerModule - returns true if the symbol, Sym, is an inner module.
   16019                 :             : */
   16020                 :             : 
   16021                 :    10196864 : extern "C" bool SymbolTable_IsInnerModule (unsigned int Sym)
   16022                 :             : {
   16023                 :    10196864 :   if (SymbolTable_IsModule (Sym))
   16024                 :             :     {
   16025                 :      225232 :       return (SymbolTable_GetScope (Sym)) != SymbolTable_NulSym;
   16026                 :             :     }
   16027                 :             :   else
   16028                 :             :     {
   16029                 :             :       return false;
   16030                 :             :     }
   16031                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16032                 :             :   __builtin_unreachable ();
   16033                 :             : }
   16034                 :             : 
   16035                 :             : 
   16036                 :             : /*
   16037                 :             :    GetSymName - returns the symbol name.
   16038                 :             : */
   16039                 :             : 
   16040                 :  1138303761 : extern "C" NameKey_Name SymbolTable_GetSymName (unsigned int Sym)
   16041                 :             : {
   16042                 :  1138303761 :   SymbolTable_PtrToSymbol pSym;
   16043                 :  1138303761 :   NameKey_Name n;
   16044                 :             : 
   16045                 :  1138303761 :   if (Sym == SymbolTable_NulSym)
   16046                 :             :     {
   16047                 :             :       n = SymbolKey_NulKey;
   16048                 :             :     }
   16049                 :             :   else
   16050                 :             :     {
   16051                 :  1138303761 :       pSym = GetPsym (Sym);
   16052                 :  1138303761 :       switch (pSym->SymbolType)
   16053                 :             :         {
   16054                 :         327 :           case SymbolTable_ErrorSym:
   16055                 :         327 :             n = pSym->Error.name;
   16056                 :         327 :             break;
   16057                 :             : 
   16058                 :    14583536 :           case SymbolTable_ObjectSym:
   16059                 :    14583536 :             n = pSym->Object.name;
   16060                 :    14583536 :             break;
   16061                 :             : 
   16062                 :     8222239 :           case SymbolTable_DefImpSym:
   16063                 :     8222239 :             n = pSym->DefImp.name;
   16064                 :     8222239 :             break;
   16065                 :             : 
   16066                 :      507391 :           case SymbolTable_ModuleSym:
   16067                 :      507391 :             n = pSym->Module.name;
   16068                 :      507391 :             break;
   16069                 :             : 
   16070                 :   878942261 :           case SymbolTable_TypeSym:
   16071                 :   878942261 :             n = pSym->Type.name;
   16072                 :   878942261 :             break;
   16073                 :             : 
   16074                 :    10026012 :           case SymbolTable_VarSym:
   16075                 :    10026012 :             n = pSym->Var.name;
   16076                 :    10026012 :             break;
   16077                 :             : 
   16078                 :       14937 :           case SymbolTable_ConstLitSym:
   16079                 :       14937 :             n = pSym->ConstLit.name;
   16080                 :       14937 :             break;
   16081                 :             : 
   16082                 :      150590 :           case SymbolTable_ConstVarSym:
   16083                 :      150590 :             n = pSym->ConstVar.name;
   16084                 :      150590 :             break;
   16085                 :             : 
   16086                 :       14048 :           case SymbolTable_ConstStringSym:
   16087                 :       14048 :             n = pSym->ConstString.name;
   16088                 :       14048 :             break;
   16089                 :             : 
   16090                 :     1715714 :           case SymbolTable_EnumerationSym:
   16091                 :     1715714 :             n = pSym->Enumeration.name;
   16092                 :     1715714 :             break;
   16093                 :             : 
   16094                 :     1526777 :           case SymbolTable_EnumerationFieldSym:
   16095                 :     1526777 :             n = pSym->EnumerationField.name;
   16096                 :     1526777 :             break;
   16097                 :             : 
   16098                 :    14364899 :           case SymbolTable_UndefinedSym:
   16099                 :    14364899 :             n = pSym->Undefined.name;
   16100                 :    14364899 :             break;
   16101                 :             : 
   16102                 :    50706393 :           case SymbolTable_ProcedureSym:
   16103                 :    50706393 :             n = pSym->Procedure.name;
   16104                 :    50706393 :             break;
   16105                 :             : 
   16106                 :      557484 :           case SymbolTable_ProcTypeSym:
   16107                 :      557484 :             n = pSym->ProcType.name;
   16108                 :      557484 :             break;
   16109                 :             : 
   16110                 :     1213098 :           case SymbolTable_RecordFieldSym:
   16111                 :     1213098 :             n = pSym->RecordField.name;
   16112                 :     1213098 :             break;
   16113                 :             : 
   16114                 :      426604 :           case SymbolTable_RecordSym:
   16115                 :      426604 :             n = pSym->Record.name;
   16116                 :      426604 :             break;
   16117                 :             : 
   16118                 :             :           case SymbolTable_VarientSym:
   16119                 :             :             n = NameKey_NulName;
   16120                 :             :             break;
   16121                 :             : 
   16122                 :       16998 :           case SymbolTable_VarientFieldSym:
   16123                 :       16998 :             n = pSym->VarientField.name;
   16124                 :       16998 :             break;
   16125                 :             : 
   16126                 :       12291 :           case SymbolTable_VarParamSym:
   16127                 :       12291 :             n = pSym->VarParam.name;
   16128                 :       12291 :             break;
   16129                 :             : 
   16130                 :      123316 :           case SymbolTable_ParamSym:
   16131                 :      123316 :             n = pSym->Param.name;
   16132                 :      123316 :             break;
   16133                 :             : 
   16134                 :    62782186 :           case SymbolTable_PointerSym:
   16135                 :    62782186 :             n = pSym->Pointer.name;
   16136                 :    62782186 :             break;
   16137                 :             : 
   16138                 :       99688 :           case SymbolTable_ArraySym:
   16139                 :       99688 :             n = pSym->Array.name;
   16140                 :       99688 :             break;
   16141                 :             : 
   16142                 :             :           case SymbolTable_UnboundedSym:
   16143                 :             :             n = NameKey_NulName;
   16144                 :             :             break;
   16145                 :             : 
   16146                 :      444985 :           case SymbolTable_SubrangeSym:
   16147                 :      444985 :             n = pSym->Subrange.name;
   16148                 :      444985 :             break;
   16149                 :             : 
   16150                 :    84696980 :           case SymbolTable_SetSym:
   16151                 :    84696980 :             n = pSym->Set.name;
   16152                 :    84696980 :             break;
   16153                 :             : 
   16154                 :             :           case SymbolTable_SubscriptSym:
   16155                 :             :             n = NameKey_NulName;
   16156                 :             :             break;
   16157                 :             : 
   16158                 :             :           case SymbolTable_DummySym:
   16159                 :             :             n = NameKey_NulName;
   16160                 :             :             break;
   16161                 :             : 
   16162                 :           0 :           case SymbolTable_PartialUnboundedSym:
   16163                 :           0 :             n = SymbolTable_GetSymName (pSym->PartialUnbounded.Type);
   16164                 :           0 :             break;
   16165                 :             : 
   16166                 :             :           case SymbolTable_TupleSym:
   16167                 :             :             n = NameKey_NulName;
   16168                 :             :             break;
   16169                 :             : 
   16170                 :             :           case SymbolTable_GnuAsmSym:
   16171                 :             :             n = NameKey_NulName;
   16172                 :             :             break;
   16173                 :             : 
   16174                 :             :           case SymbolTable_InterfaceSym:
   16175                 :             :             n = NameKey_NulName;
   16176                 :             :             break;
   16177                 :             : 
   16178                 :             :           case SymbolTable_ImportSym:
   16179                 :             :             n = NameKey_NulName;
   16180                 :             :             break;
   16181                 :             : 
   16182                 :             :           case SymbolTable_ImportStatementSym:
   16183                 :             :             n = NameKey_NulName;
   16184                 :             :             break;
   16185                 :             : 
   16186                 :             : 
   16187                 :           0 :           default:
   16188                 :           0 :             M2Error_InternalError ((const char *) "unexpected symbol type", 22);
   16189                 :  1138303761 :             break;
   16190                 :             :         }
   16191                 :             :     }
   16192                 :  1138303761 :   return n;
   16193                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16194                 :             :   __builtin_unreachable ();
   16195                 :             : }
   16196                 :             : 
   16197                 :             : 
   16198                 :             : /*
   16199                 :             :    RenameSym - renames a symbol, Sym, with SymName.
   16200                 :             :                It also checks the unknown tree for a symbol
   16201                 :             :                with this new name. Must only be renamed in
   16202                 :             :                the same scope of being declared.
   16203                 :             : */
   16204                 :             : 
   16205                 :           0 : extern "C" void SymbolTable_RenameSym (unsigned int Sym, NameKey_Name SymName)
   16206                 :             : {
   16207                 :           0 :   SymbolTable_PtrToSymbol pSym;
   16208                 :             : 
   16209                 :           0 :   if ((SymbolTable_GetSymName (Sym)) == NameKey_NulName)
   16210                 :             :     {
   16211                 :           0 :       pSym = GetPsym (Sym);
   16212                 :           0 :       switch (pSym->SymbolType)
   16213                 :             :         {
   16214                 :           0 :           case SymbolTable_ErrorSym:
   16215                 :           0 :             M2Error_ErrorAbort0 ((const char *) "", 0);
   16216                 :           0 :             break;
   16217                 :             : 
   16218                 :           0 :           case SymbolTable_TypeSym:
   16219                 :           0 :             pSym->Type.name = SymName;
   16220                 :           0 :             break;
   16221                 :             : 
   16222                 :           0 :           case SymbolTable_VarSym:
   16223                 :           0 :             pSym->Var.name = SymName;
   16224                 :           0 :             break;
   16225                 :             : 
   16226                 :           0 :           case SymbolTable_ConstLitSym:
   16227                 :           0 :             pSym->ConstLit.name = SymName;
   16228                 :           0 :             break;
   16229                 :             : 
   16230                 :           0 :           case SymbolTable_ConstVarSym:
   16231                 :           0 :             pSym->ConstVar.name = SymName;
   16232                 :           0 :             break;
   16233                 :             : 
   16234                 :           0 :           case SymbolTable_UndefinedSym:
   16235                 :           0 :             pSym->Undefined.name = SymName;
   16236                 :           0 :             break;
   16237                 :             : 
   16238                 :           0 :           case SymbolTable_RecordSym:
   16239                 :           0 :             pSym->Record.name = SymName;
   16240                 :           0 :             break;
   16241                 :             : 
   16242                 :           0 :           case SymbolTable_PointerSym:
   16243                 :           0 :             pSym->Pointer.name = SymName;
   16244                 :           0 :             break;
   16245                 :             : 
   16246                 :             : 
   16247                 :           0 :           default:
   16248                 :           0 :             M2Error_InternalError ((const char *) "not implemented yet", 19);
   16249                 :           0 :             break;
   16250                 :             :         }
   16251                 :           0 :       AddSymToScope (Sym, SymName);
   16252                 :             :     }
   16253                 :             :   else
   16254                 :             :     {
   16255                 :           0 :       M2Error_InternalError ((const char *) "old name of symbol must be nul", 30);
   16256                 :             :     }
   16257                 :           0 : }
   16258                 :             : 
   16259                 :             : 
   16260                 :             : /*
   16261                 :             :    IsUnknown - returns true is the symbol Sym is unknown.
   16262                 :             : */
   16263                 :             : 
   16264                 :    50304115 : extern "C" bool SymbolTable_IsUnknown (unsigned int Sym)
   16265                 :             : {
   16266                 :    50304115 :   SymbolTable_PtrToSymbol pSym;
   16267                 :             : 
   16268                 :    50304115 :   AssertInRange (Sym);
   16269                 :    50304115 :   pSym = GetPsym (Sym);
   16270                 :    50304115 :   return pSym->SymbolType == SymbolTable_UndefinedSym;
   16271                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16272                 :             :   __builtin_unreachable ();
   16273                 :             : }
   16274                 :             : 
   16275                 :             : 
   16276                 :             : /*
   16277                 :             :    IsPartialUnbounded - returns TRUE if, sym, is a partially unbounded symbol.
   16278                 :             : */
   16279                 :             : 
   16280                 :     1021072 : extern "C" bool SymbolTable_IsPartialUnbounded (unsigned int sym)
   16281                 :             : {
   16282                 :     1021072 :   SymbolTable_PtrToSymbol pSym;
   16283                 :             : 
   16284                 :     1021072 :   if (sym > 0)
   16285                 :             :     {
   16286                 :     1021072 :       pSym = GetPsym (sym);
   16287                 :     1021072 :       switch (pSym->SymbolType)
   16288                 :             :         {
   16289                 :             :           case SymbolTable_PartialUnboundedSym:
   16290                 :             :             return true;
   16291                 :             :             break;
   16292                 :             : 
   16293                 :             : 
   16294                 :             :           default:
   16295                 :             :             return false;
   16296                 :             :             break;
   16297                 :             :         }
   16298                 :             :     }
   16299                 :             :   else
   16300                 :             :     {
   16301                 :             :       return false;
   16302                 :             :     }
   16303                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16304                 :             :   __builtin_unreachable ();
   16305                 :             : }
   16306                 :             : 
   16307                 :             : 
   16308                 :             : /*
   16309                 :             :    RequestSym - searches for a symbol with a name SymName in the
   16310                 :             :                 current and previous scopes.
   16311                 :             :                 If the symbol is found then it is returned
   16312                 :             :                 else an unknown symbol is returned create at token
   16313                 :             :                 position, tok.
   16314                 :             :                 This procedure does search the base scope (for
   16315                 :             :                 pervasive identifiers).
   16316                 :             : */
   16317                 :             : 
   16318                 :    46563314 : extern "C" unsigned int SymbolTable_RequestSym (unsigned int tok, NameKey_Name SymName)
   16319                 :             : {
   16320                 :    46563314 :   unsigned int Sym;
   16321                 :             : 
   16322                 :             :   /* 
   16323                 :             :       WriteString('RequestSym for: ') ; WriteKey(SymName) ; WriteLn ;
   16324                 :             :   */
   16325                 :    46563314 :   Sym = SymbolTable_GetSym (SymName);
   16326                 :    46563314 :   if (Sym == SymbolTable_NulSym)
   16327                 :             :     {
   16328                 :     6988168 :       Sym = GetSymFromUnknownTree (SymName);
   16329                 :     6988168 :       if (Sym == SymbolTable_NulSym)
   16330                 :             :         {
   16331                 :             :           /* Make unknown.  */
   16332                 :     6988168 :           NewSym (&Sym);
   16333                 :     6988168 :           FillInUnknownFields (tok, Sym, SymName);
   16334                 :             :           /* 
   16335                 :             :            ; WriteKey(SymName) ; WriteString(' unknown demanded') ; WriteLn
   16336                 :             :   */
   16337                 :     6988168 :           AddSymToUnknownTree (static_cast<int> (ScopePtr), SymName, Sym);
   16338                 :             :         }
   16339                 :             :     }
   16340                 :    46563314 :   return Sym;
   16341                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16342                 :             :   __builtin_unreachable ();
   16343                 :             : }
   16344                 :             : 
   16345                 :             : 
   16346                 :             : /*
   16347                 :             :    PutImported - places a symbol, Sym, into the current main scope.
   16348                 :             : */
   16349                 :             : 
   16350                 :      990727 : extern "C" void SymbolTable_PutImported (unsigned int Sym)
   16351                 :             : {
   16352                 :      990727 :   SymbolTable_PtrToSymbol pSym;
   16353                 :      990727 :   unsigned int ModSym;
   16354                 :      990727 :   NameKey_Name n;
   16355                 :             : 
   16356                 :             :   /* 
   16357                 :             :       We have currently imported Sym, now place it into the current module.
   16358                 :             :   */
   16359                 :      990727 :   ModSym = SymbolTable_GetCurrentModuleScope ();
   16360                 :     1981454 :   M2Debug_Assert ((SymbolTable_IsDefImp (ModSym)) || (SymbolTable_IsModule (ModSym)));
   16361                 :      990727 :   pSym = GetPsym (ModSym);
   16362                 :      990727 :   switch (pSym->SymbolType)
   16363                 :             :     {
   16364                 :      102138 :       case SymbolTable_ModuleSym:
   16365                 :      102138 :         if ((SymbolKey_GetSymKey (pSym->Module.ImportTree, SymbolTable_GetSymName (Sym))) == Sym)
   16366                 :             :           {
   16367                 :             :             /* avoid dangling else.  */
   16368                 :          90 :             if (M2Options_Pedantic)
   16369                 :             :               {
   16370                 :           6 :                 n = SymbolTable_GetSymName (Sym);
   16371                 :           6 :                 M2Error_WriteFormat1 ((const char *) "symbol (%a) has already been imported", 37, (const unsigned char *) &n, (sizeof (n)-1));
   16372                 :             :               }
   16373                 :             :           }
   16374                 :      102048 :         else if ((SymbolKey_GetSymKey (pSym->Module.ImportTree, SymbolTable_GetSymName (Sym))) == SymbolKey_NulKey)
   16375                 :             :           {
   16376                 :             :             /* avoid dangling else.  */
   16377                 :      102048 :             if ((SymbolKey_GetSymKey (pSym->Module.WhereImported, Sym)) == SymbolKey_NulKey)
   16378                 :             :               {
   16379                 :      102048 :                 SymbolKey_PutSymKey (pSym->Module.WhereImported, Sym, M2LexBuf_GetTokenNo ());
   16380                 :             :               }
   16381                 :      102048 :             SymbolKey_PutSymKey (pSym->Module.ImportTree, SymbolTable_GetSymName (Sym), Sym);
   16382                 :      102048 :             SymbolTable_AddSymToModuleScope (ModSym, Sym);
   16383                 :             :           }
   16384                 :             :         else
   16385                 :             :           {
   16386                 :             :             /* avoid dangling else.  */
   16387                 :           0 :             n = SymbolTable_GetSymName (Sym);
   16388                 :           0 :             M2Error_WriteFormat1 ((const char *) "name clash when trying to import (%a)", 37, (const unsigned char *) &n, (sizeof (n)-1));
   16389                 :             :           }
   16390                 :             :         break;
   16391                 :             : 
   16392                 :      888589 :       case SymbolTable_DefImpSym:
   16393                 :      888589 :         if ((SymbolKey_GetSymKey (pSym->DefImp.ImportTree, SymbolTable_GetSymName (Sym))) == Sym)
   16394                 :             :           {
   16395                 :             :             /* avoid dangling else.  */
   16396                 :         106 :             if (M2Options_Pedantic)
   16397                 :             :               {
   16398                 :           0 :                 n = SymbolTable_GetSymName (Sym);
   16399                 :           0 :                 M2Error_WriteFormat1 ((const char *) "symbol (%a) has already been imported", 37, (const unsigned char *) &n, (sizeof (n)-1));
   16400                 :             :               }
   16401                 :             :           }
   16402                 :      888483 :         else if ((SymbolKey_GetSymKey (pSym->DefImp.ImportTree, SymbolTable_GetSymName (Sym))) == SymbolKey_NulKey)
   16403                 :             :           {
   16404                 :             :             /* avoid dangling else.  */
   16405                 :      888483 :             if ((SymbolKey_GetSymKey (pSym->DefImp.WhereImported, Sym)) == SymbolKey_NulKey)
   16406                 :             :               {
   16407                 :      888483 :                 SymbolKey_PutSymKey (pSym->DefImp.WhereImported, Sym, M2LexBuf_GetTokenNo ());
   16408                 :             :               }
   16409                 :      888483 :             SymbolKey_PutSymKey (pSym->DefImp.ImportTree, SymbolTable_GetSymName (Sym), Sym);
   16410                 :      888483 :             SymbolTable_AddSymToModuleScope (ModSym, Sym);
   16411                 :             :           }
   16412                 :             :         else
   16413                 :             :           {
   16414                 :             :             /* avoid dangling else.  */
   16415                 :           0 :             n = SymbolTable_GetSymName (Sym);
   16416                 :           0 :             M2Error_WriteFormat1 ((const char *) "name clash when trying to import (%a)", 37, (const unsigned char *) &n, (sizeof (n)-1));
   16417                 :             :           }
   16418                 :             :         break;
   16419                 :             : 
   16420                 :             : 
   16421                 :           0 :       default:
   16422                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   16423                 :      990727 :         break;
   16424                 :             :     }
   16425                 :      990727 : }
   16426                 :             : 
   16427                 :             : 
   16428                 :             : /*
   16429                 :             :    PutIncluded - places a symbol, Sym, into the included list of the
   16430                 :             :                  current module.
   16431                 :             :                  Symbols that are placed in this list are indirectly declared
   16432                 :             :                  by:
   16433                 :             : 
   16434                 :             :                  IMPORT modulename ;
   16435                 :             : 
   16436                 :             :                  modulename.identifier
   16437                 :             : */
   16438                 :             : 
   16439                 :      767686 : extern "C" void SymbolTable_PutIncluded (unsigned int Sym)
   16440                 :             : {
   16441                 :      767686 :   SymbolTable_PtrToSymbol pSym;
   16442                 :      767686 :   unsigned int ModSym;
   16443                 :      767686 :   NameKey_Name n1;
   16444                 :      767686 :   NameKey_Name n2;
   16445                 :             : 
   16446                 :             :   /* 
   16447                 :             :       We have referenced Sym, via modulename.Sym
   16448                 :             :       now place it into the current module include list.
   16449                 :             :   */
   16450                 :      767686 :   ModSym = SymbolTable_GetCurrentModuleScope ();
   16451                 :     1535372 :   M2Debug_Assert ((SymbolTable_IsDefImp (ModSym)) || (SymbolTable_IsModule (ModSym)));
   16452                 :      767686 :   if (DebugUnknowns)
   16453                 :             :     {
   16454                 :             :       n1 = SymbolTable_GetSymName (Sym);
   16455                 :             :       n2 = SymbolTable_GetSymName (ModSym);
   16456                 :             :       M2Printf_printf2 ((const char *) "including %a into scope %a\\n", 28, (const unsigned char *) &n1, (sizeof (n1)-1), (const unsigned char *) &n2, (sizeof (n2)-1));
   16457                 :             :     }
   16458                 :      767686 :   pSym = GetPsym (ModSym);
   16459                 :      767686 :   switch (pSym->SymbolType)
   16460                 :             :     {
   16461                 :        4634 :       case SymbolTable_ModuleSym:
   16462                 :        4634 :         Lists_IncludeItemIntoList (pSym->Module.IncludeList, Sym);
   16463                 :        4634 :         break;
   16464                 :             : 
   16465                 :      763052 :       case SymbolTable_DefImpSym:
   16466                 :      763052 :         Lists_IncludeItemIntoList (pSym->DefImp.IncludeList, Sym);
   16467                 :      763052 :         break;
   16468                 :             : 
   16469                 :             : 
   16470                 :           0 :       default:
   16471                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module or DefImp symbol", 35);
   16472                 :      767686 :         break;
   16473                 :             :     }
   16474                 :      767686 : }
   16475                 :             : 
   16476                 :             : 
   16477                 :             : /*
   16478                 :             :    PutExported - places a symbol, Sym into the next level out module.
   16479                 :             :                  Sym is also placed in the ExportTree of the current inner
   16480                 :             :                  module.
   16481                 :             : */
   16482                 :             : 
   16483                 :         276 : extern "C" void SymbolTable_PutExported (unsigned int Sym)
   16484                 :             : {
   16485                 :         276 :   SymbolTable_PtrToSymbol pSym;
   16486                 :             : 
   16487                 :             :   /* 
   16488                 :             :    WriteString('PutExported') ; WriteLn ;
   16489                 :             :   */
   16490                 :         276 :   SymbolTable_AddSymToModuleScope (GetLastModuleOrProcedureScope (), Sym);
   16491                 :         276 :   pSym = GetPsym (SymbolTable_GetCurrentModuleScope ());
   16492                 :         276 :   switch (pSym->SymbolType)
   16493                 :             :     {
   16494                 :         276 :       case SymbolTable_ModuleSym:
   16495                 :         276 :         SymbolKey_PutSymKey (pSym->Module.ExportTree, SymbolTable_GetSymName (Sym), Sym);
   16496                 :         276 :         if (SymbolTable_IsUnknown (Sym))
   16497                 :             :           {
   16498                 :         276 :             PutExportUndeclared (SymbolTable_GetCurrentModuleScope (), Sym);
   16499                 :             :           }
   16500                 :             :         /* 
   16501                 :             :                  ; WriteKey(Module.name) ; WriteString(' exports ') ;
   16502                 :             :                  ; WriteKey(GetSymName(Sym)) ; WriteLn ;
   16503                 :             :   */
   16504                 :         276 :         break;
   16505                 :             : 
   16506                 :             : 
   16507                 :           0 :       default:
   16508                 :           0 :         M2Error_InternalError ((const char *) "expecting a Module symbol", 25);
   16509                 :         276 :         break;
   16510                 :             :     }
   16511                 :         276 : }
   16512                 :             : 
   16513                 :             : 
   16514                 :             : /*
   16515                 :             :    PutExportQualified - places a symbol with the name, SymName,
   16516                 :             :                         into the export tree of the
   16517                 :             :                         Definition module being compiled.
   16518                 :             :                         The symbol with name has been EXPORT QUALIFIED
   16519                 :             :                         by the definition module and therefore any reference
   16520                 :             :                         to this symbol in the code generation phase
   16521                 :             :                         will be in the form _Module_Name.
   16522                 :             : */
   16523                 :             : 
   16524                 :     3752888 : extern "C" void SymbolTable_PutExportQualified (unsigned int tokenno, NameKey_Name SymName)
   16525                 :             : {
   16526                 :     3752888 :   SymbolTable_PtrToSymbol pSym;
   16527                 :     3752888 :   NameKey_Name n;
   16528                 :     3752888 :   unsigned int Sym;
   16529                 :     3752888 :   unsigned int ModSym;
   16530                 :             : 
   16531                 :     3752888 :   ModSym = SymbolTable_GetCurrentModule ();
   16532                 :     3752888 :   M2Debug_Assert (SymbolTable_IsDefImp (ModSym));
   16533                 :     7505776 :   M2Debug_Assert ((M2Comp_CompilingDefinitionModule ()) || ((SymbolTable_GetSymName (ModSym)) == (NameKey_MakeKey ((const char *) "SYSTEM", 6))));
   16534                 :             :   /* 
   16535                 :             :    WriteString('1st MODULE ') ; WriteKey(GetSymName(ModSym)) ;
   16536                 :             :    WriteString(' identifier ') ; WriteKey(SymName) ; WriteLn ;
   16537                 :             :   */
   16538                 :     3752888 :   pSym = GetPsym (ModSym);
   16539                 :     3752888 :   switch (pSym->SymbolType)
   16540                 :             :     {
   16541                 :     3752888 :       case SymbolTable_DefImpSym:
   16542                 :     3752888 :         if (((SymbolKey_GetSymKey (pSym->DefImp.ExportQualifiedTree, SymName)) != SymbolKey_NulKey) && ((SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName)) == SymbolKey_NulKey))
   16543                 :             :           {
   16544                 :           6 :             n = SymbolTable_GetSymName (ModSym);
   16545                 :           6 :             M2Error_WriteFormat2 ((const char *) "identifier (%a) has already been exported from MODULE %a", 56, (const unsigned char *) &SymName, (sizeof (SymName)-1), (const unsigned char *) &n, (sizeof (n)-1));
   16546                 :             :           }
   16547                 :     3752882 :         else if ((SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName)) != SymbolKey_NulKey)
   16548                 :             :           {
   16549                 :             :             /* avoid dangling else.  */
   16550                 :      302655 :             Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName));
   16551                 :      302655 :             SymbolKey_DelSymKey (pSym->DefImp.ExportRequest, SymName);
   16552                 :      302655 :             SymbolKey_PutSymKey (pSym->DefImp.ExportQualifiedTree, SymName, Sym);
   16553                 :      302655 :             PutExportUndeclared (ModSym, Sym);
   16554                 :             :           }
   16555                 :             :         else
   16556                 :             :           {
   16557                 :             :             /* avoid dangling else.  */
   16558                 :     3450227 :             Sym = SymbolTable_GetDeclareSym (tokenno, SymName);
   16559                 :     3450227 :             SymbolKey_PutSymKey (pSym->DefImp.ExportQualifiedTree, SymName, Sym);
   16560                 :     3450227 :             PutExportUndeclared (ModSym, Sym);
   16561                 :             :           }
   16562                 :     3752888 :         break;
   16563                 :             : 
   16564                 :             : 
   16565                 :           0 :       default:
   16566                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   16567                 :     3752888 :         break;
   16568                 :             :     }
   16569                 :     3752888 : }
   16570                 :             : 
   16571                 :             : 
   16572                 :             : /*
   16573                 :             :    PutExportUnQualified - places a symbol with the name, SymName,
   16574                 :             :                           into the export tree of the
   16575                 :             :                           Definition module being compiled.
   16576                 :             :                           The symbol with Name has been EXPORT UNQUALIFIED
   16577                 :             :                           by the definition module and therefore any reference
   16578                 :             :                           to this symbol in the code generation phase
   16579                 :             :                           will be in the form _Name.
   16580                 :             : */
   16581                 :             : 
   16582                 :      815252 : extern "C" void SymbolTable_PutExportUnQualified (unsigned int tokenno, NameKey_Name SymName)
   16583                 :             : {
   16584                 :      815252 :   SymbolTable_PtrToSymbol pSym;
   16585                 :      815252 :   NameKey_Name n;
   16586                 :      815252 :   unsigned int Sym;
   16587                 :      815252 :   unsigned int ModSym;
   16588                 :             : 
   16589                 :      815252 :   ModSym = SymbolTable_GetCurrentModule ();
   16590                 :      815252 :   M2Debug_Assert (SymbolTable_IsDefImp (ModSym));
   16591                 :     1630504 :   M2Debug_Assert ((M2Comp_CompilingDefinitionModule ()) || ((SymbolTable_GetSymName (ModSym)) == (NameKey_MakeKey ((const char *) "SYSTEM", 6))));
   16592                 :      815252 :   pSym = GetPsym (ModSym);
   16593                 :      815252 :   switch (pSym->SymbolType)
   16594                 :             :     {
   16595                 :      815252 :       case SymbolTable_DefImpSym:
   16596                 :      815252 :         if (((SymbolKey_GetSymKey (pSym->DefImp.ExportUnQualifiedTree, SymName)) != SymbolKey_NulKey) && ((SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName)) == SymbolKey_NulKey))
   16597                 :             :           {
   16598                 :           0 :             n = SymbolTable_GetSymName (ModSym);
   16599                 :           0 :             M2Error_WriteFormat2 ((const char *) "identifier (%a) has already been exported from MODULE %a", 56, (const unsigned char *) &SymName, (sizeof (SymName)-1), (const unsigned char *) &n, (sizeof (n)-1));
   16600                 :             :           }
   16601                 :      815252 :         else if ((SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName)) != SymbolKey_NulKey)
   16602                 :             :           {
   16603                 :             :             /* avoid dangling else.  */
   16604                 :       24065 :             Sym = static_cast<unsigned int> (SymbolKey_GetSymKey (pSym->DefImp.ExportRequest, SymName));
   16605                 :       24065 :             SymbolKey_DelSymKey (pSym->DefImp.ExportRequest, SymName);
   16606                 :       24065 :             SymbolKey_PutSymKey (pSym->DefImp.ExportUnQualifiedTree, SymName, Sym);
   16607                 :       24065 :             PutExportUndeclared (ModSym, Sym);
   16608                 :             :           }
   16609                 :             :         else
   16610                 :             :           {
   16611                 :             :             /* avoid dangling else.  */
   16612                 :      791187 :             Sym = SymbolTable_GetDeclareSym (tokenno, SymName);
   16613                 :      791187 :             SymbolKey_PutSymKey (pSym->DefImp.ExportUnQualifiedTree, SymName, Sym);
   16614                 :      791187 :             PutExportUndeclared (ModSym, Sym);
   16615                 :             :           }
   16616                 :      815252 :         break;
   16617                 :             : 
   16618                 :             : 
   16619                 :           0 :       default:
   16620                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   16621                 :      815252 :         break;
   16622                 :             :     }
   16623                 :      815252 : }
   16624                 :             : 
   16625                 :             : 
   16626                 :             : /*
   16627                 :             :    PutExportUnImplemented - places a symbol, Sym, into the currently compiled
   16628                 :             :                             DefImp module NeedToBeImplemented list.
   16629                 :             : */
   16630                 :             : 
   16631                 :     3342036 : extern "C" void SymbolTable_PutExportUnImplemented (unsigned int tokenno, unsigned int Sym)
   16632                 :             : {
   16633                 :     3342036 :   SymbolTable_PtrToSymbol pSym;
   16634                 :             : 
   16635                 :     3342036 :   pSym = GetPsym (CurrentModule);
   16636                 :     3342036 :   switch (pSym->SymbolType)
   16637                 :             :     {
   16638                 :     3342036 :       case SymbolTable_DefImpSym:
   16639                 :     3342036 :         if ((SymbolKey_GetSymKey (pSym->DefImp.NeedToBeImplemented, SymbolTable_GetSymName (Sym))) == Sym)
   16640                 :             :           {
   16641                 :             :             /* 
   16642                 :             :                     n1 := GetSymName (Sym) ;
   16643                 :             :                     n2 := GetSymName (CurrentModule) ;
   16644                 :             :                     WriteFormat2 ('symbol (%a) already exported from module (%a)', n1, n2)
   16645                 :             :   */
   16646                 :           0 :             M2MetaError_MetaErrorT2 (tokenno, (const char *) "symbol {%1a} is already exported from module {%2a}", 50, Sym, CurrentModule);
   16647                 :             :           }
   16648                 :             :         else
   16649                 :             :           {
   16650                 :     3342036 :             SymbolKey_PutSymKey (pSym->DefImp.NeedToBeImplemented, SymbolTable_GetSymName (Sym), Sym);
   16651                 :             :           }
   16652                 :     3342036 :         break;
   16653                 :             : 
   16654                 :             : 
   16655                 :           0 :       default:
   16656                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   16657                 :     3342036 :         break;
   16658                 :             :     }
   16659                 :     3342036 : }
   16660                 :             : 
   16661                 :             : 
   16662                 :             : /*
   16663                 :             :    GetExported - returns the symbol which has a name SymName,
   16664                 :             :                  and is exported from the definition module ModSym.
   16665                 :             : 
   16666                 :             : */
   16667                 :             : 
   16668                 :     2766199 : extern "C" unsigned int SymbolTable_GetExported (unsigned int tokenno, unsigned int ModSym, NameKey_Name SymName)
   16669                 :             : {
   16670                 :     2766199 :   SymbolTable_PtrToSymbol pSym;
   16671                 :     2766199 :   unsigned int Sym;
   16672                 :             : 
   16673                 :     2766199 :   pSym = GetPsym (ModSym);
   16674                 :     2766199 :   switch (pSym->SymbolType)
   16675                 :             :     {
   16676                 :     2766091 :       case SymbolTable_DefImpSym:
   16677                 :     2766091 :         Sym = RequestFromDefinition (tokenno, ModSym, SymName);
   16678                 :     2766091 :         break;
   16679                 :             : 
   16680                 :         108 :       case SymbolTable_ModuleSym:
   16681                 :         108 :         Sym = RequestFromModule (tokenno, ModSym, SymName);
   16682                 :         108 :         break;
   16683                 :             : 
   16684                 :             : 
   16685                 :           0 :       default:
   16686                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   16687                 :     2766199 :         break;
   16688                 :             :     }
   16689                 :     2766199 :   return Sym;
   16690                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16691                 :             :   __builtin_unreachable ();
   16692                 :             : }
   16693                 :             : 
   16694                 :             : 
   16695                 :             : /*
   16696                 :             :    GetFromOuterModule - returns a symbol with name, SymName, which comes
   16697                 :             :                         from outside the current module.
   16698                 :             : */
   16699                 :             : 
   16700                 :         336 : extern "C" unsigned int SymbolTable_GetFromOuterModule (unsigned int tokenno, NameKey_Name SymName)
   16701                 :             : {
   16702                 :         336 :   SymbolTable_PtrToCallFrame pCall;
   16703                 :         336 :   unsigned int ScopeId;
   16704                 :         336 :   unsigned int Sym;
   16705                 :         336 :   unsigned int ScopeSym;
   16706                 :             : 
   16707                 :         336 :   ScopeId = ScopePtr;
   16708                 :         336 :   pCall = GetPcall (ScopeId);
   16709                 :         696 :   while ((! (SymbolTable_IsModule (pCall->Search))) && (! (SymbolTable_IsDefImp (pCall->Search))))
   16710                 :             :     {
   16711                 :          24 :       M2Debug_Assert (ScopeId > 0);
   16712                 :          24 :       ScopeId -= 1;
   16713                 :          24 :       pCall = GetPcall (ScopeId);
   16714                 :             :     }
   16715                 :         336 :   ScopeId -= 1;
   16716                 :             :   /* we are now below the current module  */
   16717                 :         492 :   while (ScopeId > 0)
   16718                 :             :     {
   16719                 :         492 :       pCall = GetPcall (ScopeId);
   16720                 :         492 :       ScopeSym = pCall->Search;
   16721                 :         492 :       if (ScopeSym != SymbolTable_NulSym)
   16722                 :             :         {
   16723                 :         492 :           Sym = SymbolTable_GetLocalSym (ScopeSym, SymName);
   16724                 :         492 :           if (Sym == SymbolTable_NulSym)
   16725                 :             :             {
   16726                 :             :               /* avoid dangling else.  */
   16727                 :         168 :               if (((SymbolTable_IsModule (ScopeSym)) || (SymbolTable_IsProcedure (ScopeSym))) || (SymbolTable_IsDefImp (ScopeSym)))
   16728                 :             :                 {
   16729                 :         132 :                   if (Sym == SymbolTable_NulSym)
   16730                 :             :                     {
   16731                 :         132 :                       Sym = ExamineUnresolvedTree (ScopeSym, SymName);
   16732                 :         132 :                       if (Sym != SymbolTable_NulSym)
   16733                 :             :                         {
   16734                 :             :                           return Sym;
   16735                 :             :                         }
   16736                 :             :                     }
   16737                 :             :                 }
   16738                 :             :             }
   16739                 :             :           else
   16740                 :             :             {
   16741                 :             :               return Sym;
   16742                 :             :             }
   16743                 :             :         }
   16744                 :         156 :       ScopeId -= 1;
   16745                 :         156 :       pCall = GetPcall (ScopeId);
   16746                 :             :     }
   16747                 :             :   /* at this point we force an unknown from the last module scope  */
   16748                 :           0 :   return RequestFromModule (tokenno, SymbolTable_GetLastModuleScope (), SymName);
   16749                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16750                 :             :   __builtin_unreachable ();
   16751                 :             : }
   16752                 :             : 
   16753                 :             : 
   16754                 :             : /*
   16755                 :             :    TryMoveUndeclaredSymToInnerModule - attempts to move a symbol of
   16756                 :             :                                        name, name, which is
   16757                 :             :                                        currently undefined in the
   16758                 :             :                                        outer scope to the inner scope.
   16759                 :             :                                        If successful then the symbol is
   16760                 :             :                                        returned otherwise NulSym is
   16761                 :             :                                        returned.
   16762                 :             : */
   16763                 :             : 
   16764                 :         234 : extern "C" unsigned int SymbolTable_TryMoveUndeclaredSymToInnerModule (unsigned int OuterScope, unsigned int InnerScope, NameKey_Name name)
   16765                 :             : {
   16766                 :         234 :   SymbolTable_PtrToSymbol pSym;
   16767                 :         234 :   unsigned int sym;
   16768                 :             : 
   16769                 :             :   /* assume this should not be called if OuterScope was a procedure
   16770                 :             :       as this case is handled by the caller (P1SymBuild)
   16771                 :             :   */
   16772                 :         468 :   M2Debug_Assert ((SymbolTable_IsModule (OuterScope)) || (SymbolTable_IsDefImp (OuterScope)));
   16773                 :         234 :   sym = GetExportUndeclared (OuterScope, name);
   16774                 :         234 :   if (sym != SymbolTable_NulSym)
   16775                 :             :     {
   16776                 :          18 :       M2Debug_Assert (SymbolTable_IsUnknown (sym));
   16777                 :          18 :       RemoveExportUndeclared (OuterScope, sym);
   16778                 :          18 :       SymbolTable_AddSymToModuleScope (OuterScope, sym);
   16779                 :          18 :       AddVarToScopeList (OuterScope, sym);
   16780                 :          18 :       pSym = GetPsym (OuterScope);
   16781                 :          18 :       switch (pSym->SymbolType)
   16782                 :             :         {
   16783                 :           0 :           case SymbolTable_DefImpSym:
   16784                 :           0 :             if ((SymbolKey_GetSymKey (pSym->DefImp.Unresolved, name)) == sym)
   16785                 :             :               {
   16786                 :           0 :                 SymbolKey_DelSymKey (pSym->DefImp.Unresolved, name);
   16787                 :             :               }
   16788                 :             :             break;
   16789                 :             : 
   16790                 :          18 :           case SymbolTable_ModuleSym:
   16791                 :          18 :             if ((SymbolKey_GetSymKey (pSym->Module.Unresolved, name)) == sym)
   16792                 :             :               {
   16793                 :          18 :                 SymbolKey_DelSymKey (pSym->Module.Unresolved, name);
   16794                 :             :               }
   16795                 :             :             break;
   16796                 :             : 
   16797                 :             : 
   16798                 :           0 :           default:
   16799                 :           0 :             M2Error_InternalError ((const char *) "expecting DefImp, Module symbol", 31);
   16800                 :          18 :             break;
   16801                 :             :         }
   16802                 :          18 :       AddSymToUnknown (InnerScope, name, sym);
   16803                 :          18 :       PutExportUndeclared (InnerScope, sym);
   16804                 :             :     }
   16805                 :         234 :   return sym;
   16806                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16807                 :             :   __builtin_unreachable ();
   16808                 :             : }
   16809                 :             : 
   16810                 :             : 
   16811                 :             : /*
   16812                 :             :    IsExportQualified - returns true if a symbol, Sym, was defined as
   16813                 :             :                        being EXPORT QUALIFIED.
   16814                 :             :                        Sym is expected to be either a procedure or a
   16815                 :             :                        variable.
   16816                 :             : */
   16817                 :             : 
   16818                 :     8378163 : extern "C" bool SymbolTable_IsExportQualified (unsigned int Sym)
   16819                 :             : {
   16820                 :     8378163 :   SymbolTable_PtrToSymbol pSym;
   16821                 :     8378163 :   unsigned int OuterModule;
   16822                 :             : 
   16823                 :     8378163 :   OuterModule = Sym;
   16824                 :     9061946 :   do {
   16825                 :     9061946 :     OuterModule = SymbolTable_GetScope (OuterModule);
   16826                 :     9061946 :   } while (! ((SymbolTable_GetScope (OuterModule)) == SymbolTable_NulSym));
   16827                 :     8378163 :   pSym = GetPsym (OuterModule);
   16828                 :     8378163 :   switch (pSym->SymbolType)
   16829                 :             :     {
   16830                 :             :       case SymbolTable_ModuleSym:
   16831                 :             :         return false;
   16832                 :     7918383 :         break;
   16833                 :             : 
   16834                 :     7918383 :       case SymbolTable_DefImpSym:
   16835                 :     7918383 :         return (SymbolKey_GetSymKey (pSym->DefImp.ExportQualifiedTree, SymbolTable_GetSymName (Sym))) == Sym;
   16836                 :           0 :         break;
   16837                 :             : 
   16838                 :             : 
   16839                 :           0 :       default:
   16840                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   16841                 :             :         break;
   16842                 :             :     }
   16843                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   16844                 :             :   __builtin_unreachable ();
   16845                 :             : }
   16846                 :             : 
   16847                 :             : 
   16848                 :             : /*
   16849                 :             :    IsExportUnQualified - returns true if a symbol, Sym, was defined as
   16850                 :             :                          being EXPORT UNQUALIFIED.
   16851                 :             : */
   16852                 :             : 
   16853                 :     4106706 : extern "C" bool SymbolTable_IsExportUnQualified (unsigned int Sym)
   16854                 :             : {
   16855                 :     4106706 :   SymbolTable_PtrToSymbol pSym;
   16856                 :     4106706 :   unsigned int OuterModule;
   16857                 :             : 
   16858                 :     4106706 :   OuterModule = Sym;
   16859                 :     4106706 :   do {
   16860                 :     4106706 :     OuterModule = SymbolTable_GetScope (OuterModule);
   16861                 :     4106706 :   } while (! ((SymbolTable_GetScope (OuterModule)) == SymbolTable_NulSym));
   16862                 :     4106706 :   pSym = GetPsym (OuterModule);
   16863                 :     4106706 :   switch (pSym->SymbolType)
   16864                 :             :     {
   16865                 :             :       case SymbolTable_ModuleSym:
   16866                 :             :         return false;
   16867                 :     4027139 :         break;
   16868                 :             : 
   16869                 :     4027139 :       case SymbolTable_DefImpSym:
   16870                 :     4027139 :         return (SymbolKey_GetSymKey (pSym->DefImp.ExportUnQualifiedTree, SymbolTable_GetSymName (Sym))) == Sym;
   16871                 :           0 :         break;
   16872                 :             : 
   16873                 :             : 
   16874                 :           0 :       default:
   16875                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   16876                 :             :         break;
   16877                 :             :     }
   16878                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   16879                 :             :   __builtin_unreachable ();
   16880                 :             : }
   16881                 :             : 
   16882                 :             : 
   16883                 :             : /*
   16884                 :             :    IsExported - returns true if a symbol, Sym, is exported
   16885                 :             :                 from module, ModSym.
   16886                 :             :                 If ModSym is a DefImp symbol then its
   16887                 :             :                 ExportQualified and ExportUnQualified lists are examined.
   16888                 :             : */
   16889                 :             : 
   16890                 :     8586104 : extern "C" bool SymbolTable_IsExported (unsigned int ModSym, unsigned int Sym)
   16891                 :             : {
   16892                 :     8586104 :   SymbolTable_PtrToSymbol pSym;
   16893                 :     8586104 :   NameKey_Name SymName;
   16894                 :             : 
   16895                 :     8586104 :   SymName = SymbolTable_GetSymName (Sym);
   16896                 :     8586104 :   pSym = GetPsym (ModSym);
   16897                 :     8586104 :   switch (pSym->SymbolType)
   16898                 :             :     {
   16899                 :     8049653 :       case SymbolTable_DefImpSym:
   16900                 :     8049653 :         return ((SymbolKey_GetSymKey (pSym->DefImp.ExportQualifiedTree, SymName)) == Sym) || ((SymbolKey_GetSymKey (pSym->DefImp.ExportUnQualifiedTree, SymName)) == Sym);
   16901                 :      536451 :         break;
   16902                 :             : 
   16903                 :      536451 :       case SymbolTable_ModuleSym:
   16904                 :      536451 :         return (SymbolKey_GetSymKey (pSym->Module.ExportTree, SymName)) == Sym;
   16905                 :           0 :         break;
   16906                 :             : 
   16907                 :             : 
   16908                 :           0 :       default:
   16909                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   16910                 :             :         break;
   16911                 :             :     }
   16912                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   16913                 :             :   __builtin_unreachable ();
   16914                 :             : }
   16915                 :             : 
   16916                 :             : 
   16917                 :             : /*
   16918                 :             :    IsImplicityExported - returns TRUE if, Sym, is implicitly exported from module, ModSym.
   16919                 :             :                          ModSym must be a defimp symbol.
   16920                 :             : */
   16921                 :             : 
   16922                 :          84 : extern "C" bool SymbolTable_IsImplicityExported (unsigned int ModSym, unsigned int Sym)
   16923                 :             : {
   16924                 :          84 :   unsigned int type;
   16925                 :          84 :   SymbolTable_PtrToSymbol pSym;
   16926                 :             : 
   16927                 :          84 :   if ((SymbolTable_IsDefImp (ModSym)) && (SymbolTable_IsFieldEnumeration (Sym)))
   16928                 :             :     {
   16929                 :          66 :       pSym = GetPsym (ModSym);
   16930                 :          66 :       type = SymbolTable_SkipType (SymbolTable_GetType (Sym));
   16931                 :          66 :       return Lists_IsItemInList (pSym->DefImp.EnumerationScopeList, type);
   16932                 :             :     }
   16933                 :             :   return false;
   16934                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   16935                 :             :   __builtin_unreachable ();
   16936                 :             : }
   16937                 :             : 
   16938                 :             : 
   16939                 :             : /*
   16940                 :             :    IsImported - returns true if a symbol, Sym, in module, ModSym,
   16941                 :             :                 was imported.
   16942                 :             : */
   16943                 :             : 
   16944                 :    34532239 : extern "C" bool SymbolTable_IsImported (unsigned int ModSym, unsigned int Sym)
   16945                 :             : {
   16946                 :    34532239 :   SymbolTable_PtrToSymbol pSym;
   16947                 :    34532239 :   NameKey_Name SymName;
   16948                 :             : 
   16949                 :    34532239 :   SymName = SymbolTable_GetSymName (Sym);
   16950                 :    34532239 :   pSym = GetPsym (ModSym);
   16951                 :    34532239 :   switch (pSym->SymbolType)
   16952                 :             :     {
   16953                 :    22708688 :       case SymbolTable_DefImpSym:
   16954                 :    22708688 :         return ((SymbolKey_GetSymKey (pSym->DefImp.ImportTree, SymName)) == Sym) || (Lists_IsItemInList (pSym->DefImp.IncludeList, Sym));
   16955                 :    11823551 :         break;
   16956                 :             : 
   16957                 :    11823551 :       case SymbolTable_ModuleSym:
   16958                 :    11823551 :         return ((SymbolKey_GetSymKey (pSym->Module.ImportTree, SymName)) == Sym) || (Lists_IsItemInList (pSym->Module.IncludeList, Sym));
   16959                 :           0 :         break;
   16960                 :             : 
   16961                 :             : 
   16962                 :           0 :       default:
   16963                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   16964                 :             :         break;
   16965                 :             :     }
   16966                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   16967                 :             :   __builtin_unreachable ();
   16968                 :             : }
   16969                 :             : 
   16970                 :             : 
   16971                 :             : /*
   16972                 :             :    PutIncludedByDefinition - places a module symbol, Sym, into the
   16973                 :             :                              included list of the current definition module.
   16974                 :             : */
   16975                 :             : 
   16976                 :       10012 : extern "C" void SymbolTable_PutIncludedByDefinition (unsigned int Sym)
   16977                 :             : {
   16978                 :       10012 :   SymbolTable_PtrToSymbol pSym;
   16979                 :       10012 :   unsigned int ModSym;
   16980                 :             : 
   16981                 :       10012 :   ModSym = SymbolTable_GetCurrentModuleScope ();
   16982                 :       10012 :   M2Debug_Assert (SymbolTable_IsDefImp (ModSym));
   16983                 :       10012 :   M2Debug_Assert (SymbolTable_IsDefImp (Sym));
   16984                 :       10012 :   pSym = GetPsym (ModSym);
   16985                 :       10012 :   switch (pSym->SymbolType)
   16986                 :             :     {
   16987                 :       10012 :       case SymbolTable_DefImpSym:
   16988                 :       10012 :         Lists_IncludeItemIntoList (pSym->DefImp.DefIncludeList, Sym);
   16989                 :       10012 :         break;
   16990                 :             : 
   16991                 :             : 
   16992                 :           0 :       default:
   16993                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   16994                 :       10012 :         break;
   16995                 :             :     }
   16996                 :       10012 : }
   16997                 :             : 
   16998                 :             : 
   16999                 :             : /*
   17000                 :             :    IsIncludedByDefinition - returns TRUE if definition module symbol, Sym, was included
   17001                 :             :                             by ModSym's definition module.
   17002                 :             : */
   17003                 :             : 
   17004                 :          12 : extern "C" bool SymbolTable_IsIncludedByDefinition (unsigned int ModSym, unsigned int Sym)
   17005                 :             : {
   17006                 :          12 :   SymbolTable_PtrToSymbol pSym;
   17007                 :             : 
   17008                 :          12 :   M2Debug_Assert (SymbolTable_IsDefImp (ModSym));
   17009                 :          12 :   M2Debug_Assert (SymbolTable_IsDefImp (Sym));
   17010                 :          12 :   pSym = GetPsym (ModSym);
   17011                 :          12 :   switch (pSym->SymbolType)
   17012                 :             :     {
   17013                 :          12 :       case SymbolTable_DefImpSym:
   17014                 :          12 :         return Lists_IsItemInList (pSym->DefImp.DefIncludeList, Sym);
   17015                 :           0 :         break;
   17016                 :             : 
   17017                 :             : 
   17018                 :           0 :       default:
   17019                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17020                 :             :         break;
   17021                 :             :     }
   17022                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17023                 :             :   __builtin_unreachable ();
   17024                 :             : }
   17025                 :             : 
   17026                 :             : 
   17027                 :             : /*
   17028                 :             :    ForeachImportedDo - calls a procedure, P, foreach imported symbol
   17029                 :             :                        in module, ModSym.
   17030                 :             : */
   17031                 :             : 
   17032                 :       14983 : extern "C" void SymbolTable_ForeachImportedDo (unsigned int ModSym, SymbolKey_PerformOperation P)
   17033                 :             : {
   17034                 :       14983 :   SymbolTable_PtrToSymbol pSym;
   17035                 :             : 
   17036                 :       14983 :   pSym = GetPsym (ModSym);
   17037                 :       14983 :   switch (pSym->SymbolType)
   17038                 :             :     {
   17039                 :        4101 :       case SymbolTable_DefImpSym:
   17040                 :        4101 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ImportTree, P);
   17041                 :        4101 :         Lists_ForeachItemInListDo (pSym->DefImp.IncludeList, P);
   17042                 :        4101 :         break;
   17043                 :             : 
   17044                 :       10882 :       case SymbolTable_ModuleSym:
   17045                 :       10882 :         SymbolKey_ForeachNodeDo (pSym->Module.ImportTree, P);
   17046                 :       10882 :         Lists_ForeachItemInListDo (pSym->Module.IncludeList, P);
   17047                 :       10882 :         break;
   17048                 :             : 
   17049                 :             : 
   17050                 :           0 :       default:
   17051                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   17052                 :       14983 :         break;
   17053                 :             :     }
   17054                 :       14983 : }
   17055                 :             : 
   17056                 :             : 
   17057                 :             : /*
   17058                 :             :    ForeachExportedDo - calls a procedure, P, foreach imported symbol
   17059                 :             :                        in module, ModSym.
   17060                 :             : */
   17061                 :             : 
   17062                 :        8738 : extern "C" void SymbolTable_ForeachExportedDo (unsigned int ModSym, SymbolKey_PerformOperation P)
   17063                 :             : {
   17064                 :        8738 :   SymbolTable_PtrToSymbol pSym;
   17065                 :             : 
   17066                 :        8738 :   pSym = GetPsym (ModSym);
   17067                 :        8738 :   switch (pSym->SymbolType)
   17068                 :             :     {
   17069                 :        3348 :       case SymbolTable_DefImpSym:
   17070                 :        3348 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportQualifiedTree, P);
   17071                 :        3348 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportUnQualifiedTree, P);
   17072                 :        3348 :         break;
   17073                 :             : 
   17074                 :        5390 :       case SymbolTable_ModuleSym:
   17075                 :        5390 :         SymbolKey_ForeachNodeDo (pSym->Module.ExportTree, P);
   17076                 :        5390 :         break;
   17077                 :             : 
   17078                 :             : 
   17079                 :           0 :       default:
   17080                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   17081                 :        8738 :         break;
   17082                 :             :     }
   17083                 :        8738 : }
   17084                 :             : 
   17085                 :             : 
   17086                 :             : /*
   17087                 :             :    CheckForExportedImplementation - checks to see whether an implementation
   17088                 :             :                                     module is currently being compiled, if so,
   17089                 :             :                                     symbol, Sym, is removed from the
   17090                 :             :                                     NeedToBeImplemented list.
   17091                 :             :                                     This procedure is called whenever a symbol
   17092                 :             :                                     is declared, thus attempting to reduce
   17093                 :             :                                     the NeedToBeImplemented list.
   17094                 :             :                                     Only needs to be called when a TYPE or
   17095                 :             :                                     PROCEDURE is built since the implementation
   17096                 :             :                                     module can only implement these objects
   17097                 :             :                                     declared in the definition module.
   17098                 :             : 
   17099                 :             :                                     It also checks whether a definition module
   17100                 :             :                                     is currently being compiled and, if so,
   17101                 :             :                                     it will ensure that symbol, Sym, is removed
   17102                 :             :                                     from the ExportRequest list. If Sym is an
   17103                 :             :                                     enumerated type it ensures that its fields
   17104                 :             :                                     are also removed.
   17105                 :             : */
   17106                 :             : 
   17107                 :     2374505 : extern "C" void SymbolTable_CheckForExportedImplementation (unsigned int Sym)
   17108                 :             : {
   17109                 :     2374505 :   if (M2Comp_CompilingImplementationModule ())
   17110                 :             :     {
   17111                 :     2227705 :       RemoveExportUnImplemented (SymbolTable_GetCurrentModule (), Sym);
   17112                 :             :     }
   17113                 :     2374505 :   if ((M2Comp_CompilingDefinitionModule ()) && (SymbolTable_IsEnumeration (Sym)))
   17114                 :             :     {
   17115                 :       18816 :       RemoveEnumerationFromExportRequest (SymbolTable_GetCurrentModule (), Sym);
   17116                 :             :     }
   17117                 :     2374505 : }
   17118                 :             : 
   17119                 :             : 
   17120                 :             : /*
   17121                 :             :    CheckForUnImplementedExports - displays an error and the offending symbols
   17122                 :             :                                   which have been exported but not implemented
   17123                 :             :                                   from the current compiled module.
   17124                 :             : */
   17125                 :             : 
   17126                 :       71241 : extern "C" void SymbolTable_CheckForUnImplementedExports (void)
   17127                 :             : {
   17128                 :       71241 :   SymbolTable_PtrToSymbol pSym;
   17129                 :             : 
   17130                 :             :   /* WriteString('Inside CheckForImplementedExports') ; WriteLn ;  */
   17131                 :       71241 :   pSym = GetPsym (CurrentModule);
   17132                 :       71241 :   switch (pSym->SymbolType)
   17133                 :             :     {
   17134                 :       71241 :       case SymbolTable_DefImpSym:
   17135                 :       71241 :         if (! (SymbolKey_IsEmptyTree (pSym->DefImp.NeedToBeImplemented)))
   17136                 :             :           {
   17137                 :           0 :             CurrentError = M2Error_NewError (M2LexBuf_GetTokenNo ());
   17138                 :           0 :             M2Error_ErrorFormat1 (CurrentError, (const char *) "unimplemented identifier(s) in EXPORT list of DEFINITION MODULE %a\\nthe implementation module fails to implement the following exported identifier(s)", 149, (const unsigned char *) &pSym->DefImp.name, (sizeof (pSym->DefImp.name)-1));
   17139                 :           0 :             SymbolKey_ForeachNodeDo (pSym->DefImp.NeedToBeImplemented, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) UnImplementedSymbolError});
   17140                 :             :           }
   17141                 :       71241 :         break;
   17142                 :             : 
   17143                 :             : 
   17144                 :           0 :       default:
   17145                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17146                 :       71241 :         break;
   17147                 :             :     }
   17148                 :       71241 : }
   17149                 :             : 
   17150                 :             : 
   17151                 :             : /*
   17152                 :             :    CheckForUndeclaredExports - displays an error and the offending symbols
   17153                 :             :                                which have been exported but not declared
   17154                 :             :                                from module, ModSym.
   17155                 :             : */
   17156                 :             : 
   17157                 :      176394 : extern "C" void SymbolTable_CheckForUndeclaredExports (unsigned int ModSym)
   17158                 :             : {
   17159                 :      176394 :   SymbolTable_PtrToSymbol pSym;
   17160                 :             : 
   17161                 :             :   /* WriteString('Inside CheckForUndeclaredExports') ; WriteLn ;  */
   17162                 :      176394 :   pSym = GetPsym (ModSym);
   17163                 :      176394 :   switch (pSym->SymbolType)
   17164                 :             :     {
   17165                 :       12090 :       case SymbolTable_ModuleSym:
   17166                 :       12090 :         if (! (SymbolKey_IsEmptyTree (pSym->Module.ExportUndeclared)))
   17167                 :             :           {
   17168                 :           0 :             M2MetaError_MetaError1 ((const char *) "undeclared identifier(s) in EXPORT list of {%1ERd} {%1a}", 56, ModSym);
   17169                 :           0 :             SymbolKey_ForeachNodeDo (pSym->Module.ExportUndeclared, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) UndeclaredSymbolError});
   17170                 :             :           }
   17171                 :             :         break;
   17172                 :             : 
   17173                 :      164304 :       case SymbolTable_DefImpSym:
   17174                 :      164304 :         if (! (SymbolKey_IsEmptyTree (pSym->DefImp.ExportUndeclared)))
   17175                 :             :           {
   17176                 :           0 :             if (SymbolTable_DoesNotNeedExportList (ModSym))
   17177                 :             :               {
   17178                 :           0 :                 M2MetaError_MetaError1 ((const char *) "undeclared identifier(s) in {%1ERd} {%1a}", 41, ModSym);
   17179                 :             :               }
   17180                 :             :             else
   17181                 :             :               {
   17182                 :           0 :                 M2MetaError_MetaError1 ((const char *) "undeclared identifier(s) in export list of {%1ERd} {%1a}", 56, ModSym);
   17183                 :             :               }
   17184                 :           0 :             SymbolKey_ForeachNodeDo (pSym->DefImp.ExportUndeclared, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) UndeclaredSymbolError});
   17185                 :             :           }
   17186                 :             :         break;
   17187                 :             : 
   17188                 :             : 
   17189                 :           0 :       default:
   17190                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   17191                 :      176394 :         break;
   17192                 :             :     }
   17193                 :      176394 : }
   17194                 :             : 
   17195                 :             : 
   17196                 :             : /*
   17197                 :             :    CheckForUnknownInModule - checks for any unknown symbols in the
   17198                 :             :                              current module.
   17199                 :             :                              If any unknown symbols are found then
   17200                 :             :                              an error message is displayed.
   17201                 :             : */
   17202                 :             : 
   17203                 :      493192 : extern "C" void SymbolTable_CheckForUnknownInModule (unsigned int tokno)
   17204                 :             : {
   17205                 :      493192 :   SymbolTable_PtrToSymbol pSym;
   17206                 :             : 
   17207                 :      493192 :   pSym = GetPsym (SymbolTable_GetCurrentModuleScope ());
   17208                 :      493192 :   switch (pSym->SymbolType)
   17209                 :             :     {
   17210                 :      469355 :       case SymbolTable_DefImpSym:
   17211                 :      469355 :         CheckForUnknowns (tokno, pSym->DefImp.name, pSym->DefImp.ExportQualifiedTree, (const char *) "EXPORT QUALIFIED", 16);
   17212                 :      469355 :         CheckForUnknowns (tokno, pSym->DefImp.name, pSym->DefImp.ExportUnQualifiedTree, (const char *) "EXPORT UNQUALIFIED", 18);
   17213                 :      469355 :         CheckForSymbols (pSym->DefImp.ExportRequest, (const char *) "requested by another modules import (symbols have not been exported by the appropriate definition module)", 105);
   17214                 :      469355 :         CheckForUnknowns (tokno, pSym->DefImp.name, pSym->DefImp.Unresolved, (const char *) "unresolved", 10);
   17215                 :      469355 :         CheckForUnknowns (tokno, pSym->DefImp.name, pSym->DefImp.LocalSymbols, (const char *) "locally used", 12);
   17216                 :      469355 :         break;
   17217                 :             : 
   17218                 :       23837 :       case SymbolTable_ModuleSym:
   17219                 :       23837 :         CheckForUnknowns (tokno, pSym->Module.name, pSym->Module.Unresolved, (const char *) "unresolved", 10);
   17220                 :       23837 :         CheckForUnknowns (tokno, pSym->Module.name, pSym->Module.ExportUndeclared, (const char *) "exported but undeclared", 23);
   17221                 :       23837 :         CheckForUnknowns (tokno, pSym->Module.name, pSym->Module.ExportTree, (const char *) "exported but undeclared", 23);
   17222                 :       23837 :         CheckForUnknowns (tokno, pSym->Module.name, pSym->Module.LocalSymbols, (const char *) "locally used", 12);
   17223                 :       23837 :         break;
   17224                 :             : 
   17225                 :             : 
   17226                 :           0 :       default:
   17227                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   17228                 :      493192 :         break;
   17229                 :             :     }
   17230                 :      493192 : }
   17231                 :             : 
   17232                 :             : 
   17233                 :             : /*
   17234                 :             :    UnknownReported - if sym is an unknown symbol and has not been reported
   17235                 :             :                      then include it into the set of reported unknowns.
   17236                 :             : */
   17237                 :             : 
   17238                 :          48 : extern "C" void SymbolTable_UnknownReported (unsigned int sym)
   17239                 :             : {
   17240                 :          48 :   if (IsUnreportedUnknown (sym))
   17241                 :             :     {
   17242                 :          48 :       Sets_IncludeElementIntoSet (ReportedUnknowns, sym);
   17243                 :             :     }
   17244                 :          48 : }
   17245                 :             : 
   17246                 :             : 
   17247                 :             : /*
   17248                 :             :    IsReallyPointer - returns TRUE is sym is a pointer, address or a
   17249                 :             :                      type declared as a pointer or address.
   17250                 :             : */
   17251                 :             : 
   17252                 :      779818 : extern "C" bool SymbolTable_IsReallyPointer (unsigned int Sym)
   17253                 :             : {
   17254                 :      779818 :   if (SymbolTable_IsVar (Sym))
   17255                 :             :     {
   17256                 :      229455 :       Sym = SymbolTable_GetType (Sym);
   17257                 :             :     }
   17258                 :      779818 :   Sym = SymbolTable_SkipType (Sym);
   17259                 :      779818 :   return ((SymbolTable_IsPointer (Sym)) || (Sym == M2System_Address)) || (SymbolTable_IsHiddenReallyPointer (Sym));
   17260                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   17261                 :             :   __builtin_unreachable ();
   17262                 :             : }
   17263                 :             : 
   17264                 :             : 
   17265                 :             : /*
   17266                 :             :    CheckHiddenTypeAreAddress - checks to see that any hidden types
   17267                 :             :                                which we have declared are actually
   17268                 :             :                                of type ADDRESS or map onto a POINTER type.
   17269                 :             : */
   17270                 :             : 
   17271                 :       14515 : extern "C" void SymbolTable_CheckHiddenTypeAreAddress (void)
   17272                 :             : {
   17273                 :       14515 :   NameKey_Name name;
   17274                 :       14515 :   M2Error_Error e;
   17275                 :       14515 :   unsigned int sym;
   17276                 :       14515 :   unsigned int i;
   17277                 :       14515 :   unsigned int n;
   17278                 :             : 
   17279                 :       14515 :   i = 1;
   17280                 :       14515 :   n = Lists_NoOfItemsInList (AddressTypes);
   17281                 :       55847 :   while (i <= n)
   17282                 :             :     {
   17283                 :       26817 :       sym = static_cast<unsigned int> (Lists_GetItemFromList (AddressTypes, i));
   17284                 :       26817 :       if (! (SymbolTable_IsHiddenReallyPointer (sym)))
   17285                 :             :         {
   17286                 :           6 :           name = SymbolTable_GetSymName (sym);
   17287                 :           6 :           e = M2Error_NewError (SymbolTable_GetDeclaredDef (sym));
   17288                 :           6 :           M2Error_ErrorFormat1 (e, (const char *) "opaque type (%a) should be equivalent to a POINTER or an ADDRESS", 64, (const unsigned char *) &name, (sizeof (name)-1));
   17289                 :           6 :           e = M2Error_NewError (SymbolTable_GetDeclaredMod (sym));
   17290                 :           6 :           M2Error_ErrorFormat0 (e, (const char *) "if you really need a non POINTER type use the -fextended-opaque switch", 70);
   17291                 :             :         }
   17292                 :       26817 :       i += 1;
   17293                 :             :     }
   17294                 :       14515 : }
   17295                 :             : 
   17296                 :             : 
   17297                 :             : /*
   17298                 :             :    PutDefinitionForC - sets a flag in the current compiled module which
   17299                 :             :                        indicates that this module is a wrapper for a C
   17300                 :             :                        file. Parameters passes to procedures in this module
   17301                 :             :                        will adopt the C calling convention.
   17302                 :             : */
   17303                 :             : 
   17304                 :       26240 : extern "C" void SymbolTable_PutDefinitionForC (unsigned int Sym)
   17305                 :             : {
   17306                 :       26240 :   SymbolTable_PtrToSymbol pSym;
   17307                 :             : 
   17308                 :       26240 :   pSym = GetPsym (Sym);
   17309                 :       26240 :   switch (pSym->SymbolType)
   17310                 :             :     {
   17311                 :       26240 :       case SymbolTable_DefImpSym:
   17312                 :       26240 :         pSym->DefImp.ForC = true;
   17313                 :       26240 :         break;
   17314                 :             : 
   17315                 :             : 
   17316                 :           0 :       default:
   17317                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17318                 :       26240 :         break;
   17319                 :             :     }
   17320                 :       26240 : }
   17321                 :             : 
   17322                 :             : 
   17323                 :             : /*
   17324                 :             :    IsDefinitionForC - returns true if this definition module was declared
   17325                 :             :                       as a DEFINITION MODULE FOR "C".
   17326                 :             : */
   17327                 :             : 
   17328                 :     1216571 : extern "C" bool SymbolTable_IsDefinitionForC (unsigned int Sym)
   17329                 :             : {
   17330                 :     1216571 :   SymbolTable_PtrToSymbol pSym;
   17331                 :             : 
   17332                 :     1216571 :   pSym = GetPsym (Sym);
   17333                 :     1216571 :   switch (pSym->SymbolType)
   17334                 :             :     {
   17335                 :     1216571 :       case SymbolTable_DefImpSym:
   17336                 :     1216571 :         return pSym->DefImp.ForC;
   17337                 :           0 :         break;
   17338                 :             : 
   17339                 :             : 
   17340                 :           0 :       default:
   17341                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17342                 :             :         break;
   17343                 :             :     }
   17344                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17345                 :             :   __builtin_unreachable ();
   17346                 :             : }
   17347                 :             : 
   17348                 :             : 
   17349                 :             : /*
   17350                 :             :    PutDoesNeedExportList - sets a flag in module, Sym, which
   17351                 :             :                            indicates that this module requires an explicit
   17352                 :             :                            EXPORT QUALIFIED or UNQUALIFIED list. PIM-2
   17353                 :             : */
   17354                 :             : 
   17355                 :       86803 : extern "C" void SymbolTable_PutDoesNeedExportList (unsigned int Sym)
   17356                 :             : {
   17357                 :       86803 :   SymbolTable_PtrToSymbol pSym;
   17358                 :             : 
   17359                 :       86803 :   pSym = GetPsym (Sym);
   17360                 :       86803 :   switch (pSym->SymbolType)
   17361                 :             :     {
   17362                 :       86803 :       case SymbolTable_DefImpSym:
   17363                 :       86803 :         pSym->DefImp.NeedExportList = true;
   17364                 :       86803 :         break;
   17365                 :             : 
   17366                 :             : 
   17367                 :           0 :       default:
   17368                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17369                 :       86803 :         break;
   17370                 :             :     }
   17371                 :       86803 : }
   17372                 :             : 
   17373                 :             : 
   17374                 :             : /*
   17375                 :             :    PutDoesNotNeedExportList - sets a flag in module, Sym, which
   17376                 :             :                               indicates that this module does not require an explicit
   17377                 :             :                               EXPORT QUALIFIED or UNQUALIFIED list. PIM-3|4
   17378                 :             : */
   17379                 :             : 
   17380                 :      164472 : extern "C" void SymbolTable_PutDoesNotNeedExportList (unsigned int Sym)
   17381                 :             : {
   17382                 :      164472 :   SymbolTable_PtrToSymbol pSym;
   17383                 :             : 
   17384                 :      164472 :   pSym = GetPsym (Sym);
   17385                 :      164472 :   switch (pSym->SymbolType)
   17386                 :             :     {
   17387                 :      164472 :       case SymbolTable_DefImpSym:
   17388                 :      164472 :         pSym->DefImp.NeedExportList = false;
   17389                 :      164472 :         break;
   17390                 :             : 
   17391                 :             : 
   17392                 :           0 :       default:
   17393                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17394                 :      164472 :         break;
   17395                 :             :     }
   17396                 :      164472 : }
   17397                 :             : 
   17398                 :             : 
   17399                 :             : /*
   17400                 :             :    DoesNotNeedExportList - returns TRUE if module, Sym, does not require an explicit
   17401                 :             :                            EXPORT QUALIFIED list.
   17402                 :             : */
   17403                 :             : 
   17404                 :     4062894 : extern "C" bool SymbolTable_DoesNotNeedExportList (unsigned int Sym)
   17405                 :             : {
   17406                 :     4062894 :   SymbolTable_PtrToSymbol pSym;
   17407                 :             : 
   17408                 :     4062894 :   pSym = GetPsym (Sym);
   17409                 :     4062894 :   switch (pSym->SymbolType)
   17410                 :             :     {
   17411                 :     4062894 :       case SymbolTable_DefImpSym:
   17412                 :     4062894 :         return ! pSym->DefImp.NeedExportList;
   17413                 :           0 :         break;
   17414                 :             : 
   17415                 :             : 
   17416                 :           0 :       default:
   17417                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   17418                 :             :         break;
   17419                 :             :     }
   17420                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17421                 :             :   __builtin_unreachable ();
   17422                 :             : }
   17423                 :             : 
   17424                 :             : 
   17425                 :             : /*
   17426                 :             :    CheckForEnumerationInCurrentModule - checks to see whether the enumeration
   17427                 :             :                                         type symbol, Sym, has been entered into
   17428                 :             :                                         the current modules scope list.
   17429                 :             : */
   17430                 :             : 
   17431                 :     1701382 : extern "C" void SymbolTable_CheckForEnumerationInCurrentModule (unsigned int Sym)
   17432                 :             : {
   17433                 :     1701382 :   SymbolTable_PtrToSymbol pSym;
   17434                 :     1701382 :   unsigned int ModSym;
   17435                 :             : 
   17436                 :     1701382 :   if (((SymbolTable_SkipType (Sym)) != SymbolTable_NulSym) && (SymbolTable_IsEnumeration (SymbolTable_SkipType (Sym))))
   17437                 :             :     {
   17438                 :       17738 :       Sym = SymbolTable_SkipType (Sym);
   17439                 :             :     }
   17440                 :     1701382 :   if (SymbolTable_IsEnumeration (Sym))
   17441                 :             :     {
   17442                 :       17738 :       ModSym = SymbolTable_GetCurrentModuleScope ();
   17443                 :       17738 :       pSym = GetPsym (ModSym);
   17444                 :       17738 :       switch (pSym->SymbolType)
   17445                 :             :         {
   17446                 :       17336 :           case SymbolTable_DefImpSym:
   17447                 :       17336 :             CheckEnumerationInList (pSym->DefImp.EnumerationScopeList, Sym);
   17448                 :       17336 :             break;
   17449                 :             : 
   17450                 :         402 :           case SymbolTable_ModuleSym:
   17451                 :         402 :             CheckEnumerationInList (pSym->Module.EnumerationScopeList, Sym);
   17452                 :         402 :             break;
   17453                 :             : 
   17454                 :             : 
   17455                 :           0 :           default:
   17456                 :           0 :             M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   17457                 :             :             break;
   17458                 :             :         }
   17459                 :             :     }
   17460                 :     1701382 : }
   17461                 :             : 
   17462                 :             : 
   17463                 :             : /*
   17464                 :             :    SanityCheckConstants - must only be called once all constants, types, procedures
   17465                 :             :                           have been declared.  It checks to see that constants are
   17466                 :             :                           not used as procedure parameter types.
   17467                 :             : */
   17468                 :             : 
   17469                 :       15213 : extern "C" void SymbolTable_SanityCheckConstants (void)
   17470                 :             : {
   17471                 :       15213 :   SymbolTable_ForeachModuleDo ((SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SanityCheckModule});
   17472                 :       15213 :   ForeachSymbolDo ((SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) SanityCheckArray});
   17473                 :       15213 : }
   17474                 :             : 
   17475                 :             : 
   17476                 :             : /*
   17477                 :             :    ForeachLocalSymDo - foreach local symbol in module, Sym, or procedure, Sym,
   17478                 :             :                        perform the procedure, P.
   17479                 :             : */
   17480                 :             : 
   17481                 :    13321104 : extern "C" void SymbolTable_ForeachLocalSymDo (unsigned int Sym, SymbolKey_PerformOperation P)
   17482                 :             : {
   17483                 :    13321104 :   SymbolTable_PtrToSymbol pSym;
   17484                 :             : 
   17485                 :    13321104 :   pSym = GetPsym (Sym);
   17486                 :    13321104 :   switch (pSym->SymbolType)
   17487                 :             :     {
   17488                 :      603761 :       case SymbolTable_DefImpSym:
   17489                 :      603761 :         SymbolKey_ForeachNodeDo (pSym->DefImp.LocalSymbols, P);
   17490                 :      603761 :         break;
   17491                 :             : 
   17492                 :       94239 :       case SymbolTable_ModuleSym:
   17493                 :       94239 :         SymbolKey_ForeachNodeDo (pSym->Module.LocalSymbols, P);
   17494                 :       94239 :         break;
   17495                 :             : 
   17496                 :      258128 :       case SymbolTable_ProcedureSym:
   17497                 :      258128 :         SymbolKey_ForeachNodeDo (pSym->Procedure.LocalSymbols, P);
   17498                 :      258128 :         break;
   17499                 :             : 
   17500                 :           0 :       case SymbolTable_RecordSym:
   17501                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Record.LocalSymbols, P);
   17502                 :           0 :         break;
   17503                 :             : 
   17504                 :    12364976 :       case SymbolTable_EnumerationSym:
   17505                 :    12364976 :         SymbolKey_ForeachNodeDo (pSym->Enumeration.LocalSymbols, P);
   17506                 :    12364976 :         break;
   17507                 :             : 
   17508                 :             : 
   17509                 :           0 :       default:
   17510                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp, Module or Procedure symbol", 46);
   17511                 :    13321104 :         break;
   17512                 :             :     }
   17513                 :    13321104 : }
   17514                 :             : 
   17515                 :             : 
   17516                 :             : /*
   17517                 :             :    ForeachParamSymDo - foreach parameter symbol in procedure Sym
   17518                 :             :                        perform the procedure P.  Each symbol
   17519                 :             :                        looked up will be VarParam or Param
   17520                 :             :                        (not the shadow variable).  Every parameter
   17521                 :             :                        from each KindProcedure is iterated over.
   17522                 :             : */
   17523                 :             : 
   17524                 :     1912360 : extern "C" void SymbolTable_ForeachParamSymDo (unsigned int Sym, SymbolKey_PerformOperation P)
   17525                 :             : {
   17526                 :     1912360 :   SymbolTable_ProcedureKind kind;
   17527                 :     1912360 :   unsigned int param;
   17528                 :     1912360 :   unsigned int p;
   17529                 :     1912360 :   unsigned int i;
   17530                 :             : 
   17531                 :     1912360 :   if (SymbolTable_IsProcedure (Sym))
   17532                 :             :     {
   17533                 :     7591144 :       for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   17534                 :             :         {
   17535                 :     5693358 :           p = SymbolTable_NoOfParam (Sym, kind);
   17536                 :     5693358 :           i = p;
   17537                 :    17317707 :           while (i > 0)
   17538                 :             :             {
   17539                 :     5930991 :               param = SymbolTable_GetNthParam (Sym, kind, i);
   17540                 :     5930991 :               (*P.proc) (param);
   17541                 :     5930991 :               i -= 1;
   17542                 :             :             }
   17543                 :             :         }
   17544                 :             :     }
   17545                 :     1912360 : }
   17546                 :             : 
   17547                 :             : 
   17548                 :             : /*
   17549                 :             :    ForeachFieldEnumerationDo - for each field in enumeration, Sym,
   17550                 :             :                                do procedure, P.  Each call to P contains
   17551                 :             :                                an enumeration field, the order is alphabetical.
   17552                 :             :                                Use ForeachLocalSymDo for declaration order.
   17553                 :             : */
   17554                 :             : 
   17555                 :       93023 : extern "C" void SymbolTable_ForeachFieldEnumerationDo (unsigned int Sym, SymbolKey_PerformOperation P)
   17556                 :             : {
   17557                 :       93023 :   SymbolTable_PtrToSymbol pSym;
   17558                 :             : 
   17559                 :       93023 :   pSym = GetPsym (Sym);
   17560                 :       93023 :   switch (pSym->SymbolType)
   17561                 :             :     {
   17562                 :       93023 :       case SymbolTable_EnumerationSym:
   17563                 :       93023 :         SymbolKey_ForeachNodeDo (pSym->Enumeration.LocalSymbols, P);
   17564                 :       93023 :         break;
   17565                 :             : 
   17566                 :             : 
   17567                 :           0 :       default:
   17568                 :           0 :         M2Error_InternalError ((const char *) "expecting Enumeration symbol", 28);
   17569                 :       93023 :         break;
   17570                 :             :     }
   17571                 :       93023 : }
   17572                 :             : 
   17573                 :             : 
   17574                 :             : /*
   17575                 :             :    IsType - returns true if the Sym is a type symbol.
   17576                 :             : */
   17577                 :             : 
   17578                 :  1668327039 : extern "C" bool SymbolTable_IsType (unsigned int Sym)
   17579                 :             : {
   17580                 :  1668327039 :   SymbolTable_PtrToSymbol pSym;
   17581                 :             : 
   17582                 :  1668327039 :   pSym = GetPsym (Sym);
   17583                 :  1668327039 :   return pSym->SymbolType == SymbolTable_TypeSym;
   17584                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   17585                 :             :   __builtin_unreachable ();
   17586                 :             : }
   17587                 :             : 
   17588                 :             : 
   17589                 :             : /*
   17590                 :             :    IsProcedure - returns true if Sym is a procedure symbol.
   17591                 :             : */
   17592                 :             : 
   17593                 :   428548245 : extern "C" bool SymbolTable_IsProcedure (unsigned int Sym)
   17594                 :             : {
   17595                 :   428548245 :   SymbolTable_PtrToSymbol pSym;
   17596                 :             : 
   17597                 :   428548245 :   AssertInRange (Sym);
   17598                 :   428548245 :   pSym = GetPsym (Sym);
   17599                 :   428548245 :   return pSym->SymbolType == SymbolTable_ProcedureSym;
   17600                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   17601                 :             :   __builtin_unreachable ();
   17602                 :             : }
   17603                 :             : 
   17604                 :             : 
   17605                 :             : /*
   17606                 :             :    IsParameter - returns true if Sym is a parameter symbol.
   17607                 :             : */
   17608                 :             : 
   17609                 :    74266953 : extern "C" bool SymbolTable_IsParameter (unsigned int Sym)
   17610                 :             : {
   17611                 :    74266953 :   SymbolTable_PtrToSymbol pSym;
   17612                 :             : 
   17613                 :    74266953 :   pSym = GetPsym (Sym);
   17614                 :    74266953 :   switch (pSym->SymbolType)
   17615                 :             :     {
   17616                 :             :       case SymbolTable_ParamSym:
   17617                 :             :       case SymbolTable_VarParamSym:
   17618                 :             :         return true;
   17619                 :    66176147 :         break;
   17620                 :             : 
   17621                 :             : 
   17622                 :    66176147 :       default:
   17623                 :    66176147 :         return false;
   17624                 :             :         break;
   17625                 :             :     }
   17626                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   17627                 :             :   __builtin_unreachable ();
   17628                 :             : }
   17629                 :             : 
   17630                 :             : 
   17631                 :             : /*
   17632                 :             :    GetProcedureKind - returns the procedure kind given the declaration tok.
   17633                 :             :                       The declaration tok must match the ident tok in the
   17634                 :             :                       procedure name.  It is only safe to call this
   17635                 :             :                       procedure function during pass 2 onwards.
   17636                 :             : */
   17637                 :             : 
   17638                 :    32334129 : extern "C" SymbolTable_ProcedureKind SymbolTable_GetProcedureKind (unsigned int sym, unsigned int tok)
   17639                 :             : {
   17640                 :    32334129 :   SymbolTable_ProcedureKind kind;
   17641                 :    32334129 :   SymbolTable_PtrToSymbol pSym;
   17642                 :             : 
   17643                 :    32334129 :   pSym = GetPsym (sym);
   17644                 :    32334129 :   switch (pSym->SymbolType)
   17645                 :             :     {
   17646                 :             :       case SymbolTable_ProcedureSym:
   17647                 :    71978237 :         for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   17648                 :             :           {
   17649                 :    71978237 :             if (pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ProcedureTok == tok)
   17650                 :             :               {
   17651                 :             :                 return kind;
   17652                 :             :               }
   17653                 :             :           }
   17654                 :           0 :         break;
   17655                 :             : 
   17656                 :             :       case SymbolTable_ProcTypeSym:
   17657                 :             :         return SymbolTable_ProperProcedure;
   17658                 :           0 :         break;
   17659                 :             : 
   17660                 :             : 
   17661                 :           0 :       default:
   17662                 :           0 :         M2Error_InternalError ((const char *) "expecting ProcedureSym symbol", 29);
   17663                 :           0 :         break;
   17664                 :             :     }
   17665                 :           0 :   M2Error_InternalError ((const char *) "ProcedureSym kind has not yet been declared", 43);
   17666                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17667                 :             :   __builtin_unreachable ();
   17668                 :             : }
   17669                 :             : 
   17670                 :             : 
   17671                 :             : /*
   17672                 :             :    GetProcedureDeclaredTok - return the token where the
   17673                 :             :                              declaration of procedure sym:kind
   17674                 :             :                              occurred.
   17675                 :             : */
   17676                 :             : 
   17677                 :          36 : extern "C" unsigned int SymbolTable_GetProcedureDeclaredTok (unsigned int sym, SymbolTable_ProcedureKind kind)
   17678                 :             : {
   17679                 :          36 :   SymbolTable_PtrToSymbol pSym;
   17680                 :             : 
   17681                 :          36 :   pSym = GetPsym (sym);
   17682                 :          36 :   switch (pSym->SymbolType)
   17683                 :             :     {
   17684                 :          36 :       case SymbolTable_ProcedureSym:
   17685                 :          36 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ProcedureTok;
   17686                 :           0 :         break;
   17687                 :             : 
   17688                 :             : 
   17689                 :           0 :       default:
   17690                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   17691                 :             :         break;
   17692                 :             :     }
   17693                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17694                 :             :   __builtin_unreachable ();
   17695                 :             : }
   17696                 :             : 
   17697                 :             : 
   17698                 :             : /*
   17699                 :             :    PutProcedureDeclaredTok - places the tok where the
   17700                 :             :                              declaration of procedure sym:kind
   17701                 :             :                              occurred.
   17702                 :             : */
   17703                 :             : 
   17704                 :     5447454 : extern "C" void SymbolTable_PutProcedureDeclaredTok (unsigned int sym, SymbolTable_ProcedureKind kind, unsigned int tok)
   17705                 :             : {
   17706                 :     5447454 :   SymbolTable_PtrToSymbol pSym;
   17707                 :             : 
   17708                 :     5447454 :   pSym = GetPsym (sym);
   17709                 :     5447454 :   switch (pSym->SymbolType)
   17710                 :             :     {
   17711                 :     5447454 :       case SymbolTable_ProcedureSym:
   17712                 :     5447454 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ProcedureTok = tok;
   17713                 :     5447454 :         break;
   17714                 :             : 
   17715                 :             : 
   17716                 :           0 :       default:
   17717                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   17718                 :     5447454 :         break;
   17719                 :             :     }
   17720                 :     5447454 : }
   17721                 :             : 
   17722                 :             : 
   17723                 :             : /*
   17724                 :             :    GetReturnTypeTok - return the token where the
   17725                 :             :                                return type procedure sym:kind or proctype
   17726                 :             :                                was defined.
   17727                 :             : */
   17728                 :             : 
   17729                 :           6 : extern "C" unsigned int SymbolTable_GetReturnTypeTok (unsigned int sym, SymbolTable_ProcedureKind kind)
   17730                 :             : {
   17731                 :           6 :   SymbolTable_PtrToSymbol pSym;
   17732                 :             : 
   17733                 :           6 :   pSym = GetPsym (sym);
   17734                 :           6 :   switch (pSym->SymbolType)
   17735                 :             :     {
   17736                 :           6 :       case SymbolTable_ProcedureSym:
   17737                 :           6 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnTypeTok;
   17738                 :           0 :         break;
   17739                 :             : 
   17740                 :           0 :       case SymbolTable_ProcTypeSym:
   17741                 :           0 :         return pSym->ProcType.ReturnTypeTok;
   17742                 :           0 :         break;
   17743                 :             : 
   17744                 :             : 
   17745                 :           0 :       default:
   17746                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   17747                 :             :         break;
   17748                 :             :     }
   17749                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17750                 :             :   __builtin_unreachable ();
   17751                 :             : }
   17752                 :             : 
   17753                 :             : 
   17754                 :             : /*
   17755                 :             :    PutReturnTypeTok - places the tok where the
   17756                 :             :                       return type of procedure sym:kind or proctype
   17757                 :             :                       was defined.
   17758                 :             : */
   17759                 :             : 
   17760                 :           0 : extern "C" void SymbolTable_PutReturnTypeTok (unsigned int sym, SymbolTable_ProcedureKind kind, unsigned int tok)
   17761                 :             : {
   17762                 :           0 :   SymbolTable_PtrToSymbol pSym;
   17763                 :             : 
   17764                 :           0 :   pSym = GetPsym (sym);
   17765                 :           0 :   switch (pSym->SymbolType)
   17766                 :             :     {
   17767                 :           0 :       case SymbolTable_ProcedureSym:
   17768                 :           0 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnTypeTok = tok;
   17769                 :           0 :         break;
   17770                 :             : 
   17771                 :           0 :       case SymbolTable_ProcTypeSym:
   17772                 :           0 :         pSym->ProcType.ReturnTypeTok = tok;
   17773                 :           0 :         break;
   17774                 :             : 
   17775                 :             : 
   17776                 :           0 :       default:
   17777                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure symbol", 26);
   17778                 :           0 :         break;
   17779                 :             :     }
   17780                 :           0 : }
   17781                 :             : 
   17782                 :             : 
   17783                 :             : /*
   17784                 :             :    PutProcedureParametersDefined - the procedure symbol sym:kind
   17785                 :             :                                    parameters have been defined.
   17786                 :             : */
   17787                 :             : 
   17788                 :    10713629 : extern "C" void SymbolTable_PutProcedureParametersDefined (unsigned int sym, SymbolTable_ProcedureKind kind)
   17789                 :             : {
   17790                 :    10713629 :   SymbolTable_PtrToSymbol pSym;
   17791                 :             : 
   17792                 :    10713629 :   AssertInRange (sym);
   17793                 :    10713629 :   pSym = GetPsym (sym);
   17794                 :    10713629 :   switch (pSym->SymbolType)
   17795                 :             :     {
   17796                 :             :       case SymbolTable_ErrorSym:
   17797                 :             :         break;
   17798                 :             : 
   17799                 :    10713629 :       case SymbolTable_ProcedureSym:
   17800                 :    10713629 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ParamDefined = true;
   17801                 :    10713629 :         pSym->Procedure.BuildProcType = false;
   17802                 :    10713629 :         break;
   17803                 :             : 
   17804                 :             :       case SymbolTable_ProcTypeSym:
   17805                 :             :         break;
   17806                 :             : 
   17807                 :             : 
   17808                 :           0 :       default:
   17809                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   17810                 :    10713629 :         break;
   17811                 :             :     }
   17812                 :    10713629 : }
   17813                 :             : 
   17814                 :             : 
   17815                 :             : /*
   17816                 :             :    GetProcedureParametersDefined - returns true if procedure symbol sym:kind
   17817                 :             :                                    parameters are defined.
   17818                 :             : */
   17819                 :             : 
   17820                 :   184466020 : extern "C" bool SymbolTable_GetProcedureParametersDefined (unsigned int sym, SymbolTable_ProcedureKind kind)
   17821                 :             : {
   17822                 :   184466020 :   SymbolTable_PtrToSymbol pSym;
   17823                 :             : 
   17824                 :   184466020 :   AssertInRange (sym);
   17825                 :   184466020 :   pSym = GetPsym (sym);
   17826                 :   184466020 :   switch (pSym->SymbolType)
   17827                 :             :     {
   17828                 :             :       case SymbolTable_ErrorSym:
   17829                 :             :         return false;
   17830                 :   175517078 :         break;
   17831                 :             : 
   17832                 :   175517078 :       case SymbolTable_ProcedureSym:
   17833                 :   175517078 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ParamDefined;
   17834                 :     8948942 :         break;
   17835                 :             : 
   17836                 :     8948942 :       case SymbolTable_ProcTypeSym:
   17837                 :     8948942 :         return true;
   17838                 :           0 :         break;
   17839                 :             : 
   17840                 :             : 
   17841                 :           0 :       default:
   17842                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   17843                 :             :         break;
   17844                 :             :     }
   17845                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17846                 :             :   __builtin_unreachable ();
   17847                 :             : }
   17848                 :             : 
   17849                 :             : 
   17850                 :             : /*
   17851                 :             :    PutProcedureDefined - the procedure symbol sym:kind is defined.
   17852                 :             : */
   17853                 :             : 
   17854                 :     7204534 : extern "C" void SymbolTable_PutProcedureDefined (unsigned int sym, SymbolTable_ProcedureKind kind)
   17855                 :             : {
   17856                 :     7204534 :   SymbolTable_PtrToSymbol pSym;
   17857                 :             : 
   17858                 :     7204534 :   AssertInRange (sym);
   17859                 :     7204534 :   pSym = GetPsym (sym);
   17860                 :     7204534 :   switch (pSym->SymbolType)
   17861                 :             :     {
   17862                 :             :       case SymbolTable_ErrorSym:
   17863                 :             :         break;
   17864                 :             : 
   17865                 :     7204534 :       case SymbolTable_ProcedureSym:
   17866                 :     7204534 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].Defined = true;
   17867                 :     7204534 :         break;
   17868                 :             : 
   17869                 :             : 
   17870                 :           0 :       default:
   17871                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   17872                 :     7204534 :         break;
   17873                 :             :     }
   17874                 :     7204534 : }
   17875                 :             : 
   17876                 :             : 
   17877                 :             : /*
   17878                 :             :    GetProcedureDefined - returns true if procedure symbol sym:kind
   17879                 :             :                          is defined.
   17880                 :             : */
   17881                 :             : 
   17882                 :    36838376 : extern "C" bool SymbolTable_GetProcedureDefined (unsigned int sym, SymbolTable_ProcedureKind kind)
   17883                 :             : {
   17884                 :    36838376 :   SymbolTable_PtrToSymbol pSym;
   17885                 :             : 
   17886                 :    36838376 :   AssertInRange (sym);
   17887                 :    36838376 :   pSym = GetPsym (sym);
   17888                 :    36838376 :   switch (pSym->SymbolType)
   17889                 :             :     {
   17890                 :             :       case SymbolTable_ErrorSym:
   17891                 :             :         return false;
   17892                 :    36838376 :         break;
   17893                 :             : 
   17894                 :    36838376 :       case SymbolTable_ProcedureSym:
   17895                 :    36838376 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].Defined;
   17896                 :           0 :         break;
   17897                 :             : 
   17898                 :             : 
   17899                 :           0 :       default:
   17900                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure symbol", 28);
   17901                 :             :         break;
   17902                 :             :     }
   17903                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17904                 :             :   __builtin_unreachable ();
   17905                 :             : }
   17906                 :             : 
   17907                 :             : 
   17908                 :             : /*
   17909                 :             :    PutUseVarArgs - tell the symbol table that this procedure, Sym,
   17910                 :             :                    uses varargs.
   17911                 :             :                    The procedure _must_ be declared inside a
   17912                 :             :                    DEFINITION FOR "C"
   17913                 :             : 
   17914                 :             : */
   17915                 :             : 
   17916                 :       11332 : extern "C" void SymbolTable_PutUseVarArgs (unsigned int Sym)
   17917                 :             : {
   17918                 :       11332 :   SymbolTable_PtrToSymbol pSym;
   17919                 :             : 
   17920                 :       11332 :   AssertInRange (Sym);
   17921                 :       11332 :   pSym = GetPsym (Sym);
   17922                 :       11332 :   switch (pSym->SymbolType)
   17923                 :             :     {
   17924                 :             :       case SymbolTable_ErrorSym:
   17925                 :             :         break;
   17926                 :             : 
   17927                 :       11332 :       case SymbolTable_ProcedureSym:
   17928                 :             :         /* Currently can only declare var args in a definition module.  */
   17929                 :       11332 :         pSym->Procedure.Decl.array[SymbolTable_DefProcedure-SymbolTable_ProperProcedure].HasVarArgs = true;
   17930                 :       11332 :         break;
   17931                 :             : 
   17932                 :           0 :       case SymbolTable_ProcTypeSym:
   17933                 :           0 :         pSym->ProcType.HasVarArgs = true;
   17934                 :           0 :         break;
   17935                 :             : 
   17936                 :             : 
   17937                 :           0 :       default:
   17938                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   17939                 :       11332 :         break;
   17940                 :             :     }
   17941                 :       11332 : }
   17942                 :             : 
   17943                 :             : 
   17944                 :             : /*
   17945                 :             :    UsesVarArgs - returns TRUE if procedure, Sym, uses varargs.
   17946                 :             :                  The procedure _must_ be declared inside a
   17947                 :             :                  DEFINITION FOR "C"
   17948                 :             : */
   17949                 :             : 
   17950                 :     3834474 : extern "C" bool SymbolTable_UsesVarArgs (unsigned int Sym)
   17951                 :             : {
   17952                 :     3834474 :   SymbolTable_PtrToSymbol pSym;
   17953                 :             : 
   17954                 :     3834474 :   AssertInRange (Sym);
   17955                 :     3834474 :   pSym = GetPsym (Sym);
   17956                 :     3834474 :   switch (pSym->SymbolType)
   17957                 :             :     {
   17958                 :             :       case SymbolTable_ErrorSym:
   17959                 :             :         return false;
   17960                 :     3775846 :         break;
   17961                 :             : 
   17962                 :     3775846 :       case SymbolTable_ProcedureSym:
   17963                 :             :         /* Currently can only declare var args in a definition module.  */
   17964                 :     3775846 :         return pSym->Procedure.Decl.array[SymbolTable_DefProcedure-SymbolTable_ProperProcedure].HasVarArgs;
   17965                 :       58628 :         break;
   17966                 :             : 
   17967                 :       58628 :       case SymbolTable_ProcTypeSym:
   17968                 :       58628 :         return pSym->ProcType.HasVarArgs;
   17969                 :           0 :         break;
   17970                 :             : 
   17971                 :             : 
   17972                 :           0 :       default:
   17973                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   17974                 :             :         break;
   17975                 :             :     }
   17976                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   17977                 :             :   __builtin_unreachable ();
   17978                 :             : }
   17979                 :             : 
   17980                 :             : 
   17981                 :             : /*
   17982                 :             :    PutUseOptArg - tell the symbol table that this procedure, Sym,
   17983                 :             :                   uses an optarg.
   17984                 :             : */
   17985                 :             : 
   17986                 :       18167 : extern "C" void SymbolTable_PutUseOptArg (unsigned int Sym, SymbolTable_ProcedureKind kind)
   17987                 :             : {
   17988                 :       18167 :   SymbolTable_PtrToSymbol pSym;
   17989                 :             : 
   17990                 :       18167 :   AssertInRange (Sym);
   17991                 :       18167 :   pSym = GetPsym (Sym);
   17992                 :       18167 :   switch (pSym->SymbolType)
   17993                 :             :     {
   17994                 :             :       case SymbolTable_ErrorSym:
   17995                 :             :         break;
   17996                 :             : 
   17997                 :       18167 :       case SymbolTable_ProcedureSym:
   17998                 :       18167 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].HasOptArg = true;
   17999                 :       18167 :         break;
   18000                 :             : 
   18001                 :           0 :       case SymbolTable_ProcTypeSym:
   18002                 :           0 :         pSym->ProcType.HasOptArg = true;
   18003                 :           0 :         break;
   18004                 :             : 
   18005                 :             : 
   18006                 :           0 :       default:
   18007                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   18008                 :       18167 :         break;
   18009                 :             :     }
   18010                 :       18167 : }
   18011                 :             : 
   18012                 :             : 
   18013                 :             : /*
   18014                 :             :    UsesOptArg - returns TRUE if procedure, Sym, uses varargs.
   18015                 :             : */
   18016                 :             : 
   18017                 :      221009 : extern "C" bool SymbolTable_UsesOptArg (unsigned int Sym, SymbolTable_ProcedureKind kind)
   18018                 :             : {
   18019                 :      221009 :   SymbolTable_PtrToSymbol pSym;
   18020                 :             : 
   18021                 :      221009 :   AssertInRange (Sym);
   18022                 :      221009 :   pSym = GetPsym (Sym);
   18023                 :      221009 :   switch (pSym->SymbolType)
   18024                 :             :     {
   18025                 :             :       case SymbolTable_ErrorSym:
   18026                 :             :         return false;
   18027                 :      221009 :         break;
   18028                 :             : 
   18029                 :      221009 :       case SymbolTable_ProcedureSym:
   18030                 :      221009 :         return pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].HasOptArg;
   18031                 :           0 :         break;
   18032                 :             : 
   18033                 :           0 :       case SymbolTable_ProcTypeSym:
   18034                 :           0 :         return pSym->ProcType.HasOptArg;
   18035                 :           0 :         break;
   18036                 :             : 
   18037                 :             : 
   18038                 :           0 :       default:
   18039                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   18040                 :             :         break;
   18041                 :             :     }
   18042                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18043                 :             :   __builtin_unreachable ();
   18044                 :             : }
   18045                 :             : 
   18046                 :             : 
   18047                 :             : /*
   18048                 :             :    PutOptArgInit - makes symbol, Sym, the initializer value to
   18049                 :             :                    procedure, ProcSym.
   18050                 :             : */
   18051                 :             : 
   18052                 :       15233 : extern "C" void SymbolTable_PutOptArgInit (unsigned int ProcSym, unsigned int Sym)
   18053                 :             : {
   18054                 :       15233 :   SymbolTable_PtrToSymbol pSym;
   18055                 :             : 
   18056                 :       15233 :   AssertInRange (Sym);
   18057                 :       15233 :   if (! (SymbolTable_IsError (ProcSym)))
   18058                 :             :     {
   18059                 :       15233 :       pSym = GetPsym (ProcSym);
   18060                 :       15233 :       switch (pSym->SymbolType)
   18061                 :             :         {
   18062                 :             :           case SymbolTable_ErrorSym:
   18063                 :             :             break;
   18064                 :             : 
   18065                 :       15233 :           case SymbolTable_ProcedureSym:
   18066                 :       15233 :             pSym->Procedure.OptArgInit = Sym;
   18067                 :       15233 :             break;
   18068                 :             : 
   18069                 :           0 :           case SymbolTable_ProcTypeSym:
   18070                 :           0 :             pSym->ProcType.OptArgInit = Sym;
   18071                 :           0 :             break;
   18072                 :             : 
   18073                 :             : 
   18074                 :           0 :           default:
   18075                 :           0 :             M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   18076                 :             :             break;
   18077                 :             :         }
   18078                 :             :     }
   18079                 :       15233 : }
   18080                 :             : 
   18081                 :             : 
   18082                 :             : /*
   18083                 :             :    GetOptArgInit - returns the initializer value to the optional parameter in
   18084                 :             :                    procedure, ProcSym.
   18085                 :             : */
   18086                 :             : 
   18087                 :        3622 : extern "C" unsigned int SymbolTable_GetOptArgInit (unsigned int ProcSym)
   18088                 :             : {
   18089                 :        3622 :   SymbolTable_PtrToSymbol pSym;
   18090                 :             : 
   18091                 :        3622 :   if (! (SymbolTable_IsError (ProcSym)))
   18092                 :             :     {
   18093                 :        3622 :       pSym = GetPsym (ProcSym);
   18094                 :        3622 :       switch (pSym->SymbolType)
   18095                 :             :         {
   18096                 :             :           case SymbolTable_ErrorSym:
   18097                 :             :             break;
   18098                 :             : 
   18099                 :        3622 :           case SymbolTable_ProcedureSym:
   18100                 :        3622 :             return pSym->Procedure.OptArgInit;
   18101                 :           0 :             break;
   18102                 :             : 
   18103                 :           0 :           case SymbolTable_ProcTypeSym:
   18104                 :           0 :             return pSym->ProcType.OptArgInit;
   18105                 :           0 :             break;
   18106                 :             : 
   18107                 :             : 
   18108                 :           0 :           default:
   18109                 :           0 :             M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   18110                 :             :             break;
   18111                 :             :         }
   18112                 :             :     }
   18113                 :             :   return SymbolTable_NulSym;
   18114                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18115                 :             :   __builtin_unreachable ();
   18116                 :             : }
   18117                 :             : 
   18118                 :             : 
   18119                 :             : /*
   18120                 :             :    MakePointer - returns a pointer symbol with PointerName.
   18121                 :             : */
   18122                 :             : 
   18123                 :      173234 : extern "C" unsigned int SymbolTable_MakePointer (unsigned int tok, NameKey_Name PointerName)
   18124                 :             : {
   18125                 :      173234 :   unsigned int oaf;
   18126                 :      173234 :   unsigned int sym;
   18127                 :             : 
   18128                 :      173234 :   tok = CheckTok (tok, (const char *) "pointer", 7);
   18129                 :      173234 :   sym = HandleHiddenOrDeclare (tok, PointerName, &oaf);
   18130                 :      173234 :   FillInPointerFields (sym, PointerName, SymbolTable_GetCurrentScope (), oaf);
   18131                 :      173234 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   18132                 :      173234 :   return sym;
   18133                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18134                 :             :   __builtin_unreachable ();
   18135                 :             : }
   18136                 :             : 
   18137                 :             : 
   18138                 :             : /*
   18139                 :             :    PutPointer - gives a pointer symbol a type, PointerType.
   18140                 :             : */
   18141                 :             : 
   18142                 :      204182 : extern "C" void SymbolTable_PutPointer (unsigned int Sym, unsigned int PointerType)
   18143                 :             : {
   18144                 :      204182 :   SymbolTable_PtrToSymbol pSym;
   18145                 :             : 
   18146                 :      204182 :   pSym = GetPsym (Sym);
   18147                 :      204182 :   switch (pSym->SymbolType)
   18148                 :             :     {
   18149                 :             :       case SymbolTable_ErrorSym:
   18150                 :             :         break;
   18151                 :             : 
   18152                 :      204182 :       case SymbolTable_PointerSym:
   18153                 :      204182 :         pSym->Pointer.Type = PointerType;
   18154                 :      204182 :         break;
   18155                 :             : 
   18156                 :             : 
   18157                 :           0 :       default:
   18158                 :           0 :         M2Error_InternalError ((const char *) "expecting a Pointer symbol", 26);
   18159                 :      204182 :         break;
   18160                 :             :     }
   18161                 :      204182 : }
   18162                 :             : 
   18163                 :             : 
   18164                 :             : /*
   18165                 :             :    IsPointer - returns true is Sym is a pointer type symbol.
   18166                 :             : */
   18167                 :             : 
   18168                 :   474886940 : extern "C" bool SymbolTable_IsPointer (unsigned int Sym)
   18169                 :             : {
   18170                 :   474886940 :   SymbolTable_PtrToSymbol pSym;
   18171                 :             : 
   18172                 :   474886940 :   AssertInRange (Sym);
   18173                 :   474886940 :   pSym = GetPsym (Sym);
   18174                 :   474886940 :   return pSym->SymbolType == SymbolTable_PointerSym;
   18175                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18176                 :             :   __builtin_unreachable ();
   18177                 :             : }
   18178                 :             : 
   18179                 :             : 
   18180                 :             : /*
   18181                 :             :    IsRecord - returns true is Sym is a record type symbol.
   18182                 :             : */
   18183                 :             : 
   18184                 :   475114761 : extern "C" bool SymbolTable_IsRecord (unsigned int Sym)
   18185                 :             : {
   18186                 :   475114761 :   SymbolTable_PtrToSymbol pSym;
   18187                 :             : 
   18188                 :   475114761 :   AssertInRange (Sym);
   18189                 :   475114755 :   pSym = GetPsym (Sym);
   18190                 :   475114755 :   return pSym->SymbolType == SymbolTable_RecordSym;
   18191                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18192                 :             :   __builtin_unreachable ();
   18193                 :             : }
   18194                 :             : 
   18195                 :             : 
   18196                 :             : /*
   18197                 :             :    IsVarient - returns true if the symbol, Sym, is a
   18198                 :             :                varient symbol.
   18199                 :             : */
   18200                 :             : 
   18201                 :   388232392 : extern "C" bool SymbolTable_IsVarient (unsigned int Sym)
   18202                 :             : {
   18203                 :   388232392 :   SymbolTable_PtrToSymbol pSym;
   18204                 :             : 
   18205                 :   388232392 :   pSym = GetPsym (Sym);
   18206                 :   388232392 :   return pSym->SymbolType == SymbolTable_VarientSym;
   18207                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18208                 :             :   __builtin_unreachable ();
   18209                 :             : }
   18210                 :             : 
   18211                 :             : 
   18212                 :             : /*
   18213                 :             :    IsFieldVarient - returns true if the symbol, Sym, is a
   18214                 :             :                     varient field.
   18215                 :             : */
   18216                 :             : 
   18217                 :   223690380 : extern "C" bool SymbolTable_IsFieldVarient (unsigned int Sym)
   18218                 :             : {
   18219                 :   223690380 :   SymbolTable_PtrToSymbol pSym;
   18220                 :             : 
   18221                 :   223690380 :   pSym = GetPsym (Sym);
   18222                 :   223690380 :   return pSym->SymbolType == SymbolTable_VarientFieldSym;
   18223                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18224                 :             :   __builtin_unreachable ();
   18225                 :             : }
   18226                 :             : 
   18227                 :             : 
   18228                 :             : /*
   18229                 :             :    IsFieldEnumeration - returns true if the symbol, Sym, is an
   18230                 :             :                         enumeration field.
   18231                 :             : */
   18232                 :             : 
   18233                 :    11594727 : extern "C" bool SymbolTable_IsFieldEnumeration (unsigned int Sym)
   18234                 :             : {
   18235                 :    11594727 :   SymbolTable_PtrToSymbol pSym;
   18236                 :             : 
   18237                 :    11594727 :   pSym = GetPsym (Sym);
   18238                 :    11594727 :   return pSym->SymbolType == SymbolTable_EnumerationFieldSym;
   18239                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18240                 :             :   __builtin_unreachable ();
   18241                 :             : }
   18242                 :             : 
   18243                 :             : 
   18244                 :             : /*
   18245                 :             :    IsArray - returns true is Sym is an array type symbol.
   18246                 :             : */
   18247                 :             : 
   18248                 :   328639999 : extern "C" bool SymbolTable_IsArray (unsigned int Sym)
   18249                 :             : {
   18250                 :   328639999 :   SymbolTable_PtrToSymbol pSym;
   18251                 :             : 
   18252                 :   328639999 :   AssertInRange (Sym);
   18253                 :   328639999 :   pSym = GetPsym (Sym);
   18254                 :   328639999 :   return pSym->SymbolType == SymbolTable_ArraySym;
   18255                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18256                 :             :   __builtin_unreachable ();
   18257                 :             : }
   18258                 :             : 
   18259                 :             : 
   18260                 :             : /*
   18261                 :             :    IsEnumeration - returns true if Sym is an enumeration symbol.
   18262                 :             : */
   18263                 :             : 
   18264                 :   469203108 : extern "C" bool SymbolTable_IsEnumeration (unsigned int Sym)
   18265                 :             : {
   18266                 :   469203108 :   SymbolTable_PtrToSymbol pSym;
   18267                 :             : 
   18268                 :   469203108 :   AssertInRange (Sym);
   18269                 :   469203108 :   pSym = GetPsym (Sym);
   18270                 :   469203108 :   return pSym->SymbolType == SymbolTable_EnumerationSym;
   18271                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18272                 :             :   __builtin_unreachable ();
   18273                 :             : }
   18274                 :             : 
   18275                 :             : 
   18276                 :             : /*
   18277                 :             :    IsSet - returns TRUE if Sym is a set symbol.
   18278                 :             : */
   18279                 :             : 
   18280                 :   202536355 : extern "C" bool SymbolTable_IsSet (unsigned int Sym)
   18281                 :             : {
   18282                 :   202536355 :   SymbolTable_PtrToSymbol pSym;
   18283                 :             : 
   18284                 :   202536355 :   AssertInRange (Sym);
   18285                 :   202536355 :   pSym = GetPsym (Sym);
   18286                 :   202536355 :   return pSym->SymbolType == SymbolTable_SetSym;
   18287                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18288                 :             :   __builtin_unreachable ();
   18289                 :             : }
   18290                 :             : 
   18291                 :             : 
   18292                 :             : /*
   18293                 :             :    IsHiddenType - returns TRUE if, Sym, is a Type and is also declared as a hidden type.
   18294                 :             : */
   18295                 :             : 
   18296                 :    26643894 : extern "C" bool SymbolTable_IsHiddenType (unsigned int Sym)
   18297                 :             : {
   18298                 :    26643894 :   SymbolTable_PtrToSymbol pSym;
   18299                 :             : 
   18300                 :    26643894 :   pSym = GetPsym (Sym);
   18301                 :    26643894 :   switch (pSym->SymbolType)
   18302                 :             :     {
   18303                 :    26613668 :       case SymbolTable_TypeSym:
   18304                 :    26613668 :         return pSym->Type.IsHidden;
   18305                 :             :         break;
   18306                 :             : 
   18307                 :             : 
   18308                 :             :       default:
   18309                 :             :         return false;
   18310                 :             :         break;
   18311                 :             :     }
   18312                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18313                 :             :   __builtin_unreachable ();
   18314                 :             : }
   18315                 :             : 
   18316                 :             : 
   18317                 :             : /*
   18318                 :             :    IsOAFamily - returns TRUE if, Sym, is an OAFamily symbol.
   18319                 :             : */
   18320                 :             : 
   18321                 :           0 : extern "C" bool SymbolTable_IsOAFamily (unsigned int Sym)
   18322                 :             : {
   18323                 :           0 :   SymbolTable_PtrToSymbol pSym;
   18324                 :             : 
   18325                 :           0 :   AssertInRange (Sym);
   18326                 :           0 :   pSym = GetPsym (Sym);
   18327                 :           0 :   return pSym->SymbolType == SymbolTable_OAFamilySym;
   18328                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18329                 :             :   __builtin_unreachable ();
   18330                 :             : }
   18331                 :             : 
   18332                 :             : 
   18333                 :             : /*
   18334                 :             :    GetDimension - return the number of dimensions associated with
   18335                 :             :                   this unbounded ARRAY parameter.
   18336                 :             : */
   18337                 :             : 
   18338                 :      375869 : extern "C" unsigned int SymbolTable_GetDimension (unsigned int sym)
   18339                 :             : {
   18340                 :      667261 :   SymbolTable_PtrToSymbol pSym;
   18341                 :             : 
   18342                 :      667261 :   pSym = GetPsym (sym);
   18343                 :      667261 :   switch (pSym->SymbolType)
   18344                 :             :     {
   18345                 :           0 :       case SymbolTable_PartialUnboundedSym:
   18346                 :           0 :         return pSym->PartialUnbounded.NDim;
   18347                 :      368981 :         break;
   18348                 :             : 
   18349                 :      368981 :       case SymbolTable_UnboundedSym:
   18350                 :      368981 :         return pSym->Unbounded.Dimensions;
   18351                 :           0 :         break;
   18352                 :             : 
   18353                 :           0 :       case SymbolTable_OAFamilySym:
   18354                 :           0 :         return pSym->OAFamily.MaxDimensions;
   18355                 :      175796 :         break;
   18356                 :             : 
   18357                 :      175796 :       case SymbolTable_ParamSym:
   18358                 :      175796 :         if (pSym->Param.IsUnbounded)
   18359                 :             :           {
   18360                 :      175796 :             return SymbolTable_GetDimension (SymbolTable_GetType (sym));
   18361                 :             :           }
   18362                 :             :         else
   18363                 :             :           {
   18364                 :           0 :             M2Error_InternalError ((const char *) "expecting unbounded paramater", 29);
   18365                 :             :           }
   18366                 :      115560 :         break;
   18367                 :             : 
   18368                 :      115560 :       case SymbolTable_VarParamSym:
   18369                 :      115560 :         if (pSym->VarParam.IsUnbounded)
   18370                 :             :           {
   18371                 :      115560 :             return SymbolTable_GetDimension (SymbolTable_GetType (sym));
   18372                 :             :           }
   18373                 :             :         else
   18374                 :             :           {
   18375                 :           0 :             M2Error_InternalError ((const char *) "expecting unbounded paramater", 29);
   18376                 :             :           }
   18377                 :        6888 :         break;
   18378                 :             : 
   18379                 :        6888 :       case SymbolTable_ArraySym:
   18380                 :        6888 :         return GetArrayDimension (sym);
   18381                 :           0 :         break;
   18382                 :             : 
   18383                 :           0 :       case SymbolTable_TypeSym:
   18384                 :           0 :         return SymbolTable_GetDimension (SymbolTable_GetType (sym));
   18385                 :          36 :         break;
   18386                 :             : 
   18387                 :          36 :       case SymbolTable_VarSym:
   18388                 :          36 :         return SymbolTable_GetDimension (SymbolTable_GetType (sym));
   18389                 :           0 :         break;
   18390                 :             : 
   18391                 :             : 
   18392                 :           0 :       default:
   18393                 :           0 :         M2Error_InternalError ((const char *) "expecting PartialUnbounded", 26);
   18394                 :             :         break;
   18395                 :             :     }
   18396                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18397                 :             :   __builtin_unreachable ();
   18398                 :             : }
   18399                 :             : 
   18400                 :             : 
   18401                 :             : /*
   18402                 :             :    MakeOAFamily - makes an OAFamily symbol based on SimpleType.
   18403                 :             :                   It returns the OAFamily symbol.  A new symbol
   18404                 :             :                   is created if one does not already exist for
   18405                 :             :                   SimpleType.
   18406                 :             : */
   18407                 :             : 
   18408                 :     1033321 : extern "C" unsigned int SymbolTable_MakeOAFamily (unsigned int SimpleType)
   18409                 :             : {
   18410                 :     1033321 :   SymbolTable_PtrToSymbol pSym;
   18411                 :     1033321 :   unsigned int sym;
   18412                 :             : 
   18413                 :     1033321 :   sym = SymbolTable_GetOAFamily (SimpleType);
   18414                 :     1033321 :   if (sym == SymbolTable_NulSym)
   18415                 :             :     {
   18416                 :       30888 :       NewSym (&sym);
   18417                 :       30888 :       pSym = GetPsym (sym);
   18418                 :       30888 :       pSym->SymbolType = SymbolTable_OAFamilySym;
   18419                 :       30888 :       pSym->OAFamily.MaxDimensions = 0;
   18420                 :       30888 :       pSym->OAFamily.SimpleType = SimpleType;
   18421                 :       30888 :       pSym->OAFamily.Dimensions = Indexing_InitIndex (1);
   18422                 :       30888 :       PutOAFamily (SimpleType, sym);
   18423                 :             :     }
   18424                 :     1033321 :   return sym;
   18425                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18426                 :             :   __builtin_unreachable ();
   18427                 :             : }
   18428                 :             : 
   18429                 :             : 
   18430                 :             : /*
   18431                 :             :    GetOAFamily - returns the oafamily symbol associated with
   18432                 :             :                  SimpleType.
   18433                 :             : */
   18434                 :             : 
   18435                 :   422600046 : extern "C" unsigned int SymbolTable_GetOAFamily (unsigned int SimpleType)
   18436                 :             : {
   18437                 :   422600046 :   SymbolTable_PtrToSymbol pSym;
   18438                 :             : 
   18439                 :   422600046 :   pSym = GetPsym (SimpleType);
   18440                 :   422600046 :   switch (pSym->SymbolType)
   18441                 :             :     {
   18442                 :             :       case SymbolTable_ErrorSym:
   18443                 :             :         return SymbolTable_NulSym;
   18444                 :    41410159 :         break;
   18445                 :             : 
   18446                 :    41410159 :       case SymbolTable_RecordSym:
   18447                 :    41410159 :         return pSym->Record.oafamily;
   18448                 :     5562341 :         break;
   18449                 :             : 
   18450                 :     5562341 :       case SymbolTable_SubrangeSym:
   18451                 :     5562341 :         return pSym->Subrange.oafamily;
   18452                 :    11358192 :         break;
   18453                 :             : 
   18454                 :    11358192 :       case SymbolTable_EnumerationSym:
   18455                 :    11358192 :         return pSym->Enumeration.oafamily;
   18456                 :     4738600 :         break;
   18457                 :             : 
   18458                 :     4738600 :       case SymbolTable_ArraySym:
   18459                 :     4738600 :         return pSym->Array.oafamily;
   18460                 :     4727021 :         break;
   18461                 :             : 
   18462                 :     4727021 :       case SymbolTable_ProcTypeSym:
   18463                 :     4727021 :         return pSym->ProcType.oafamily;
   18464                 :    86507660 :         break;
   18465                 :             : 
   18466                 :    86507660 :       case SymbolTable_TypeSym:
   18467                 :    86507660 :         return pSym->Type.oafamily;
   18468                 :    48654888 :         break;
   18469                 :             : 
   18470                 :    48654888 :       case SymbolTable_PointerSym:
   18471                 :    48654888 :         return pSym->Pointer.oafamily;
   18472                 :     1687566 :         break;
   18473                 :             : 
   18474                 :     1687566 :       case SymbolTable_SetSym:
   18475                 :     1687566 :         return pSym->Set.oafamily;
   18476                 :      127813 :         break;
   18477                 :             : 
   18478                 :      127813 :       case SymbolTable_UndefinedSym:
   18479                 :      127813 :         return pSym->Undefined.oafamily;
   18480                 :             :         break;
   18481                 :             : 
   18482                 :             : 
   18483                 :             :       default:
   18484                 :             :         return SymbolTable_NulSym;
   18485                 :             :         break;
   18486                 :             :     }
   18487                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18488                 :             :   __builtin_unreachable ();
   18489                 :             : }
   18490                 :             : 
   18491                 :             : 
   18492                 :             : /*
   18493                 :             :    ForeachOAFamily - call, p[oaf, ndim, symbol] for every unbounded symbol,
   18494                 :             :                      sym, in the oaf.
   18495                 :             : */
   18496                 :             : 
   18497                 :   421566725 : extern "C" void SymbolTable_ForeachOAFamily (unsigned int sym, SymbolTable_FamilyOperation p)
   18498                 :             : {
   18499                 :   421566725 :   typedef unsigned int *ForeachOAFamily__T1;
   18500                 :             : 
   18501                 :   421566725 :   SymbolTable_PtrToSymbol pSym;
   18502                 :   421566725 :   unsigned int h;
   18503                 :   421566725 :   unsigned int i;
   18504                 :   421566725 :   ForeachOAFamily__T1 pc;
   18505                 :             : 
   18506                 :   421566725 :   if (sym != SymbolTable_NulSym)
   18507                 :             :     {
   18508                 :    26217886 :       pSym = GetPsym (sym);
   18509                 :    26217886 :       switch (pSym->SymbolType)
   18510                 :             :         {
   18511                 :    26217886 :           case SymbolTable_OAFamilySym:
   18512                 :    26217886 :             h = Indexing_HighIndice (pSym->OAFamily.Dimensions);
   18513                 :    26217886 :             i = 1;
   18514                 :    78816744 :             while (i <= h)
   18515                 :             :               {
   18516                 :    26380972 :                 pc = static_cast<ForeachOAFamily__T1> (Indexing_GetIndice (pSym->OAFamily.Dimensions, i));
   18517                 :    26380972 :                 if (pc != NULL)
   18518                 :             :                   {
   18519                 :    26380972 :                     (*p.proc) (sym, i, (*pc));
   18520                 :             :                   }
   18521                 :    26380972 :                 i += 1;
   18522                 :             :               }
   18523                 :             :             break;
   18524                 :             : 
   18525                 :             : 
   18526                 :           0 :           default:
   18527                 :           0 :             M2Error_InternalError ((const char *) "expecting OAFamily symbol", 25);
   18528                 :             :             break;
   18529                 :             :         }
   18530                 :             :     }
   18531                 :   421566725 : }
   18532                 :             : 
   18533                 :             : 
   18534                 :             : /*
   18535                 :             :    IsUnbounded - returns true if Sym is an unbounded symbol.
   18536                 :             : */
   18537                 :             : 
   18538                 :   254829035 : extern "C" bool SymbolTable_IsUnbounded (unsigned int Sym)
   18539                 :             : {
   18540                 :   254829035 :   SymbolTable_PtrToSymbol pSym;
   18541                 :             : 
   18542                 :   254829035 :   AssertInRange (Sym);
   18543                 :   254829035 :   pSym = GetPsym (Sym);
   18544                 :   254829035 :   return pSym->SymbolType == SymbolTable_UnboundedSym;
   18545                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18546                 :             :   __builtin_unreachable ();
   18547                 :             : }
   18548                 :             : 
   18549                 :             : 
   18550                 :             : /*
   18551                 :             :    GetUnbounded - returns the unbounded symbol associated with
   18552                 :             :                   the OAFamily symbol, oaf, and the number of
   18553                 :             :                   dimensions, ndim, of the open array.
   18554                 :             : */
   18555                 :             : 
   18556                 :     1033321 : extern "C" unsigned int SymbolTable_GetUnbounded (unsigned int oaf, unsigned int ndim)
   18557                 :             : {
   18558                 :     1033321 :   SymbolTable_PtrToSymbol pSym;
   18559                 :             : 
   18560                 :     1033321 :   pSym = GetPsym (oaf);
   18561                 :     1033321 :   switch (pSym->SymbolType)
   18562                 :             :     {
   18563                 :     1033321 :       case SymbolTable_OAFamilySym:
   18564                 :     1033321 :         if (ndim > pSym->OAFamily.MaxDimensions)
   18565                 :             :           {
   18566                 :             :             return SymbolTable_NulSym;
   18567                 :             :           }
   18568                 :             :         else
   18569                 :             :           {
   18570                 :     1002373 :             return GetFromIndex (pSym->OAFamily.Dimensions, ndim);
   18571                 :             :           }
   18572                 :           0 :         break;
   18573                 :             : 
   18574                 :             : 
   18575                 :           0 :       default:
   18576                 :           0 :         M2Error_InternalError ((const char *) "expecting OAFamily symbol", 25);
   18577                 :             :         break;
   18578                 :             :     }
   18579                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18580                 :             :   __builtin_unreachable ();
   18581                 :             : }
   18582                 :             : 
   18583                 :             : 
   18584                 :             : /*
   18585                 :             :    GetUnboundedRecordType - returns the record type used to
   18586                 :             :                             implement the unbounded array.
   18587                 :             : */
   18588                 :             : 
   18589                 :    29505715 : extern "C" unsigned int SymbolTable_GetUnboundedRecordType (unsigned int Sym)
   18590                 :             : {
   18591                 :    29505715 :   SymbolTable_PtrToSymbol pSym;
   18592                 :             : 
   18593                 :    29505715 :   pSym = GetPsym (Sym);
   18594                 :    29505715 :   switch (pSym->SymbolType)
   18595                 :             :     {
   18596                 :    29505715 :       case SymbolTable_UnboundedSym:
   18597                 :    29505715 :         return pSym->Unbounded.RecordType;
   18598                 :           0 :         break;
   18599                 :             : 
   18600                 :             : 
   18601                 :           0 :       default:
   18602                 :           0 :         M2Error_InternalError ((const char *) "expecting an UnBounded symbol", 29);
   18603                 :             :         break;
   18604                 :             :     }
   18605                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18606                 :             :   __builtin_unreachable ();
   18607                 :             : }
   18608                 :             : 
   18609                 :             : 
   18610                 :             : /*
   18611                 :             :    GetUnboundedAddressOffset - returns the offset of the address field
   18612                 :             :                                inside the record used to implement the
   18613                 :             :                                unbounded type.
   18614                 :             : */
   18615                 :             : 
   18616                 :       77985 : extern "C" unsigned int SymbolTable_GetUnboundedAddressOffset (unsigned int sym)
   18617                 :             : {
   18618                 :       77985 :   unsigned int field;
   18619                 :       77985 :   unsigned int rec;
   18620                 :             : 
   18621                 :       77985 :   rec = SymbolTable_GetUnboundedRecordType (sym);
   18622                 :       77985 :   if (rec == SymbolTable_NulSym)
   18623                 :             :     {
   18624                 :           0 :       M2Error_InternalError ((const char *) "expecting record type to be declared", 36);
   18625                 :             :     }
   18626                 :             :   else
   18627                 :             :     {
   18628                 :       77985 :       field = SymbolTable_GetLocalSym (rec, NameKey_MakeKey ((const char *) "_m2_contents", 12));
   18629                 :       77985 :       if (field == SymbolTable_NulSym)
   18630                 :             :         {
   18631                 :           0 :           M2Error_InternalError ((const char *) "expecting address field to be present inside unbounded record", 61);
   18632                 :             :         }
   18633                 :             :       else
   18634                 :             :         {
   18635                 :       77985 :           return field;
   18636                 :             :         }
   18637                 :             :     }
   18638                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18639                 :             :   __builtin_unreachable ();
   18640                 :             : }
   18641                 :             : 
   18642                 :             : 
   18643                 :             : /*
   18644                 :             :    GetUnboundedHighOffset - returns the offset of the high field
   18645                 :             :                             inside the record used to implement the
   18646                 :             :                             unbounded type.
   18647                 :             : */
   18648                 :             : 
   18649                 :       64519 : extern "C" unsigned int SymbolTable_GetUnboundedHighOffset (unsigned int sym, unsigned int ndim)
   18650                 :             : {
   18651                 :       64519 :   unsigned int rec;
   18652                 :             : 
   18653                 :       64519 :   rec = SymbolTable_GetUnboundedRecordType (sym);
   18654                 :       64519 :   if (rec == SymbolTable_NulSym)
   18655                 :             :     {
   18656                 :           0 :       M2Error_InternalError ((const char *) "expecting record type to be declared", 36);
   18657                 :             :     }
   18658                 :             :   else
   18659                 :             :     {
   18660                 :       64519 :       return SymbolTable_GetLocalSym (rec, NameKey_makekey (DynamicStrings_string (DynamicStrings_Mark (FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_m2_high_%d", 11)), (const unsigned char *) &ndim, (sizeof (ndim)-1))))));
   18661                 :             :     }
   18662                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   18663                 :             :   __builtin_unreachable ();
   18664                 :             : }
   18665                 :             : 
   18666                 :             : 
   18667                 :             : /*
   18668                 :             :    MakeSubscript - makes a subscript Symbol.
   18669                 :             :                    No name is required.
   18670                 :             : */
   18671                 :             : 
   18672                 :      165592 : extern "C" unsigned int SymbolTable_MakeSubscript (void)
   18673                 :             : {
   18674                 :      165592 :   SymbolTable_PtrToSymbol pSym;
   18675                 :      165592 :   unsigned int Sym;
   18676                 :             : 
   18677                 :      165592 :   NewSym (&Sym);
   18678                 :      165592 :   pSym = GetPsym (Sym);
   18679                 :      165592 :   pSym->SymbolType = SymbolTable_SubscriptSym;
   18680                 :      165592 :   pSym->Subscript.Type = SymbolTable_NulSym;  /* Index to a subrange symbol.  */
   18681                 :      165592 :   pSym->Subscript.Size = M2ALU_InitValue ();  /* Size of this indice in*Size  */
   18682                 :      165592 :   pSym->Subscript.Offset = M2ALU_InitValue ();  /* Offset at runtime of symbol  */
   18683                 :      165592 :   InitWhereDeclared (&pSym->Subscript.At);  /* Declared here  */
   18684                 :      165592 :   return Sym;
   18685                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18686                 :             :   __builtin_unreachable ();
   18687                 :             : }
   18688                 :             : 
   18689                 :             : 
   18690                 :             : /*
   18691                 :             :    PutSubscript - gives a subscript symbol a type, SimpleType.
   18692                 :             : */
   18693                 :             : 
   18694                 :      165592 : extern "C" void SymbolTable_PutSubscript (unsigned int Sym, unsigned int SimpleType)
   18695                 :             : {
   18696                 :      165592 :   SymbolTable_PtrToSymbol pSym;
   18697                 :             : 
   18698                 :      165592 :   pSym = GetPsym (Sym);
   18699                 :      165592 :   switch (pSym->SymbolType)
   18700                 :             :     {
   18701                 :             :       case SymbolTable_ErrorSym:
   18702                 :             :         break;
   18703                 :             : 
   18704                 :      165592 :       case SymbolTable_SubscriptSym:
   18705                 :      165592 :         pSym->Subscript.Type = SimpleType;
   18706                 :      165592 :         break;
   18707                 :             : 
   18708                 :             : 
   18709                 :           0 :       default:
   18710                 :           0 :         M2Error_InternalError ((const char *) "expecting a SubScript symbol", 28);
   18711                 :      165592 :         break;
   18712                 :             :     }
   18713                 :      165592 : }
   18714                 :             : 
   18715                 :             : 
   18716                 :             : /*
   18717                 :             :    MakeUnbounded - makes an unbounded array Symbol.
   18718                 :             :                    ndim is the number of dimensions required.
   18719                 :             :                    No name is required.
   18720                 :             : */
   18721                 :             : 
   18722                 :     1033321 : extern "C" unsigned int SymbolTable_MakeUnbounded (unsigned int tok, unsigned int SimpleType, unsigned int ndim)
   18723                 :             : {
   18724                 :     1033321 :   unsigned int sym;
   18725                 :     1033321 :   unsigned int oaf;
   18726                 :             : 
   18727                 :     1033321 :   tok = CheckTok (tok, (const char *) "unbounded", 9);
   18728                 :     1033321 :   oaf = SymbolTable_MakeOAFamily (SimpleType);
   18729                 :     1033321 :   sym = SymbolTable_GetUnbounded (oaf, ndim);
   18730                 :     1033321 :   if (sym == SymbolTable_NulSym)
   18731                 :             :     {
   18732                 :       30948 :       NewSym (&sym);
   18733                 :       30948 :       if (SymbolTable_IsUnknown (SimpleType))
   18734                 :             :         {
   18735                 :           0 :           PutPartialUnbounded (sym, SimpleType, ndim);
   18736                 :             :         }
   18737                 :             :       else
   18738                 :             :         {
   18739                 :       30948 :           FillInUnboundedFields (tok, sym, SimpleType, ndim);
   18740                 :             :         }
   18741                 :       30948 :       PutUnbounded (oaf, sym, ndim);
   18742                 :             :     }
   18743                 :     1033321 :   return sym;
   18744                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18745                 :             :   __builtin_unreachable ();
   18746                 :             : }
   18747                 :             : 
   18748                 :             : 
   18749                 :             : /*
   18750                 :             :    NoOfElements - Returns the number of elements in array Sym,
   18751                 :             :                   or the number of elements in an enumeration Sym or
   18752                 :             :                   the number of interface symbols in an Interface list.
   18753                 :             : */
   18754                 :             : 
   18755                 :         244 : extern "C" unsigned int SymbolTable_NoOfElements (unsigned int Sym)
   18756                 :             : {
   18757                 :         244 :   SymbolTable_PtrToSymbol pSym;
   18758                 :         244 :   unsigned int n;
   18759                 :             : 
   18760                 :         244 :   pSym = GetPsym (Sym);
   18761                 :         244 :   switch (pSym->SymbolType)
   18762                 :             :     {
   18763                 :             :       case SymbolTable_ErrorSym:
   18764                 :             :         n = 0;
   18765                 :             :         break;
   18766                 :             : 
   18767                 :         244 :       case SymbolTable_EnumerationSym:
   18768                 :         244 :         n = pSym->Enumeration.NoOfElements;
   18769                 :         244 :         break;
   18770                 :             : 
   18771                 :           0 :       case SymbolTable_InterfaceSym:
   18772                 :           0 :         n = Indexing_HighIndice (pSym->Interface.Parameters);
   18773                 :           0 :         break;
   18774                 :             : 
   18775                 :             : 
   18776                 :           0 :       default:
   18777                 :           0 :         M2Error_InternalError ((const char *) "expecting an Array or UnBounded symbol", 38);
   18778                 :         244 :         break;
   18779                 :             :     }
   18780                 :         244 :   return n;
   18781                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   18782                 :             :   __builtin_unreachable ();
   18783                 :             : }
   18784                 :             : 
   18785                 :             : 
   18786                 :             : /*
   18787                 :             :    PutArray - places a type symbol into an arraysym.
   18788                 :             : */
   18789                 :             : 
   18790                 :      165592 : extern "C" void SymbolTable_PutArray (unsigned int arraysym, unsigned int typesym)
   18791                 :             : {
   18792                 :      165592 :   SymbolTable_PtrToSymbol pSym;
   18793                 :             : 
   18794                 :      165592 :   pSym = GetPsym (arraysym);
   18795                 :      165592 :   switch (pSym->SymbolType)
   18796                 :             :     {
   18797                 :             :       case SymbolTable_ErrorSym:
   18798                 :             :         break;
   18799                 :             : 
   18800                 :      165592 :       case SymbolTable_ArraySym:
   18801                 :      165592 :         pSym->Array.Type = typesym;  /* The ARRAY OF typesym.  */
   18802                 :      165592 :         break;
   18803                 :             : 
   18804                 :             : 
   18805                 :           0 :       default:
   18806                 :           0 :         M2Error_InternalError ((const char *) "expecting an Array symbol", 25);
   18807                 :      165592 :         break;
   18808                 :             :     }
   18809                 :      165592 : }
   18810                 :             : 
   18811                 :             : 
   18812                 :             : /*
   18813                 :             :    ResolveImports - it examines the import list of all inner modules
   18814                 :             :                     and resolves all relative imports.
   18815                 :             : */
   18816                 :             : 
   18817                 :       83049 : extern "C" void SymbolTable_ResolveImports (void)
   18818                 :             : {
   18819                 :       83049 :   unsigned int scope;
   18820                 :             : 
   18821                 :       83049 :   scope = SymbolTable_GetCurrentScope ();
   18822                 :       83049 :   if (DebugUnknowns)
   18823                 :             :     {
   18824                 :             :       SymbolTable_DisplayTrees (scope);
   18825                 :             :     }
   18826                 :       83049 :   SymbolTable_ForeachProcedureDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) ResolveRelativeImport});
   18827                 :       83049 :   SymbolTable_ForeachInnerModuleDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) ResolveRelativeImport});
   18828                 :       83049 : }
   18829                 :             : 
   18830                 :             : 
   18831                 :             : /*
   18832                 :             :    ResolveConstructorTypes - to be called at the end of pass three.  Its
   18833                 :             :                              purpose is to fix up all constructors whose
   18834                 :             :                              types are unknown.
   18835                 :             : */
   18836                 :             : 
   18837                 :       15219 : extern "C" void SymbolTable_ResolveConstructorTypes (void)
   18838                 :             : {
   18839                 :       51719 :   bool finished;
   18840                 :       51719 :   unsigned int i;
   18841                 :       51719 :   unsigned int n;
   18842                 :       51719 :   unsigned int s;
   18843                 :             : 
   18844                 :       51719 :   do {
   18845                 :       51719 :     n = Lists_NoOfItemsInList (UnresolvedConstructorType);
   18846                 :       51719 :     finished = true;
   18847                 :       51719 :     i = 1;
   18848                 :      139944 :     while (i <= n)
   18849                 :             :       {
   18850                 :       36506 :         s = static_cast<unsigned int> (Lists_GetItemFromList (UnresolvedConstructorType, i));
   18851                 :       36506 :         M2Debug_Assert (SymbolTable_IsConstructor (s));
   18852                 :       36506 :         if (CanResolveConstructor (s))
   18853                 :             :           {
   18854                 :       36500 :             finished = false;
   18855                 :       36500 :             Lists_RemoveItemFromList (UnresolvedConstructorType, s);
   18856                 :       36500 :             i = n;
   18857                 :             :           }
   18858                 :       36506 :         i += 1;
   18859                 :             :       }
   18860                 :       51719 :   } while (! (finished));
   18861                 :       15219 :   CheckAllConstructorsResolved ();
   18862                 :       15213 : }
   18863                 :             : 
   18864                 :             : 
   18865                 :             : /*
   18866                 :             :    AddNameToScope - adds a Name, n, to the list of objects declared at the
   18867                 :             :                     current scope.
   18868                 :             : */
   18869                 :             : 
   18870                 :     7933195 : extern "C" void SymbolTable_AddNameToScope (NameKey_Name n)
   18871                 :             : {
   18872                 :     7933195 :   SymbolTable_PtrToSymbol pSym;
   18873                 :     7933195 :   unsigned int scope;
   18874                 :             : 
   18875                 :     7933195 :   scope = SymbolTable_GetCurrentScope ();
   18876                 :     7933195 :   pSym = GetPsym (scope);
   18877                 :     7933195 :   switch (pSym->SymbolType)
   18878                 :             :     {
   18879                 :     1563817 :       case SymbolTable_ProcedureSym:
   18880                 :     1563817 :         AddNameTo (pSym->Procedure.NamedObjects, MakeObject (n));
   18881                 :     1563817 :         break;
   18882                 :             : 
   18883                 :       45348 :       case SymbolTable_ModuleSym:
   18884                 :       45348 :         AddNameTo (pSym->Module.NamedObjects, MakeObject (n));
   18885                 :       45348 :         break;
   18886                 :             : 
   18887                 :     6324030 :       case SymbolTable_DefImpSym:
   18888                 :     6324030 :         AddNameTo (pSym->DefImp.NamedObjects, MakeObject (n));
   18889                 :     6324030 :         break;
   18890                 :             : 
   18891                 :             : 
   18892                 :           0 :       default:
   18893                 :           0 :         M2Error_InternalError ((const char *) "expecting - DefImp", 18);
   18894                 :     7933195 :         break;
   18895                 :             :     }
   18896                 :     7933195 : }
   18897                 :             : 
   18898                 :             : 
   18899                 :             : /*
   18900                 :             :    AddNameToImportList - adds a Name, n, to the import list of the current
   18901                 :             :                          module.
   18902                 :             : */
   18903                 :             : 
   18904                 :         168 : extern "C" void SymbolTable_AddNameToImportList (NameKey_Name n)
   18905                 :             : {
   18906                 :         168 :   SymbolTable_PtrToSymbol pSym;
   18907                 :         168 :   unsigned int scope;
   18908                 :             : 
   18909                 :         168 :   scope = SymbolTable_GetCurrentScope ();
   18910                 :         168 :   pSym = GetPsym (scope);
   18911                 :         168 :   switch (pSym->SymbolType)
   18912                 :             :     {
   18913                 :         168 :       case SymbolTable_ModuleSym:
   18914                 :         168 :         AddNameTo (pSym->Module.NamedImports, MakeObject (n));
   18915                 :         168 :         break;
   18916                 :             : 
   18917                 :           0 :       case SymbolTable_DefImpSym:
   18918                 :           0 :         AddNameTo (pSym->DefImp.NamedImports, MakeObject (n));
   18919                 :           0 :         break;
   18920                 :             : 
   18921                 :             : 
   18922                 :           0 :       default:
   18923                 :           0 :         M2Error_InternalError ((const char *) "expecting - DefImp or Module symbol", 35);
   18924                 :         168 :         break;
   18925                 :             :     }
   18926                 :         168 : }
   18927                 :             : 
   18928                 :             : 
   18929                 :             : /*
   18930                 :             :    GetScope - returns the declaration scope of the symbol.
   18931                 :             : */
   18932                 :             : 
   18933                 :    79265440 : extern "C" unsigned int SymbolTable_GetScope (unsigned int Sym)
   18934                 :             : {
   18935                 :    79265440 :   SymbolTable_PtrToSymbol pSym;
   18936                 :             : 
   18937                 :    79265440 :   pSym = GetPsym (Sym);
   18938                 :    79265440 :   switch (pSym->SymbolType)
   18939                 :             :     {
   18940                 :           0 :       case SymbolTable_ErrorSym:
   18941                 :           0 :         return pSym->Error.Scope;
   18942                 :             :         break;
   18943                 :             : 
   18944                 :             :       case SymbolTable_DefImpSym:
   18945                 :             :         return SymbolTable_NulSym;
   18946                 :     3351220 :         break;
   18947                 :             : 
   18948                 :     3351220 :       case SymbolTable_ModuleSym:
   18949                 :     3351220 :         return pSym->Module.Scope;
   18950                 :     3259402 :         break;
   18951                 :             : 
   18952                 :     3259402 :       case SymbolTable_VarSym:
   18953                 :     3259402 :         return pSym->Var.Scope;
   18954                 :    47918908 :         break;
   18955                 :             : 
   18956                 :    47918908 :       case SymbolTable_ProcedureSym:
   18957                 :    47918908 :         return pSym->Procedure.Scope;
   18958                 :      238232 :         break;
   18959                 :             : 
   18960                 :      238232 :       case SymbolTable_ProcTypeSym:
   18961                 :      238232 :         return pSym->ProcType.Scope;
   18962                 :     1142998 :         break;
   18963                 :             : 
   18964                 :     1142998 :       case SymbolTable_RecordFieldSym:
   18965                 :     1142998 :         return pSym->RecordField.Scope;
   18966                 :        8430 :         break;
   18967                 :             : 
   18968                 :        8430 :       case SymbolTable_VarientSym:
   18969                 :        8430 :         return pSym->Varient.Scope;
   18970                 :       23076 :         break;
   18971                 :             : 
   18972                 :       23076 :       case SymbolTable_VarientFieldSym:
   18973                 :       23076 :         return pSym->VarientField.Scope;
   18974                 :      134658 :         break;
   18975                 :             : 
   18976                 :      134658 :       case SymbolTable_EnumerationSym:
   18977                 :      134658 :         return pSym->Enumeration.Scope;
   18978                 :     1829948 :         break;
   18979                 :             : 
   18980                 :     1829948 :       case SymbolTable_EnumerationFieldSym:
   18981                 :     1829948 :         return pSym->EnumerationField.Scope;
   18982                 :      344805 :         break;
   18983                 :             : 
   18984                 :      344805 :       case SymbolTable_SubrangeSym:
   18985                 :      344805 :         return pSym->Subrange.Scope;
   18986                 :        1402 :         break;
   18987                 :             : 
   18988                 :        1402 :       case SymbolTable_ArraySym:
   18989                 :        1402 :         return pSym->Array.Scope;
   18990                 :      190969 :         break;
   18991                 :             : 
   18992                 :      190969 :       case SymbolTable_TypeSym:
   18993                 :      190969 :         return pSym->Type.Scope;
   18994                 :      101016 :         break;
   18995                 :             : 
   18996                 :      101016 :       case SymbolTable_PointerSym:
   18997                 :      101016 :         return pSym->Pointer.Scope;
   18998                 :      710667 :         break;
   18999                 :             : 
   19000                 :      710667 :       case SymbolTable_RecordSym:
   19001                 :      710667 :         return pSym->Record.Scope;
   19002                 :       16180 :         break;
   19003                 :             : 
   19004                 :       16180 :       case SymbolTable_SetSym:
   19005                 :       16180 :         return pSym->Set.Scope;
   19006                 :          24 :         break;
   19007                 :             : 
   19008                 :          24 :       case SymbolTable_UnboundedSym:
   19009                 :          24 :         return pSym->Unbounded.Scope;
   19010                 :          12 :         break;
   19011                 :             : 
   19012                 :          12 :       case SymbolTable_ConstLitSym:
   19013                 :          12 :         return pSym->ConstLit.Scope;
   19014                 :          48 :         break;
   19015                 :             : 
   19016                 :          48 :       case SymbolTable_ConstStringSym:
   19017                 :          48 :         return pSym->ConstString.Scope;
   19018                 :         258 :         break;
   19019                 :             : 
   19020                 :         258 :       case SymbolTable_ConstVarSym:
   19021                 :         258 :         return pSym->ConstVar.Scope;
   19022                 :         150 :         break;
   19023                 :             : 
   19024                 :         150 :       case SymbolTable_ParamSym:
   19025                 :         150 :         return pSym->Param.Scope;
   19026                 :          12 :         break;
   19027                 :             : 
   19028                 :          12 :       case SymbolTable_VarParamSym:
   19029                 :          12 :         return pSym->VarParam.Scope;
   19030                 :             :         break;
   19031                 :             : 
   19032                 :             :       case SymbolTable_UndefinedSym:
   19033                 :             :         return SymbolTable_NulSym;
   19034                 :           0 :         break;
   19035                 :             : 
   19036                 :           0 :       case SymbolTable_PartialUnboundedSym:
   19037                 :           0 :         M2Error_InternalError ((const char *) "should not be requesting the scope of a PartialUnbounded symbol", 63);
   19038                 :           0 :         break;
   19039                 :             : 
   19040                 :             : 
   19041                 :           0 :       default:
   19042                 :           0 :         M2Error_InternalError ((const char *) "not implemented yet", 19);
   19043                 :             :         break;
   19044                 :             :     }
   19045                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19046                 :             :   __builtin_unreachable ();
   19047                 :             : }
   19048                 :             : 
   19049                 :             : 
   19050                 :             : /*
   19051                 :             :    GetModuleScope - returns the module scope of symbol, sym.
   19052                 :             :                     If sym was declared within a nested procedure
   19053                 :             :                     then return the module which defines the
   19054                 :             :                     procedure.
   19055                 :             : */
   19056                 :             : 
   19057                 :      460336 : extern "C" unsigned int SymbolTable_GetModuleScope (unsigned int sym)
   19058                 :             : {
   19059                 :      460336 :   unsigned int mod;
   19060                 :             : 
   19061                 :      460336 :   mod = SymbolTable_GetScope (sym);
   19062                 :      921728 :   while (((mod != SymbolTable_NulSym) && (! (SymbolTable_IsDefImp (mod)))) && (! (SymbolTable_IsModule (mod))))
   19063                 :             :     {
   19064                 :        1056 :       mod = SymbolTable_GetScope (mod);
   19065                 :             :     }
   19066                 :      460336 :   return mod;
   19067                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19068                 :             :   __builtin_unreachable ();
   19069                 :             : }
   19070                 :             : 
   19071                 :             : 
   19072                 :             : /*
   19073                 :             :    GetProcedureScope - returns the innermost procedure (if any)
   19074                 :             :                        in which the symbol, sym, resides.
   19075                 :             :                        A module inside the procedure is skipped
   19076                 :             :                        over.
   19077                 :             : */
   19078                 :             : 
   19079                 :      373012 : extern "C" unsigned int SymbolTable_GetProcedureScope (unsigned int sym)
   19080                 :             : {
   19081                 :      750632 :   while ((sym != SymbolTable_NulSym) && (! (SymbolTable_IsProcedure (sym))))
   19082                 :             :     {
   19083                 :      377620 :       sym = SymbolTable_GetScope (sym);
   19084                 :             :     }
   19085                 :      373012 :   if ((sym != SymbolTable_NulSym) && (SymbolTable_IsProcedure (sym)))
   19086                 :             :     {
   19087                 :             :       return sym;
   19088                 :             :     }
   19089                 :             :   else
   19090                 :             :     {
   19091                 :      370678 :       return SymbolTable_NulSym;
   19092                 :             :     }
   19093                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19094                 :             :   __builtin_unreachable ();
   19095                 :             : }
   19096                 :             : 
   19097                 :             : 
   19098                 :             : /*
   19099                 :             :    IsModuleWithinProcedure - returns TRUE if module, sym, is
   19100                 :             :                              inside a procedure.
   19101                 :             : */
   19102                 :             : 
   19103                 :      265942 : extern "C" bool SymbolTable_IsModuleWithinProcedure (unsigned int sym)
   19104                 :             : {
   19105                 :      265942 :   return (SymbolTable_GetProcedureScope (sym)) != SymbolTable_NulSym;
   19106                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19107                 :             :   __builtin_unreachable ();
   19108                 :             : }
   19109                 :             : 
   19110                 :             : 
   19111                 :             : /*
   19112                 :             :    GetParent - returns the parent of symbol, Sym.
   19113                 :             : */
   19114                 :             : 
   19115                 :     2343398 : extern "C" unsigned int SymbolTable_GetParent (unsigned int Sym)
   19116                 :             : {
   19117                 :     2343398 :   SymbolTable_PtrToSymbol pSym;
   19118                 :             : 
   19119                 :     2343398 :   pSym = GetPsym (Sym);
   19120                 :     2343398 :   switch (pSym->SymbolType)
   19121                 :             :     {
   19122                 :           6 :       case SymbolTable_ErrorSym:
   19123                 :           6 :         M2Error_ErrorAbort0 ((const char *) "", 0);
   19124                 :      576946 :         break;
   19125                 :             : 
   19126                 :      576946 :       case SymbolTable_VarientSym:
   19127                 :      576946 :         return pSym->Varient.Parent;
   19128                 :     1734438 :         break;
   19129                 :             : 
   19130                 :     1734438 :       case SymbolTable_VarientFieldSym:
   19131                 :     1734438 :         return pSym->VarientField.Parent;
   19132                 :       32008 :         break;
   19133                 :             : 
   19134                 :       32008 :       case SymbolTable_RecordFieldSym:
   19135                 :       32008 :         return pSym->RecordField.Parent;
   19136                 :           0 :         break;
   19137                 :             : 
   19138                 :           0 :       case SymbolTable_EnumerationFieldSym:
   19139                 :           0 :         return pSym->EnumerationField.Type;
   19140                 :           0 :         break;
   19141                 :             : 
   19142                 :             : 
   19143                 :           0 :       default:
   19144                 :           0 :         M2Error_InternalError ((const char *) "not implemented yet", 19);
   19145                 :             :         break;
   19146                 :             :     }
   19147                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19148                 :             :   __builtin_unreachable ();
   19149                 :             : }
   19150                 :             : 
   19151                 :             : 
   19152                 :             : /*
   19153                 :             :    IsRecordField - returns true if Sym is a record field.
   19154                 :             : */
   19155                 :             : 
   19156                 :   672128928 : extern "C" bool SymbolTable_IsRecordField (unsigned int Sym)
   19157                 :             : {
   19158                 :   672128928 :   SymbolTable_PtrToSymbol pSym;
   19159                 :             : 
   19160                 :   672128928 :   pSym = GetPsym (Sym);
   19161                 :   672128928 :   return pSym->SymbolType == SymbolTable_RecordFieldSym;
   19162                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19163                 :             :   __builtin_unreachable ();
   19164                 :             : }
   19165                 :             : 
   19166                 :             : 
   19167                 :             : /*
   19168                 :             :    MakeProcType - returns a procedure type symbol with ProcTypeName.
   19169                 :             : */
   19170                 :             : 
   19171                 :     5167074 : extern "C" unsigned int SymbolTable_MakeProcType (unsigned int tok, NameKey_Name ProcTypeName)
   19172                 :             : {
   19173                 :     5167074 :   SymbolTable_PtrToSymbol pSym;
   19174                 :     5167074 :   unsigned int oaf;
   19175                 :     5167074 :   unsigned int sym;
   19176                 :             : 
   19177                 :     5167074 :   tok = CheckTok (tok, (const char *) "proctype", 8);
   19178                 :     5167074 :   sym = HandleHiddenOrDeclare (tok, ProcTypeName, &oaf);
   19179                 :     5167074 :   if (! (SymbolTable_IsError (sym)))
   19180                 :             :     {
   19181                 :     5167074 :       pSym = GetPsym (sym);
   19182                 :     5167074 :       pSym->SymbolType = SymbolTable_ProcTypeSym;
   19183                 :     5167074 :       switch (pSym->SymbolType)
   19184                 :             :         {
   19185                 :     5167074 :           case SymbolTable_ProcTypeSym:
   19186                 :     5167074 :             pSym->ProcType.ReturnType = SymbolTable_NulSym;
   19187                 :     5167074 :             pSym->ProcType.name = ProcTypeName;
   19188                 :     5167074 :             Lists_InitList (&pSym->ProcType.ListOfParam);
   19189                 :     5167074 :             pSym->ProcType.HasVarArgs = false;  /* Does this proc type use ... ?  */
   19190                 :     5167074 :             pSym->ProcType.HasOptArg = false;  /* Does this proc type use [ ] ?  */
   19191                 :     5167074 :             pSym->ProcType.OptArgInit = SymbolTable_NulSym;  /* The optarg initial value.  */
   19192                 :     5167074 :             pSym->ProcType.ReturnOptional = false;  /* Is the return value optional?  */
   19193                 :     5167074 :             pSym->ProcType.ReturnTypeTok = M2LexBuf_UnknownTokenNo;  /* Is the return value optional?  */
   19194                 :     5167074 :             pSym->ProcType.Scope = SymbolTable_GetCurrentScope ();
   19195                 :             :             /* scope of procedure.  */
   19196                 :     5167074 :             pSym->ProcType.Size = M2ALU_InitValue ();
   19197                 :     5167074 :             pSym->ProcType.TotalParamSize = M2ALU_InitValue ();  /* size of all parameters  */
   19198                 :     5167074 :             pSym->ProcType.oafamily = oaf;  /* The oa family for this symbol  */
   19199                 :     5167074 :             InitWhereDeclaredTok (tok, &pSym->ProcType.At);  /* Declared here  */
   19200                 :     5167074 :             break;
   19201                 :             : 
   19202                 :             : 
   19203                 :             :           default:
   19204                 :             :             M2Error_InternalError ((const char *) "expecting ProcType symbol", 25);
   19205                 :     5167074 :             break;
   19206                 :             :         }
   19207                 :             :     }
   19208                 :     5167074 :   SymbolTable_ForeachOAFamily (oaf, (SymbolTable_FamilyOperation) {(SymbolTable_FamilyOperation_t) doFillInOAFamily});
   19209                 :     5167074 :   return sym;
   19210                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19211                 :             :   __builtin_unreachable ();
   19212                 :             : }
   19213                 :             : 
   19214                 :             : 
   19215                 :             : /*
   19216                 :             :    PutProcTypeParam - Places a Non VAR parameter ParamName with type
   19217                 :             :                       ParamType into ProcType Sym.
   19218                 :             : */
   19219                 :             : 
   19220                 :     8241675 : extern "C" void SymbolTable_PutProcTypeParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded)
   19221                 :             : {
   19222                 :     8241675 :   SymbolTable_PtrToSymbol pSym;
   19223                 :     8241675 :   unsigned int ParSym;
   19224                 :             : 
   19225                 :     8241675 :   NewSym (&ParSym);
   19226                 :     8241675 :   pSym = GetPsym (ParSym);
   19227                 :     8241675 :   pSym->SymbolType = SymbolTable_ParamSym;
   19228                 :     8241675 :   pSym->Param.name = NameKey_NulName;
   19229                 :     8241675 :   pSym->Param.Type = ParamType;
   19230                 :     8241675 :   pSym->Param.IsUnbounded = isUnbounded;
   19231                 :     8241675 :   pSym->Param.ShadowVar = SymbolTable_NulSym;
   19232                 :     8241675 :   pSym->Param.FullTok = tok;
   19233                 :     8241675 :   pSym->Param.At = tok;
   19234                 :     8241675 :   AddParameter (Sym, SymbolTable_ProperProcedure, ParSym);
   19235                 :     8241675 : }
   19236                 :             : 
   19237                 :             : 
   19238                 :             : /*
   19239                 :             :    PutProcTypeVarParam - Places a Non VAR parameter ParamName with type
   19240                 :             :                          ParamType into ProcType Sym.
   19241                 :             : */
   19242                 :             : 
   19243                 :      767221 : extern "C" void SymbolTable_PutProcTypeVarParam (unsigned int tok, unsigned int Sym, unsigned int ParamType, bool isUnbounded)
   19244                 :             : {
   19245                 :      767221 :   SymbolTable_PtrToSymbol pSym;
   19246                 :      767221 :   unsigned int ParSym;
   19247                 :             : 
   19248                 :      767221 :   NewSym (&ParSym);
   19249                 :      767221 :   pSym = GetPsym (ParSym);
   19250                 :      767221 :   pSym->SymbolType = SymbolTable_VarParamSym;
   19251                 :      767221 :   pSym->Param.name = NameKey_NulName;
   19252                 :      767221 :   pSym->Param.Type = ParamType;
   19253                 :      767221 :   pSym->Param.IsUnbounded = isUnbounded;
   19254                 :      767221 :   pSym->Param.ShadowVar = SymbolTable_NulSym;
   19255                 :      767221 :   pSym->Param.FullTok = tok;
   19256                 :      767221 :   pSym->Param.At = tok;
   19257                 :      767221 :   AddParameter (Sym, SymbolTable_ProperProcedure, ParSym);
   19258                 :      767221 : }
   19259                 :             : 
   19260                 :             : 
   19261                 :             : /*
   19262                 :             :    IsProcType - returns true if Sym is a ProcType Symbol.
   19263                 :             : */
   19264                 :             : 
   19265                 :   280042016 : extern "C" bool SymbolTable_IsProcType (unsigned int Sym)
   19266                 :             : {
   19267                 :   280042016 :   SymbolTable_PtrToSymbol pSym;
   19268                 :             : 
   19269                 :   280042016 :   pSym = GetPsym (Sym);
   19270                 :   280042016 :   return pSym->SymbolType == SymbolTable_ProcTypeSym;
   19271                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19272                 :             :   __builtin_unreachable ();
   19273                 :             : }
   19274                 :             : 
   19275                 :             : 
   19276                 :             : /*
   19277                 :             :    IsVar - returns true if Sym is a Var Symbol.
   19278                 :             : */
   19279                 :             : 
   19280                 :   153377343 : extern "C" bool SymbolTable_IsVar (unsigned int Sym)
   19281                 :             : {
   19282                 :   153377343 :   SymbolTable_PtrToSymbol pSym;
   19283                 :             : 
   19284                 :   153377343 :   pSym = GetPsym (Sym);
   19285                 :   153377343 :   return pSym->SymbolType == SymbolTable_VarSym;
   19286                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19287                 :             :   __builtin_unreachable ();
   19288                 :             : }
   19289                 :             : 
   19290                 :             : 
   19291                 :             : /*
   19292                 :             :    IsVarConst - returns the IsConst field indicating the variable is read only.
   19293                 :             : */
   19294                 :             : 
   19295                 :      323118 : extern "C" bool SymbolTable_IsVarConst (unsigned int sym)
   19296                 :             : {
   19297                 :      323118 :   SymbolTable_PtrToSymbol pSym;
   19298                 :             : 
   19299                 :      323118 :   pSym = GetPsym (sym);
   19300                 :      323118 :   switch (pSym->SymbolType)
   19301                 :             :     {
   19302                 :      323118 :       case SymbolTable_VarSym:
   19303                 :      323118 :         return pSym->Var.IsConst;
   19304                 :           0 :         break;
   19305                 :             : 
   19306                 :             : 
   19307                 :           0 :       default:
   19308                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   19309                 :             :         break;
   19310                 :             :     }
   19311                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19312                 :             :   __builtin_unreachable ();
   19313                 :             : }
   19314                 :             : 
   19315                 :             : 
   19316                 :             : /*
   19317                 :             :    IsConst - returns true if Sym contains a constant value.
   19318                 :             : */
   19319                 :             : 
   19320                 :   237206935 : extern "C" bool SymbolTable_IsConst (unsigned int Sym)
   19321                 :             : {
   19322                 :   237206935 :   if (SymbolTable_IsConstructor (Sym))
   19323                 :             :     {
   19324                 :     3588272 :       return SymbolTable_IsConstructorConstant (Sym);
   19325                 :             :     }
   19326                 :             :   else
   19327                 :             :     {
   19328                 :   233618663 :       return DoIsConst (Sym);
   19329                 :             :     }
   19330                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19331                 :             :   __builtin_unreachable ();
   19332                 :             : }
   19333                 :             : 
   19334                 :             : 
   19335                 :             : /*
   19336                 :             :    IsConstString - returns whether sym is a conststring of any variant.
   19337                 :             : */
   19338                 :             : 
   19339                 :     7564002 : extern "C" bool SymbolTable_IsConstString (unsigned int sym)
   19340                 :             : {
   19341                 :     7564002 :   SymbolTable_PtrToSymbol pSym;
   19342                 :             : 
   19343                 :     7564002 :   pSym = GetPsym (sym);
   19344                 :     7564002 :   return pSym->SymbolType == SymbolTable_ConstStringSym;
   19345                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19346                 :             :   __builtin_unreachable ();
   19347                 :             : }
   19348                 :             : 
   19349                 :             : 
   19350                 :             : /*
   19351                 :             :    IsConstStringNulTerminated - returns TRUE if the constant string, sym,
   19352                 :             :                                 should be created with a nul terminator.
   19353                 :             : */
   19354                 :             : 
   19355                 :           0 : extern "C" bool SymbolTable_IsConstStringNulTerminated (unsigned int sym)
   19356                 :             : {
   19357                 :           0 :   SymbolTable_PtrToSymbol pSym;
   19358                 :             : 
   19359                 :           0 :   pSym = GetPsym (sym);
   19360                 :           0 :   switch (pSym->SymbolType)
   19361                 :             :     {
   19362                 :           0 :       case SymbolTable_ConstStringSym:
   19363                 :           0 :         return (pSym->ConstString.StringVariant == SymbolTable_m2nulstr) || (pSym->ConstString.StringVariant == SymbolTable_cnulstr);
   19364                 :           0 :         break;
   19365                 :             : 
   19366                 :             : 
   19367                 :           0 :       default:
   19368                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstStringSym", 24);
   19369                 :             :         break;
   19370                 :             :     }
   19371                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19372                 :             :   __builtin_unreachable ();
   19373                 :             : }
   19374                 :             : 
   19375                 :             : 
   19376                 :             : /*
   19377                 :             :    IsConstLit - returns true if Sym is a literal constant.
   19378                 :             : */
   19379                 :             : 
   19380                 :     9035506 : extern "C" bool SymbolTable_IsConstLit (unsigned int Sym)
   19381                 :             : {
   19382                 :     9035506 :   SymbolTable_PtrToSymbol pSym;
   19383                 :             : 
   19384                 :     9035506 :   pSym = GetPsym (Sym);
   19385                 :     9035506 :   return pSym->SymbolType == SymbolTable_ConstLitSym;
   19386                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19387                 :             :   __builtin_unreachable ();
   19388                 :             : }
   19389                 :             : 
   19390                 :             : 
   19391                 :             : /*
   19392                 :             :    IsConstructor - returns TRUE if the constant is declared as a
   19393                 :             :                    constant set, array or record.
   19394                 :             : */
   19395                 :             : 
   19396                 :   386309935 : extern "C" bool SymbolTable_IsConstructor (unsigned int Sym)
   19397                 :             : {
   19398                 :   386309935 :   SymbolTable_PtrToSymbol pSym;
   19399                 :             : 
   19400                 :   386309935 :   pSym = GetPsym (Sym);
   19401                 :   386309935 :   switch (pSym->SymbolType)
   19402                 :             :     {
   19403                 :    62820046 :       case SymbolTable_ConstVarSym:
   19404                 :    62820046 :         return pSym->ConstVar.IsConstructor;
   19405                 :    67270920 :         break;
   19406                 :             : 
   19407                 :    67270920 :       case SymbolTable_ConstLitSym:
   19408                 :    67270920 :         return pSym->ConstLit.IsConstructor;
   19409                 :             :         break;
   19410                 :             : 
   19411                 :             : 
   19412                 :             :       default:
   19413                 :             :         return false;
   19414                 :             :         break;
   19415                 :             :     }
   19416                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19417                 :             :   __builtin_unreachable ();
   19418                 :             : }
   19419                 :             : 
   19420                 :             : 
   19421                 :             : /*
   19422                 :             :    IsDummy - returns true if Sym is a Dummy symbol.
   19423                 :             : */
   19424                 :             : 
   19425                 :           0 : extern "C" bool SymbolTable_IsDummy (unsigned int Sym)
   19426                 :             : {
   19427                 :           0 :   SymbolTable_PtrToSymbol pSym;
   19428                 :             : 
   19429                 :           0 :   pSym = GetPsym (Sym);
   19430                 :           0 :   return pSym->SymbolType == SymbolTable_DummySym;
   19431                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19432                 :             :   __builtin_unreachable ();
   19433                 :             : }
   19434                 :             : 
   19435                 :             : 
   19436                 :             : /*
   19437                 :             :    IsTemporary - returns true if Sym is a Temporary symbol.
   19438                 :             : */
   19439                 :             : 
   19440                 :     2030204 : extern "C" bool SymbolTable_IsTemporary (unsigned int Sym)
   19441                 :             : {
   19442                 :     2030204 :   SymbolTable_PtrToSymbol pSym;
   19443                 :             : 
   19444                 :     2030204 :   pSym = GetPsym (Sym);
   19445                 :     2030204 :   switch (pSym->SymbolType)
   19446                 :             :     {
   19447                 :     1945625 :       case SymbolTable_VarSym:
   19448                 :     1945625 :         return pSym->Var.IsTemp;
   19449                 :        3318 :         break;
   19450                 :             : 
   19451                 :        3318 :       case SymbolTable_ConstVarSym:
   19452                 :        3318 :         return pSym->ConstVar.IsTemp;
   19453                 :             :         break;
   19454                 :             : 
   19455                 :             : 
   19456                 :             :       default:
   19457                 :             :         return false;
   19458                 :             :         break;
   19459                 :             :     }
   19460                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19461                 :             :   __builtin_unreachable ();
   19462                 :             : }
   19463                 :             : 
   19464                 :             : 
   19465                 :             : /*
   19466                 :             :    IsVarAParam - returns true if Sym is a variable declared as a parameter.
   19467                 :             : */
   19468                 :             : 
   19469                 :       34708 : extern "C" bool SymbolTable_IsVarAParam (unsigned int Sym)
   19470                 :             : {
   19471                 :       34708 :   SymbolTable_PtrToSymbol pSym;
   19472                 :             : 
   19473                 :       34708 :   pSym = GetPsym (Sym);
   19474                 :       34708 :   switch (pSym->SymbolType)
   19475                 :             :     {
   19476                 :       34708 :       case SymbolTable_VarSym:
   19477                 :       34708 :         return pSym->Var.IsParam;
   19478                 :             :         break;
   19479                 :             : 
   19480                 :             : 
   19481                 :             :       default:
   19482                 :             :         return false;
   19483                 :             :         break;
   19484                 :             :     }
   19485                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19486                 :             :   __builtin_unreachable ();
   19487                 :             : }
   19488                 :             : 
   19489                 :             : 
   19490                 :             : /*
   19491                 :             :    IsSubscript - returns true if Sym is a subscript symbol.
   19492                 :             : */
   19493                 :             : 
   19494                 :     5784462 : extern "C" bool SymbolTable_IsSubscript (unsigned int Sym)
   19495                 :             : {
   19496                 :     5784462 :   SymbolTable_PtrToSymbol pSym;
   19497                 :             : 
   19498                 :     5784462 :   pSym = GetPsym (Sym);
   19499                 :     5784462 :   return pSym->SymbolType == SymbolTable_SubscriptSym;
   19500                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19501                 :             :   __builtin_unreachable ();
   19502                 :             : }
   19503                 :             : 
   19504                 :             : 
   19505                 :             : /*
   19506                 :             :    IsSubrange - returns true if Sym is a subrange symbol.
   19507                 :             : */
   19508                 :             : 
   19509                 :   441657535 : extern "C" bool SymbolTable_IsSubrange (unsigned int Sym)
   19510                 :             : {
   19511                 :   441657535 :   SymbolTable_PtrToSymbol pSym;
   19512                 :             : 
   19513                 :   441657535 :   pSym = GetPsym (Sym);
   19514                 :   441657535 :   return pSym->SymbolType == SymbolTable_SubrangeSym;
   19515                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19516                 :             :   __builtin_unreachable ();
   19517                 :             : }
   19518                 :             : 
   19519                 :             : 
   19520                 :             : /*
   19521                 :             :    IsProcedureVariable - returns true if a Sym is a variable and
   19522                 :             :                          it was declared within a procedure.
   19523                 :             : */
   19524                 :             : 
   19525                 :           0 : extern "C" bool SymbolTable_IsProcedureVariable (unsigned int Sym)
   19526                 :             : {
   19527                 :           0 :   AssertInRange (Sym);
   19528                 :           0 :   return (SymbolTable_IsVar (Sym)) && (SymbolTable_IsProcedure (SymbolTable_GetVarScope (Sym)));
   19529                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19530                 :             :   __builtin_unreachable ();
   19531                 :             : }
   19532                 :             : 
   19533                 :             : 
   19534                 :             : /*
   19535                 :             :    IsProcedureNested - returns TRUE if procedure, Sym, was
   19536                 :             :                        declared as a nested procedure.
   19537                 :             : */
   19538                 :             : 
   19539                 :     4637192 : extern "C" bool SymbolTable_IsProcedureNested (unsigned int Sym)
   19540                 :             : {
   19541                 :     4637192 :   return (SymbolTable_IsProcedure (Sym)) && (SymbolTable_IsProcedure (SymbolTable_GetScope (Sym)));
   19542                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19543                 :             :   __builtin_unreachable ();
   19544                 :             : }
   19545                 :             : 
   19546                 :             : 
   19547                 :             : /*
   19548                 :             :    IsAModula2Type - returns true if Sym, is a:
   19549                 :             :                     IsType, IsPointer, IsRecord, IsEnumeration,
   19550                 :             :                     IsSubrange, IsArray, IsUnbounded, IsProcType.
   19551                 :             :                     NOTE that it different from IsType.
   19552                 :             : */
   19553                 :             : 
   19554                 :    47898392 : extern "C" bool SymbolTable_IsAModula2Type (unsigned int Sym)
   19555                 :             : {
   19556                 :    47898392 :   AssertInRange (Sym);
   19557                 :    47898392 :   return ((((((((SymbolTable_IsType (Sym)) || (SymbolTable_IsRecord (Sym))) || (SymbolTable_IsPointer (Sym))) || (SymbolTable_IsEnumeration (Sym))) || (SymbolTable_IsSubrange (Sym))) || (SymbolTable_IsArray (Sym))) || (SymbolTable_IsUnbounded (Sym))) || (SymbolTable_IsProcType (Sym))) || (SymbolTable_IsSet (Sym));
   19558                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19559                 :             :   __builtin_unreachable ();
   19560                 :             : }
   19561                 :             : 
   19562                 :             : 
   19563                 :             : /*
   19564                 :             :    IsGnuAsmVolatile - returns TRUE if a GnuAsm symbol was defined as VOLATILE.
   19565                 :             : */
   19566                 :             : 
   19567                 :          27 : extern "C" bool SymbolTable_IsGnuAsmVolatile (unsigned int Sym)
   19568                 :             : {
   19569                 :          27 :   SymbolTable_PtrToSymbol pSym;
   19570                 :             : 
   19571                 :          27 :   pSym = GetPsym (Sym);
   19572                 :          27 :   switch (pSym->SymbolType)
   19573                 :             :     {
   19574                 :          27 :       case SymbolTable_GnuAsmSym:
   19575                 :          27 :         return pSym->GnuAsm.Volatile;
   19576                 :           0 :         break;
   19577                 :             : 
   19578                 :             : 
   19579                 :           0 :       default:
   19580                 :           0 :         M2Error_InternalError ((const char *) "expecting GnuAsm symbol", 23);
   19581                 :             :         break;
   19582                 :             :     }
   19583                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19584                 :             :   __builtin_unreachable ();
   19585                 :             : }
   19586                 :             : 
   19587                 :             : 
   19588                 :             : /*
   19589                 :             :    IsGnuAsmSimple - returns TRUE if a GnuAsm symbol is a simple kind.
   19590                 :             : */
   19591                 :             : 
   19592                 :          27 : extern "C" bool SymbolTable_IsGnuAsmSimple (unsigned int Sym)
   19593                 :             : {
   19594                 :          27 :   SymbolTable_PtrToSymbol pSym;
   19595                 :             : 
   19596                 :          27 :   pSym = GetPsym (Sym);
   19597                 :          27 :   switch (pSym->SymbolType)
   19598                 :             :     {
   19599                 :          27 :       case SymbolTable_GnuAsmSym:
   19600                 :          27 :         return pSym->GnuAsm.Simple;
   19601                 :           0 :         break;
   19602                 :             : 
   19603                 :             : 
   19604                 :           0 :       default:
   19605                 :           0 :         M2Error_InternalError ((const char *) "expecting GnuAsm symbol", 23);
   19606                 :             :         break;
   19607                 :             :     }
   19608                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19609                 :             :   __builtin_unreachable ();
   19610                 :             : }
   19611                 :             : 
   19612                 :             : 
   19613                 :             : /*
   19614                 :             :    IsGnuAsm - returns TRUE if Sym is a GnuAsm symbol.
   19615                 :             : */
   19616                 :             : 
   19617                 :         108 : extern "C" bool SymbolTable_IsGnuAsm (unsigned int Sym)
   19618                 :             : {
   19619                 :         108 :   SymbolTable_PtrToSymbol pSym;
   19620                 :             : 
   19621                 :         108 :   pSym = GetPsym (Sym);
   19622                 :         108 :   return pSym->SymbolType == SymbolTable_GnuAsmSym;
   19623                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19624                 :             :   __builtin_unreachable ();
   19625                 :             : }
   19626                 :             : 
   19627                 :             : 
   19628                 :             : /*
   19629                 :             :    IsRegInterface - returns TRUE if Sym is a RegInterface symbol.
   19630                 :             : */
   19631                 :             : 
   19632                 :           0 : extern "C" bool SymbolTable_IsRegInterface (unsigned int Sym)
   19633                 :             : {
   19634                 :           0 :   SymbolTable_PtrToSymbol pSym;
   19635                 :             : 
   19636                 :           0 :   pSym = GetPsym (Sym);
   19637                 :           0 :   return pSym->SymbolType == SymbolTable_InterfaceSym;
   19638                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19639                 :             :   __builtin_unreachable ();
   19640                 :             : }
   19641                 :             : 
   19642                 :             : 
   19643                 :             : /*
   19644                 :             :    IsSizeSolved - returns true if the size of Sym is solved.
   19645                 :             : */
   19646                 :             : 
   19647                 :       23486 : extern "C" bool SymbolTable_IsSizeSolved (unsigned int Sym)
   19648                 :             : {
   19649                 :       23486 :   SymbolTable_PtrToSymbol pSym;
   19650                 :             : 
   19651                 :       23486 :   AssertInRange (Sym);
   19652                 :       23486 :   pSym = GetPsym (Sym);
   19653                 :       23486 :   switch (pSym->SymbolType)
   19654                 :             :     {
   19655                 :           0 :       case SymbolTable_ProcedureSym:
   19656                 :           0 :         return M2ALU_IsSolved (pSym->Procedure.Size);
   19657                 :        3036 :         break;
   19658                 :             : 
   19659                 :        3036 :       case SymbolTable_VarSym:
   19660                 :        3036 :         return M2ALU_IsSolved (pSym->Var.Size);
   19661                 :       16088 :         break;
   19662                 :             : 
   19663                 :       16088 :       case SymbolTable_TypeSym:
   19664                 :       16088 :         return M2ALU_IsSolved (pSym->Type.Size);
   19665                 :         788 :         break;
   19666                 :             : 
   19667                 :         788 :       case SymbolTable_SetSym:
   19668                 :         788 :         return M2ALU_IsSolved (pSym->Set.Size);
   19669                 :          12 :         break;
   19670                 :             : 
   19671                 :          12 :       case SymbolTable_RecordSym:
   19672                 :          12 :         return M2ALU_IsSolved (pSym->Record.Size);
   19673                 :           0 :         break;
   19674                 :             : 
   19675                 :           0 :       case SymbolTable_VarientSym:
   19676                 :           0 :         return M2ALU_IsSolved (pSym->Varient.Size);
   19677                 :          12 :         break;
   19678                 :             : 
   19679                 :          12 :       case SymbolTable_EnumerationSym:
   19680                 :          12 :         return M2ALU_IsSolved (pSym->Enumeration.Size);
   19681                 :          52 :         break;
   19682                 :             : 
   19683                 :          52 :       case SymbolTable_PointerSym:
   19684                 :          52 :         return M2ALU_IsSolved (pSym->Pointer.Size);
   19685                 :        3486 :         break;
   19686                 :             : 
   19687                 :        3486 :       case SymbolTable_ArraySym:
   19688                 :        3486 :         return M2ALU_IsSolved (pSym->Array.Size);
   19689                 :           0 :         break;
   19690                 :             : 
   19691                 :           0 :       case SymbolTable_RecordFieldSym:
   19692                 :           0 :         return M2ALU_IsSolved (pSym->RecordField.Size);
   19693                 :           0 :         break;
   19694                 :             : 
   19695                 :           0 :       case SymbolTable_VarientFieldSym:
   19696                 :           0 :         return M2ALU_IsSolved (pSym->VarientField.Size);
   19697                 :           0 :         break;
   19698                 :             : 
   19699                 :           0 :       case SymbolTable_SubrangeSym:
   19700                 :           0 :         return M2ALU_IsSolved (pSym->Subrange.Size);
   19701                 :           0 :         break;
   19702                 :             : 
   19703                 :           0 :       case SymbolTable_SubscriptSym:
   19704                 :           0 :         return M2ALU_IsSolved (pSym->Subscript.Size);
   19705                 :          12 :         break;
   19706                 :             : 
   19707                 :          12 :       case SymbolTable_ProcTypeSym:
   19708                 :          12 :         return M2ALU_IsSolved (pSym->ProcType.Size);
   19709                 :           0 :         break;
   19710                 :             : 
   19711                 :           0 :       case SymbolTable_UnboundedSym:
   19712                 :           0 :         return M2ALU_IsSolved (pSym->Unbounded.Size);
   19713                 :           0 :         break;
   19714                 :             : 
   19715                 :             : 
   19716                 :           0 :       default:
   19717                 :           0 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   19718                 :             :         break;
   19719                 :             :     }
   19720                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19721                 :             :   __builtin_unreachable ();
   19722                 :             : }
   19723                 :             : 
   19724                 :             : 
   19725                 :             : /*
   19726                 :             :    IsOffsetSolved - returns true if the Offset of Sym is solved.
   19727                 :             : */
   19728                 :             : 
   19729                 :           0 : extern "C" bool SymbolTable_IsOffsetSolved (unsigned int Sym)
   19730                 :             : {
   19731                 :           0 :   SymbolTable_PtrToSymbol pSym;
   19732                 :             : 
   19733                 :           0 :   AssertInRange (Sym);
   19734                 :           0 :   pSym = GetPsym (Sym);
   19735                 :           0 :   switch (pSym->SymbolType)
   19736                 :             :     {
   19737                 :           0 :       case SymbolTable_VarSym:
   19738                 :           0 :         return M2ALU_IsSolved (pSym->Var.Offset);
   19739                 :           0 :         break;
   19740                 :             : 
   19741                 :           0 :       case SymbolTable_RecordFieldSym:
   19742                 :           0 :         return M2ALU_IsSolved (pSym->RecordField.Offset);
   19743                 :           0 :         break;
   19744                 :             : 
   19745                 :           0 :       case SymbolTable_VarientFieldSym:
   19746                 :           0 :         return M2ALU_IsSolved (pSym->VarientField.Offset);
   19747                 :           0 :         break;
   19748                 :             : 
   19749                 :             : 
   19750                 :           0 :       default:
   19751                 :           0 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   19752                 :             :         break;
   19753                 :             :     }
   19754                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19755                 :             :   __builtin_unreachable ();
   19756                 :             : }
   19757                 :             : 
   19758                 :             : 
   19759                 :             : /*
   19760                 :             :    IsValueSolved - returns true if the value of Sym is solved.
   19761                 :             : */
   19762                 :             : 
   19763                 :     3697551 : extern "C" bool SymbolTable_IsValueSolved (unsigned int Sym)
   19764                 :             : {
   19765                 :     3697551 :   SymbolTable_PtrToSymbol pSym;
   19766                 :             : 
   19767                 :     3697551 :   AssertInRange (Sym);
   19768                 :     3697551 :   pSym = GetPsym (Sym);
   19769                 :     3697551 :   switch (pSym->SymbolType)
   19770                 :             :     {
   19771                 :     2078112 :       case SymbolTable_ConstLitSym:
   19772                 :     2078112 :         return M2ALU_IsSolved (pSym->ConstLit.Value);
   19773                 :      794761 :         break;
   19774                 :             : 
   19775                 :      794761 :       case SymbolTable_ConstVarSym:
   19776                 :      794761 :         return M2ALU_IsSolved (pSym->ConstVar.Value);
   19777                 :      546118 :         break;
   19778                 :             : 
   19779                 :      546118 :       case SymbolTable_EnumerationFieldSym:
   19780                 :      546118 :         return M2ALU_IsSolved (pSym->EnumerationField.Value);
   19781                 :             :         break;
   19782                 :             : 
   19783                 :             :       case SymbolTable_ConstStringSym:
   19784                 :             :         return true;
   19785                 :           6 :         break;
   19786                 :             : 
   19787                 :             : 
   19788                 :           6 :       default:
   19789                 :           6 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   19790                 :             :         break;
   19791                 :             :     }
   19792                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19793                 :             :   __builtin_unreachable ();
   19794                 :             : }
   19795                 :             : 
   19796                 :             : 
   19797                 :             : /*
   19798                 :             :    IsConstructorConstant - returns TRUE if constructor, Sym, is
   19799                 :             :                            defined by only constants.
   19800                 :             : */
   19801                 :             : 
   19802                 :     4195688 : extern "C" bool SymbolTable_IsConstructorConstant (unsigned int Sym)
   19803                 :             : {
   19804                 :     4195688 :   SymbolTable_PtrToSymbol pSym;
   19805                 :             : 
   19806                 :     4195688 :   if ((SymbolTable_IsConstructor (Sym)) || (SymbolTable_IsConstSet (Sym)))
   19807                 :             :     {
   19808                 :     4195688 :       pSym = GetPsym (Sym);
   19809                 :     4195688 :       switch (pSym->SymbolType)
   19810                 :             :         {
   19811                 :     4195688 :           case SymbolTable_ConstVarSym:
   19812                 :     4195688 :             return M2ALU_IsValueConst (pSym->ConstVar.Value);
   19813                 :           0 :             break;
   19814                 :             : 
   19815                 :           0 :           case SymbolTable_ConstLitSym:
   19816                 :           0 :             return M2ALU_IsValueConst (pSym->ConstLit.Value);
   19817                 :           0 :             break;
   19818                 :             : 
   19819                 :             : 
   19820                 :           0 :           default:
   19821                 :           0 :             M2Error_InternalError ((const char *) "expecting Constructor", 21);
   19822                 :           0 :             break;
   19823                 :             :         }
   19824                 :             :     }
   19825                 :             :   else
   19826                 :             :     {
   19827                 :           0 :       M2Error_InternalError ((const char *) "expecting Constructor", 21);
   19828                 :             :     }
   19829                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19830                 :             :   __builtin_unreachable ();
   19831                 :             : }
   19832                 :             : 
   19833                 :             : 
   19834                 :             : /*
   19835                 :             :    IsComposite - returns TRUE if symbol, sym, is a composite
   19836                 :             :                  type:  ie an ARRAY or RECORD.
   19837                 :             : */
   19838                 :             : 
   19839                 :      151006 : extern "C" bool SymbolTable_IsComposite (unsigned int sym)
   19840                 :             : {
   19841                 :      151006 :   if (sym == SymbolTable_NulSym)
   19842                 :             :     {
   19843                 :             :       return false;
   19844                 :             :     }
   19845                 :             :   else
   19846                 :             :     {
   19847                 :      150982 :       sym = SymbolTable_SkipType (sym);
   19848                 :      150982 :       return (SymbolTable_IsArray (sym)) || (SymbolTable_IsRecord (sym));
   19849                 :             :     }
   19850                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   19851                 :             :   __builtin_unreachable ();
   19852                 :             : }
   19853                 :             : 
   19854                 :             : 
   19855                 :             : /*
   19856                 :             :    IsSumOfParamSizeSolved - has the sum of parameters been solved yet?
   19857                 :             : */
   19858                 :             : 
   19859                 :           0 : extern "C" bool SymbolTable_IsSumOfParamSizeSolved (unsigned int Sym)
   19860                 :             : {
   19861                 :           0 :   SymbolTable_PtrToSymbol pSym;
   19862                 :             : 
   19863                 :           0 :   AssertInRange (Sym);
   19864                 :           0 :   pSym = GetPsym (Sym);
   19865                 :           0 :   switch (pSym->SymbolType)
   19866                 :             :     {
   19867                 :           0 :       case SymbolTable_ProcedureSym:
   19868                 :           0 :         return M2ALU_IsSolved (pSym->Procedure.TotalParamSize);
   19869                 :           0 :         break;
   19870                 :             : 
   19871                 :           0 :       case SymbolTable_ProcTypeSym:
   19872                 :           0 :         return M2ALU_IsSolved (pSym->ProcType.TotalParamSize);
   19873                 :           0 :         break;
   19874                 :             : 
   19875                 :             : 
   19876                 :           0 :       default:
   19877                 :           0 :         M2Error_InternalError ((const char *) "expecting Procedure or ProcType symbol", 38);
   19878                 :             :         break;
   19879                 :             :     }
   19880                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19881                 :             :   __builtin_unreachable ();
   19882                 :             : }
   19883                 :             : 
   19884                 :             : 
   19885                 :             : /*
   19886                 :             :    PutAlignment - assigns the alignment constant associated with,
   19887                 :             :                   type, with, align.
   19888                 :             : */
   19889                 :             : 
   19890                 :         192 : extern "C" void SymbolTable_PutAlignment (unsigned int type, unsigned int align)
   19891                 :             : {
   19892                 :         192 :   SymbolTable_PtrToSymbol pSym;
   19893                 :             : 
   19894                 :         192 :   pSym = GetPsym (type);
   19895                 :         192 :   switch (pSym->SymbolType)
   19896                 :             :     {
   19897                 :           0 :       case SymbolTable_RecordSym:
   19898                 :           0 :         pSym->Record.Align = align;
   19899                 :           0 :         break;
   19900                 :             : 
   19901                 :         120 :       case SymbolTable_RecordFieldSym:
   19902                 :         120 :         pSym->RecordField.Align = align;
   19903                 :         120 :         break;
   19904                 :             : 
   19905                 :          18 :       case SymbolTable_TypeSym:
   19906                 :          18 :         pSym->Type.Align = align;
   19907                 :          18 :         break;
   19908                 :             : 
   19909                 :          12 :       case SymbolTable_PointerSym:
   19910                 :          12 :         pSym->Pointer.Align = align;
   19911                 :          12 :         break;
   19912                 :             : 
   19913                 :          12 :       case SymbolTable_SubrangeSym:
   19914                 :          12 :         pSym->Subrange.Align = align;
   19915                 :          12 :         break;
   19916                 :             : 
   19917                 :           0 :       case SymbolTable_SetSym:
   19918                 :           0 :         pSym->Set.Align = align;
   19919                 :           0 :         break;
   19920                 :             : 
   19921                 :          30 :       case SymbolTable_ArraySym:
   19922                 :          30 :         pSym->Array.Align = align;
   19923                 :          30 :         break;
   19924                 :             : 
   19925                 :             : 
   19926                 :           0 :       default:
   19927                 :           0 :         M2Error_InternalError ((const char *) "expecting record, field, pointer, type, subrange or an array symbol", 67);
   19928                 :         192 :         break;
   19929                 :             :     }
   19930                 :         192 : }
   19931                 :             : 
   19932                 :             : 
   19933                 :             : /*
   19934                 :             :    GetAlignment - returns the alignment constant associated with,
   19935                 :             :                   type.
   19936                 :             : */
   19937                 :             : 
   19938                 :   399821343 : extern "C" unsigned int SymbolTable_GetAlignment (unsigned int type)
   19939                 :             : {
   19940                 :   399827493 :   SymbolTable_PtrToSymbol pSym;
   19941                 :             : 
   19942                 :   399827493 :   pSym = GetPsym (type);
   19943                 :   399827493 :   switch (pSym->SymbolType)
   19944                 :             :     {
   19945                 :      106699 :       case SymbolTable_RecordSym:
   19946                 :      106699 :         return pSym->Record.Align;
   19947                 :   235768264 :         break;
   19948                 :             : 
   19949                 :   235768264 :       case SymbolTable_RecordFieldSym:
   19950                 :   235768264 :         return pSym->RecordField.Align;
   19951                 :   102577375 :         break;
   19952                 :             : 
   19953                 :   102577375 :       case SymbolTable_TypeSym:
   19954                 :   102577375 :         return pSym->Type.Align;
   19955                 :    49983926 :         break;
   19956                 :             : 
   19957                 :    49983926 :       case SymbolTable_PointerSym:
   19958                 :    49983926 :         return pSym->Pointer.Align;
   19959                 :        6114 :         break;
   19960                 :             : 
   19961                 :        6114 :       case SymbolTable_VarientFieldSym:
   19962                 :        6114 :         return SymbolTable_GetAlignment (pSym->VarientField.Parent);
   19963                 :          36 :         break;
   19964                 :             : 
   19965                 :          36 :       case SymbolTable_VarientSym:
   19966                 :          36 :         return SymbolTable_GetAlignment (pSym->Varient.Parent);
   19967                 :     6009481 :         break;
   19968                 :             : 
   19969                 :     6009481 :       case SymbolTable_SubrangeSym:
   19970                 :     6009481 :         return pSym->Subrange.Align;
   19971                 :           0 :         break;
   19972                 :             : 
   19973                 :           0 :       case SymbolTable_SetSym:
   19974                 :           0 :         return pSym->Set.Align;
   19975                 :     5375598 :         break;
   19976                 :             : 
   19977                 :     5375598 :       case SymbolTable_ArraySym:
   19978                 :     5375598 :         return pSym->Array.Align;
   19979                 :           0 :         break;
   19980                 :             : 
   19981                 :             : 
   19982                 :           0 :       default:
   19983                 :           0 :         M2Error_InternalError ((const char *) "expecting record, field, pointer, type, subrange or an array symbol", 67);
   19984                 :             :         break;
   19985                 :             :     }
   19986                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   19987                 :             :   __builtin_unreachable ();
   19988                 :             : }
   19989                 :             : 
   19990                 :             : 
   19991                 :             : /*
   19992                 :             :    GetDefaultRecordFieldAlignment - assigns, align, as the default alignment
   19993                 :             :                                     to record, sym.
   19994                 :             : */
   19995                 :             : 
   19996                 :    45073239 : extern "C" unsigned int SymbolTable_GetDefaultRecordFieldAlignment (unsigned int sym)
   19997                 :             : {
   19998                 :    45079281 :   SymbolTable_PtrToSymbol pSym;
   19999                 :             : 
   20000                 :    45079281 :   pSym = GetPsym (sym);
   20001                 :    45079281 :   switch (pSym->SymbolType)
   20002                 :             :     {
   20003                 :    45073239 :       case SymbolTable_RecordSym:
   20004                 :    45073239 :         return pSym->Record.DefaultAlign;
   20005                 :        6042 :         break;
   20006                 :             : 
   20007                 :        6042 :       case SymbolTable_VarientFieldSym:
   20008                 :        6042 :         return SymbolTable_GetDefaultRecordFieldAlignment (SymbolTable_GetParent (sym));
   20009                 :           0 :         break;
   20010                 :             : 
   20011                 :           0 :       case SymbolTable_VarientSym:
   20012                 :           0 :         return SymbolTable_GetDefaultRecordFieldAlignment (SymbolTable_GetParent (sym));
   20013                 :           0 :         break;
   20014                 :             : 
   20015                 :             : 
   20016                 :           0 :       default:
   20017                 :           0 :         M2Error_InternalError ((const char *) "expecting record symbol", 23);
   20018                 :             :         break;
   20019                 :             :     }
   20020                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20021                 :             :   __builtin_unreachable ();
   20022                 :             : }
   20023                 :             : 
   20024                 :             : 
   20025                 :             : /*
   20026                 :             :    PutDefaultRecordFieldAlignment - assigns, align, as the default alignment
   20027                 :             :                                     to record, sym.
   20028                 :             : */
   20029                 :             : 
   20030                 :          36 : extern "C" void SymbolTable_PutDefaultRecordFieldAlignment (unsigned int sym, unsigned int align)
   20031                 :             : {
   20032                 :          36 :   SymbolTable_PtrToSymbol pSym;
   20033                 :             : 
   20034                 :          36 :   pSym = GetPsym (sym);
   20035                 :          36 :   switch (pSym->SymbolType)
   20036                 :             :     {
   20037                 :          36 :       case SymbolTable_RecordSym:
   20038                 :          36 :         pSym->Record.DefaultAlign = align;
   20039                 :          36 :         break;
   20040                 :             : 
   20041                 :             : 
   20042                 :           0 :       default:
   20043                 :           0 :         M2Error_InternalError ((const char *) "expecting record symbol", 23);
   20044                 :          36 :         break;
   20045                 :             :     }
   20046                 :          36 : }
   20047                 :             : 
   20048                 :             : 
   20049                 :             : /*
   20050                 :             :    PutUnused - sets, sym, as unused.  This is a gm2 pragma.
   20051                 :             : */
   20052                 :             : 
   20053                 :           0 : extern "C" void SymbolTable_PutUnused (unsigned int sym)
   20054                 :             : {
   20055                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20056                 :             : 
   20057                 :           0 :   pSym = GetPsym (sym);
   20058                 :           0 :   switch (pSym->SymbolType)
   20059                 :             :     {
   20060                 :           0 :       case SymbolTable_RecordFieldSym:
   20061                 :           0 :         pSym->RecordField.Used = false;
   20062                 :           0 :         break;
   20063                 :             : 
   20064                 :             : 
   20065                 :           0 :       default:
   20066                 :           0 :         M2MetaError_MetaError1 ((const char *) "cannot use pragma 'unused' on symbol {%1ad}", 43, sym);
   20067                 :           0 :         break;
   20068                 :             :     }
   20069                 :           0 : }
   20070                 :             : 
   20071                 :             : 
   20072                 :             : /*
   20073                 :             :    IsUnused - returns TRUE if the symbol was declared as unused with a
   20074                 :             :               gm2 pragma.
   20075                 :             : */
   20076                 :             : 
   20077                 :      147866 : extern "C" bool SymbolTable_IsUnused (unsigned int sym)
   20078                 :             : {
   20079                 :      147866 :   SymbolTable_PtrToSymbol pSym;
   20080                 :             : 
   20081                 :      147866 :   pSym = GetPsym (sym);
   20082                 :      147866 :   switch (pSym->SymbolType)
   20083                 :             :     {
   20084                 :      147866 :       case SymbolTable_RecordFieldSym:
   20085                 :      147866 :         return ! pSym->RecordField.Used;
   20086                 :           0 :         break;
   20087                 :             : 
   20088                 :             : 
   20089                 :           0 :       default:
   20090                 :           0 :         M2Error_InternalError ((const char *) "expecting a record field symbol", 31);
   20091                 :             :         break;
   20092                 :             :     }
   20093                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20094                 :             :   __builtin_unreachable ();
   20095                 :             : }
   20096                 :             : 
   20097                 :             : 
   20098                 :             : /*
   20099                 :             :    PutDeclaredPacked - sets the Packed field of the record or record field symbol.
   20100                 :             : */
   20101                 :             : 
   20102                 :      517523 : extern "C" void SymbolTable_PutDeclaredPacked (unsigned int sym, bool b)
   20103                 :             : {
   20104                 :      517523 :   SymbolTable_PtrToSymbol pSym;
   20105                 :             : 
   20106                 :      517523 :   pSym = GetPsym (sym);
   20107                 :      517523 :   switch (pSym->SymbolType)
   20108                 :             :     {
   20109                 :      100585 :       case SymbolTable_RecordSym:
   20110                 :      100585 :         pSym->Record.DeclPacked = b;
   20111                 :      100585 :         pSym->Record.DeclResolved = true;
   20112                 :      100585 :         break;
   20113                 :             : 
   20114                 :      405010 :       case SymbolTable_RecordFieldSym:
   20115                 :      405010 :         pSym->RecordField.DeclPacked = b;
   20116                 :      405010 :         pSym->RecordField.DeclResolved = true;
   20117                 :      405010 :         break;
   20118                 :             : 
   20119                 :        6012 :       case SymbolTable_VarientFieldSym:
   20120                 :        6012 :         pSym->VarientField.DeclPacked = b;
   20121                 :        6012 :         pSym->VarientField.DeclResolved = true;
   20122                 :        6012 :         break;
   20123                 :             : 
   20124                 :        5916 :       case SymbolTable_VarientSym:
   20125                 :        5916 :         pSym->Varient.DeclPacked = b;
   20126                 :        5916 :         pSym->Varient.DeclResolved = true;
   20127                 :        5916 :         break;
   20128                 :             : 
   20129                 :             : 
   20130                 :           0 :       default:
   20131                 :           0 :         M2Error_InternalError ((const char *) "expecting a record or field record symbol", 41);
   20132                 :      517523 :         break;
   20133                 :             :     }
   20134                 :      517523 : }
   20135                 :             : 
   20136                 :             : 
   20137                 :             : /*
   20138                 :             :    IsDeclaredPacked - was the record symbol or record field, sym,
   20139                 :             :                       declared as packed?
   20140                 :             : */
   20141                 :             : 
   20142                 :     1434542 : extern "C" bool SymbolTable_IsDeclaredPacked (unsigned int sym)
   20143                 :             : {
   20144                 :     1434542 :   SymbolTable_PtrToSymbol pSym;
   20145                 :             : 
   20146                 :     1434542 :   pSym = GetPsym (sym);
   20147                 :     1434542 :   switch (pSym->SymbolType)
   20148                 :             :     {
   20149                 :      201170 :       case SymbolTable_RecordSym:
   20150                 :      201170 :         return pSym->Record.DeclPacked;
   20151                 :     1215252 :         break;
   20152                 :             : 
   20153                 :     1215252 :       case SymbolTable_RecordFieldSym:
   20154                 :     1215252 :         return pSym->RecordField.DeclPacked;
   20155                 :       12156 :         break;
   20156                 :             : 
   20157                 :       12156 :       case SymbolTable_VarientFieldSym:
   20158                 :       12156 :         return pSym->VarientField.DeclPacked;
   20159                 :        5964 :         break;
   20160                 :             : 
   20161                 :        5964 :       case SymbolTable_VarientSym:
   20162                 :        5964 :         return pSym->Varient.DeclPacked;
   20163                 :           0 :         break;
   20164                 :             : 
   20165                 :             : 
   20166                 :           0 :       default:
   20167                 :           0 :         M2Error_InternalError ((const char *) "expecting a record or a record field symbol", 43);
   20168                 :             :         break;
   20169                 :             :     }
   20170                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20171                 :             :   __builtin_unreachable ();
   20172                 :             : }
   20173                 :             : 
   20174                 :             : 
   20175                 :             : /*
   20176                 :             :    IsDeclaredPackedResolved - do we know if the record symbol or record
   20177                 :             :                               field, sym, declared as packed or not packed?
   20178                 :             : */
   20179                 :             : 
   20180                 :           0 : extern "C" bool SymbolTable_IsDeclaredPackedResolved (unsigned int sym)
   20181                 :             : {
   20182                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20183                 :             : 
   20184                 :           0 :   pSym = GetPsym (sym);
   20185                 :           0 :   switch (pSym->SymbolType)
   20186                 :             :     {
   20187                 :           0 :       case SymbolTable_RecordSym:
   20188                 :           0 :         return pSym->Record.DeclResolved;
   20189                 :           0 :         break;
   20190                 :             : 
   20191                 :           0 :       case SymbolTable_RecordFieldSym:
   20192                 :           0 :         return pSym->RecordField.DeclResolved;
   20193                 :           0 :         break;
   20194                 :             : 
   20195                 :           0 :       case SymbolTable_VarientFieldSym:
   20196                 :           0 :         return pSym->VarientField.DeclResolved;
   20197                 :           0 :         break;
   20198                 :             : 
   20199                 :           0 :       case SymbolTable_VarientSym:
   20200                 :           0 :         return pSym->Varient.DeclResolved;
   20201                 :           0 :         break;
   20202                 :             : 
   20203                 :             : 
   20204                 :           0 :       default:
   20205                 :           0 :         M2Error_InternalError ((const char *) "expecting a record or a record field symbol", 43);
   20206                 :             :         break;
   20207                 :             :     }
   20208                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20209                 :             :   __builtin_unreachable ();
   20210                 :             : }
   20211                 :             : 
   20212                 :             : 
   20213                 :             : /*
   20214                 :             :    GetPackedEquivalent - returns the packed equivalent of type, sym.
   20215                 :             :                          sym must be a type, subrange or enumerated type.
   20216                 :             : */
   20217                 :             : 
   20218                 :       14851 : extern "C" unsigned int SymbolTable_GetPackedEquivalent (unsigned int sym)
   20219                 :             : {
   20220                 :       14851 :   SymbolTable_PtrToSymbol pSym;
   20221                 :             : 
   20222                 :       14851 :   pSym = GetPsym (sym);
   20223                 :       14851 :   switch (pSym->SymbolType)
   20224                 :             :     {
   20225                 :       14731 :       case SymbolTable_EnumerationSym:
   20226                 :       14731 :         return GetEquivalent (&pSym->Enumeration.packedInfo, sym);
   20227                 :         120 :         break;
   20228                 :             : 
   20229                 :         120 :       case SymbolTable_SubrangeSym:
   20230                 :         120 :         return GetEquivalent (&pSym->Subrange.packedInfo, sym);
   20231                 :           0 :         break;
   20232                 :             : 
   20233                 :           0 :       case SymbolTable_TypeSym:
   20234                 :           0 :         return GetEquivalent (&pSym->Type.packedInfo, sym);
   20235                 :           0 :         break;
   20236                 :             : 
   20237                 :           0 :       case SymbolTable_SetSym:
   20238                 :           0 :         return GetEquivalent (&pSym->Set.packedInfo, sym);
   20239                 :           0 :         break;
   20240                 :             : 
   20241                 :             : 
   20242                 :           0 :       default:
   20243                 :           0 :         M2Error_InternalError ((const char *) "expecting type, subrange or enumerated type symbol", 50);
   20244                 :             :         break;
   20245                 :             :     }
   20246                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20247                 :             :   __builtin_unreachable ();
   20248                 :             : }
   20249                 :             : 
   20250                 :             : 
   20251                 :             : /*
   20252                 :             :    GetNonPackedEquivalent - returns the equivalent non packed symbol associated with, sym.
   20253                 :             : */
   20254                 :             : 
   20255                 :           0 : extern "C" unsigned int SymbolTable_GetNonPackedEquivalent (unsigned int sym)
   20256                 :             : {
   20257                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20258                 :             : 
   20259                 :           0 :   pSym = GetPsym (sym);
   20260                 :           0 :   switch (pSym->SymbolType)
   20261                 :             :     {
   20262                 :           0 :       case SymbolTable_EquivSym:
   20263                 :           0 :         return pSym->Equiv.nonPacked;
   20264                 :           0 :         break;
   20265                 :             : 
   20266                 :             : 
   20267                 :           0 :       default:
   20268                 :           0 :         M2Error_InternalError ((const char *) "expecting equivalent symbol", 27);
   20269                 :             :         break;
   20270                 :             :     }
   20271                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20272                 :             :   __builtin_unreachable ();
   20273                 :             : }
   20274                 :             : 
   20275                 :             : 
   20276                 :             : /*
   20277                 :             :    IsEquivalent - returns TRUE if, sym, is an equivalent symbol.
   20278                 :             : */
   20279                 :             : 
   20280                 :           0 : extern "C" bool SymbolTable_IsEquivalent (unsigned int sym)
   20281                 :             : {
   20282                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20283                 :             : 
   20284                 :           0 :   pSym = GetPsym (sym);
   20285                 :           0 :   switch (pSym->SymbolType)
   20286                 :             :     {
   20287                 :             :       case SymbolTable_EquivSym:
   20288                 :             :         return true;
   20289                 :           0 :         break;
   20290                 :             : 
   20291                 :             : 
   20292                 :           0 :       default:
   20293                 :           0 :         return false;
   20294                 :             :         break;
   20295                 :             :     }
   20296                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20297                 :             :   __builtin_unreachable ();
   20298                 :             : }
   20299                 :             : 
   20300                 :             : 
   20301                 :             : /*
   20302                 :             :    PushSize - pushes the size of Sym.
   20303                 :             : */
   20304                 :             : 
   20305                 :      100034 : extern "C" void SymbolTable_PushSize (unsigned int Sym)
   20306                 :             : {
   20307                 :      100034 :   SymbolTable_PtrToSymbol pSym;
   20308                 :             : 
   20309                 :      100034 :   AssertInRange (Sym);
   20310                 :      100034 :   pSym = GetPsym (Sym);
   20311                 :      100034 :   switch (pSym->SymbolType)
   20312                 :             :     {
   20313                 :           0 :       case SymbolTable_ProcedureSym:
   20314                 :           0 :         M2ALU_PushFrom (pSym->Procedure.Size);
   20315                 :           0 :         break;
   20316                 :             : 
   20317                 :        3036 :       case SymbolTable_VarSym:
   20318                 :        3036 :         M2ALU_PushFrom (pSym->Var.Size);
   20319                 :        3036 :         break;
   20320                 :             : 
   20321                 :       16088 :       case SymbolTable_TypeSym:
   20322                 :       16088 :         M2ALU_PushFrom (pSym->Type.Size);
   20323                 :       16088 :         break;
   20324                 :             : 
   20325                 :         788 :       case SymbolTable_SetSym:
   20326                 :         788 :         M2ALU_PushFrom (pSym->Set.Size);
   20327                 :         788 :         break;
   20328                 :             : 
   20329                 :           0 :       case SymbolTable_VarientSym:
   20330                 :           0 :         M2ALU_PushFrom (pSym->Varient.Size);
   20331                 :           0 :         break;
   20332                 :             : 
   20333                 :          12 :       case SymbolTable_RecordSym:
   20334                 :          12 :         M2ALU_PushFrom (pSym->Record.Size);
   20335                 :          12 :         break;
   20336                 :             : 
   20337                 :          12 :       case SymbolTable_EnumerationSym:
   20338                 :          12 :         M2ALU_PushFrom (pSym->Enumeration.Size);
   20339                 :          12 :         break;
   20340                 :             : 
   20341                 :       76600 :       case SymbolTable_PointerSym:
   20342                 :       76600 :         M2ALU_PushFrom (pSym->Pointer.Size);
   20343                 :       76600 :         break;
   20344                 :             : 
   20345                 :        3486 :       case SymbolTable_ArraySym:
   20346                 :        3486 :         M2ALU_PushFrom (pSym->Array.Size);
   20347                 :        3486 :         break;
   20348                 :             : 
   20349                 :           0 :       case SymbolTable_RecordFieldSym:
   20350                 :           0 :         M2ALU_PushFrom (pSym->RecordField.Size);
   20351                 :           0 :         break;
   20352                 :             : 
   20353                 :           0 :       case SymbolTable_VarientFieldSym:
   20354                 :           0 :         M2ALU_PushFrom (pSym->VarientField.Size);
   20355                 :           0 :         break;
   20356                 :             : 
   20357                 :           0 :       case SymbolTable_SubrangeSym:
   20358                 :           0 :         M2ALU_PushFrom (pSym->Subrange.Size);
   20359                 :           0 :         break;
   20360                 :             : 
   20361                 :           0 :       case SymbolTable_SubscriptSym:
   20362                 :           0 :         M2ALU_PushFrom (pSym->Subscript.Size);
   20363                 :           0 :         break;
   20364                 :             : 
   20365                 :          12 :       case SymbolTable_ProcTypeSym:
   20366                 :          12 :         M2ALU_PushFrom (pSym->ProcType.Size);
   20367                 :          12 :         break;
   20368                 :             : 
   20369                 :           0 :       case SymbolTable_UnboundedSym:
   20370                 :           0 :         M2ALU_PushFrom (pSym->Unbounded.Size);
   20371                 :           0 :         break;
   20372                 :             : 
   20373                 :             : 
   20374                 :           0 :       default:
   20375                 :           0 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   20376                 :      100034 :         break;
   20377                 :             :     }
   20378                 :      100034 : }
   20379                 :             : 
   20380                 :             : 
   20381                 :             : /*
   20382                 :             :    PopSize - pops the ALU stack into Size of Sym.
   20383                 :             : */
   20384                 :             : 
   20385                 :      864206 : extern "C" void SymbolTable_PopSize (unsigned int Sym)
   20386                 :             : {
   20387                 :      864206 :   SymbolTable_PtrToSymbol pSym;
   20388                 :             : 
   20389                 :      864206 :   AssertInRange (Sym);
   20390                 :      864206 :   pSym = GetPsym (Sym);
   20391                 :      864206 :   switch (pSym->SymbolType)
   20392                 :             :     {
   20393                 :           0 :       case SymbolTable_ProcedureSym:
   20394                 :           0 :         M2ALU_PopInto (pSym->Procedure.Size);
   20395                 :           0 :         break;
   20396                 :             : 
   20397                 :        2740 :       case SymbolTable_VarSym:
   20398                 :        2740 :         M2ALU_PopInto (pSym->Var.Size);
   20399                 :        2740 :         break;
   20400                 :             : 
   20401                 :      604748 :       case SymbolTable_TypeSym:
   20402                 :      604748 :         M2ALU_PopInto (pSym->Type.Size);
   20403                 :      604748 :         break;
   20404                 :             : 
   20405                 :          12 :       case SymbolTable_RecordSym:
   20406                 :          12 :         M2ALU_PopInto (pSym->Record.Size);
   20407                 :          12 :         break;
   20408                 :             : 
   20409                 :           0 :       case SymbolTable_VarientSym:
   20410                 :           0 :         M2ALU_PopInto (pSym->Varient.Size);
   20411                 :           0 :         break;
   20412                 :             : 
   20413                 :           6 :       case SymbolTable_EnumerationSym:
   20414                 :           6 :         M2ALU_PopInto (pSym->Enumeration.Size);
   20415                 :           6 :         break;
   20416                 :             : 
   20417                 :       15534 :       case SymbolTable_PointerSym:
   20418                 :       15534 :         M2ALU_PopInto (pSym->Pointer.Size);
   20419                 :       15534 :         break;
   20420                 :             : 
   20421                 :         636 :       case SymbolTable_ArraySym:
   20422                 :         636 :         M2ALU_PopInto (pSym->Array.Size);
   20423                 :         636 :         break;
   20424                 :             : 
   20425                 :           0 :       case SymbolTable_RecordFieldSym:
   20426                 :           0 :         M2ALU_PopInto (pSym->RecordField.Size);
   20427                 :           0 :         break;
   20428                 :             : 
   20429                 :           0 :       case SymbolTable_VarientFieldSym:
   20430                 :           0 :         M2ALU_PopInto (pSym->VarientField.Size);
   20431                 :           0 :         break;
   20432                 :             : 
   20433                 :           0 :       case SymbolTable_SubrangeSym:
   20434                 :           0 :         M2ALU_PopInto (pSym->Subrange.Size);
   20435                 :           0 :         break;
   20436                 :             : 
   20437                 :      162948 :       case SymbolTable_SubscriptSym:
   20438                 :      162948 :         M2ALU_PopInto (pSym->Subscript.Size);
   20439                 :      162948 :         break;
   20440                 :             : 
   20441                 :       15518 :       case SymbolTable_ProcTypeSym:
   20442                 :       15518 :         M2ALU_PopInto (pSym->ProcType.Size);
   20443                 :       15518 :         break;
   20444                 :             : 
   20445                 :           0 :       case SymbolTable_UnboundedSym:
   20446                 :           0 :         M2ALU_PopInto (pSym->Unbounded.Size);
   20447                 :           0 :         break;
   20448                 :             : 
   20449                 :       62064 :       case SymbolTable_SetSym:
   20450                 :       62064 :         M2ALU_PopInto (pSym->Set.Size);
   20451                 :       62064 :         break;
   20452                 :             : 
   20453                 :             : 
   20454                 :           0 :       default:
   20455                 :           0 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   20456                 :      864206 :         break;
   20457                 :             :     }
   20458                 :      864206 : }
   20459                 :             : 
   20460                 :             : 
   20461                 :             : /*
   20462                 :             :    PushValue - pushes the Value of Sym onto the ALU stack.
   20463                 :             : */
   20464                 :             : 
   20465                 :    25927755 : extern "C" void SymbolTable_PushValue (unsigned int Sym)
   20466                 :             : {
   20467                 :    25927755 :   SymbolTable_PtrToSymbol pSym;
   20468                 :             : 
   20469                 :    25927755 :   AssertInRange (Sym);
   20470                 :    25927755 :   pSym = GetPsym (Sym);
   20471                 :    25927755 :   switch (pSym->SymbolType)
   20472                 :             :     {
   20473                 :     2490364 :       case SymbolTable_ConstLitSym:
   20474                 :     2490364 :         M2ALU_PushFrom (pSym->ConstLit.Value);
   20475                 :     2490364 :         break;
   20476                 :             : 
   20477                 :     1866177 :       case SymbolTable_ConstVarSym:
   20478                 :     1866177 :         M2ALU_PushFrom (pSym->ConstVar.Value);
   20479                 :     1866177 :         break;
   20480                 :             : 
   20481                 :    21538262 :       case SymbolTable_EnumerationFieldSym:
   20482                 :    21538262 :         M2ALU_PushFrom (pSym->EnumerationField.Value);
   20483                 :    21538262 :         break;
   20484                 :             : 
   20485                 :       32952 :       case SymbolTable_ConstStringSym:
   20486                 :       32952 :         PushConstString (Sym);
   20487                 :       32952 :         break;
   20488                 :             : 
   20489                 :             : 
   20490                 :           0 :       default:
   20491                 :           0 :         M2Error_InternalError ((const char *) "not expecting this kind of symbol", 33);
   20492                 :    25927755 :         break;
   20493                 :             :     }
   20494                 :    25927755 : }
   20495                 :             : 
   20496                 :             : 
   20497                 :             : /*
   20498                 :             :    PushVarSize - pushes the size of a variable, Sym.
   20499                 :             :                  The runtime size of Sym will depend upon its addressing mode,
   20500                 :             :                  RightValue has size PushSize(GetType(Sym)) and
   20501                 :             :                  LeftValue has size PushSize(Address) since it points to a
   20502                 :             :                  variable.
   20503                 :             : */
   20504                 :             : 
   20505                 :           0 : extern "C" void SymbolTable_PushVarSize (unsigned int Sym)
   20506                 :             : {
   20507                 :           0 :   AssertInRange (Sym);
   20508                 :           0 :   M2Debug_Assert (SymbolTable_IsVar (Sym));
   20509                 :           0 :   if ((SymbolTable_GetMode (Sym)) == SymbolTable_LeftValue)
   20510                 :             :     {
   20511                 :           0 :       SymbolTable_PushSize (M2System_Address);
   20512                 :             :     }
   20513                 :             :   else
   20514                 :             :     {
   20515                 :           0 :       M2Debug_Assert ((SymbolTable_GetMode (Sym)) == SymbolTable_RightValue);
   20516                 :           0 :       SymbolTable_PushSize (SymbolTable_GetType (Sym));
   20517                 :             :     }
   20518                 :           0 : }
   20519                 :             : 
   20520                 :             : 
   20521                 :             : /*
   20522                 :             :    PopValue - pops the ALU stack into Value of Sym.
   20523                 :             : */
   20524                 :             : 
   20525                 :     1379997 : extern "C" void SymbolTable_PopValue (unsigned int Sym)
   20526                 :             : {
   20527                 :     1379997 :   SymbolTable_PtrToSymbol pSym;
   20528                 :             : 
   20529                 :     1379997 :   AssertInRange (Sym);
   20530                 :     1379997 :   pSym = GetPsym (Sym);
   20531                 :     1379997 :   switch (pSym->SymbolType)
   20532                 :             :     {
   20533                 :           0 :       case SymbolTable_ConstLitSym:
   20534                 :           0 :         M2ALU_PopInto (pSym->ConstLit.Value);
   20535                 :           0 :         break;
   20536                 :             : 
   20537                 :     1379997 :       case SymbolTable_ConstVarSym:
   20538                 :     1379997 :         M2ALU_PopInto (pSym->ConstVar.Value);
   20539                 :     1379997 :         break;
   20540                 :             : 
   20541                 :           0 :       case SymbolTable_EnumerationFieldSym:
   20542                 :           0 :         M2Error_InternalError ((const char *) "cannot pop into an enumeration field", 36);
   20543                 :           0 :         break;
   20544                 :             : 
   20545                 :             : 
   20546                 :           0 :       default:
   20547                 :           0 :         M2Error_InternalError ((const char *) "symbol type not expected", 24);
   20548                 :     1379997 :         break;
   20549                 :             :     }
   20550                 :     1379997 : }
   20551                 :             : 
   20552                 :             : 
   20553                 :             : /*
   20554                 :             :    IsObject - returns TRUE if the symbol is an object symbol.
   20555                 :             : */
   20556                 :             : 
   20557                 :           0 : extern "C" bool SymbolTable_IsObject (unsigned int Sym)
   20558                 :             : {
   20559                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20560                 :             : 
   20561                 :           0 :   AssertInRange (Sym);
   20562                 :           0 :   pSym = GetPsym (Sym);
   20563                 :           0 :   return pSym->SymbolType == SymbolTable_ObjectSym;
   20564                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20565                 :             :   __builtin_unreachable ();
   20566                 :             : }
   20567                 :             : 
   20568                 :             : 
   20569                 :             : /*
   20570                 :             :    IsTuple - returns TRUE if the symbol is a tuple symbol.
   20571                 :             : */
   20572                 :             : 
   20573                 :       17948 : extern "C" bool SymbolTable_IsTuple (unsigned int Sym)
   20574                 :             : {
   20575                 :       17948 :   SymbolTable_PtrToSymbol pSym;
   20576                 :             : 
   20577                 :       17948 :   AssertInRange (Sym);
   20578                 :       17948 :   pSym = GetPsym (Sym);
   20579                 :       17948 :   return pSym->SymbolType == SymbolTable_TupleSym;
   20580                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20581                 :             :   __builtin_unreachable ();
   20582                 :             : }
   20583                 :             : 
   20584                 :             : 
   20585                 :             : /*
   20586                 :             :    Make2Tuple - creates and returns a 2 tuple from, a, and, b.
   20587                 :             : */
   20588                 :             : 
   20589                 :        3072 : extern "C" unsigned int SymbolTable_Make2Tuple (unsigned int a, unsigned int b)
   20590                 :             : {
   20591                 :        3072 :   SymbolTable_PtrToSymbol pSym;
   20592                 :        3072 :   unsigned int Sym;
   20593                 :             : 
   20594                 :        3072 :   NewSym (&Sym);
   20595                 :        3072 :   pSym = GetPsym (Sym);
   20596                 :        3072 :   pSym->SymbolType = SymbolTable_TupleSym;
   20597                 :        3072 :   pSym->Tuple.nTuple = 2;
   20598                 :        3072 :   pSym->Tuple.list = Indexing_InitIndex (1);
   20599                 :        3072 :   PutIntoIndex (&pSym->Tuple.list, 1, a);
   20600                 :        3072 :   PutIntoIndex (&pSym->Tuple.list, 2, b);
   20601                 :        3072 :   InitWhereDeclared (&pSym->Tuple.At);
   20602                 :        3072 :   InitWhereFirstUsed (&pSym->Tuple.At);
   20603                 :        3072 :   return Sym;
   20604                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20605                 :             :   __builtin_unreachable ();
   20606                 :             : }
   20607                 :             : 
   20608                 :             : 
   20609                 :             : /*
   20610                 :             :    MakeError - creates an error node, which can be used in MetaError messages.
   20611                 :             :                It will be removed from ExportUndeclared and Unknown trees.
   20612                 :             : */
   20613                 :             : 
   20614                 :         200 : extern "C" unsigned int SymbolTable_MakeError (unsigned int tok, NameKey_Name name)
   20615                 :             : {
   20616                 :         200 :   SymbolTable_PtrToSymbol pSym;
   20617                 :         200 :   unsigned int Sym;
   20618                 :             : 
   20619                 :             :   /* if Sym is present on the unknown tree then remove it  */
   20620                 :         200 :   Sym = FetchUnknownSym (name);
   20621                 :         200 :   if (Sym == SymbolTable_NulSym)
   20622                 :             :     {
   20623                 :         194 :       NewSym (&Sym);
   20624                 :             :     }
   20625                 :             :   else
   20626                 :             :     {
   20627                 :             :       /* 
   20628                 :             :          remove symbol from this tree as we have already generated
   20629                 :             :          a meaningful error message
   20630                 :             :   */
   20631                 :           6 :       RemoveExportUndeclared (SymbolTable_GetCurrentModuleScope (), Sym);
   20632                 :             :     }
   20633                 :         200 :   pSym = GetPsym (Sym);
   20634                 :         200 :   pSym->SymbolType = SymbolTable_ErrorSym;
   20635                 :         200 :   pSym->Error.name = name;
   20636                 :         200 :   pSym->Error.Scope = SymbolTable_GetCurrentScope ();
   20637                 :         200 :   InitWhereDeclaredTok (tok, &pSym->Error.At);
   20638                 :         200 :   InitWhereFirstUsedTok (tok, &pSym->Error.At);
   20639                 :         200 :   return Sym;
   20640                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20641                 :             :   __builtin_unreachable ();
   20642                 :             : }
   20643                 :             : 
   20644                 :             : 
   20645                 :             : /*
   20646                 :             :    MakeErrorS - creates an error node from a string, which can be used
   20647                 :             :                 in MetaError messages.
   20648                 :             :                 It will be removed from ExportUndeclared and Unknown trees.
   20649                 :             : */
   20650                 :             : 
   20651                 :           0 : extern "C" unsigned int SymbolTable_MakeErrorS (unsigned int tok, DynamicStrings_String name)
   20652                 :             : {
   20653                 :           0 :   return SymbolTable_MakeError (tok, NameKey_makekey (DynamicStrings_string (name)));
   20654                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20655                 :             :   __builtin_unreachable ();
   20656                 :             : }
   20657                 :             : 
   20658                 :             : 
   20659                 :             : /*
   20660                 :             :    IsError - returns TRUE if the symbol is an error symbol.
   20661                 :             : */
   20662                 :             : 
   20663                 :    31897489 : extern "C" bool SymbolTable_IsError (unsigned int Sym)
   20664                 :             : {
   20665                 :    31897489 :   SymbolTable_PtrToSymbol pSym;
   20666                 :             : 
   20667                 :    31897489 :   AssertInRange (Sym);
   20668                 :    31897489 :   pSym = GetPsym (Sym);
   20669                 :    31897489 :   return pSym->SymbolType == SymbolTable_ErrorSym;
   20670                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20671                 :             :   __builtin_unreachable ();
   20672                 :             : }
   20673                 :             : 
   20674                 :             : 
   20675                 :             : /*
   20676                 :             :    IsLegal - returns TRUE if, sym, is a legal symbol.
   20677                 :             : */
   20678                 :             : 
   20679                 :     1063562 : extern "C" bool SymbolTable_IsLegal (unsigned int sym)
   20680                 :             : {
   20681                 :     1063562 :   return sym < FreeSymbol;
   20682                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20683                 :             :   __builtin_unreachable ();
   20684                 :             : }
   20685                 :             : 
   20686                 :             : 
   20687                 :             : /*
   20688                 :             :    PutModuleContainsBuiltin - sets a flag in the current compiled module which
   20689                 :             :                               indicates that a builtin procedure is being declared.
   20690                 :             :                               This is only expected to be called when we are
   20691                 :             :                               parsing the definition module.
   20692                 :             : */
   20693                 :             : 
   20694                 :      439620 : extern "C" void SymbolTable_PutModuleContainsBuiltin (void)
   20695                 :             : {
   20696                 :      439620 :   SymbolTable_PtrToSymbol pSym;
   20697                 :             : 
   20698                 :      439620 :   SymbolTable_PutHiddenTypeDeclared ();
   20699                 :      439620 :   pSym = GetPsym (CurrentModule);
   20700                 :      439620 :   switch (pSym->SymbolType)
   20701                 :             :     {
   20702                 :      439620 :       case SymbolTable_DefImpSym:
   20703                 :      439620 :         pSym->DefImp.ContainsBuiltin = true;
   20704                 :      439620 :         break;
   20705                 :             : 
   20706                 :             : 
   20707                 :           0 :       default:
   20708                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   20709                 :      439620 :         break;
   20710                 :             :     }
   20711                 :      439620 : }
   20712                 :             : 
   20713                 :             : 
   20714                 :             : /*
   20715                 :             :    IsBuiltinInModule - returns true if a module, Sym, has declared a builtin procedure.
   20716                 :             : */
   20717                 :             : 
   20718                 :      160069 : extern "C" bool SymbolTable_IsBuiltinInModule (unsigned int Sym)
   20719                 :             : {
   20720                 :      160069 :   SymbolTable_PtrToSymbol pSym;
   20721                 :             : 
   20722                 :      160069 :   pSym = GetPsym (Sym);
   20723                 :      160069 :   switch (pSym->SymbolType)
   20724                 :             :     {
   20725                 :      160069 :       case SymbolTable_DefImpSym:
   20726                 :      160069 :         return pSym->DefImp.ContainsBuiltin;
   20727                 :           0 :         break;
   20728                 :             : 
   20729                 :             : 
   20730                 :           0 :       default:
   20731                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   20732                 :             :         break;
   20733                 :             :     }
   20734                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20735                 :             :   __builtin_unreachable ();
   20736                 :             : }
   20737                 :             : 
   20738                 :             : 
   20739                 :             : /*
   20740                 :             :    PutHiddenTypeDeclared - sets a flag in the current compiled module which
   20741                 :             :                            indicates that a Hidden Type is declared within
   20742                 :             :                            the implementation part of the module.
   20743                 :             :                            This procedure is expected to be called while
   20744                 :             :                            compiling the associated definition module.
   20745                 :             : */
   20746                 :             : 
   20747                 :     1350045 : extern "C" void SymbolTable_PutHiddenTypeDeclared (void)
   20748                 :             : {
   20749                 :     1350045 :   SymbolTable_PtrToSymbol pSym;
   20750                 :             : 
   20751                 :     1350045 :   pSym = GetPsym (CurrentModule);
   20752                 :     1350045 :   switch (pSym->SymbolType)
   20753                 :             :     {
   20754                 :     1350045 :       case SymbolTable_DefImpSym:
   20755                 :     1350045 :         pSym->DefImp.ContainsHiddenType = true;
   20756                 :     1350045 :         break;
   20757                 :             : 
   20758                 :             : 
   20759                 :           0 :       default:
   20760                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   20761                 :     1350045 :         break;
   20762                 :             :     }
   20763                 :     1350045 : }
   20764                 :             : 
   20765                 :             : 
   20766                 :             : /*
   20767                 :             :    IsHiddenTypeDeclared - returns true if a Hidden Type was declared in
   20768                 :             :                           the module, Sym.
   20769                 :             : */
   20770                 :             : 
   20771                 :     8372072 : extern "C" bool SymbolTable_IsHiddenTypeDeclared (unsigned int Sym)
   20772                 :             : {
   20773                 :     8372072 :   SymbolTable_PtrToSymbol pSym;
   20774                 :             : 
   20775                 :     8372072 :   pSym = GetPsym (Sym);
   20776                 :     8372072 :   switch (pSym->SymbolType)
   20777                 :             :     {
   20778                 :     8372072 :       case SymbolTable_DefImpSym:
   20779                 :     8372072 :         return pSym->DefImp.ContainsHiddenType;
   20780                 :           0 :         break;
   20781                 :             : 
   20782                 :             : 
   20783                 :           0 :       default:
   20784                 :           0 :         M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   20785                 :             :         break;
   20786                 :             :     }
   20787                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20788                 :             :   __builtin_unreachable ();
   20789                 :             : }
   20790                 :             : 
   20791                 :             : 
   20792                 :             : /*
   20793                 :             :    IsHiddenReallyPointer - returns TRUE is sym is a pointer, address or a
   20794                 :             :                            type declared as a pointer or address.
   20795                 :             : */
   20796                 :             : 
   20797                 :      438269 : extern "C" bool SymbolTable_IsHiddenReallyPointer (unsigned int Sym)
   20798                 :             : {
   20799                 :      438269 :   if (SymbolTable_IsVar (Sym))
   20800                 :             :     {
   20801                 :           0 :       Sym = SymbolTable_GetType (Sym);
   20802                 :             :     }
   20803                 :      459300 :   while ((Sym != SymbolTable_NulSym) && (SymbolTable_IsType (Sym)))
   20804                 :             :     {
   20805                 :       21031 :       Sym = SymbolTable_SkipType (SymbolTable_GetType (Sym));
   20806                 :             :     }
   20807                 :      438269 :   return (Sym != SymbolTable_NulSym) && ((SymbolTable_IsPointer (Sym)) || (Sym == M2System_Address));
   20808                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20809                 :             :   __builtin_unreachable ();
   20810                 :             : }
   20811                 :             : 
   20812                 :             : 
   20813                 :             : /*
   20814                 :             :    DisplayTrees - displays the SymbolTrees for Module symbol, ModSym.
   20815                 :             : */
   20816                 :             : 
   20817                 :           0 : extern "C" void SymbolTable_DisplayTrees (unsigned int ModSym)
   20818                 :             : {
   20819                 :           0 :   SymbolTable_PtrToSymbol pSym;
   20820                 :           0 :   NameKey_Name n;
   20821                 :             : 
   20822                 :           0 :   n = SymbolTable_GetSymName (ModSym);
   20823                 :           0 :   M2Printf_printf1 ((const char *) "Symbol trees for module/procedure: %a\\n", 39, (const unsigned char *) &n, (sizeof (n)-1));
   20824                 :           0 :   pSym = GetPsym (ModSym);
   20825                 :           0 :   switch (pSym->SymbolType)
   20826                 :             :     {
   20827                 :           0 :       case SymbolTable_DefImpSym:
   20828                 :           0 :         n = SymbolTable_GetSymName (ModSym);
   20829                 :           0 :         M2Printf_printf1 ((const char *) "%a  UndefinedTree", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20830                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.Unresolved, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20831                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20832                 :           0 :         M2Printf_printf1 ((const char *) "%a  Local symbols", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20833                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.LocalSymbols, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20834                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20835                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportRequest", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20836                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportRequest, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20837                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20838                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportQualified", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20839                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportQualifiedTree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20840                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20841                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportUnQualified", 21, (const unsigned char *) &n, (sizeof (n)-1));
   20842                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportUnQualifiedTree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20843                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20844                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportUndeclared", 20, (const unsigned char *) &n, (sizeof (n)-1));
   20845                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.ExportUndeclared, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20846                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20847                 :           0 :         M2Printf_printf1 ((const char *) "%a  DeclaredObjects", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20848                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.NamedObjects, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20849                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20850                 :           0 :         M2Printf_printf1 ((const char *) "%a  ImportedObjects", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20851                 :           0 :         SymbolKey_ForeachNodeDo (pSym->DefImp.NamedImports, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplayName});
   20852                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20853                 :           0 :         break;
   20854                 :             : 
   20855                 :           0 :       case SymbolTable_ModuleSym:
   20856                 :           0 :         n = SymbolTable_GetSymName (ModSym);
   20857                 :           0 :         M2Printf_printf1 ((const char *) "%a  UndefinedTree", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20858                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.Unresolved, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20859                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20860                 :           0 :         M2Printf_printf1 ((const char *) "%a  Local symbols", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20861                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.LocalSymbols, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20862                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20863                 :           0 :         M2Printf_printf1 ((const char *) "%a  ImportTree", 14, (const unsigned char *) &n, (sizeof (n)-1));
   20864                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.ImportTree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20865                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20866                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportTree", 14, (const unsigned char *) &n, (sizeof (n)-1));
   20867                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.ExportTree, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20868                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20869                 :           0 :         M2Printf_printf1 ((const char *) "%a  ExportUndeclared", 20, (const unsigned char *) &n, (sizeof (n)-1));
   20870                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.ExportUndeclared, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20871                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20872                 :           0 :         M2Printf_printf1 ((const char *) "%a  DeclaredObjects", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20873                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.NamedObjects, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20874                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20875                 :           0 :         M2Printf_printf1 ((const char *) "%a  ImportedObjects", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20876                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Module.NamedImports, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplayName});
   20877                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20878                 :           0 :         break;
   20879                 :             : 
   20880                 :           0 :       case SymbolTable_ProcedureSym:
   20881                 :           0 :         n = SymbolTable_GetSymName (ModSym);
   20882                 :           0 :         M2Printf_printf1 ((const char *) "%a  UndefinedTree", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20883                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Procedure.Unresolved, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20884                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20885                 :           0 :         M2Printf_printf1 ((const char *) "%a  Local symbols", 17, (const unsigned char *) &n, (sizeof (n)-1));
   20886                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Procedure.LocalSymbols, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplaySymbol});
   20887                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20888                 :           0 :         M2Printf_printf1 ((const char *) "%a  DeclaredObjects", 19, (const unsigned char *) &n, (sizeof (n)-1));
   20889                 :           0 :         SymbolKey_ForeachNodeDo (pSym->Procedure.NamedObjects, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DisplayName});
   20890                 :           0 :         M2Printf_printf0 ((const char *) "\\n", 2);
   20891                 :           0 :         break;
   20892                 :             : 
   20893                 :             : 
   20894                 :           0 :       default:
   20895                 :           0 :         M2Error_InternalError ((const char *) "expecting DefImp symbol", 23);
   20896                 :           0 :         break;
   20897                 :             :     }
   20898                 :           0 : }
   20899                 :             : 
   20900                 :             : 
   20901                 :             : /*
   20902                 :             :    DebugLineNumbers - internal debugging, emit all procedure names in this module
   20903                 :             :                       together with the line numbers for the corresponding begin/end
   20904                 :             :                       tokens.
   20905                 :             : */
   20906                 :             : 
   20907                 :       14227 : extern "C" void SymbolTable_DebugLineNumbers (unsigned int sym)
   20908                 :             : {
   20909                 :       14227 :   if (M2Options_GetDebugFunctionLineNumbers ())
   20910                 :             :     {
   20911                 :           0 :       M2Printf_printf0 ((const char *) "<lines>\\n", 9);
   20912                 :           0 :       SymbolTable_ForeachProcedureDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) DebugProcedureLineNumber});
   20913                 :           0 :       M2Printf_printf0 ((const char *) "</lines>\\n", 10);
   20914                 :             :     }
   20915                 :       14227 : }
   20916                 :             : 
   20917                 :             : 
   20918                 :             : /*
   20919                 :             :    GetErrorScope - returns the error scope for a symbol.
   20920                 :             :                    The error scope is the title scope which is used to
   20921                 :             :                    announce the symbol in the GCC error message.
   20922                 :             : */
   20923                 :             : 
   20924                 :   147921396 : extern "C" M2Error_ErrorScope SymbolTable_GetErrorScope (unsigned int sym)
   20925                 :             : {
   20926                 :   147921396 :   SymbolTable_PtrToSymbol pSym;
   20927                 :             : 
   20928                 :   147921396 :   pSym = GetPsym (sym);
   20929                 :   147921396 :   switch (pSym->SymbolType)
   20930                 :             :     {
   20931                 :     1631137 :       case SymbolTable_ProcedureSym:
   20932                 :     1631137 :         return pSym->Procedure.errorScope;
   20933                 :     4366514 :         break;
   20934                 :             : 
   20935                 :     4366514 :       case SymbolTable_ModuleSym:
   20936                 :     4366514 :         return pSym->Module.errorScope;
   20937                 :   141923745 :         break;
   20938                 :             : 
   20939                 :   141923745 :       case SymbolTable_DefImpSym:
   20940                 :   141923745 :         return pSym->DefImp.errorScope;
   20941                 :           0 :         break;
   20942                 :             : 
   20943                 :           0 :       case SymbolTable_UndefinedSym:
   20944                 :           0 :         return pSym->Undefined.errorScope;
   20945                 :           0 :         break;
   20946                 :             : 
   20947                 :             : 
   20948                 :           0 :       default:
   20949                 :           0 :         M2Error_InternalError ((const char *) "expecting procedure, module or defimp symbol", 44);
   20950                 :             :         break;
   20951                 :             :     }
   20952                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   20953                 :             :   __builtin_unreachable ();
   20954                 :             : }
   20955                 :             : 
   20956                 :             : 
   20957                 :             : /*
   20958                 :             :    MakeImport - create and return an import symbol.
   20959                 :             :                 moduleSym is the symbol being imported.
   20960                 :             :                 isqualified is FALSE if it were IMPORT modulename and
   20961                 :             :                 TRUE for the qualified FROM modulename IMPORT etc.
   20962                 :             :                 listno is the import list count for this module.
   20963                 :             :                 tok should match this modulename position.
   20964                 :             : */
   20965                 :             : 
   20966                 :      417720 : extern "C" unsigned int SymbolTable_MakeImport (unsigned int tok, unsigned int moduleSym, unsigned int listno, bool isqualified)
   20967                 :             : {
   20968                 :      417720 :   unsigned int importSym;
   20969                 :      417720 :   SymbolTable_PtrToSymbol pSym;
   20970                 :             : 
   20971                 :      417720 :   NewSym (&importSym);
   20972                 :      417720 :   pSym = GetPsym (importSym);
   20973                 :      417720 :   pSym->SymbolType = SymbolTable_ImportSym;
   20974                 :      417720 :   pSym->Import.module = moduleSym;
   20975                 :      417720 :   pSym->Import.listNo = listno;
   20976                 :      417720 :   pSym->Import.qualified = isqualified;
   20977                 :      417720 :   InitWhereDeclaredTok (tok, &pSym->Import.at);
   20978                 :      417720 :   return importSym;
   20979                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   20980                 :             :   __builtin_unreachable ();
   20981                 :             : }
   20982                 :             : 
   20983                 :             : 
   20984                 :             : /*
   20985                 :             :    MakeImportStatement - return a dependent symbol which represents an import statement
   20986                 :             :                    or a qualified import statement.  The tok should either match
   20987                 :             :                    the FROM token or the IMPORT token.  listno is the import list
   20988                 :             :                    count for the module.
   20989                 :             : */
   20990                 :             : 
   20991                 :      402544 : extern "C" unsigned int SymbolTable_MakeImportStatement (unsigned int tok, unsigned int listno)
   20992                 :             : {
   20993                 :      402544 :   unsigned int dependentSym;
   20994                 :      402544 :   SymbolTable_PtrToSymbol pSym;
   20995                 :             : 
   20996                 :      402544 :   NewSym (&dependentSym);
   20997                 :      402544 :   pSym = GetPsym (dependentSym);
   20998                 :      402544 :   pSym->SymbolType = SymbolTable_ImportStatementSym;
   20999                 :      402544 :   pSym->ImportStatement.listNo = listno;
   21000                 :      402544 :   Lists_InitList (&pSym->ImportStatement.ListOfImports);
   21001                 :      402544 :   InitWhereDeclaredTok (tok, &pSym->ImportStatement.at);
   21002                 :      402544 :   return dependentSym;
   21003                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21004                 :             :   __builtin_unreachable ();
   21005                 :             : }
   21006                 :             : 
   21007                 :             : 
   21008                 :             : /*
   21009                 :             :    IsImport - returns TRUE if sym is an import symbol.
   21010                 :             : */
   21011                 :             : 
   21012                 :     1155267 : extern "C" bool SymbolTable_IsImport (unsigned int sym)
   21013                 :             : {
   21014                 :     1155267 :   SymbolTable_PtrToSymbol pSym;
   21015                 :             : 
   21016                 :     1155267 :   pSym = GetPsym (sym);
   21017                 :     1155267 :   return pSym->SymbolType == SymbolTable_ImportSym;
   21018                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21019                 :             :   __builtin_unreachable ();
   21020                 :             : }
   21021                 :             : 
   21022                 :             : 
   21023                 :             : /*
   21024                 :             :    IsImportStatement - returns TRUE if sym is a dependent symbol.
   21025                 :             : */
   21026                 :             : 
   21027                 :     1525566 : extern "C" bool SymbolTable_IsImportStatement (unsigned int sym)
   21028                 :             : {
   21029                 :     1525566 :   SymbolTable_PtrToSymbol pSym;
   21030                 :             : 
   21031                 :     1525566 :   pSym = GetPsym (sym);
   21032                 :     1525566 :   return pSym->SymbolType == SymbolTable_ImportStatementSym;
   21033                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21034                 :             :   __builtin_unreachable ();
   21035                 :             : }
   21036                 :             : 
   21037                 :             : 
   21038                 :             : /*
   21039                 :             :    GetImportModule - returns the module associated with the import symbol.
   21040                 :             : */
   21041                 :             : 
   21042                 :      357199 : extern "C" unsigned int SymbolTable_GetImportModule (unsigned int sym)
   21043                 :             : {
   21044                 :      357199 :   SymbolTable_PtrToSymbol pSym;
   21045                 :             : 
   21046                 :      357199 :   M2Debug_Assert (SymbolTable_IsImport (sym));
   21047                 :      357199 :   pSym = GetPsym (sym);
   21048                 :      357199 :   return pSym->Import.module;
   21049                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21050                 :             :   __builtin_unreachable ();
   21051                 :             : }
   21052                 :             : 
   21053                 :             : 
   21054                 :             : /*
   21055                 :             :    GetImportDeclared - returns the token associated with the import symbol.
   21056                 :             : */
   21057                 :             : 
   21058                 :       23149 : extern "C" unsigned int SymbolTable_GetImportDeclared (unsigned int sym)
   21059                 :             : {
   21060                 :       23149 :   unsigned int tok;
   21061                 :             : 
   21062                 :       23149 :   M2Debug_Assert (SymbolTable_IsImport (sym));
   21063                 :       23149 :   tok = SymbolTable_GetDeclaredDefinition (sym);
   21064                 :       23149 :   if (tok == M2LexBuf_UnknownTokenNo)
   21065                 :             :     {
   21066                 :       21213 :       return SymbolTable_GetDeclaredModule (sym);
   21067                 :             :     }
   21068                 :             :   return tok;
   21069                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21070                 :             :   __builtin_unreachable ();
   21071                 :             : }
   21072                 :             : 
   21073                 :             : 
   21074                 :             : /*
   21075                 :             :    GetImportStatementList - returns the list of imports for this dependent.
   21076                 :             :                             Each import symbol corresponds to a module.
   21077                 :             : */
   21078                 :             : 
   21079                 :      762783 : extern "C" Lists_List SymbolTable_GetImportStatementList (unsigned int sym)
   21080                 :             : {
   21081                 :      762783 :   SymbolTable_PtrToSymbol pSym;
   21082                 :             : 
   21083                 :      762783 :   M2Debug_Assert (SymbolTable_IsImportStatement (sym));
   21084                 :      762783 :   pSym = GetPsym (sym);
   21085                 :      762783 :   return pSym->ImportStatement.ListOfImports;
   21086                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21087                 :             :   __builtin_unreachable ();
   21088                 :             : }
   21089                 :             : 
   21090                 :             : 
   21091                 :             : /*
   21092                 :             :    GetModuleDefImportStatementList - returns the list of dependents associated with
   21093                 :             :                                      the definition module.
   21094                 :             : */
   21095                 :             : 
   21096                 :      216674 : extern "C" Lists_List SymbolTable_GetModuleDefImportStatementList (unsigned int sym)
   21097                 :             : {
   21098                 :      216674 :   SymbolTable_PtrToSymbol pSym;
   21099                 :             : 
   21100                 :      433348 :   M2Debug_Assert ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)));
   21101                 :      216674 :   if (SymbolTable_IsDefImp (sym))
   21102                 :             :     {
   21103                 :      202508 :       pSym = GetPsym (sym);
   21104                 :      202508 :       return pSym->DefImp.DefListOfDep;
   21105                 :             :     }
   21106                 :             :   return static_cast<Lists_List> (NULL);
   21107                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21108                 :             :   __builtin_unreachable ();
   21109                 :             : }
   21110                 :             : 
   21111                 :             : 
   21112                 :             : /*
   21113                 :             :    GetModuleModImportStatementList - returns the list of dependents associated with
   21114                 :             :                                      the implementation or program module.
   21115                 :             : */
   21116                 :             : 
   21117                 :      406560 : extern "C" Lists_List SymbolTable_GetModuleModImportStatementList (unsigned int sym)
   21118                 :             : {
   21119                 :      406560 :   SymbolTable_PtrToSymbol pSym;
   21120                 :             : 
   21121                 :      813120 :   M2Debug_Assert ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)));
   21122                 :      406560 :   pSym = GetPsym (sym);
   21123                 :      406560 :   if (SymbolTable_IsDefImp (sym))
   21124                 :             :     {
   21125                 :      377809 :       return pSym->DefImp.ModListOfDep;
   21126                 :             :     }
   21127                 :             :   else
   21128                 :             :     {
   21129                 :       28751 :       return pSym->Module.ModListOfDep;
   21130                 :             :     }
   21131                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21132                 :             :   __builtin_unreachable ();
   21133                 :             : }
   21134                 :             : 
   21135                 :             : 
   21136                 :             : /*
   21137                 :             :    AppendModuleImportStatement - appends the ImportStatement symbol onto the
   21138                 :             :                                  module import list.
   21139                 :             : 
   21140                 :             :                                  For example:
   21141                 :             : 
   21142                 :             :                                  FROM x IMPORT y, z ;
   21143                 :             :                                  ^^^^
   21144                 :             : 
   21145                 :             :                                  also:
   21146                 :             : 
   21147                 :             :                                  IMPORT p, q, r;
   21148                 :             :                                  ^^^^^^
   21149                 :             :                                  will result in a new ImportStatement symbol added
   21150                 :             :                                  to the current module import list.
   21151                 :             :                                  The statement symbol is expected to be created
   21152                 :             :                                  by MakeImportStatement using the token positions
   21153                 :             :                                  outlined above.
   21154                 :             : */
   21155                 :             : 
   21156                 :      402544 : extern "C" void SymbolTable_AppendModuleImportStatement (unsigned int module, unsigned int statement)
   21157                 :             : {
   21158                 :      402544 :   SymbolTable_PtrToSymbol pSym;
   21159                 :             : 
   21160                 :      402544 :   if (SymbolTable_IsDefImp (module))
   21161                 :             :     {
   21162                 :      388367 :       pSym = GetPsym (module);
   21163                 :      388367 :       if (M2Comp_CompilingDefinitionModule ())
   21164                 :             :         {
   21165                 :      111509 :           Lists_IncludeItemIntoList (pSym->DefImp.DefListOfDep, statement);
   21166                 :             :         }
   21167                 :             :       else
   21168                 :             :         {
   21169                 :      276858 :           Lists_IncludeItemIntoList (pSym->DefImp.ModListOfDep, statement);
   21170                 :             :         }
   21171                 :             :     }
   21172                 :       14177 :   else if (SymbolTable_IsModule (module))
   21173                 :             :     {
   21174                 :             :       /* avoid dangling else.  */
   21175                 :       14177 :       pSym = GetPsym (module);
   21176                 :       14177 :       Lists_IncludeItemIntoList (pSym->Module.ModListOfDep, statement);
   21177                 :             :     }
   21178                 :             :   else
   21179                 :             :     {
   21180                 :             :       /* avoid dangling else.  */
   21181                 :           0 :       M2Error_InternalError ((const char *) "expecting DefImp or Module symbol", 33);
   21182                 :             :     }
   21183                 :      402544 : }
   21184                 :             : 
   21185                 :             : 
   21186                 :             : /*
   21187                 :             :    AppendModuleOnImportStatement - appends the import symbol onto the
   21188                 :             :                                    dependent list (chain).
   21189                 :             : 
   21190                 :             :                                    For example each:
   21191                 :             : 
   21192                 :             :                                    FROM x IMPORT y, z ;
   21193                 :             :                                         ^
   21194                 :             :                                    x are added to the dependent list.
   21195                 :             : 
   21196                 :             :                                    also:
   21197                 :             : 
   21198                 :             :                                    IMPORT p, q, r;
   21199                 :             :                                           ^  ^  ^
   21200                 :             :                                    will result in p, q and r added to
   21201                 :             :                                    to the dependent list.
   21202                 :             : 
   21203                 :             :                                    The import symbol is created by MakeImport
   21204                 :             :                                    and the token is expected to match the module
   21205                 :             :                                    name position outlined above.
   21206                 :             : */
   21207                 :             : 
   21208                 :      417720 : extern "C" void SymbolTable_AppendModuleOnImportStatement (unsigned int module, unsigned int import)
   21209                 :             : {
   21210                 :      417720 :   Lists_List l;
   21211                 :      417720 :   unsigned int lastImportStatement;
   21212                 :             : 
   21213                 :      417720 :   M2Debug_Assert (SymbolTable_IsImport (import));
   21214                 :      417720 :   if (M2Comp_CompilingDefinitionModule ())
   21215                 :             :     {
   21216                 :      113917 :       l = SymbolTable_GetModuleDefImportStatementList (module);
   21217                 :             :     }
   21218                 :             :   else
   21219                 :             :     {
   21220                 :      303803 :       l = SymbolTable_GetModuleModImportStatementList (module);
   21221                 :             :     }
   21222                 :      417720 :   M2Debug_Assert (l != NULL);
   21223                 :      417720 :   M2Debug_Assert ((Lists_NoOfItemsInList (l)) > 0);  /* There should always be one on the list.  */
   21224                 :      417720 :   lastImportStatement = static_cast<unsigned int> (Lists_GetItemFromList (l, Lists_NoOfItemsInList (l)));  /* There should always be one on the list.  */
   21225                 :      417720 :   M2Debug_Assert (SymbolTable_IsImportStatement (lastImportStatement));
   21226                 :      417720 :   l = SymbolTable_GetImportStatementList (lastImportStatement);
   21227                 :      417720 :   Lists_IncludeItemIntoList (l, import);
   21228                 :      417720 : }
   21229                 :             : 
   21230                 :             : 
   21231                 :             : /*
   21232                 :             :    PutModLink - assigns link to module sym.
   21233                 :             : */
   21234                 :             : 
   21235                 :       62832 : extern "C" void SymbolTable_PutModLink (unsigned int sym, bool link)
   21236                 :             : {
   21237                 :       62832 :   SymbolTable_PtrToSymbol pSym;
   21238                 :             : 
   21239                 :       62832 :   if (SymbolTable_IsModule (sym))
   21240                 :             :     {
   21241                 :           0 :       pSym = GetPsym (sym);
   21242                 :           0 :       pSym->Module.ModLink = link;
   21243                 :             :     }
   21244                 :       62832 :   else if (SymbolTable_IsDefImp (sym))
   21245                 :             :     {
   21246                 :             :       /* avoid dangling else.  */
   21247                 :       62832 :       pSym = GetPsym (sym);
   21248                 :       62832 :       pSym->DefImp.ModLink = link;
   21249                 :             :     }
   21250                 :             :   else
   21251                 :             :     {
   21252                 :             :       /* avoid dangling else.  */
   21253                 :           0 :       M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   21254                 :             :     }
   21255                 :       62832 : }
   21256                 :             : 
   21257                 :             : 
   21258                 :             : /*
   21259                 :             :    IsModLink - returns the ModLink value associated with the module symbol.
   21260                 :             : */
   21261                 :             : 
   21262                 :      377527 : extern "C" bool SymbolTable_IsModLink (unsigned int sym)
   21263                 :             : {
   21264                 :      377527 :   SymbolTable_PtrToSymbol pSym;
   21265                 :             : 
   21266                 :      377527 :   if (SymbolTable_IsModule (sym))
   21267                 :             :     {
   21268                 :      181956 :       pSym = GetPsym (sym);
   21269                 :      181956 :       return pSym->Module.ModLink;
   21270                 :             :     }
   21271                 :      195571 :   else if (SymbolTable_IsDefImp (sym))
   21272                 :             :     {
   21273                 :             :       /* avoid dangling else.  */
   21274                 :      195571 :       pSym = GetPsym (sym);
   21275                 :      195571 :       return pSym->DefImp.ModLink;
   21276                 :             :     }
   21277                 :             :   else
   21278                 :             :     {
   21279                 :             :       /* avoid dangling else.  */
   21280                 :           0 :       M2Error_InternalError ((const char *) "expecting a DefImp or Module symbol", 35);
   21281                 :             :     }
   21282                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21283                 :             :   __builtin_unreachable ();
   21284                 :             : }
   21285                 :             : 
   21286                 :             : 
   21287                 :             : /*
   21288                 :             :    PutDefLink - assigns link to the definition module sym.
   21289                 :             : */
   21290                 :             : 
   21291                 :           0 : extern "C" void SymbolTable_PutDefLink (unsigned int sym, bool link)
   21292                 :             : {
   21293                 :           0 :   SymbolTable_PtrToSymbol pSym;
   21294                 :             : 
   21295                 :           0 :   if (SymbolTable_IsDefImp (sym))
   21296                 :             :     {
   21297                 :           0 :       pSym = GetPsym (sym);
   21298                 :           0 :       pSym->DefImp.DefLink = link;
   21299                 :             :     }
   21300                 :             :   else
   21301                 :             :     {
   21302                 :           0 :       M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   21303                 :             :     }
   21304                 :           0 : }
   21305                 :             : 
   21306                 :             : 
   21307                 :             : /*
   21308                 :             :    IsDefLink - returns the DefLink value associated with the definition module symbol.
   21309                 :             : */
   21310                 :             : 
   21311                 :      173764 : extern "C" bool SymbolTable_IsDefLink (unsigned int sym)
   21312                 :             : {
   21313                 :      173764 :   SymbolTable_PtrToSymbol pSym;
   21314                 :             : 
   21315                 :      173764 :   if (SymbolTable_IsDefImp (sym))
   21316                 :             :     {
   21317                 :      173764 :       pSym = GetPsym (sym);
   21318                 :      173764 :       return pSym->DefImp.DefLink;
   21319                 :             :     }
   21320                 :             :   else
   21321                 :             :     {
   21322                 :           0 :       M2Error_InternalError ((const char *) "expecting a DefImp symbol", 25);
   21323                 :             :     }
   21324                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21325                 :             :   __builtin_unreachable ();
   21326                 :             : }
   21327                 :             : 
   21328                 :             : 
   21329                 :             : /*
   21330                 :             :    IsModuleBuiltin - returns TRUE if the module is a builtin module.
   21331                 :             :                      (For example _BaseTypes).
   21332                 :             : */
   21333                 :             : 
   21334                 :       87138 : extern "C" bool SymbolTable_IsModuleBuiltin (unsigned int sym)
   21335                 :             : {
   21336                 :       87138 :   SymbolTable_PtrToSymbol pSym;
   21337                 :             : 
   21338                 :       87138 :   if (SymbolTable_IsDefImp (sym))
   21339                 :             :     {
   21340                 :       84460 :       pSym = GetPsym (sym);
   21341                 :       84460 :       return pSym->DefImp.Builtin;
   21342                 :             :     }
   21343                 :        2678 :   else if (SymbolTable_IsModule (sym))
   21344                 :             :     {
   21345                 :             :       /* avoid dangling else.  */
   21346                 :        2678 :       pSym = GetPsym (sym);
   21347                 :        2678 :       return pSym->Module.Builtin;
   21348                 :             :     }
   21349                 :             :   return false;
   21350                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21351                 :             :   __builtin_unreachable ();
   21352                 :             : }
   21353                 :             : 
   21354                 :             : 
   21355                 :             : /*
   21356                 :             :    PutModuleBuiltin - sets the Builtin flag to value.
   21357                 :             :                       Currently the procedure expects sym to be a DefImp
   21358                 :             :                       module only.
   21359                 :             : */
   21360                 :             : 
   21361                 :       15506 : extern "C" void SymbolTable_PutModuleBuiltin (unsigned int sym, bool value)
   21362                 :             : {
   21363                 :       15506 :   SymbolTable_PtrToSymbol pSym;
   21364                 :             : 
   21365                 :       15506 :   if (SymbolTable_IsDefImp (sym))
   21366                 :             :     {
   21367                 :           0 :       pSym = GetPsym (sym);
   21368                 :           0 :       pSym->DefImp.Builtin = value;
   21369                 :             :     }
   21370                 :       15506 :   else if (SymbolTable_IsModule (sym))
   21371                 :             :     {
   21372                 :             :       /* avoid dangling else.  */
   21373                 :       15506 :       pSym = GetPsym (sym);
   21374                 :       15506 :       pSym->Module.Builtin = value;
   21375                 :             :     }
   21376                 :             :   else
   21377                 :             :     {
   21378                 :             :       /* avoid dangling else.  */
   21379                 :           0 :       M2Error_InternalError ((const char *) "expecting Module or DefImp symbol", 33);
   21380                 :             :     }
   21381                 :       15506 : }
   21382                 :             : 
   21383                 :             : 
   21384                 :             : /*
   21385                 :             :    PutVarArrayRef - assigns ArrayRef field with value.
   21386                 :             : */
   21387                 :             : 
   21388                 :       56720 : extern "C" void SymbolTable_PutVarArrayRef (unsigned int sym, bool value)
   21389                 :             : {
   21390                 :       56720 :   SymbolTable_PtrToSymbol pSym;
   21391                 :             : 
   21392                 :       56720 :   pSym = GetPsym (sym);
   21393                 :       56720 :   switch (pSym->SymbolType)
   21394                 :             :     {
   21395                 :       56720 :       case SymbolTable_VarSym:
   21396                 :       56720 :         pSym->Var.ArrayRef = value;
   21397                 :       56720 :         break;
   21398                 :             : 
   21399                 :             : 
   21400                 :           0 :       default:
   21401                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   21402                 :       56720 :         break;
   21403                 :             :     }
   21404                 :       56720 : }
   21405                 :             : 
   21406                 :             : 
   21407                 :             : /*
   21408                 :             :    IsVarArrayRef - returns ArrayRef field value.
   21409                 :             : */
   21410                 :             : 
   21411                 :       17978 : extern "C" bool SymbolTable_IsVarArrayRef (unsigned int sym)
   21412                 :             : {
   21413                 :       17978 :   SymbolTable_PtrToSymbol pSym;
   21414                 :             : 
   21415                 :       17978 :   pSym = GetPsym (sym);
   21416                 :       17978 :   switch (pSym->SymbolType)
   21417                 :             :     {
   21418                 :       17978 :       case SymbolTable_VarSym:
   21419                 :       17978 :         return pSym->Var.ArrayRef;
   21420                 :           0 :         break;
   21421                 :             : 
   21422                 :             : 
   21423                 :           0 :       default:
   21424                 :           0 :         M2Error_InternalError ((const char *) "expecting VarSym", 16);
   21425                 :             :         break;
   21426                 :             :     }
   21427                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21428                 :             :   __builtin_unreachable ();
   21429                 :             : }
   21430                 :             : 
   21431                 :             : 
   21432                 :             : /*
   21433                 :             :    VarCheckReadInit - returns TRUE if sym has been initialized.
   21434                 :             : */
   21435                 :             : 
   21436                 :        9714 : extern "C" bool SymbolTable_VarCheckReadInit (unsigned int sym, SymbolTable_ModeOfAddr mode)
   21437                 :             : {
   21438                 :        9714 :   SymbolTable_PtrToSymbol pSym;
   21439                 :             : 
   21440                 :        9714 :   if (SymbolTable_IsVar (sym))
   21441                 :             :     {
   21442                 :        9714 :       pSym = GetPsym (sym);
   21443                 :        9714 :       switch (pSym->SymbolType)
   21444                 :             :         {
   21445                 :        9714 :           case SymbolTable_VarSym:
   21446                 :        9714 :             return M2SymInit_GetInitialized (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[mode-SymbolTable_RightValue]));
   21447                 :             :             break;
   21448                 :             : 
   21449                 :             : 
   21450                 :             :           default:
   21451                 :             :             break;
   21452                 :             :         }
   21453                 :             :     }
   21454                 :             :   return false;
   21455                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21456                 :             :   __builtin_unreachable ();
   21457                 :             : }
   21458                 :             : 
   21459                 :             : 
   21460                 :             : /*
   21461                 :             :    VarInitState - initializes the init state for variable sym.
   21462                 :             : */
   21463                 :             : 
   21464                 :      209324 : extern "C" void SymbolTable_VarInitState (unsigned int sym)
   21465                 :             : {
   21466                 :      209324 :   SymbolTable_PtrToSymbol pSym;
   21467                 :             : 
   21468                 :      209324 :   if (SymbolTable_IsVar (sym))
   21469                 :             :     {
   21470                 :      209324 :       pSym = GetPsym (sym);
   21471                 :      209324 :       switch (pSym->SymbolType)
   21472                 :             :         {
   21473                 :      209324 :           case SymbolTable_VarSym:
   21474                 :      209324 :             M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_LeftValue-SymbolTable_RightValue]), sym);
   21475                 :      209324 :             M2SymInit_ConfigSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_RightValue-SymbolTable_RightValue]), sym);
   21476                 :      209324 :             break;
   21477                 :             : 
   21478                 :             : 
   21479                 :             :           default:
   21480                 :             :             break;
   21481                 :             :         }
   21482                 :             :     }
   21483                 :      209324 : }
   21484                 :             : 
   21485                 :             : 
   21486                 :             : /*
   21487                 :             :    PutVarInitialized - set sym as initialized.
   21488                 :             : */
   21489                 :             : 
   21490                 :       39951 : extern "C" void SymbolTable_PutVarInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode)
   21491                 :             : {
   21492                 :       39951 :   SymbolTable_PtrToSymbol pSym;
   21493                 :             : 
   21494                 :       39951 :   if (SymbolTable_IsVar (sym))
   21495                 :             :     {
   21496                 :       39951 :       pSym = GetPsym (sym);
   21497                 :       39951 :       switch (pSym->SymbolType)
   21498                 :             :         {
   21499                 :       39951 :           case SymbolTable_VarSym:
   21500                 :       39951 :             M2SymInit_SetInitialized (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[mode-SymbolTable_RightValue]));
   21501                 :       39951 :             break;
   21502                 :             : 
   21503                 :             : 
   21504                 :             :           default:
   21505                 :             :             break;
   21506                 :             :         }
   21507                 :             :     }
   21508                 :       39951 : }
   21509                 :             : 
   21510                 :             : 
   21511                 :             : /*
   21512                 :             :    PutVarFieldInitialized - records that field has been initialized with
   21513                 :             :                             variable sym.  TRUE is returned if the field
   21514                 :             :                             is detected and changed to initialized.
   21515                 :             : */
   21516                 :             : 
   21517                 :        3292 : extern "C" bool SymbolTable_PutVarFieldInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode, Lists_List fieldlist)
   21518                 :             : {
   21519                 :        3292 :   SymbolTable_PtrToSymbol pSym;
   21520                 :             : 
   21521                 :        3292 :   if (SymbolTable_IsVar (sym))
   21522                 :             :     {
   21523                 :        3292 :       pSym = GetPsym (sym);
   21524                 :        3292 :       switch (pSym->SymbolType)
   21525                 :             :         {
   21526                 :        3292 :           case SymbolTable_VarSym:
   21527                 :        3292 :             return M2SymInit_SetFieldInitialized (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[mode-SymbolTable_RightValue]), fieldlist);
   21528                 :             :             break;
   21529                 :             : 
   21530                 :             : 
   21531                 :             :           default:
   21532                 :             :             break;
   21533                 :             :         }
   21534                 :             :     }
   21535                 :             :   return false;
   21536                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21537                 :             :   __builtin_unreachable ();
   21538                 :             : }
   21539                 :             : 
   21540                 :             : 
   21541                 :             : /*
   21542                 :             :    GetVarFieldInitialized - return TRUE if fieldlist has been initialized
   21543                 :             :                             within variable sym.
   21544                 :             : */
   21545                 :             : 
   21546                 :         232 : extern "C" bool SymbolTable_GetVarFieldInitialized (unsigned int sym, SymbolTable_ModeOfAddr mode, Lists_List fieldlist)
   21547                 :             : {
   21548                 :         232 :   SymbolTable_PtrToSymbol pSym;
   21549                 :             : 
   21550                 :         232 :   if (SymbolTable_IsVar (sym))
   21551                 :             :     {
   21552                 :         232 :       pSym = GetPsym (sym);
   21553                 :         232 :       switch (pSym->SymbolType)
   21554                 :             :         {
   21555                 :         232 :           case SymbolTable_VarSym:
   21556                 :         232 :             return M2SymInit_GetFieldInitialized (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[mode-SymbolTable_RightValue]), fieldlist);
   21557                 :             :             break;
   21558                 :             : 
   21559                 :             : 
   21560                 :             :           default:
   21561                 :             :             break;
   21562                 :             :         }
   21563                 :             :     }
   21564                 :             :   return false;
   21565                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21566                 :             :   __builtin_unreachable ();
   21567                 :             : }
   21568                 :             : 
   21569                 :             : 
   21570                 :             : /*
   21571                 :             :    PrintInitialized - display variable sym initialization state.
   21572                 :             : */
   21573                 :             : 
   21574                 :           0 : extern "C" void SymbolTable_PrintInitialized (unsigned int sym)
   21575                 :             : {
   21576                 :           0 :   SymbolTable_PtrToSymbol pSym;
   21577                 :             : 
   21578                 :           0 :   if (SymbolTable_IsVar (sym))
   21579                 :             :     {
   21580                 :           0 :       pSym = GetPsym (sym);
   21581                 :           0 :       switch (pSym->SymbolType)
   21582                 :             :         {
   21583                 :           0 :           case SymbolTable_VarSym:
   21584                 :           0 :             M2Printf_printf0 ((const char *) "LeftMode init: ", 15);
   21585                 :           0 :             M2SymInit_PrintSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_LeftValue-SymbolTable_RightValue]));
   21586                 :           0 :             M2Printf_printf0 ((const char *) "RightMode init: ", 16);
   21587                 :           0 :             M2SymInit_PrintSymInit (static_cast<M2SymInit_InitDesc> (pSym->Var.InitState.array[SymbolTable_RightValue-SymbolTable_RightValue]));
   21588                 :           0 :             break;
   21589                 :             : 
   21590                 :             : 
   21591                 :             :           default:
   21592                 :             :             break;
   21593                 :             :         }
   21594                 :             :     }
   21595                 :           0 : }
   21596                 :             : 
   21597                 :             : 
   21598                 :             : /*
   21599                 :             :    GetParameterHeapVar - return the heap variable associated with the
   21600                 :             :                          parameter or NulSym.
   21601                 :             : */
   21602                 :             : 
   21603                 :       46548 : extern "C" unsigned int SymbolTable_GetParameterHeapVar (unsigned int ParSym)
   21604                 :             : {
   21605                 :       46548 :   SymbolTable_PtrToSymbol pSym;
   21606                 :             : 
   21607                 :       46548 :   pSym = GetPsym (ParSym);
   21608                 :       46548 :   switch (pSym->SymbolType)
   21609                 :             :     {
   21610                 :             :       case SymbolTable_ParamSym:
   21611                 :             :         return SymbolTable_NulSym;  /* Only VarParam has the pointer.  */
   21612                 :        7160 :         break;
   21613                 :             : 
   21614                 :        7160 :       case SymbolTable_VarParamSym:
   21615                 :        7160 :         return pSym->VarParam.HeapVar;  /* Only VarParam has the pointer.  */
   21616                 :           0 :         break;
   21617                 :             : 
   21618                 :             : 
   21619                 :           0 :       default:
   21620                 :           0 :         M2Error_InternalError ((const char *) "expecting Param or VarParam symbol", 34);
   21621                 :             :         break;
   21622                 :             :     }
   21623                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21624                 :             :   __builtin_unreachable ();
   21625                 :             : }
   21626                 :             : 
   21627                 :             : 
   21628                 :             : /*
   21629                 :             :    PutProcedureParameterHeapVars - creates heap variables for parameter sym.
   21630                 :             : */
   21631                 :             : 
   21632                 :     1878264 : extern "C" void SymbolTable_PutProcedureParameterHeapVars (unsigned int sym)
   21633                 :             : {
   21634                 :     1878264 :   M2Debug_Assert (SymbolTable_IsProcedure (sym));
   21635                 :     1878264 :   SymbolTable_ForeachParamSymDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PutParameterHeapVar});
   21636                 :     1878264 : }
   21637                 :             : 
   21638                 :             : 
   21639                 :             : /*
   21640                 :             :    IsProcedureBuiltinAvailable - return TRUE if procedure is available as a builtin
   21641                 :             :                                  for the target architecture.
   21642                 :             : */
   21643                 :             : 
   21644                 :     1214993 : extern "C" bool SymbolTable_IsProcedureBuiltinAvailable (unsigned int procedure)
   21645                 :             : {
   21646                 :     1214993 :   return (SymbolTable_IsProcedureBuiltin (procedure)) && (CanUseBuiltin (procedure));
   21647                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21648                 :             :   __builtin_unreachable ();
   21649                 :             : }
   21650                 :             : 
   21651                 :             : 
   21652                 :             : /*
   21653                 :             :    PutConstLitInternal - marks the sym as being an internal constant.
   21654                 :             :                          Currently this is used when generating a default
   21655                 :             :                          BY constant expression during a FOR loop.
   21656                 :             :                          A constant marked as internal will always pass
   21657                 :             :                          an expression type check.
   21658                 :             : */
   21659                 :             : 
   21660                 :       16182 : extern "C" void SymbolTable_PutConstLitInternal (unsigned int sym, bool value)
   21661                 :             : {
   21662                 :       16182 :   SymbolTable_PtrToSymbol pSym;
   21663                 :             : 
   21664                 :       16182 :   pSym = GetPsym (sym);
   21665                 :       16182 :   switch (pSym->SymbolType)
   21666                 :             :     {
   21667                 :       16182 :       case SymbolTable_ConstLitSym:
   21668                 :       16182 :         pSym->ConstLit.IsInternal = value;
   21669                 :       16182 :         break;
   21670                 :             : 
   21671                 :             : 
   21672                 :           0 :       default:
   21673                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstLitSym", 21);
   21674                 :       16182 :         break;
   21675                 :             :     }
   21676                 :       16182 : }
   21677                 :             : 
   21678                 :             : 
   21679                 :             : /*
   21680                 :             :    IsConstLitInternal - returns the value of the IsInternal field within
   21681                 :             :                         a constant expression.
   21682                 :             : */
   21683                 :             : 
   21684                 :      831719 : extern "C" bool SymbolTable_IsConstLitInternal (unsigned int sym)
   21685                 :             : {
   21686                 :      831719 :   SymbolTable_PtrToSymbol pSym;
   21687                 :             : 
   21688                 :      831719 :   pSym = GetPsym (sym);
   21689                 :      831719 :   switch (pSym->SymbolType)
   21690                 :             :     {
   21691                 :      831719 :       case SymbolTable_ConstLitSym:
   21692                 :      831719 :         return pSym->ConstLit.IsInternal;
   21693                 :           0 :         break;
   21694                 :             : 
   21695                 :             : 
   21696                 :           0 :       default:
   21697                 :           0 :         M2Error_InternalError ((const char *) "expecting ConstLitSym", 21);
   21698                 :             :         break;
   21699                 :             :     }
   21700                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21701                 :             :   __builtin_unreachable ();
   21702                 :             : }
   21703                 :             : 
   21704                 :             : 
   21705                 :             : /*
   21706                 :             :    GetVarDeclTypeTok - returns the TypeTok field associate with variable sym.
   21707                 :             : */
   21708                 :             : 
   21709                 :           0 : extern "C" unsigned int SymbolTable_GetVarDeclTypeTok (unsigned int sym)
   21710                 :             : {
   21711                 :           0 :   SymbolTable_PtrToSymbol pSym;
   21712                 :             : 
   21713                 :           0 :   if (SymbolTable_IsParameter (sym))
   21714                 :             :     {
   21715                 :           0 :       pSym = GetPsym (sym);
   21716                 :           0 :       if (SymbolTable_IsParameterVar (sym))
   21717                 :             :         {
   21718                 :           0 :           return SymbolTable_GetVarDeclTypeTok (pSym->VarParam.ShadowVar);
   21719                 :             :         }
   21720                 :             :       else
   21721                 :             :         {
   21722                 :           0 :           return SymbolTable_GetVarDeclTypeTok (pSym->Param.ShadowVar);
   21723                 :             :         }
   21724                 :             :     }
   21725                 :           0 :   else if (SymbolTable_IsVar (sym))
   21726                 :             :     {
   21727                 :             :       /* avoid dangling else.  */
   21728                 :           0 :       return doGetVarDeclTypeTok (sym);
   21729                 :             :     }
   21730                 :             :   else
   21731                 :             :     {
   21732                 :             :       /* avoid dangling else.  */
   21733                 :             :       return M2LexBuf_UnknownTokenNo;
   21734                 :             :     }
   21735                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21736                 :             :   __builtin_unreachable ();
   21737                 :             : }
   21738                 :             : 
   21739                 :             : 
   21740                 :             : /*
   21741                 :             :    PutVarDeclTypeTok - assigns the TypeTok field to typetok.
   21742                 :             :                        sym can be a variable or parameter.
   21743                 :             : */
   21744                 :             : 
   21745                 :           0 : extern "C" void SymbolTable_PutVarDeclTypeTok (unsigned int sym, unsigned int typetok)
   21746                 :             : {
   21747                 :           0 :   SymbolTable_PtrToSymbol pSym;
   21748                 :             : 
   21749                 :           0 :   if (SymbolTable_IsParameter (sym))
   21750                 :             :     {
   21751                 :           0 :       pSym = GetPsym (sym);
   21752                 :           0 :       if (SymbolTable_IsParameterVar (sym))
   21753                 :             :         {
   21754                 :           0 :           SymbolTable_PutVarDeclTypeTok (pSym->VarParam.ShadowVar, typetok);
   21755                 :             :         }
   21756                 :             :       else
   21757                 :             :         {
   21758                 :           0 :           SymbolTable_PutVarDeclTypeTok (pSym->Param.ShadowVar, typetok);
   21759                 :             :         }
   21760                 :             :     }
   21761                 :           0 :   else if (SymbolTable_IsVar (sym))
   21762                 :             :     {
   21763                 :             :       /* avoid dangling else.  */
   21764                 :           0 :       doPutVarDeclTypeTok (sym, typetok);
   21765                 :             :     }
   21766                 :           0 : }
   21767                 :             : 
   21768                 :             : 
   21769                 :             : /*
   21770                 :             :    GetVarDeclTok - returns the TypeTok field associate with variable sym.
   21771                 :             : */
   21772                 :             : 
   21773                 :          96 : extern "C" unsigned int SymbolTable_GetVarDeclTok (unsigned int sym)
   21774                 :             : {
   21775                 :         156 :   SymbolTable_PtrToSymbol pSym;
   21776                 :             : 
   21777                 :         156 :   if (SymbolTable_IsParameter (sym))
   21778                 :             :     {
   21779                 :          96 :       pSym = GetPsym (sym);
   21780                 :          96 :       if (SymbolTable_IsParameterVar (sym))
   21781                 :             :         {
   21782                 :           6 :           if (pSym->VarParam.ShadowVar == SymbolTable_NulSym)
   21783                 :             :             {
   21784                 :           0 :               return pSym->VarParam.At;
   21785                 :             :             }
   21786                 :             :           else
   21787                 :             :             {
   21788                 :             :               return SymbolTable_GetVarDeclTok (pSym->VarParam.ShadowVar);
   21789                 :             :             }
   21790                 :             :         }
   21791                 :             :       else
   21792                 :             :         {
   21793                 :          90 :           if (pSym->Param.ShadowVar == SymbolTable_NulSym)
   21794                 :             :             {
   21795                 :          36 :               return pSym->Param.At;
   21796                 :             :             }
   21797                 :             :           else
   21798                 :             :             {
   21799                 :             :               return SymbolTable_GetVarDeclTok (pSym->Param.ShadowVar);
   21800                 :             :             }
   21801                 :             :         }
   21802                 :             :     }
   21803                 :          60 :   else if (SymbolTable_IsVar (sym))
   21804                 :             :     {
   21805                 :             :       /* avoid dangling else.  */
   21806                 :          60 :       return doGetVarDeclTok (sym);
   21807                 :             :     }
   21808                 :             :   else
   21809                 :             :     {
   21810                 :             :       /* avoid dangling else.  */
   21811                 :             :       return M2LexBuf_UnknownTokenNo;
   21812                 :             :     }
   21813                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21814                 :             :   __builtin_unreachable ();
   21815                 :             : }
   21816                 :             : 
   21817                 :             : 
   21818                 :             : /*
   21819                 :             :    PutVarDeclTok - assigns the VarTok field to typetok.
   21820                 :             :                    sym can be a variable or parameter.
   21821                 :             : */
   21822                 :             : 
   21823                 :     1690910 : extern "C" void SymbolTable_PutVarDeclTok (unsigned int sym, unsigned int vartok)
   21824                 :             : {
   21825                 :     1690910 :   SymbolTable_PtrToSymbol pSym;
   21826                 :             : 
   21827                 :     1690910 :   if (SymbolTable_IsParameter (sym))
   21828                 :             :     {
   21829                 :           0 :       pSym = GetPsym (sym);
   21830                 :           0 :       if (SymbolTable_IsParameterVar (sym))
   21831                 :             :         {
   21832                 :           0 :           SymbolTable_PutVarDeclTok (pSym->VarParam.ShadowVar, vartok);
   21833                 :             :         }
   21834                 :             :       else
   21835                 :             :         {
   21836                 :           0 :           SymbolTable_PutVarDeclTok (pSym->Param.ShadowVar, vartok);
   21837                 :             :         }
   21838                 :             :     }
   21839                 :     1690910 :   else if (SymbolTable_IsVar (sym))
   21840                 :             :     {
   21841                 :             :       /* avoid dangling else.  */
   21842                 :     1690910 :       doPutVarDeclTok (sym, vartok);
   21843                 :             :     }
   21844                 :     1690910 : }
   21845                 :             : 
   21846                 :             : 
   21847                 :             : /*
   21848                 :             :    GetVarDeclFullTok - returns the full virtual token containing var: type.
   21849                 :             : */
   21850                 :             : 
   21851                 :         360 : extern "C" unsigned int SymbolTable_GetVarDeclFullTok (unsigned int sym)
   21852                 :             : {
   21853                 :         360 :   SymbolTable_PtrToSymbol pSym;
   21854                 :             : 
   21855                 :         360 :   pSym = GetPsym (sym);
   21856                 :         360 :   if (SymbolTable_IsParameter (sym))
   21857                 :             :     {
   21858                 :          78 :       if (SymbolTable_IsParameterVar (sym))
   21859                 :             :         {
   21860                 :           6 :           return pSym->VarParam.FullTok;
   21861                 :             :         }
   21862                 :             :       else
   21863                 :             :         {
   21864                 :          72 :           return pSym->Param.FullTok;
   21865                 :             :         }
   21866                 :             :     }
   21867                 :         282 :   else if (SymbolTable_IsVar (sym))
   21868                 :             :     {
   21869                 :             :       /* avoid dangling else.  */
   21870                 :         282 :       return doGetVarDeclFullTok (sym);
   21871                 :             :     }
   21872                 :             :   else
   21873                 :             :     {
   21874                 :             :       /* avoid dangling else.  */
   21875                 :             :       return M2LexBuf_UnknownTokenNo;
   21876                 :             :     }
   21877                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21878                 :             :   __builtin_unreachable ();
   21879                 :             : }
   21880                 :             : 
   21881                 :             : 
   21882                 :             : /*
   21883                 :             :    IsProcedureAnyNoReturn - return TRUE if any of the defined kinds
   21884                 :             :                             of procedure sym is declared no return.
   21885                 :             : */
   21886                 :             : 
   21887                 :     3710985 : extern "C" bool SymbolTable_IsProcedureAnyNoReturn (unsigned int sym)
   21888                 :             : {
   21889                 :     3710985 :   return IsProcedureAnyDefaultBoolean (sym, false, (SymbolTable_ProcAnyBoolean) {(SymbolTable_ProcAnyBoolean_t) SymbolTable_IsProcedureNoReturn});
   21890                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21891                 :             :   __builtin_unreachable ();
   21892                 :             : }
   21893                 :             : 
   21894                 :             : 
   21895                 :             : /*
   21896                 :             :    GetNthParamAny - returns the nth parameter from the order
   21897                 :             :                     proper procedure, forward declaration
   21898                 :             :                     or definition module procedure.
   21899                 :             : */
   21900                 :             : 
   21901                 :    21150619 : extern "C" unsigned int SymbolTable_GetNthParamAny (unsigned int sym, unsigned int ParamNo)
   21902                 :             : {
   21903                 :    21150619 :   SymbolTable_ProcedureKind kind;
   21904                 :             : 
   21905                 :    33751113 :   for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   21906                 :             :     {
   21907                 :    33751113 :       if (SymbolTable_GetProcedureParametersDefined (sym, kind))
   21908                 :             :         {
   21909                 :    21150619 :           return SymbolTable_GetNthParam (sym, kind, ParamNo);
   21910                 :             :         }
   21911                 :             :     }
   21912                 :           0 :   M2Error_InternalError ((const char *) "no procedure kind exists", 24);
   21913                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   21914                 :             :   __builtin_unreachable ();
   21915                 :             : }
   21916                 :             : 
   21917                 :             : 
   21918                 :             : /*
   21919                 :             :    NoOfParamAny - return the number of parameters for sym.
   21920                 :             : */
   21921                 :             : 
   21922                 :    25923198 : extern "C" unsigned int SymbolTable_NoOfParamAny (unsigned int sym)
   21923                 :             : {
   21924                 :    25923198 :   SymbolTable_ProcedureKind kind;
   21925                 :    25923198 :   SymbolTable_PtrToSymbol pSym;
   21926                 :             : 
   21927                 :    25923198 :   AssertInRange (sym);
   21928                 :    25923198 :   pSym = GetPsym (sym);
   21929                 :    25923198 :   switch (pSym->SymbolType)
   21930                 :             :     {
   21931                 :             :       case SymbolTable_ErrorSym:
   21932                 :             :         return 0;
   21933                 :             :         break;
   21934                 :             : 
   21935                 :             :       case SymbolTable_ProcedureSym:
   21936                 :    42704683 :         for (kind=SymbolTable_ProperProcedure; kind<=SymbolTable_DefProcedure; kind= static_cast<SymbolTable_ProcedureKind>(static_cast<int>(kind+1)))
   21937                 :             :           {
   21938                 :    40510603 :             if (SymbolTable_GetProcedureParametersDefined (sym, kind))
   21939                 :             :               {
   21940                 :    17218293 :                 return SymbolTable_NoOfParam (sym, kind);
   21941                 :             :               }
   21942                 :             :           }
   21943                 :             :         break;
   21944                 :             : 
   21945                 :     6510813 :       case SymbolTable_ProcTypeSym:
   21946                 :     6510813 :         return Lists_NoOfItemsInList (pSym->ProcType.ListOfParam);
   21947                 :          12 :         break;
   21948                 :             : 
   21949                 :             : 
   21950                 :          12 :       default:
   21951                 :          12 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   21952                 :             :         break;
   21953                 :             :     }
   21954                 :             :   return 0;
   21955                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   21956                 :             :   __builtin_unreachable ();
   21957                 :             : }
   21958                 :             : 
   21959                 :             : 
   21960                 :             : /*
   21961                 :             :    SetReturnOptional - sets the ReturnOptional field in the Procedure:kind or
   21962                 :             :                        ProcType symboltable entry.
   21963                 :             : */
   21964                 :             : 
   21965                 :     3137942 : extern "C" void SymbolTable_SetReturnOptional (unsigned int sym, SymbolTable_ProcedureKind kind, bool isopt)
   21966                 :             : {
   21967                 :     3137942 :   SymbolTable_PtrToSymbol pSym;
   21968                 :             : 
   21969                 :     3137942 :   pSym = GetPsym (sym);
   21970                 :     3137942 :   switch (pSym->SymbolType)
   21971                 :             :     {
   21972                 :     3130082 :       case SymbolTable_ProcedureSym:
   21973                 :     3130082 :         pSym->Procedure.Decl.array[kind-SymbolTable_ProperProcedure].ReturnOptional = isopt;
   21974                 :     3130082 :         break;
   21975                 :             : 
   21976                 :        7860 :       case SymbolTable_ProcTypeSym:
   21977                 :        7860 :         pSym->ProcType.ReturnOptional = isopt;
   21978                 :        7860 :         break;
   21979                 :             : 
   21980                 :             : 
   21981                 :           0 :       default:
   21982                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   21983                 :     3137942 :         break;
   21984                 :             :     }
   21985                 :     3137942 : }
   21986                 :             : 
   21987                 :             : 
   21988                 :             : /*
   21989                 :             :    UsesOptArgAny - returns TRUE if procedure Sym:kind uses an optional argument.
   21990                 :             : */
   21991                 :             : 
   21992                 :      213095 : extern "C" bool SymbolTable_UsesOptArgAny (unsigned int Sym)
   21993                 :             : {
   21994                 :      213095 :   SymbolTable_PtrToSymbol pSym;
   21995                 :             : 
   21996                 :      213095 :   pSym = GetPsym (Sym);
   21997                 :      213095 :   switch (pSym->SymbolType)
   21998                 :             :     {
   21999                 :             :       case SymbolTable_ErrorSym:
   22000                 :             :         return false;
   22001                 :      212347 :         break;
   22002                 :             : 
   22003                 :      212347 :       case SymbolTable_ProcedureSym:
   22004                 :      212347 :         return IsProcedureAnyDefaultBoolean (Sym, false, (SymbolTable_ProcAnyBoolean) {(SymbolTable_ProcAnyBoolean_t) SymbolTable_UsesOptArg});
   22005                 :         748 :         break;
   22006                 :             : 
   22007                 :         748 :       case SymbolTable_ProcTypeSym:
   22008                 :         748 :         return pSym->ProcType.HasOptArg;
   22009                 :           0 :         break;
   22010                 :             : 
   22011                 :             : 
   22012                 :           0 :       default:
   22013                 :           0 :         M2Error_InternalError ((const char *) "expecting a Procedure or ProcType symbol", 40);
   22014                 :             :         break;
   22015                 :             :     }
   22016                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   22017                 :             :   __builtin_unreachable ();
   22018                 :             : }
   22019                 :             : 
   22020                 :             : 
   22021                 :             : /*
   22022                 :             :    GetProcedureKindDesc - return a string describing kind.
   22023                 :             : */
   22024                 :             : 
   22025                 :         180 : extern "C" DynamicStrings_String SymbolTable_GetProcedureKindDesc (SymbolTable_ProcedureKind kind)
   22026                 :             : {
   22027                 :         180 :   if (kind == SymbolTable_ProperProcedure)
   22028                 :             :     {
   22029                 :          90 :       return DynamicStrings_InitString ((const char *) "proper procedure", 16);
   22030                 :             :     }
   22031                 :          90 :   else if (kind == SymbolTable_ForwardProcedure)
   22032                 :             :     {
   22033                 :             :       /* avoid dangling else.  */
   22034                 :          24 :       return DynamicStrings_InitString ((const char *) "forward procedure", 17);
   22035                 :             :     }
   22036                 :          66 :   else if (kind == SymbolTable_DefProcedure)
   22037                 :             :     {
   22038                 :             :       /* avoid dangling else.  */
   22039                 :          66 :       return DynamicStrings_InitString ((const char *) "definition procedure", 20);
   22040                 :             :     }
   22041                 :           0 :   M2Error_InternalError ((const char *) "unknown kind value", 18);
   22042                 :             :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.def", 20, 1);
   22043                 :             :   __builtin_unreachable ();
   22044                 :             : }
   22045                 :             : 
   22046                 :             : 
   22047                 :             : /*
   22048                 :             :    GetNthParamAnyClosest - returns the nth parameter from the order
   22049                 :             :                            proper procedure, forward declaration
   22050                 :             :                            or definition module procedure.
   22051                 :             :                            It chooses the parameter which is closest
   22052                 :             :                            in source terms to currentmodule.
   22053                 :             :                            The same module will return using the order
   22054                 :             :                            proper procedure, forward procedure, definition module.
   22055                 :             :                            Whereas an imported procedure will choose from
   22056                 :             :                            DefProcedure, ProperProcedure, ForwardProcedure.
   22057                 :             : */
   22058                 :             : 
   22059                 :      633990 : extern "C" unsigned int SymbolTable_GetNthParamAnyClosest (unsigned int sym, unsigned int ParamNo, unsigned int currentmodule)
   22060                 :             : {
   22061                 :      633990 :   if (SymbolTable_IsUnknown (sym))
   22062                 :             :     {
   22063                 :           0 :       M2Error_InternalError ((const char *) "/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/SymbolTable.mod:GetNthParamAnyClosest:not expecting an unknown symbol", 131);
   22064                 :             :     }
   22065                 :      633990 :   if ((GetOuterModuleScope (currentmodule)) == (GetOuterModuleScope (sym)))
   22066                 :             :     {
   22067                 :             :       /* Same module.  */
   22068                 :      232632 :       return GetNthParamOrdered (sym, ParamNo, SymbolTable_ProperProcedure, SymbolTable_ForwardProcedure, SymbolTable_DefProcedure);
   22069                 :             :     }
   22070                 :             :   else
   22071                 :             :     {
   22072                 :             :       /* Procedure is imported.  */
   22073                 :      401358 :       return GetNthParamOrdered (sym, ParamNo, SymbolTable_DefProcedure, SymbolTable_ProperProcedure, SymbolTable_ForwardProcedure);
   22074                 :             :     }
   22075                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   22076                 :             :   __builtin_unreachable ();
   22077                 :             : }
   22078                 :             : 
   22079                 :             : 
   22080                 :             : /*
   22081                 :             :    IsConstVar - returns TRUE if sym is a const var.  This is a
   22082                 :             :                 constant which might be assigned to TRUE or FALSE
   22083                 :             :                 depending upon the result of the quad stack control flow.
   22084                 :             :                 Typically used in CONST foo = (a AND b) or similar.
   22085                 :             :                 This symbol will only be assigned once with a value, but
   22086                 :             :                 will appear more than once as a designator to an assignment
   22087                 :             :                 in the quad table.  However as the quad table is reduced
   22088                 :             :                 only one assignment will remain.  If after reducing quads
   22089                 :             :                 two or more assignments remain, then there is an error
   22090                 :             :                 as sym should not have been declared a constant.
   22091                 :             : */
   22092                 :             : 
   22093                 :         150 : extern "C" bool SymbolTable_IsConstVar (unsigned int sym)
   22094                 :             : {
   22095                 :         150 :   SymbolTable_PtrToSymbol pSym;
   22096                 :             : 
   22097                 :         150 :   pSym = GetPsym (sym);
   22098                 :         150 :   return pSym->SymbolType == SymbolTable_ConstVarSym;
   22099                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
   22100                 :             :   __builtin_unreachable ();
   22101                 :             : }
   22102                 :             : 
   22103                 :       15506 : extern "C" void _M2_SymbolTable_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
   22104                 :             : {
   22105                 :       15506 :   Init ();
   22106                 :       15506 : }
   22107                 :             : 
   22108                 :           0 : extern "C" void _M2_SymbolTable_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
   22109                 :             : {
   22110                 :           0 : }
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.