LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2Code.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 77.8 % 198 154
Test Date: 2026-02-28 14:20:25 Functions: 88.2 % 17 15
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* do not edit automatically generated by mc from M2Code.  */
       2              : /* M2Code.mod coordinate the activity of the front end.
       3              : 
       4              : Copyright (C) 2001-2026 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              : #define _M2Code_C
      43              : 
      44              : #include "GM2Code.h"
      45              : #   include "GSYSTEM.h"
      46              : #   include "GM2Options.h"
      47              : #   include "GM2LangDump.h"
      48              : #   include "GM2Error.h"
      49              : #   include "GM2Students.h"
      50              : #   include "GSymbolTable.h"
      51              : #   include "GM2Printf.h"
      52              : #   include "GNameKey.h"
      53              : #   include "GM2Batch.h"
      54              : #   include "GM2Quads.h"
      55              : #   include "GM2SymInit.h"
      56              : #   include "GM2Pass.h"
      57              : #   include "GM2BasicBlock.h"
      58              : #   include "GM2Optimize.h"
      59              : #   include "GM2GenGCC.h"
      60              : #   include "GM2GCCDeclare.h"
      61              : #   include "GM2Scope.h"
      62              : #   include "Gm2top.h"
      63              : #   include "GM2Swig.h"
      64              : #   include "Gm2flex.h"
      65              : #   include "GFIO.h"
      66              : #   include "GM2Quiet.h"
      67              : #   include "GM2SSA.h"
      68              : #   include "Gm2pp.h"
      69              : #   include "GDynamicStrings.h"
      70              : #   include "GM2Diagnostic.h"
      71              : 
      72              : #   define MaxOptimTimes 10
      73              : #   define Debugging true
      74              : #   define TraceQuadruples false
      75              : static unsigned int Total;
      76              : static unsigned int Count;
      77              : static unsigned int OptimTimes;
      78              : static unsigned int DeltaProc;
      79              : static unsigned int Proc;
      80              : static unsigned int DeltaConst;
      81              : static unsigned int Const;
      82              : static unsigned int DeltaJump;
      83              : static unsigned int Jump;
      84              : static unsigned int DeltaBasicB;
      85              : static unsigned int BasicB;
      86              : 
      87              : /*
      88              :    Code - calls procedures to generates trees from the quadruples.
      89              :           All front end quadruple optimization is performed via this call.
      90              : */
      91              : 
      92              : extern "C" void M2Code_Code (void);
      93              : 
      94              : /*
      95              :    CodeBlock - generates all code for this block and also declares
      96              :                all types and procedures for this block. It will
      97              :                also optimize quadruples within this scope.
      98              : */
      99              : 
     100              : extern "C" void M2Code_CodeBlock (unsigned int scope);
     101              : 
     102              : /*
     103              :    Percent - calculates the percentage from numerator and divisor
     104              : */
     105              : 
     106              : static void Percent (unsigned int numerator, unsigned int divisor);
     107              : 
     108              : /*
     109              :    ResourceAnalysis - displays resource analysis relating to the front end.
     110              : */
     111              : 
     112              : static void ResourceAnalysis (void);
     113              : 
     114              : /*
     115              :    RemoveUnreachableCode -
     116              : */
     117              : 
     118              : static void RemoveUnreachableCode (void);
     119              : 
     120              : /*
     121              :    DoModuleDeclare - declare all constants, types, variables, procedures for the
     122              :                      main module or all modules.
     123              : */
     124              : 
     125              : static void DoModuleDeclare (void);
     126              : 
     127              : /*
     128              :    DoCodeBlock - generate code for the main module or all modules.
     129              : */
     130              : 
     131              : static void DoCodeBlock (void);
     132              : 
     133              : /*
     134              :    DetermineSubExpTemporaries -
     135              : */
     136              : 
     137              : static void DetermineSubExpTemporaries (void);
     138              : static void InitialDeclareAndOptimize (unsigned int scope, unsigned int start, unsigned int end);
     139              : static void SecondDeclareAndOptimize (unsigned int scope, unsigned int start, unsigned int end);
     140              : 
     141              : /*
     142              :    InitOptimizeVariables -
     143              : */
     144              : 
     145              : static void InitOptimizeVariables (void);
     146              : 
     147              : /*
     148              :    Init -
     149              : */
     150              : 
     151              : static void Init (void);
     152              : 
     153              : /*
     154              :    OptimizeScopeBlock -
     155              : */
     156              : 
     157              : static void OptimizeScopeBlock (M2Scope_ScopeBlock sb);
     158              : 
     159              : /*
     160              :    CodeProceduresWithinBlock - codes the procedures within the module scope.
     161              : */
     162              : 
     163              : static void CodeProceduresWithinBlock (unsigned int scope);
     164              : 
     165              : /*
     166              :    CodeProcedures -
     167              : */
     168              : 
     169              : static void CodeProcedures (unsigned int scope);
     170              : 
     171              : 
     172              : /*
     173              :    Percent - calculates the percentage from numerator and divisor
     174              : */
     175              : 
     176            0 : static void Percent (unsigned int numerator, unsigned int divisor)
     177              : {
     178            0 :   unsigned int value;
     179              : 
     180            0 :   M2Printf_printf0 ((const char *) "  (", 3);
     181            0 :   if (divisor == 0)
     182              :     {
     183            0 :       M2Printf_printf0 ((const char *) "overflow error", 14);
     184              :     }
     185              :   else
     186              :     {
     187            0 :       value = (numerator*100) / divisor;
     188            0 :       M2Printf_printf1 ((const char *) "%3d", 3, (const unsigned char *) &value, (sizeof (value)-1));
     189              :     }
     190            0 :   M2Printf_printf0 ((const char *) "\\%)", 3);
     191            0 : }
     192              : 
     193              : 
     194              : /*
     195              :    ResourceAnalysis - displays resource analysis relating to the front end.
     196              : */
     197              : 
     198        13652 : static void ResourceAnalysis (void)
     199              : {
     200        13652 :   unsigned int value;
     201              : 
     202        13652 :   if (M2Options_Statistics)
     203              :     {
     204            0 :       Count = M2Quads_CountQuads ();
     205            0 :       M2Printf_printf1 ((const char *) "M2 initial number of quadruples: %6d", 36, (const unsigned char *) &Total, (sizeof (Total)-1));
     206            0 :       Percent (Total, Total);
     207            0 :       M2Printf_printf0 ((const char *) "\\n", 2);
     208            0 :       M2Printf_printf1 ((const char *) "M2 constant folding achieved   : %6d", 36, (const unsigned char *) &Const, (sizeof (Const)-1));
     209            0 :       Percent (Const, Total);
     210            0 :       M2Printf_printf0 ((const char *) "\\n", 2);
     211            0 :       M2Printf_printf1 ((const char *) "M2 branch folding achieved     : %6d", 36, (const unsigned char *) &Jump, (sizeof (Jump)-1));
     212            0 :       Percent (Jump, Total);
     213            0 :       M2Printf_printf0 ((const char *) "\\n", 2);
     214            0 :       value = (Const+Jump)+Proc;
     215            0 :       M2Printf_printf1 ((const char *) "Front end optimization removed : %6d", 36, (const unsigned char *) &value, (sizeof (value)-1));
     216            0 :       Percent (value, Total);
     217            0 :       M2Printf_printf0 ((const char *) "\\n", 2);
     218            0 :       M2Printf_printf1 ((const char *) "Front end final                : %6d", 36, (const unsigned char *) &Count, (sizeof (Count)-1));
     219            0 :       Percent (Count, Total);
     220            0 :       M2Printf_printf0 ((const char *) "\\n", 2);
     221            0 :       Count = m2flex_GetTotalLines ();
     222            0 :       M2Printf_printf1 ((const char *) "Total source lines compiled    : %6d\\n", 38, (const unsigned char *) &Count, (sizeof (Count)-1));
     223            0 :       FIO_FlushBuffer (FIO_StdOut);
     224              :     }
     225        13652 :   M2Quads_DumpQuadruples ((const char *) "after all front end optimization\\n", 34);
     226        13652 : }
     227              : 
     228              : 
     229              : /*
     230              :    RemoveUnreachableCode -
     231              : */
     232              : 
     233        13940 : static void RemoveUnreachableCode (void)
     234              : {
     235        13940 :   if (M2Options_WholeProgram)
     236              :     {
     237           24 :       M2Batch_ForeachSourceModuleDo ((M2Batch_DoProcedure) {(M2Batch_DoProcedure_t) M2Optimize_RemoveProcedures});
     238              :     }
     239              :   else
     240              :     {
     241        13916 :       M2Optimize_RemoveProcedures (SymbolTable_GetMainModule ());
     242              :     }
     243        13940 : }
     244              : 
     245              : 
     246              : /*
     247              :    DoModuleDeclare - declare all constants, types, variables, procedures for the
     248              :                      main module or all modules.
     249              : */
     250              : 
     251        13940 : static void DoModuleDeclare (void)
     252              : {
     253        13940 :   if (M2Options_GetDumpDecl ())
     254              :     {
     255            0 :       M2LangDump_CreateDumpDecl ((const char *) "symbol resolver of filtered symbols\\n", 37);
     256            0 :       M2GCCDeclare_DumpFilteredResolver ();
     257              :     }
     258        13940 :   if (M2Options_WholeProgram)
     259              :     {
     260           24 :       M2Batch_ForeachSourceModuleDo ((M2Batch_DoProcedure) {(M2Batch_DoProcedure_t) M2GCCDeclare_StartDeclareScope});
     261              :     }
     262              :   else
     263              :     {
     264        13916 :       M2GCCDeclare_StartDeclareScope (SymbolTable_GetMainModule ());
     265              :     }
     266        13880 :   if (M2Options_GetDumpDecl ())
     267              :     {
     268            0 :       M2LangDump_CloseDumpDecl ();
     269            0 :       M2LangDump_CreateDumpDecl ((const char *) "definitive declaration of filtered symbols\\n", 44);
     270            0 :       M2GCCDeclare_DumpFilteredDefinitive ();
     271            0 :       M2LangDump_CloseDumpDecl ();
     272              :     }
     273        13880 : }
     274              : 
     275              : 
     276              : /*
     277              :    DoCodeBlock - generate code for the main module or all modules.
     278              : */
     279              : 
     280        13796 : static void DoCodeBlock (void)
     281              : {
     282        13796 :   DynamicStrings_String filename;
     283        13796 :   unsigned int len;
     284              : 
     285        13796 :   if (M2Options_GetDumpGimple ())
     286              :     {
     287            0 :       filename = M2LangDump_MakeGimpleTemplate (&len);
     288            0 :       m2pp_CreateDumpGimple (reinterpret_cast <void *> (filename), len);
     289            0 :       filename = DynamicStrings_KillString (filename);
     290            0 :       M2Code_CodeBlock (SymbolTable_GetMainModule ());
     291            0 :       m2pp_CloseDumpGimple ();
     292              :     }
     293              :   else
     294              :     {
     295        13796 :       M2Code_CodeBlock (SymbolTable_GetMainModule ());
     296              :     }
     297        13652 : }
     298              : 
     299              : 
     300              : /*
     301              :    DetermineSubExpTemporaries -
     302              : */
     303              : 
     304        13940 : static void DetermineSubExpTemporaries (void)
     305              : {
     306        13940 :   if (M2Options_WholeProgram)
     307              :     {
     308           24 :       M2Batch_ForeachSourceModuleDo ((M2Batch_DoProcedure) {(M2Batch_DoProcedure_t) M2SSA_DiscoverSSA});
     309              :     }
     310              :   else
     311              :     {
     312        13916 :       M2SSA_DiscoverSSA (SymbolTable_GetMainModule ());
     313              :     }
     314        13940 : }
     315              : 
     316       398425 : static void InitialDeclareAndOptimize (unsigned int scope, unsigned int start, unsigned int end)
     317              : {
     318              :   /* 
     319              :    InitialDeclareAndCodeBlock - declares all objects within scope,
     320              :   */
     321       398425 :   Count = M2Quads_CountQuads ();
     322       398425 :   M2BasicBlock_FreeBasicBlocks (M2BasicBlock_InitBasicBlocksFromRange (scope, start, end));
     323       398425 :   BasicB = Count-(M2Quads_CountQuads ());
     324       398425 :   Count = M2Quads_CountQuads ();
     325       398425 :   M2Optimize_FoldBranches (start, end);
     326       398425 :   Jump = Count-(M2Quads_CountQuads ());
     327       398425 :   Count = M2Quads_CountQuads ();
     328       398425 : }
     329              : 
     330       691929 : static void SecondDeclareAndOptimize (unsigned int scope, unsigned int start, unsigned int end)
     331              : {
     332       772733 :   M2BasicBlock_BasicBlock bb;
     333              : 
     334              :   /* 
     335              :    DeclareAndCodeBlock - declares all objects within scope,
     336              :   */
     337       772733 :   do {
     338       772733 :     bb = M2BasicBlock_InitBasicBlocksFromRange (scope, start, end);
     339       772733 :     M2BasicBlock_ForeachBasicBlockDo (bb, (M2BasicBlock_BasicBlockProc) {(M2BasicBlock_BasicBlockProc_t) M2GCCDeclare_FoldConstants});
     340       772601 :     M2BasicBlock_FreeBasicBlocks (bb);
     341       772601 :     DeltaConst = Count-(M2Quads_CountQuads ());
     342       772601 :     Count = M2Quads_CountQuads ();
     343       772601 :     M2BasicBlock_FreeBasicBlocks (M2BasicBlock_InitBasicBlocksFromRange (scope, start, end));
     344       772601 :     DeltaBasicB = Count-(M2Quads_CountQuads ());
     345       772601 :     Count = M2Quads_CountQuads ();
     346       772601 :     M2BasicBlock_FreeBasicBlocks (M2BasicBlock_InitBasicBlocksFromRange (scope, start, end));
     347       772601 :     M2Optimize_FoldBranches (start, end);
     348       772601 :     DeltaJump = Count-(M2Quads_CountQuads ());
     349       772601 :     Count = M2Quads_CountQuads ();
     350       772601 :     M2BasicBlock_FreeBasicBlocks (M2BasicBlock_InitBasicBlocksFromRange (scope, start, end));
     351       772601 :     DeltaBasicB += Count-(M2Quads_CountQuads ());
     352       772601 :     Count = M2Quads_CountQuads ();
     353              :     /* now total the optimization components  */
     354       772601 :     Proc += DeltaProc;
     355       772601 :     Const += DeltaConst;
     356       772601 :     Jump += DeltaJump;
     357       772601 :     BasicB += DeltaBasicB;
     358       772601 :   } while (! ((OptimTimes >= MaxOptimTimes) || ((((DeltaProc == 0) && (DeltaConst == 0)) && (DeltaJump == 0)) && (DeltaBasicB == 0))));
     359       691797 :   if ((((DeltaProc != 0) || (DeltaConst != 0)) || (DeltaJump != 0)) || (DeltaBasicB != 0))
     360              :     {
     361            0 :       M2Printf_printf0 ((const char *) "optimization finished although more reduction may be possible (increase MaxOptimTimes)\\n", 88);
     362              :     }
     363       691797 : }
     364              : 
     365              : 
     366              : /*
     367              :    InitOptimizeVariables -
     368              : */
     369              : 
     370       230345 : static void InitOptimizeVariables (void)
     371              : {
     372       230345 :   Count = M2Quads_CountQuads ();
     373       230345 :   OptimTimes = 0;
     374       230345 :   DeltaProc = 0;
     375       230345 :   DeltaConst = 0;
     376       230345 :   DeltaJump = 0;
     377       230345 :   DeltaBasicB = 0;
     378       230345 : }
     379              : 
     380              : 
     381              : /*
     382              :    Init -
     383              : */
     384              : 
     385        14952 : static void Init (void)
     386              : {
     387        14952 :   Proc = 0;
     388        14952 :   Const = 0;
     389        14952 :   Jump = 0;
     390        14952 :   BasicB = 0;
     391            0 : }
     392              : 
     393              : 
     394              : /*
     395              :    OptimizeScopeBlock -
     396              : */
     397              : 
     398       230345 : static void OptimizeScopeBlock (M2Scope_ScopeBlock sb)
     399              : {
     400       230345 :   unsigned int OptimTimes;
     401       230345 :   unsigned int Previous;
     402       230345 :   unsigned int Current;
     403              : 
     404       230345 :   InitOptimizeVariables ();
     405       230345 :   OptimTimes = 1;
     406       230345 :   Current = M2Quads_CountQuads ();
     407       230345 :   M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) InitialDeclareAndOptimize});
     408       230345 :   M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) M2SymInit_ScopeBlockVariableAnalysis});
     409       312292 :   do {
     410       312292 :     M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) SecondDeclareAndOptimize});
     411       312160 :     Previous = Current;
     412       312160 :     Current = M2Quads_CountQuads ();
     413       312160 :     OptimTimes += 1;
     414       312160 :   } while (! ((OptimTimes == MaxOptimTimes) || (Current == Previous)));
     415       230213 :   M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) M2Quads_LoopAnalysis});
     416       230213 : }
     417              : 
     418              : 
     419              : /*
     420              :    CodeProceduresWithinBlock - codes the procedures within the module scope.
     421              : */
     422              : 
     423          222 : static void CodeProceduresWithinBlock (unsigned int scope)
     424              : {
     425          222 :   SymbolTable_ForeachProcedureDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) M2Code_CodeBlock});
     426          222 : }
     427              : 
     428              : 
     429              : /*
     430              :    CodeProcedures -
     431              : */
     432              : 
     433          552 : static void CodeProcedures (unsigned int scope)
     434              : {
     435          552 :   if ((SymbolTable_IsDefImp (scope)) || (SymbolTable_IsModule (scope)))
     436              :     {
     437          552 :       SymbolTable_ForeachProcedureDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) M2Code_CodeBlock});
     438              :     }
     439          552 : }
     440              : 
     441              : 
     442              : /*
     443              :    Code - calls procedures to generates trees from the quadruples.
     444              :           All front end quadruple optimization is performed via this call.
     445              : */
     446              : 
     447        13940 : extern "C" void M2Code_Code (void)
     448              : {
     449        13940 :   M2Quads_DumpQuadruples ((const char *) "before any optimization\\n", 25);
     450        13940 :   SymbolTable_CheckHiddenTypeAreAddress ();
     451        13940 :   M2Pass_SetPassToNoPass ();
     452        13940 :   M2Quads_BackPatchSubrangesAndOptParam ();
     453        13940 :   Total = M2Quads_CountQuads ();
     454        13940 :   M2Quads_ForLoopAnalysis ();  /* must be done before any optimization as the index variable increment quad might change  */
     455        13940 :   M2Quads_DumpQuadruples ((const char *) "before declaring symbols to gcc\\n", 33);
     456              :   /* we know all the front end symbols must be resolved.  */
     457        13940 :   if (M2Options_StyleChecking)
     458              :     {
     459          613 :       M2Students_StudentVariableCheck ();
     460              :     }
     461        13940 :   M2Pass_SetPassToCodeGeneration ();
     462        13940 :   m2top_SetFlagUnitAtATime (M2Options_Optimizing);
     463        13940 :   m2top_StartGlobalContext ();
     464        13940 :   M2GCCDeclare_InitDeclarations ();  /* default and fixed sized types are all declared from now on.  */
     465        13940 :   RemoveUnreachableCode ();  /* default and fixed sized types are all declared from now on.  */
     466        13940 :   M2Quads_DumpQuadruples ((const char *) "after dead procedure elimination\\n", 34);
     467        13940 :   DetermineSubExpTemporaries ();
     468        13940 :   M2Quads_DumpQuadruples ((const char *) "after identifying simple subexpression temporaries\\n", 52);
     469        13940 :   M2Quiet_qprintf0 ((const char *) "        symbols to gcc trees\\n", 30);
     470        13940 :   DoModuleDeclare ();
     471        13880 :   M2Error_FlushWarnings ();
     472        13880 :   M2Error_FlushErrors ();
     473        13796 :   M2Quiet_qprintf0 ((const char *) "        statements to gcc trees\\n", 33);
     474        13796 :   DoCodeBlock ();
     475        13652 :   M2GCCDeclare_MarkExported (SymbolTable_GetMainModule ());
     476        13652 :   M2Swig_GenerateSwigFile (SymbolTable_GetMainModule ());
     477        13652 :   SymbolTable_DebugLineNumbers (SymbolTable_GetMainModule ());
     478        13652 :   M2Quiet_qprintf0 ((const char *) "        gcc trees given to the gcc backend\\n", 44);
     479        13652 :   m2top_EndGlobalContext ();
     480        13652 :   ResourceAnalysis ();
     481        13652 : }
     482              : 
     483              : 
     484              : /*
     485              :    CodeBlock - generates all code for this block and also declares
     486              :                all types and procedures for this block. It will
     487              :                also optimize quadruples within this scope.
     488              : */
     489              : 
     490       230345 : extern "C" void M2Code_CodeBlock (unsigned int scope)
     491              : {
     492       230345 :   M2Scope_ScopeBlock sb;
     493       230345 :   NameKey_Name n;
     494              : 
     495       230345 :   if (TraceQuadruples)
     496              :     {
     497              :       n = SymbolTable_GetSymName (scope);
     498              :       M2Printf_printf1 ((const char *) "before coding block %a\\n", 24, (const unsigned char *) &n, (sizeof (n)-1));
     499              :     }
     500       230345 :   sb = M2Scope_InitScopeBlock (scope);
     501       230345 :   OptimizeScopeBlock (sb);
     502       230213 :   if (SymbolTable_IsProcedure (scope))
     503              :     {
     504       216399 :       if (TraceQuadruples)
     505              :         {
     506              :           n = SymbolTable_GetSymName (scope);
     507              :           M2Printf_printf1 ((const char *) "before coding procedure %a\\n", 28, (const unsigned char *) &n, (sizeof (n)-1));
     508              :           M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) M2Quads_DisplayQuadRange});
     509              :           M2Printf_printf0 ((const char *) "===============\\n", 17);
     510              :         }
     511       216399 :       M2Scope_ForeachScopeBlockDo2 (sb, (M2Scope_ScopeProcedure2) {(M2Scope_ScopeProcedure2_t) M2GenGCC_ConvertQuadsToTree});
     512              :     }
     513        13814 :   else if (SymbolTable_IsModuleWithinProcedure (scope))
     514              :     {
     515              :       /* avoid dangling else.  */
     516          144 :       if (TraceQuadruples)
     517              :         {
     518              :           n = SymbolTable_GetSymName (scope);
     519              :           M2Printf_printf1 ((const char *) "before coding module %a within procedure\\n", 42, (const unsigned char *) &n, (sizeof (n)-1));
     520              :           M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) M2Quads_DisplayQuadRange});
     521              :           M2Printf_printf0 ((const char *) "===============\\n", 17);
     522              :         }
     523          144 :       M2Scope_ForeachScopeBlockDo2 (sb, (M2Scope_ScopeProcedure2) {(M2Scope_ScopeProcedure2_t) M2GenGCC_ConvertQuadsToTree});
     524          144 :       SymbolTable_ForeachProcedureDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) M2Code_CodeBlock});
     525              :     }
     526              :   else
     527              :     {
     528              :       /* avoid dangling else.  */
     529        13670 :       if (TraceQuadruples)
     530              :         {
     531              :           n = SymbolTable_GetSymName (scope);
     532              :           M2Printf_printf1 ((const char *) "before coding module %a\\n", 25, (const unsigned char *) &n, (sizeof (n)-1));
     533              :           M2Scope_ForeachScopeBlockDo3 (sb, (M2Scope_ScopeProcedure3) {(M2Scope_ScopeProcedure3_t) M2Quads_DisplayQuadRange});
     534              :           M2Printf_printf0 ((const char *) "===============\\n", 17);
     535              :         }
     536        13670 :       M2Scope_ForeachScopeBlockDo2 (sb, (M2Scope_ScopeProcedure2) {(M2Scope_ScopeProcedure2_t) M2GenGCC_ConvertQuadsToTree});
     537        13670 :       if (M2Options_WholeProgram)
     538              :         {
     539           24 :           M2Batch_ForeachSourceModuleDo ((M2Batch_DoProcedure) {(M2Batch_DoProcedure_t) CodeProcedures});
     540              :         }
     541              :       else
     542              :         {
     543        13646 :           SymbolTable_ForeachProcedureDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) M2Code_CodeBlock});
     544              :         }
     545        13652 :       SymbolTable_ForeachInnerModuleDo (scope, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) CodeProceduresWithinBlock});
     546              :     }
     547       230183 :   M2Scope_KillScopeBlock (&sb);
     548       230183 : }
     549              : 
     550        14952 : extern "C" void _M2_M2Code_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     551              : {
     552        14952 :   Init ();
     553        14952 : }
     554              : 
     555            0 : extern "C" void _M2_M2Code_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     556              : {
     557            0 : }
        

Generated by: LCOV version 2.4-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.