public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8290] modula2: tidyup gcc/m2/gm2-compiler/M2GenGCC.mod remove unused parameters/vars
@ 2024-01-19 17:18 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-01-19 17:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e04376b336502016456eaf4e90c3ea792c77c8df

commit r14-8290-ge04376b336502016456eaf4e90c3ea792c77c8df
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Fri Jan 19 17:16:38 2024 +0000

    modula2: tidyup gcc/m2/gm2-compiler/M2GenGCC.mod remove unused parameters/vars
    
    This patch removes unused parameters and local variables from
    M2GenGCC.mod.  It required ForeachScopeBlockDo2 to be implemented and
    exported affecting any module indirectly calling ConvertQuadsToTree.
    
    gcc/m2/ChangeLog:
    
            * gm2-compiler/M2BasicBlock.mod (InitBasicBlocks): Rename
            ForeachScopeBlockDo to ForeachScopeBlockDo3.
            * gm2-compiler/M2Code.mod: Import ForeachScopeBlockDo2.
            (OptimizeScopeBlock): Call ForeachScopeBlockDo3 for
            procedures with three parameters and ForeachScopeBlockDo2
            for two parameters.
            (CodeBlock): Ditto.
            * gm2-compiler/M2GCCDeclare.mod (DeclareTypesConstantsProcedures):
            Rename ForeachScopeBlockDo to ForeachScopeBlockDo3.
            * gm2-compiler/M2GenGCC.def (ConvertQuadsToTree): Remove Scope
            parameter.
            * gm2-compiler/M2GenGCC.mod (ConvertQuadsToTree): Remove Scope
            parameter.
            (MaybeDebugBuiltinMemcpy): Remove parameter tok.
            (MaybeDebugBuiltinMemset): Remove.
            (MakeCopyUse): Remove tokenno from call to
            MaybeDebugBuiltinMemcpy.
            (PerformFoldBecomes): Remove desloc and exprloc.
            (checkArrayElements): Remove location.  Remove virtpos
            as a parameter to MaybeDebugBuiltinMemcpy.
            (NoWalkProcedure): Add attribute unused.
            (CheckElementSetTypes): Remove parameter p.
            Remove CurrentQuadToken in call to MaybeDebugBuiltinMemcpy.
            Remove NoWalkProcedure from call to CheckElementSetTypes.
            Remove tokenno from call to MaybeDebugBuiltinMemcpy.
            * gm2-compiler/M2Optimize.mod (RemoveProcedures): Replace
            two parameter indirect procedure iterator with
            ForeachScopeBlockDo2.
            * gm2-compiler/M2SSA.mod: Remove ForeachScopeBlockDo.
            * gm2-compiler/M2Scope.def (ForeachScopeBlockDo2): New
            declaration.
            (ForeachScopeBlockDo): Rename ...
            (ForeachScopeBlockDo3): ... to this.
            (ScopeProcedure2): New declaration.
            * gm2-compiler/M2Scope.mod (ForeachScopeBlockDo2): New
            procedure.
            (ForeachScopeBlockDo): Rename ...
            (ForeachScopeBlockDo3): ... to this.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/gm2-compiler/M2BasicBlock.mod |  5 ++-
 gcc/m2/gm2-compiler/M2Code.mod       | 24 +++++++-------
 gcc/m2/gm2-compiler/M2GCCDeclare.mod |  4 +--
 gcc/m2/gm2-compiler/M2GenGCC.def     |  2 +-
 gcc/m2/gm2-compiler/M2GenGCC.mod     | 64 +++++++++++++-----------------------
 gcc/m2/gm2-compiler/M2Optimize.mod   | 12 +++----
 gcc/m2/gm2-compiler/M2SSA.mod        |  2 +-
 gcc/m2/gm2-compiler/M2Scope.def      | 21 +++++++-----
 gcc/m2/gm2-compiler/M2Scope.mod      | 40 ++++++++++++++++++++--
 9 files changed, 97 insertions(+), 77 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2BasicBlock.mod b/gcc/m2/gm2-compiler/M2BasicBlock.mod
index 007fe77f700..f4b9cb021c8 100644
--- a/gcc/m2/gm2-compiler/M2BasicBlock.mod
+++ b/gcc/m2/gm2-compiler/M2BasicBlock.mod
@@ -37,8 +37,7 @@ FROM M2Quads IMPORT IsReferenced, IsConditional, IsUnConditional, IsCall,
                     GetNextQuad, GetQuad, QuadOperator,
                     SubQuad, DisplayQuadRange ;
 
-FROM M2Scope IMPORT ScopeBlock, ForeachScopeBlockDo ;
-FROM M2GenGCC IMPORT ConvertQuadsToTree ;
+FROM M2Scope IMPORT ScopeBlock, ForeachScopeBlockDo3 ;
 
 
 CONST
@@ -68,7 +67,7 @@ VAR
 PROCEDURE InitBasicBlocks (sb: ScopeBlock) : BasicBlock ;
 BEGIN
    HeadOfBasicBlock := NIL ;
-   ForeachScopeBlockDo (sb, ConvertQuads2BasicBlock) ;
+   ForeachScopeBlockDo3 (sb, ConvertQuads2BasicBlock) ;
    RETURN HeadOfBasicBlock
 END InitBasicBlocks ;
 
diff --git a/gcc/m2/gm2-compiler/M2Code.mod b/gcc/m2/gm2-compiler/M2Code.mod
index 1c7ff83479f..010e1d02fca 100644
--- a/gcc/m2/gm2-compiler/M2Code.mod
+++ b/gcc/m2/gm2-compiler/M2Code.mod
@@ -61,7 +61,9 @@ FROM M2GCCDeclare IMPORT FoldConstants, StartDeclareScope,
                          DeclareProcedure, InitDeclarations,
                          DeclareModuleVariables, MarkExported ;
 
-FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
+FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock,
+                    ForeachScopeBlockDo2, ForeachScopeBlockDo3 ;
+
 FROM m2top IMPORT StartGlobalContext, EndGlobalContext, SetFlagUnitAtATime ;
 FROM M2Error IMPORT FlushErrors, FlushWarnings ;
 FROM M2Swig IMPORT GenerateSwigFile ;
@@ -402,15 +404,15 @@ BEGIN
    InitOptimizeVariables ;
    OptimTimes := 1 ;
    Current := CountQuads () ;
-   ForeachScopeBlockDo (sb, InitialDeclareAndOptimize) ;
-   ForeachScopeBlockDo (sb, ScopeBlockVariableAnalysis) ;
+   ForeachScopeBlockDo3 (sb, InitialDeclareAndOptimize) ;
+   ForeachScopeBlockDo3 (sb, ScopeBlockVariableAnalysis) ;
    REPEAT
-      ForeachScopeBlockDo (sb, SecondDeclareAndOptimize) ;
+      ForeachScopeBlockDo3 (sb, SecondDeclareAndOptimize) ;
       Previous := Current ;
       Current := CountQuads () ;
       INC (OptimTimes)
    UNTIL (OptimTimes=MaxOptimTimes) OR (Current=Previous) ;
-   ForeachScopeBlockDo (sb, LoopAnalysis)
+   ForeachScopeBlockDo3 (sb, LoopAnalysis)
 END OptimizeScopeBlock ;
 
 
@@ -476,30 +478,30 @@ BEGIN
       THEN
          n := GetSymName(scope) ;
          printf1('before coding procedure %a\n', n) ;
-         ForeachScopeBlockDo(sb, DisplayQuadRange) ;
+         ForeachScopeBlockDo3 (sb, DisplayQuadRange) ;
          printf0('===============\n')
       END ;
-      ForeachScopeBlockDo(sb, ConvertQuadsToTree)
+      ForeachScopeBlockDo2 (sb, ConvertQuadsToTree)
    ELSIF IsModuleWithinProcedure(scope)
    THEN
       IF DisplayQuadruples
       THEN
          n := GetSymName(scope) ;
          printf1('before coding module %a within procedure\n', n) ;
-         ForeachScopeBlockDo(sb, DisplayQuadRange) ;
+         ForeachScopeBlockDo3 (sb, DisplayQuadRange) ;
          printf0('===============\n')
       END ;
-      ForeachScopeBlockDo(sb, ConvertQuadsToTree) ;
+      ForeachScopeBlockDo2 (sb, ConvertQuadsToTree) ;
       ForeachProcedureDo(scope, CodeBlock)
    ELSE
       IF DisplayQuadruples
       THEN
          n := GetSymName(scope) ;
          printf1('before coding module %a\n', n) ;
-         ForeachScopeBlockDo(sb, DisplayQuadRange) ;
+         ForeachScopeBlockDo3 (sb, DisplayQuadRange) ;
          printf0('===============\n')
       END ;
-      ForeachScopeBlockDo(sb, ConvertQuadsToTree) ;
+      ForeachScopeBlockDo2 (sb, ConvertQuadsToTree) ;
       IF WholeProgram
       THEN
          ForeachSourceModuleDo(CodeProcedures)
diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod
index 594178f826d..643374db0a6 100644
--- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod
+++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod
@@ -144,7 +144,7 @@ FROM M2System IMPORT IsPseudoSystemFunction, IsSystemType,
 FROM M2Bitset IMPORT Bitset, Bitnum ;
 FROM SymbolConversion IMPORT AddModGcc, Mod2Gcc, GccKnowsAbout, Poison, RemoveMod2Gcc ;
 FROM M2GenGCC IMPORT ResolveConstantExpressions ;
-FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
+FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo3 ;
 
 FROM M2ALU IMPORT Addn, Sub, Equ, GreEqu, Gre, Less, PushInt, PushCard, ConvertToType,
                   PushIntegerTree, PopIntegerTree, PopRealTree, ConvertToInt, PopSetTree,
@@ -2865,7 +2865,7 @@ BEGIN
    PushBinding (scope) ;
    REPEAT
       copy := DupGroup (copy) ;
-      ForeachScopeBlockDo (sb, DeclareTypesConstantsProceduresInRange)
+      ForeachScopeBlockDo3 (sb, DeclareTypesConstantsProceduresInRange)
    UNTIL EqualGroup (copy, GlobalGroup) ;
    KillGroup (copy) ;
    PopBinding (scope) ;
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.def b/gcc/m2/gm2-compiler/M2GenGCC.def
index bb755a3f2f3..3e4705ec235 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.def
+++ b/gcc/m2/gm2-compiler/M2GenGCC.def
@@ -45,7 +45,7 @@ EXPORT QUALIFIED ConvertQuadsToTree, ResolveConstantExpressions,
                         the GCC tree structure.
 *)
 
-PROCEDURE ConvertQuadsToTree (Scope: CARDINAL; Start, End: CARDINAL) ;
+PROCEDURE ConvertQuadsToTree (Start, End: CARDINAL) ;
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 2261cb0348a..ced4724f4c0 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -415,7 +415,7 @@ END IsExportedGcc ;
                         the GCC tree structure.
 *)
 
-PROCEDURE ConvertQuadsToTree (Scope: CARDINAL; Start, End: CARDINAL) ;
+PROCEDURE ConvertQuadsToTree (Start, End: CARDINAL) ;
 BEGIN
    REPEAT
       CodeStatement (Start) ;
@@ -1311,7 +1311,9 @@ END GetSizeOfHighFromUnbounded ;
 
 
 (*
-   MaybeDebugBuiltinAlloca -
+   MaybeDebugBuiltinAlloca - if DebugBuiltins is set
+                             then call Builtins.alloca_trace
+                             else call Builtins.alloca.
 *)
 
 PROCEDURE MaybeDebugBuiltinAlloca (location: location_t; tok: CARDINAL; high: Tree) : Tree ;
@@ -1339,10 +1341,12 @@ END MaybeDebugBuiltinAlloca ;
 
 
 (*
-   MaybeDebugBuiltinMemcpy -
+   MaybeDebugBuiltinMemcpy - if DebugBuiltins is set
+                             then call memcpy
+                             else call Builtins.memcpy.
 *)
 
-PROCEDURE MaybeDebugBuiltinMemcpy (location: location_t; tok: CARDINAL; src, dest, nbytes: Tree) : Tree ;
+PROCEDURE MaybeDebugBuiltinMemcpy (location: location_t; src, dest, nbytes: Tree) : Tree ;
 VAR
    call,
    func: Tree ;
@@ -1359,28 +1363,6 @@ BEGIN
 END MaybeDebugBuiltinMemcpy ;
 
 
-(*
-   MaybeDebugBuiltinMemset -
-*)
-
-PROCEDURE MaybeDebugBuiltinMemset (location: location_t; tok: CARDINAL;
-                                   ptr, bytevalue, nbytes: Tree) : Tree ;
-VAR
-   call,
-   func: Tree ;
-BEGIN
-   IF DebugBuiltins
-   THEN
-      func := Mod2Gcc (Memset) ;
-      call := BuildCall3 (location, func, GetPointerType (), ptr, bytevalue, nbytes) ;
-   ELSE
-      call := BuiltinMemSet (location, ptr, bytevalue, nbytes)
-   END ;
-   SetLastFunction (call) ;
-   RETURN BuildFunctValue (location, call)
-END MaybeDebugBuiltinMemset ;
-
-
 (*
    MakeCopyUse - make a copy of the unbounded array and alter all references
                  from the old unbounded array to the new unbounded array.
@@ -1411,7 +1393,7 @@ BEGIN
    Addr := GetAddressOfUnbounded (location, param) ;
 
    NewArray := MaybeDebugBuiltinAlloca (location, tokenno, High) ;
-   NewArray := MaybeDebugBuiltinMemcpy (location, tokenno, NewArray, Addr, High) ;
+   NewArray := MaybeDebugBuiltinMemcpy (location, NewArray, Addr, High) ;
 
    (* now assign  param.Addr := ADR(NewArray) *)
 
@@ -2784,7 +2766,6 @@ VAR
    exprpos, becomespos,
    virtpos            : CARDINAL ;
    op                 : QuadOperator ;
-   desloc, exprloc    : location_t ;
 BEGIN
    GetQuadOtok (quad, becomespos, op,
                 des, op2, expr, overflowChecking,
@@ -3106,9 +3087,8 @@ END PrepareCopyString ;
 
 PROCEDURE checkArrayElements (des, expr: CARDINAL; virtpos, despos, exprpos: CARDINAL) : BOOLEAN ;
 VAR
-   e1, e3  : Tree ;
-   t1, t3  : CARDINAL ;
-   location: location_t ;
+   e1, e3: Tree ;
+   t1, t3: CARDINAL ;
 BEGIN
    t1 := GetType (des) ;
    t3 := GetType (expr) ;
@@ -3304,7 +3284,7 @@ BEGIN
                       expr, des)
       END ;
       AddStatement (location,
-                    MaybeDebugBuiltinMemcpy (location, virtpos,
+                    MaybeDebugBuiltinMemcpy (location,
                                              BuildAddr (location, Mod2Gcc (des), FALSE),
                                              BuildAddr (location, exprt, FALSE),
                                              length))
@@ -3319,7 +3299,7 @@ BEGIN
       THEN
          checkDeclare (des) ;
          AddStatement (location,
-                       MaybeDebugBuiltinMemcpy (location, virtpos,
+                       MaybeDebugBuiltinMemcpy (location,
                                                 BuildAddr(location, Mod2Gcc (des), FALSE),
                                                 BuildAddr(location, Mod2Gcc (expr), FALSE),
                                                 BuildSize(location, Mod2Gcc (des), FALSE)))
@@ -3624,7 +3604,7 @@ END CodeBinary ;
    NoWalkProcedure -
 *)
 
-PROCEDURE NoWalkProcedure (param: CARDINAL) ;
+PROCEDURE NoWalkProcedure (param: CARDINAL <* unused *>) ;
 BEGIN
 END NoWalkProcedure ;
 
@@ -3688,12 +3668,12 @@ END CheckBinaryExpressionTypes ;
 
 (*
    CheckElementSetTypes - returns TRUE if all expression checks pass.
-                                If the expression check fails quad is removed,
-                                the walk procedure (des) is called and NoChange is
-                                set to FALSE.
+                          If the expression check fails quad is removed,
+                          the walk procedure (des) is called and NoChange is
+                          set to FALSE.
 *)
 
-PROCEDURE CheckElementSetTypes (quad: CARDINAL; p: WalkAction) : BOOLEAN ;
+PROCEDURE CheckElementSetTypes (quad: CARDINAL) : BOOLEAN ;
 VAR
    lefttype,
    righttype,
@@ -6472,7 +6452,7 @@ BEGIN
             (* does not work t := BuildCoerce(Mod2Gcc(op1), Mod2Gcc(op2), Mod2Gcc(op3)) *)
             checkDeclare (op1) ;
             AddStatement (location,
-                          MaybeDebugBuiltinMemcpy(location, CurrentQuadToken,
+                          MaybeDebugBuiltinMemcpy(location,
                                                   BuildAddr(location, Mod2Gcc(op1), FALSE),
                                                   BuildAddr(location, Mod2Gcc(op3), FALSE),
                                                   FindSize(CurrentQuadToken, op2)))
@@ -7371,7 +7351,7 @@ BEGIN
    IF IsConst(op1) AND IsConst(op2)
    THEN
       InternalError ('should not get to here (if we do we should consider calling FoldIfIn)')
-   ELSIF CheckElementSetTypes (quad, NoWalkProcedure)
+   ELSIF CheckElementSetTypes (quad)
    THEN
       IF IsConst(op1)
       THEN
@@ -7438,7 +7418,7 @@ BEGIN
    IF IsConst(op1) AND IsConst(op2)
    THEN
       InternalError ('should not get to here (if we do we should consider calling FoldIfIn)')
-   ELSIF CheckElementSetTypes (quad, NoWalkProcedure)
+   ELSIF CheckElementSetTypes (quad)
    THEN
       IF IsConst(op1)
       THEN
@@ -7576,7 +7556,7 @@ BEGIN
                       op3, op1)
       END ;
       AddStatement (location,
-                    MaybeDebugBuiltinMemcpy (location, tokenno,
+                    MaybeDebugBuiltinMemcpy (location,
                                              Mod2Gcc (op1),
                                              BuildAddr (location, newstr, FALSE),
                                              length))
diff --git a/gcc/m2/gm2-compiler/M2Optimize.mod b/gcc/m2/gm2-compiler/M2Optimize.mod
index 1a653c00dd9..29fda9a6dd7 100644
--- a/gcc/m2/gm2-compiler/M2Optimize.mod
+++ b/gcc/m2/gm2-compiler/M2Optimize.mod
@@ -38,7 +38,8 @@ FROM NumberIO IMPORT WriteCard ;
 FROM M2Error IMPORT InternalError ;
 FROM M2Batch IMPORT GetModuleNo ;
 FROM M2Quiet IMPORT qprintf1 ;
-FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
+FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock,
+                    ForeachScopeBlockDo2, ForeachScopeBlockDo3 ;
 
 FROM SymbolTable IMPORT GetSymName,
                         GetProcedureQuads, GetModuleQuads,
@@ -336,13 +337,13 @@ BEGIN
    IF IsProcedure(scope)
    THEN
       PutProcedureReachable(scope) ;
-      ForeachScopeBlockDo(sb, KnownReachable)
+      ForeachScopeBlockDo2 (sb, KnownReachable)
    ELSIF IsModuleWithinProcedure(scope)
    THEN
-      ForeachScopeBlockDo(sb, KnownReachable) ;
+      ForeachScopeBlockDo2 (sb, KnownReachable) ;
       ForeachProcedureDo(scope, CheckExportedReachable)
    ELSE
-      ForeachScopeBlockDo(sb, KnownReachable) ;
+      ForeachScopeBlockDo2 (sb, KnownReachable) ;
       ForeachProcedureDo(scope, CheckExportedReachable)
    END ;
    ForeachInnerModuleDo(scope, RemoveProcedures) ;
@@ -351,8 +352,7 @@ BEGIN
 END RemoveProcedures ;
 
 
-PROCEDURE KnownReachable (Scope: CARDINAL;
-                          Start, End: CARDINAL) ;
+PROCEDURE KnownReachable (Start, End: CARDINAL) ;
 VAR
    Op           : QuadOperator ;
    Op1, Op2, Op3: CARDINAL ;
diff --git a/gcc/m2/gm2-compiler/M2SSA.mod b/gcc/m2/gm2-compiler/M2SSA.mod
index c984c629e38..e59428c4db6 100644
--- a/gcc/m2/gm2-compiler/M2SSA.mod
+++ b/gcc/m2/gm2-compiler/M2SSA.mod
@@ -31,7 +31,7 @@ FROM NumberIO IMPORT WriteCard ;
 FROM M2Error IMPORT InternalError ;
 FROM M2Batch IMPORT GetModuleNo ;
 FROM M2Quiet IMPORT qprintf1 ;
-FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
+FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock ;
 FROM M2StackWord IMPORT StackOfWord, InitStackWord, KillStackWord, PushWord, PopWord, PeepWord ;
 FROM M2Options IMPORT CompilerDebugging ;
 FROM Lists IMPORT InitList, KillList, List, IncludeItemIntoList, IsItemInList ;
diff --git a/gcc/m2/gm2-compiler/M2Scope.def b/gcc/m2/gm2-compiler/M2Scope.def
index bdb063dc89e..917229f887b 100644
--- a/gcc/m2/gm2-compiler/M2Scope.def
+++ b/gcc/m2/gm2-compiler/M2Scope.def
@@ -31,13 +31,10 @@ DEFINITION MODULE M2Scope ;
                  which were generated within a scope.
 *)
 
-EXPORT QUALIFIED ScopeBlock, ScopeProcedure,
-                 InitScopeBlock, KillScopeBlock,
-                 ForeachScopeBlockDo ;
-
 TYPE
    ScopeBlock ;
-   ScopeProcedure = PROCEDURE (CARDINAL, CARDINAL, CARDINAL) ;
+   ScopeProcedure2 = PROCEDURE (CARDINAL, CARDINAL) ;
+   ScopeProcedure3 = PROCEDURE (CARDINAL, CARDINAL, CARDINAL) ;
 
 
 (*
@@ -55,11 +52,19 @@ PROCEDURE KillScopeBlock (VAR sb: ScopeBlock) ;
 
 
 (*
-   ForeachScopeBlockDo - calls a procedure, p, for each block of contigeous quadruples
-                         defining an outer scope, sb.
+   ForeachScopeBlockDo2 - calls a procedure p for each block of contigeous quadruples
+                          defining an outer scope sb.
+*)
+
+PROCEDURE ForeachScopeBlockDo2 (sb: ScopeBlock; p: ScopeProcedure2) ;
+
+
+(*
+   ForeachScopeBlockDo3 - calls a procedure p for each block of contigeous quadruples
+                          defining an outer scope sb.
 *)
 
-PROCEDURE ForeachScopeBlockDo (sb: ScopeBlock; p: ScopeProcedure) ;
+PROCEDURE ForeachScopeBlockDo3 (sb: ScopeBlock; p: ScopeProcedure3) ;
 
 
 END M2Scope.
diff --git a/gcc/m2/gm2-compiler/M2Scope.mod b/gcc/m2/gm2-compiler/M2Scope.mod
index 570bb04e430..f157ad42ba6 100644
--- a/gcc/m2/gm2-compiler/M2Scope.mod
+++ b/gcc/m2/gm2-compiler/M2Scope.mod
@@ -410,10 +410,44 @@ END KillScopeBlock ;
 
 
 (*
-   ForeachScopeBlockDo -
+   ForeachScopeBlockDo2 - calls a procedure p for each block of contigeous quadruples
+                          defining an outer scope sb.
 *)
 
-PROCEDURE ForeachScopeBlockDo (sb: ScopeBlock; p: ScopeProcedure) ;
+PROCEDURE ForeachScopeBlockDo2 (sb: ScopeBlock; p: ScopeProcedure2) ;
+BEGIN
+   IF DisplayQuadruples
+   THEN
+      printf0 ("ForeachScopeBlockDo\n")
+   END ;
+   WHILE sb#NIL DO
+      WITH sb^ DO
+         IF DisplayQuadruples
+         THEN
+            DisplayScope (sb)
+         END ;
+         enter (sb) ;
+         IF (low # 0) AND (high # 0)
+         THEN
+            p (low, high)
+         END ;
+         leave (sb)
+      END ;
+      sb := sb^.next
+   END ;
+   IF DisplayQuadruples
+   THEN
+      printf0 ("end ForeachScopeBlockDo\n\n")
+   END ;
+END ForeachScopeBlockDo2 ;
+
+
+(*
+   ForeachScopeBlockDo3 - calls a procedure p for each block of contigeous quadruples
+                          defining an outer scope sb.
+*)
+
+PROCEDURE ForeachScopeBlockDo3 (sb: ScopeBlock; p: ScopeProcedure3) ;
 BEGIN
    IF DisplayQuadruples
    THEN
@@ -438,7 +472,7 @@ BEGIN
    THEN
       printf0 ("end ForeachScopeBlockDo\n\n")
    END ;
-END ForeachScopeBlockDo ;
+END ForeachScopeBlockDo3 ;
 
 
 (*

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-19 17:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 17:18 [gcc r14-8290] modula2: tidyup gcc/m2/gm2-compiler/M2GenGCC.mod remove unused parameters/vars Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).