From patchwork Tue Dec 6 14:47:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaius Mulley X-Patchwork-Id: 61578 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90BCB382E47C for ; Tue, 6 Dec 2022 14:49:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90BCB382E47C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670338169; bh=Ae0VR8u1hL8M9/C7xc8u9C8rl0f/mo1S3iSdAstSU/A=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=diuVxZGltuBP6cKH3XyzY5DjIIuge+oPUcWGLPMUw2wq1QohMImw+/lu7pH+E6Pko 4PLME71IRuGdFVwkaDHXCk4jTzKJ51U6SNWSrLyUhBvrydehQaFsvJv0n/rWYPGU5M y/sRnXpve3e0EePKvoTaeeDR+tFL05x3pFxisMP0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id E26A33875B73 for ; Tue, 6 Dec 2022 14:48:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E26A33875B73 Received: by mail-wr1-x436.google.com with SMTP id o5so23813358wrm.1 for ; Tue, 06 Dec 2022 06:48:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=date:message-id:to:subject:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ae0VR8u1hL8M9/C7xc8u9C8rl0f/mo1S3iSdAstSU/A=; b=5PFAPLeQo3zlKocpcRu0EbNmdqM3lc8g8P/h3JQ+uxmlB77zQPTWxoF6sjGgnLO0ij LA4a6p1O4wyl1Lgj5eLBAFcoNkbC+tehY6OxJi9DTOhNKwf8KR7l2zbrolgYTwdEQS9Q YPN2fq7uKChi7gMEO51OWXGrU96/KkLV2gi1RmuohhyGH/3hUtWpzqe+OmI9CrecY47s 62IMoKOAlIJdqdywvAXPuiR+6389RfO2pZzTQ4DBuJSvN2TSw82S2OH6TgRr4mMxKrG2 7Yk5R2pfkzUOB279IBGYcbotwPg06rFpUtzE7AaETIrmTUiF7lnsZfH9IYrbL6Eprbd2 lIww== X-Gm-Message-State: ANoB5pn+HLCp88jw3VN/6vjuIvbo7+mILi8Hb5M5JDF0GAB2319xASXq a2ewurWm9Vf2Y5pdxACVFkpU6PMWzYs= X-Google-Smtp-Source: AA0mqf4xXmzeuXl83KjxnZr6GpRNoODu11wT5vU7H9dtCLxnw/7BJfqVUmVVT3rmITIKLswpc/cSSQ== X-Received: by 2002:a05:6000:508:b0:242:34c1:1fd1 with SMTP id a8-20020a056000050800b0024234c11fd1mr14660370wrf.218.1670338079606; Tue, 06 Dec 2022 06:47:59 -0800 (PST) Received: from lancelot ([195.147.220.46]) by smtp.gmail.com with ESMTPSA id u2-20020adfdd42000000b0024242111a27sm13141590wrm.75.2022.12.06.06.47.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 06:47:59 -0800 (PST) X-Google-Original-From: Gaius Mulley Received: from gaius by lancelot with local (Exim 4.94.2) (envelope-from ) id 1p2ZEF-004Qfy-3L for gcc-patches@gcc.gnu.org; Tue, 06 Dec 2022 14:47:27 +0000 Subject: [PATCH v3 10/19] modula2 front end: gimple interface header files *.h and *.def To: X-Mailer: mail (GNU Mailutils 3.10) Message-Id: Date: Tue, 06 Dec 2022 14:47:27 +0000 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Gaius Mulley via Gcc-patches From: Gaius Mulley Reply-To: Gaius Mulley Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patchset contains the gimple interface. The header files {*.h} must match their modula2 counterparts {*.def}. ------8<----------8<----------8<----------8<----------8<----------8<---- diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/init.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/init.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,43 @@ +(* init.def provides procedures for initialising the m2 front end. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" init ; + +FROM SYSTEM IMPORT ADDRESS ; + + +(* + FrontEndInit - initialise the modules, this is a global initialisation. + This is called once. +*) + +PROCEDURE FrontEndInit ; + + +(* + PerCompilationInit - initialise the modules before compiling, filename. + This is to be called every time we compile a new file. +*) + +PROCEDURE PerCompilationInit (filename: ADDRESS) ; + + +END init. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2block.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2block.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,225 @@ +(* m2block.def definition module for m2block.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2block ; + + +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; +FROM SYSTEM IMPORT ADDRESS ; + + +(* + init - initialise the data structures in this module. +*) + +PROCEDURE init ; + + +(* + toplevel - return TRUE if we are in the global scope. +*) + +PROCEDURE toplevel () : BOOLEAN ; + + +(* + global_constant - t is a constant, we keep a chain of all constants + in the global binding level. +*) + +PROCEDURE global_constant (t: Tree) : Tree ; + + +(* + RememberInitModuleFunction - records tree, t, in the global binding level. + So that it will not be garbage collected. + In theory the inner modules could be placed + inside the current_binding_level I suspect. +*) + +PROCEDURE RememberInitModuleFunction (t: Tree) : Tree ; + + +(* + DumpGlobalConstants - displays all global constants and checks none are + poisoned. +*) + +PROCEDURE DumpGlobalConstants () : Tree ; + + +(* + RememberConstant - adds a tree, t, onto the list of constants to be marked + whenever the ggc re-marks all used storage. Constants + live throughout the whole compilation - and they + can be used by many different functions if necessary. +*) + +PROCEDURE RememberConstant (t: Tree) : Tree ; + + +(* + RememberType - remember the type, t, in the ggc marked list. +*) + +PROCEDURE RememberType (t: Tree) : Tree ; + + +(* + pushDecl - pushes a declaration onto the current binding level. +*) + +PROCEDURE pushDecl (decl: Tree) : Tree ; + + +(* + popGlobalScope - pops the current binding level, it expects this binding level + to be the global binding level. +*) + +PROCEDURE popGlobalScope ; + + +(* + pushGlobalScope - push the global scope onto the binding level stack. + There can only ever be one instance of the global binding + level on the stack. +*) + +PROCEDURE pushGlobalScope ; + + +(* + popFunctionScope - pops a binding level, returning the function associated with the + binding level. +*) + +PROCEDURE popFunctionScope () : Tree ; + + +(* + pushFunctionScope - push a binding level. +*) + +PROCEDURE pushFunctionScope (fndecl: Tree) ; + + +(* + finishFunctionCode - adds cur_stmt_list to fndecl. The current binding level + is then able to be destroyed by a call to popFunctionScope. + The cur_stmt_list is appended to the STATEMENT_LIST. +*) + +PROCEDURE finishFunctionCode (fndecl: Tree) ; + + +(* + finishFunctionDecl - removes declarations from the current binding level and places + them inside fndecl. The current binding level is then able to + be destroyed by a call to popFunctionScope. + + The extra tree nodes associated with fndecl will be created + such as BIND_EXPR, BLOCK and the initial STATEMENT_LIST + containing the DECL_EXPR is also created. +*) + +PROCEDURE finishFunctionDecl (location: location_t; fndecl: Tree) ; + + +(* + getLabel - return the label, name, or create a label, name + in the current scope. +*) + +PROCEDURE getLabel (location: location_t; name: ADDRESS) : Tree ; + + +(* + GetErrorNode - returns the gcc error_mark_node. +*) + +PROCEDURE GetErrorNode () : Tree ; + + +(* + includeDecl - pushes a declaration onto the current binding level providing + it is not already present. +*) + +PROCEDURE includeDecl (decl: Tree) ; + + +(* + GetGlobals - returns a list of global variables, functions, constants. +*) + +PROCEDURE GetGlobals () : Tree ; + + +(* + GetGlobalContext - returns the global context tree. +*) + +PROCEDURE GetGlobalContext () : Tree ; + + +(* + begin_statement_list - starts a tree statement. It pushes the + statement list and returns the list node. +*) + +PROCEDURE begin_statement_list () : Tree ; + + +(* + push_statement_list - pushes the statement list, t, onto the + current binding level. +*) + +PROCEDURE push_statement_list (t: Tree) : Tree ; + + +(* + pop_statement_list - pops and returns a statement list from the + current binding level. +*) + +PROCEDURE pop_statement_list () : Tree ; + + +(* + addStmtNote - remember this location represents the start of a Modula-2 + statement. It is flushed if another different location is + generated or another tree is given to add_stmt. +*) + +PROCEDURE addStmtNote (location: location_t) ; + + +(* + removeStmtNote - removes any pending stmt note. +*) + +PROCEDURE removeStmtNote ; + + +END m2block. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2builtins.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2builtins.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,121 @@ +(* m2builtins.def definition module for m2builtins.cc. + +Copyright (C) 2003-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2builtins ; + +FROM SYSTEM IMPORT ADDRESS ; +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + +EXPORT QUALIFIED GetBuiltinConst, GetBuiltinConstType, + GetBuiltinTypeInfoType, GetBuiltinTypeInfo, + BuiltinExists, BuildBuiltinTree, + BuiltInMemCopy, BuiltInAlloca, + BuiltInIsfinite ; + + +(* + GetBuiltinConst - returns the gcc tree of a built in constant, name. + NIL is returned if the constant is unknown. +*) + +PROCEDURE GetBuiltinConst (name: ADDRESS) : Tree ; + + +(* + GetBuiltinConstType - returns the type of a builtin constant, name. + + 0 = unknown constant name + 1 = integer + 2 = real +*) + +PROCEDURE GetBuiltinConstType (name: ADDRESS) : CARDINAL ; + + + +(* + GetBuiltinTypeInfoType - returns value: + 0 is ident is unknown. + 1 if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow, + exception, extend. + 2 if ident is radix, places, exponentmin, exponentmax, + noofmodes. + 3 if ident is large, small. +*) + +PROCEDURE GetBuiltinTypeInfoType (ident: ADDRESS) : CARDINAL ; + + +(* + GetBuiltinTypeInfo - returns a Tree value: + + NULL_TREE if ident is unknown. + boolean Tree if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow, + exception, extend. + ZType Tree if ident is radix, places, exponentmin, exponentmax, + noofmodes. + RType Tree if ident is large, small. +*) + +PROCEDURE GetBuiltinTypeInfo (location: location_t; type: Tree; ident: ADDRESS) : Tree ; + + +(* + BuiltinExists - returns TRUE if the builtin function, name, exists + for this target architecture. +*) + +PROCEDURE BuiltinExists (name: ADDRESS) : BOOLEAN ; + + +(* + BuildBuiltinTree - returns a Tree containing the builtin function, name. +*) + +PROCEDURE BuildBuiltinTree (location: location_t; name: ADDRESS) : Tree ; + + +(* + BuiltinMemCopy and BuiltinAlloca - are called by M2GenGCC to implement open arrays. +*) + +PROCEDURE BuiltInMemCopy (location: location_t; dest, src, n: Tree) : Tree ; + + +(* + BuiltInAlloca - given an expression, n, allocate, n, bytes on the stack for the life + of the current function. +*) + +PROCEDURE BuiltInAlloca (location: location_t; n: Tree) : Tree ; + + +(* + BuiltInIsfinite - given an expression, e, return an integer Tree of 1 if the + value is finite. Return an integer Tree 0 if the value is + not finite. +*) + +PROCEDURE BuiltInIsfinite (location: location_t; e: Tree) : Tree ; + + +END m2builtins. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2color.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2color.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,57 @@ +(* m2color.def interface to gcc colorization. + +Copyright (C) 2019-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE m2color ; + +FROM SYSTEM IMPORT ADDRESS ; + +TYPE + PtrToChar = POINTER TO CHAR ; + + +(* colorize_start returns a C string containing the color escape sequences + mapped onto, name. See diagnostic-color.c for the definitive + list of GCC colors. The name list includes: error, warning, + note, range1, range2, quote, locus, fixit-insert, fixit-delete, + diff-filename, diff-hunk, diff-delete, diff-insert, type-diff. *) + +PROCEDURE colorize_start (show_color: BOOLEAN; + name: ARRAY OF CHAR; name_len: CARDINAL) : PtrToChar ; + +(* colorize_stop return a C string containing the escape sequences to + stop text colorization. *) + +PROCEDURE colorize_stop (show_color: BOOLEAN) : PtrToChar ; + + +(* open_quote return a C string containing the open quote character which + might be a UTF-8 character if on a UTF-8 supporting host. *) + +PROCEDURE open_quote () : PtrToChar ; + + +(* close_quote return a C string containing the close quote character which + might be a UTF-8 character if on a UTF-8 supporting host. *) + +PROCEDURE close_quote () : PtrToChar ; + + +END m2color. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2configure.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2configure.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,44 @@ +(* m2configure.def exports configuration constants. + +Copyright (C) 2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2configure ; + +FROM SYSTEM IMPORT ADDRESS ; +EXPORT QUALIFIED UseUnderscoreForC, FullPathCPP ; + + +CONST +(* + UseUnderscoreForC - true if gcc places an underscore in front of global functions. +*) + UseUnderscoreForC = FALSE ; + + +(* + FullPathCPP - return a string to the full path of the C preprocessor cpp. + It checks the -B option (if provided) otherwise it uses + the STANDARD_LIBEXEC_PREFIX. +*) + +PROCEDURE FullPathCPP () : ADDRESS ; + + +END m2configure. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2convert.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2convert.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,98 @@ +(* m2convert.def definition module for m2convert.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2convert ; + +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + + +(* + ToWord - converts an expression (Integer or Ordinal type) into + a WORD. +*) + +PROCEDURE ToWord (location: location_t; expr: Tree) : Tree ; + + +(* + ToCardinal - convert an expression, expr, to a CARDINAL. +*) + +PROCEDURE ToCardinal (location: location_t; expr: Tree) : Tree ; + + +(* + ToInteger - convert an expression, expr, to an INTEGER. +*) + +PROCEDURE ToInteger (location: location_t; expr: Tree) : Tree ; + + +(* + ToBitset - convert an expression, expr, to a BITSET. +*) + +PROCEDURE ToBitset (location: location_t; expr: Tree) : Tree ; + + +(* + ConvertToPtr - convert an expression to a void *. +*) + +PROCEDURE ConvertToPtr (p: Tree) : Tree ; + + +(* + BuildConvert - build and return tree VAL(type, value) + checkOverflow determines whether we + should suppress overflow checking. +*) + +PROCEDURE BuildConvert (location: location_t; type: Tree; value: Tree; checkOverflow: BOOLEAN) : Tree ; + + +(* + ConvertConstantAndCheck - in Modula-2 sementics: return( VAL(type, expr) ) + Only to be used for a constant expr, + overflow checking is performed. +*) + +PROCEDURE ConvertConstantAndCheck (location: location_t; type: Tree; expr: Tree) : Tree ; + + +(* + ConvertString - converts string, expr, into a string of type, type. +*) + +PROCEDURE ConvertString (type, expr: Tree) : Tree ; + + +(* + GenericToType - converts, expr, into, type, providing that expr is + a generic system type (byte, word etc). Otherwise + expr is returned unaltered. +*) + +PROCEDURE GenericToType (location: location_t; type, expr: Tree) : Tree ; + + +END m2convert. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2decl.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2decl.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,203 @@ +(* m2decl.def definition module for m2decl.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE m2decl ; + +FROM SYSTEM IMPORT ADDRESS ; +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + + +(* + BuildModuleCtor creates the per module constructor used as part of + the dynamic linking scaffold. +*) + +PROCEDURE BuildModuleCtor (moduleCtor: Tree) ; + + +(* + DeclareModuleCtor configures the function to be used as a ctor. +*) + +PROCEDURE DeclareModuleCtor (decl: Tree) : Tree ; + + + +(* + +*) + +PROCEDURE DeclareM2linkForcedModuleInitOrder (location: location_t; + RuntimeOverride: ADDRESS) : Tree ; + + +PROCEDURE DeclareM2linkStaticInitialization (location: location_t; + ScaffoldStatic: INTEGER) : Tree ; + +PROCEDURE BuildPtrToTypeString (location: location_t; string: ADDRESS; type: Tree) : Tree ; + + +(* + GetBitsPerBitset - returns the number of bits in a BITSET. +*) + +PROCEDURE GetBitsPerBitset () : INTEGER ; + + +(* + GetBitsPerInt - returns the number of bits in a INTEGER. +*) + +PROCEDURE GetBitsPerInt () : INTEGER ; + + +(* + GetBitsPerUnit - returns the number of bits in a UNIT. +*) + +PROCEDURE GetBitsPerUnit () : INTEGER ; + + +(* + GetBitsPerWord - returns the number of bits in a WORD. +*) + +PROCEDURE GetBitsPerWord () : INTEGER ; + + +(* + BuildIntegerConstant - return a tree containing the integer value. +*) + +PROCEDURE BuildIntegerConstant (value: INTEGER) : Tree ; + + +(* + BuildStringConstantType - builds a string constant with a type. +*) + +PROCEDURE BuildStringConstantType (length: INTEGER; string: ADDRESS; type: Tree) : Tree ; + + +(* + DeclareKnownVariable - declares a variable in scope, + funcscope. Note that the global variable, + current_function_decl, is altered if + isglobal is TRUE. +*) + +PROCEDURE DeclareKnownVariable (location: location_t; name: ADDRESS; type: Tree; + exported, imported, istemporary, isglobal: BOOLEAN; + scope, initial: Tree) : Tree ; + + +(* + DeclareKnownConstant - given a constant, value, of, type, create a constant in the GCC + symbol table. Note that the name of the constant is not used + as _all_ constants are declared in the global scope. The front end + deals with scoping rules - here we declare all constants with no names + in the global scope. This allows M2SubExp and constant folding routines + the liberty of operating with quadruples which all assume constants can + always be referenced. +*) + +PROCEDURE DeclareKnownConstant (location: location_t; type: Tree; value: Tree) : Tree ; + + +(* + BuildParameterDeclaration - creates and returns one parameter from, name, and, type. + It appends this parameter to the internal param_type_list. + If name is nul then we assume we are creating a function + type declaration and we ignore names. +*) + +PROCEDURE BuildParameterDeclaration (location: location_t; name: ADDRESS; type: Tree; + isreference: BOOLEAN) : Tree ; + + +(* + BuildStartFunctionDeclaration - initializes global variables ready + for building a function. +*) + +PROCEDURE BuildStartFunctionDeclaration (uses_varargs: BOOLEAN) ; + + +(* + BuildEndFunctionDeclaration - build a function which will return a value of returntype. + The arguments have been created by BuildParameterDeclaration. +*) + +PROCEDURE BuildEndFunctionDeclaration (location_begin, location_end: location_t; + name: ADDRESS; returntype: Tree; + isexternal, isnested, ispublic: BOOLEAN) : Tree ; + + +(* + RememberVariables - +*) + +PROCEDURE RememberVariables (l: Tree) ; + + +(* + DetermineSizeOfConstant - given, str, and, base, fill in + needsLong and needsUnsigned appropriately. +*) + +PROCEDURE DetermineSizeOfConstant (location: location_t; + str: ADDRESS; base: CARDINAL; + VAR needsLong, needsUnsigned: BOOLEAN) ; + + +(* + BuildConstLiteralNumber - returns a GCC TREE built from the string, str. + It assumes that, str, represents a legal + number in Modula-2. It always returns a + positive value. +*) + +PROCEDURE BuildConstLiteralNumber (location: location_t; + str: ADDRESS; base: CARDINAL) : Tree ; + + +(* + BuildStringConstant - creates a string constant given a, string, + and, length. +*) + +PROCEDURE BuildStringConstant (string: ADDRESS; length: INTEGER) : Tree ; + + +(* + BuildCStringConstant - creates a string constant given a, string, + and, length. +*) + +PROCEDURE BuildCStringConstant (string: ADDRESS; length: INTEGER) : Tree ; + + + +PROCEDURE GetDeclContext (t: Tree) : Tree ; + + +END m2decl. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2except.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2except.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,79 @@ +(* m2except.def provides an interface to build exception trees. + +Copyright (C) 2008-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2except ; + +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + + +(* + InitExceptions - initialize this module, it declares the + external functions and assigns them to + the appropriate global tree variables. +*) + +PROCEDURE InitExceptions (location: location_t) ; + + +(* + BuildThrow - builds a throw statement and return the tree. +*) + +PROCEDURE BuildThrow (location: location_t; t: Tree) : Tree ; + + +(* + BuildTryBegin - returns a tree representing the 'try' block. +*) + +PROCEDURE BuildTryBegin (location: location_t) : Tree ; + + +(* + BuildTryEnd - builds the end of the Try block and prepares + for the catch handlers. +*) + +PROCEDURE BuildTryEnd (tryBlock: Tree) ; + + +(* + BuildCatchBegin - creates a handler tree for the C++ + statement 'catch (...) {'. + It returns the handler tree. +*) + +PROCEDURE BuildCatchBegin (location: location_t) : Tree ; + + +(* + BuildCatchEnd - completes a try catch block. + It returns the, try_block, tree. + It creates the C++ statement + + '}' which matches the catch above. +*) + +PROCEDURE BuildCatchEnd (location: location_t; handler, tryBlock: Tree) : Tree ; + + +END m2except. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2expr.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2expr.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,700 @@ +(* m2expr.def definition module for m2expr.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2expr ; + +FROM SYSTEM IMPORT ADDRESS ; +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + + +TYPE + BuildBinCheckProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree, Tree) : Tree ; + BuildBinProcedure = PROCEDURE (location_t, Tree, Tree, BOOLEAN) : Tree ; + BuildUnaryProcedure = PROCEDURE (location_t, Tree, BOOLEAN) : Tree ; + BuildUnaryCheckProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree) : Tree ; + BuildExprProcedure = PROCEDURE (location_t, Tree, Tree) : Tree ; + BuildSetProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree, BOOLEAN) ; + BuildUnarySetProcedure = PROCEDURE (location_t, Tree, BOOLEAN) ; + BuildUnarySetFunction = PROCEDURE (location_t, Tree, BOOLEAN) : Tree ; + + +(* + init - initialise this module. +*) + +PROCEDURE init (location: location_t) ; + + +(* + CompareTrees - returns -1 if e1 < e2, 0 if e1 == e2, and 1 if e1 > e2. +*) + +PROCEDURE CompareTrees (e1: Tree; e2: Tree) : INTEGER ; + + +PROCEDURE GetPointerOne (location: location_t) : Tree ; + + +PROCEDURE GetPointerZero (location: location_t) : Tree ; + + +PROCEDURE GetWordOne (location: location_t) : Tree ; + + +PROCEDURE GetWordZero (location: location_t) : Tree ; + + +PROCEDURE GetIntegerOne (location: location_t) : Tree ; + + +PROCEDURE GetIntegerZero (location: location_t) : Tree ; + + +PROCEDURE GetCardinalOne (location: location_t) : Tree ; + + +PROCEDURE GetCardinalZero (location: location_t) : Tree ; + + +PROCEDURE GetSizeOfInBits (type: Tree) : Tree ; + + +PROCEDURE GetSizeOf (location: location_t; type: Tree) : Tree ; + + +(* + BuildLogicalRotate - builds the ISO Modula-2 ROTATE operator + for a fundamental data type. +*) + +PROCEDURE BuildLogicalRotate (location: location_t; op1: Tree; op2: Tree; op3: Tree; nBits: Tree; needconvert: BOOLEAN) ; + + +(* + BuildLRRn - builds and returns tree (op1 rotate right by op2 bits) + it rotates a set of size, nBits. +*) + +PROCEDURE BuildLRRn (location: location_t; op1: Tree; op2: Tree; nBits: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLRLn - builds and returns tree (op1 rotate left by op2 bits) + it rotates a set of size, nBits. +*) + +PROCEDURE BuildLRLn (location: location_t; op1: Tree; op2: Tree; nBits: Tree; needconvert: BOOLEAN) : Tree ; + + + +PROCEDURE BuildMask (location: location_t; nBits: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildMult - builds a multiplication tree. +*) + +PROCEDURE BuildMult (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildMultCheck - builds a multiplication tree after checking for overflow. +*) + +PROCEDURE BuildMultCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildLRR - builds and returns tree (op1 rotate right by op2 bits) +*) + +PROCEDURE BuildLRR (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLRL - builds and returns tree (op1 rotate left by op2 bits) +*) + +PROCEDURE BuildLRL (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLogicalShift - builds the ISO Modula-2 SHIFT operator + for a fundamental data type. +*) + +PROCEDURE BuildLogicalShift (location: location_t; op1: Tree; op2: Tree; op3: Tree; nBits: Tree; needconvert: BOOLEAN) ; + + +(* + BuildLSR - builds and returns tree (op1 >> op2) +*) + +PROCEDURE BuildLSR (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLSL - builds and returns tree (op1 << op2) +*) + +PROCEDURE BuildLSL (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildDivM2 - build and return ((op2 < 0) : (op1 divtrunc op2) ? (op1 divfloor op2)) + when -fiso, -fpim4 or -fpositive-mod-floor-div is present else + return op1 div trunc op2 +*) + +PROCEDURE BuildDivM2 (location: location_t; op1, op2: Tree; needsconvert: BOOLEAN) : Tree ; + + +(* + BuildDivM2Check - build and return ((op2 < 0) : (op1 divtrunc op2) ? (op1 divfloor op2)) + when -fiso, -fpim4 or -fpositive-mod-floor-div is present else + return op1 div trunc op2. Use the checking div equivalents. +*) + +PROCEDURE BuildDivM2Check (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildModM2 - build and return ((op2 < 0) : (op1 divtrunc op2) ? (op1 divfloor op2)) + when -fiso, -fpim4 or -fpositive-mod-floor-div is present else + return op1 div trunc op2 +*) + +PROCEDURE BuildModM2 (location: location_t; op1, op2: Tree; needsconvert: BOOLEAN) : Tree ; + + +(* + BuildModM2Check - if iso or pim4 then build and return ((op2 < 0) : (op1 + modceil op2) ? (op1 modfloor op2)) otherwise use modtrunc. + Use the checking mod equivalents. + build and return ((op2 < 0) : (op1 divtrunc op2) ? (op1 divfloor op2)) + when -fiso, -fpim4 or -fpositive-mod-floor-div is present else + return op1 div trunc op2. Use the checking div equivalents. +*) + +PROCEDURE BuildModM2Check (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildModFloor - builds a modulus tree. +*) + +PROCEDURE BuildModFloor (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildDivCeil - builds a division tree. +*) + +PROCEDURE BuildDivCeil (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildModCeil - builds a modulus tree. +*) + +PROCEDURE BuildModCeil (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildDivFloor - builds a division tree. +*) + +PROCEDURE BuildDivFloor (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildModTrunc - builds a modulus tree. +*) + +PROCEDURE BuildModTrunc (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildDivTrunc - builds a division tree. +*) + +PROCEDURE BuildDivTrunc (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildDivTruncCheck - builds a division tree after checking for overflow. +*) + +PROCEDURE BuildDivTruncCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildRDiv - builds a division tree (this should only be used for REAL and COMPLEX + types and NEVER for integer based types). +*) + +PROCEDURE BuildRDiv (location: location_t; op1, op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildSubCheck - builds a subtraction tree after checking for overflow. +*) + +PROCEDURE BuildSubCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildAddCheck - builds an addition tree after checking for overflow. +*) + +PROCEDURE BuildAddCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ; + + +(* + BuildSub - builds a subtraction tree. +*) + +PROCEDURE BuildSub (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildAdd - builds an addition tree. +*) + +PROCEDURE BuildAdd (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + FoldAndStrip - return expression, t, after it has been folded (if possible). +*) + +PROCEDURE FoldAndStrip (t: Tree) : Tree ; + + +(* + StringLength - returns an unsigned int which is the length + of, string. +*) + +PROCEDURE StringLength (string: Tree) : CARDINAL ; + + +(* + TreeOverflow - returns TRUE if the contant expression, t, has + caused an overflow. No error message or warning + is emitted and no modification is made to, t. +*) + +PROCEDURE TreeOverflow (t: Tree) : BOOLEAN ; + + +(* + RemoveOverflow - if tree, t, is a constant expression it removes + any overflow flag and returns, t. +*) + +PROCEDURE RemoveOverflow (t: Tree) : Tree ; + + +(* + BuildCoerce - returns a tree containing the expression, expr, after + it has been coersed to, type. +*) + +PROCEDURE BuildCoerce (location: location_t; des: Tree; type: Tree; expr: Tree) : Tree ; + + +(* + BuildTrunc - returns an integer expression from a REAL or LONGREAL op1. +*) + +PROCEDURE BuildTrunc (op1: Tree) : Tree ; + + +(* + BuildNegate - builds a negate expression and returns the tree. +*) + +PROCEDURE BuildNegate (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildNegateCheck - builds a negate expression and returns the tree. +*) + +PROCEDURE BuildNegateCheck (location: location_t; arg, lowest, min, max: Tree) : Tree ; + + +(* + BuildSetNegate - builds a set negate expression and returns the tree. +*) + +PROCEDURE BuildSetNegate (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildTBitSize - returns the minimum number of bits to represent, type. +*) + +PROCEDURE BuildTBitSize (location: location_t; type: Tree) : Tree ; + + +(* + BuildSize - builds a SIZE function expression and returns the tree. +*) + +PROCEDURE BuildSize (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildAddr - builds an expression which calculates the address of + op1 and returns the tree. +*) + +PROCEDURE BuildAddr (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildOffset1 - builds an expression containing the number of bytes the field + is offset from the start of the record structure. + This function is the same as the above, except that it + derives the record from the field and then calls BuildOffset. + The expression is returned. +*) + +PROCEDURE BuildOffset1 (location: location_t; field: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildOffset - builds an expression containing the number of bytes the field + is offset from the start of the record structure. + The expression is returned. +*) + +PROCEDURE BuildOffset (location: location_t; record: Tree; field: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLogicalOrAddress - build a logical or expressions and return the tree. +*) + +PROCEDURE BuildLogicalOrAddress (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLogicalOr - build a logical or expressions and return the tree. +*) + +PROCEDURE BuildLogicalOr (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLogicalAnd - build a logical and expression and return the tree. +*) + +PROCEDURE BuildLogicalAnd (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + + +PROCEDURE BuildSymmetricDifference (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLogicalDifference - build a logical difference expression and + return the tree. + (op1 and (not op2)) +*) + +PROCEDURE BuildLogicalDifference (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ; + + +(* + BuildLessThan - return a tree which computes < +*) + +PROCEDURE BuildLessThan (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildGreaterThan - return a tree which computes > +*) + +PROCEDURE BuildGreaterThan (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildLessThanOrEqual - return a tree which computes < +*) + +PROCEDURE BuildLessThanOrEqual (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildGreaterThanOrEqual - return a tree which computes >= +*) + +PROCEDURE BuildGreaterThanOrEqual (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildEqualTo - return a tree which computes = +*) + +PROCEDURE BuildEqualTo (location: location_t; op1: Tree; op2: Tree) : Tree ; + + + +PROCEDURE BuildNotEqualTo (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildIsSuperset - return a tree which computes: op1 & op2 == op2 +*) + +PROCEDURE BuildIsSuperset (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildIsNotSuperset - return a tree which computes: op1 & op2 != op2 +*) + +PROCEDURE BuildIsNotSuperset (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildIsSubset - return a tree which computes: op1 & op2 == op1 +*) + +PROCEDURE BuildIsSubset (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildIsNotSubset - return a tree which computes: op1 & op2 != op1 +*) + +PROCEDURE BuildIsNotSubset (location: location_t; op1: Tree; op2: Tree) : Tree ; + + +(* + BuildIfConstInVar - generates: if constel in varset then goto label. +*) + +PROCEDURE BuildIfConstInVar (location: location_t; type: Tree; varset: Tree; constel: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: ADDRESS) ; + + + +PROCEDURE BuildIfNotConstInVar (location: location_t; type: Tree; varset: Tree; constel: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: ADDRESS) ; + + +(* + BuildIfVarInVar - generates: if varel in varset then goto label +*) + +PROCEDURE BuildIfVarInVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree; high: Tree; label: ADDRESS) ; + + +(* + BuildIfNotVarInVar - generates: if not (varel in varset) then goto label +*) + +PROCEDURE BuildIfNotVarInVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree; high: Tree; label: ADDRESS) ; + + +(* + BuildForeachWordInSetDoIfExpr - foreach word in set, type, compute the expression, expr, and if true + goto label. +*) + +PROCEDURE BuildForeachWordInSetDoIfExpr (location: location_t; + type, op1, op2: Tree; + is_op1lvalue, is_op2lvalue, + is_op1const, isop2const: BOOLEAN; + expr: BuildExprProcedure; label: ADDRESS) ; + + +(* + BuildIfInRangeGoto - if var is in the range low..high then goto label +*) + +PROCEDURE BuildIfInRangeGoto (location: location_t; var: Tree; low: Tree; high: Tree; label: ADDRESS) ; + + +(* + BuildIfNotInRangeGoto - if var is not in the range low..high then goto label +*) + +PROCEDURE BuildIfNotInRangeGoto (location: location_t; var: Tree; low: Tree; high: Tree; label: ADDRESS) ; + + +(* + BuildArray - returns a tree which accesses array[index] + given, lowIndice. +*) + +PROCEDURE BuildArray (location: location_t; type: Tree; array: Tree; index: Tree; lowIndice: Tree) : Tree ; + + +(* + BuildComponentRef - build a component reference tree which accesses record.field. + If field does not belong to record it calls + BuildComponentRef on the penultimate field. +*) + +PROCEDURE BuildComponentRef (location: location_t; record: Tree; field: Tree) : Tree ; + + +(* + BuildIndirect - build: ( *target) given that the object to be copied is of, type. +*) + +PROCEDURE BuildIndirect (location: location_t; target: Tree; type: Tree) : Tree ; + + +(* + IsTrue - returns TRUE if, t, is known to be TRUE. +*) + +PROCEDURE IsTrue (t: Tree) : BOOLEAN ; + + +(* + IsFalse - returns FALSE if, t, is known to be FALSE. +*) + +PROCEDURE IsFalse (t: Tree) : BOOLEAN ; + + +(* + AreConstantsEqual - maps onto tree.c (tree_int_cst_equal). It returns + TRUE if the value of e1 is the same as e2. +*) + +PROCEDURE AreConstantsEqual (e1: Tree; e2: Tree) : BOOLEAN ; + + +(* + AreRealOrComplexConstantsEqual - returns TRUE if constants, + e1 and e2 are equal according + to IEEE rules. This does not + perform bit equivalence for + example IEEE states that + -0 == 0 and NaN != NaN. +*) + +PROCEDURE AreRealOrComplexConstantsEqual (e1: Tree; e2: Tree) : BOOLEAN ; + + +(* + DetermineSign - returns -1 if e<0 + 0 if e==0 + 1 if e>0 + + an unsigned constant will never return -1 +*) + +PROCEDURE DetermineSign (e: Tree) : INTEGER ; + + +(* + BuildCap - builds the Modula-2 function CAP(t) and returns + the result in a gcc Tree. +*) + +PROCEDURE BuildCap (location: location_t; t: Tree) : Tree ; + + +(* + BuildAbs - builds the Modula-2 function ABS(t) and returns + the result in a gcc Tree. +*) + +PROCEDURE BuildAbs (location: location_t; t: Tree) : Tree ; + + +(* + BuildRe - builds an expression for the function RE. +*) + +PROCEDURE BuildRe (op1: Tree) : Tree ; + + +(* + BuildIm - builds an expression for the function IM. +*) + +PROCEDURE BuildIm (op1: Tree) : Tree ; + + +(* + BuildCmplx - builds an expression for the function CMPLX. +*) + +PROCEDURE BuildCmplx (location: location_t; type: Tree; real: Tree; imag: Tree) : Tree ; + + +(* + BuildBinaryForeachWordDo - provides the large set operators. Each word + (or less) of the set can be calculated by binop. + This procedure runs along each word of the + large set invoking the binop. +*) + +PROCEDURE BuildBinaryForeachWordDo (location: location_t; + type, op1, op2, op3: Tree; + binop: BuildBinProcedure; + is_op1lvalue, + is_op2lvalue, + is_op3lvalue, + is_op1_const, + is_op2_const, + is_op3_const: BOOLEAN) ; + +(* + BuildBinarySetDo - if the size of the set is <= TSIZE(WORD) then + op1 := binop(op2, op3) + else + call m2rtsprocedure(op1, op2, op3) +*) + +PROCEDURE BuildBinarySetDo (location: location_t; + settype, op1, op2, op3: Tree; + binop: BuildSetProcedure; + is_op1lvalue, is_op2lvalue, is_op3lvalue: BOOLEAN; + nBits, unbounded: Tree; + varproc, leftproc, rightproc: Tree) ; + +(* + ConstantExpressionWarning - issue a warning if the constant has overflowed. +*) + +PROCEDURE ConstantExpressionWarning (value: Tree) ; + + +(* + BuildAddAddress - returns an expression op1+op2 where op1 is a pointer type + and op2 is not a pointer type. +*) + +PROCEDURE BuildAddAddress (location: location_t; op1, op2: Tree) : Tree ; + + +END m2expr. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2linemap.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2linemap.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,61 @@ +(* m2linemap.def provides access to GCC location_t. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2linemap ; + +FROM SYSTEM IMPORT ADDRESS ; + +EXPORT QUALIFIED StartFile, EndFile, StartLine, GetLocationColumn, GetLocationRange, + GetLocationBinary, UnknownLocation, BuiltinsLocation, + GetLineNoFromLocation, GetColumnNoFromLocation, + GetFilenameFromLocation, ErrorAt, ErrorAtf, + WarningAtf, NoteAtf, internal_error, location_t ; + +TYPE + location_t = INTEGER ; + + +PROCEDURE StartFile (filename: ADDRESS; linebegin: CARDINAL) ; +PROCEDURE EndFile ; +PROCEDURE StartLine (linenumber: CARDINAL; linesize: CARDINAL) ; +PROCEDURE GetLocationColumn (column: CARDINAL) : location_t ; +PROCEDURE GetLocationRange (start, end: CARDINAL) : location_t ; +PROCEDURE GetLocationBinary (caret, left, right: location_t) : location_t ; + +PROCEDURE UnknownLocation () : location_t ; +PROCEDURE BuiltinsLocation () : location_t ; + +PROCEDURE GetLineNoFromLocation (location: location_t) : INTEGER ; +PROCEDURE GetColumnNoFromLocation (location: location_t) : INTEGER ; +PROCEDURE GetFilenameFromLocation (location: location_t) : ADDRESS ; +PROCEDURE ErrorAt (location: location_t; message: ADDRESS) ; +(* +PROCEDURE ErrorAtf (location: location_t; message: ADDRESS; ...) ; +PROCEDURE WarningAtf (location: location_t; message: ADDRESS; ...) ; +PROCEDURE NoteAtf (location: location_t; message: ADDRESS; ...) ; +*) +PROCEDURE ErrorAtf (location: location_t; message: ADDRESS) ; +PROCEDURE WarningAtf (location: location_t; message: ADDRESS) ; +PROCEDURE NoteAtf (location: location_t; message: ADDRESS) ; +PROCEDURE internal_error (message: ADDRESS) ; + + +END m2linemap. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2misc.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2misc.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,29 @@ +(* m2misc.def definition module for m2misc.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2misc ; + +FROM m2tree IMPORT Tree ; + +PROCEDURE DebugTree (t: Tree) ; + + +END m2misc. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2statement.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2statement.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,312 @@ +(* m2statement.def definition module for m2statement.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2statement ; + + +FROM SYSTEM IMPORT ADDRESS ; +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; +FROM m2expr IMPORT BuildUnarySetFunction ; + + +(* + DoJump - jump to the appropriate label depending whether + result of the expression is TRUE or FALSE. +*) + +PROCEDURE DoJump (location: location_t; exp: Tree; falselabel: ADDRESS; truelabel: ADDRESS) ; + + +(* + BuildStartFunctionCode - generate function entry code. +*) + +PROCEDURE BuildStartFunctionCode (location: location_t; fndecl: Tree; isexported: BOOLEAN; isinline: BOOLEAN) ; + + +(* + BuildEndFunctionCode - generates the function epilogue. +*) + +PROCEDURE BuildEndFunctionCode (location: location_t; fndecl: Tree; nested: BOOLEAN) ; + + +(* + BuildReturnValueCode - generates the code associated with: RETURN( value ) +*) + +PROCEDURE BuildReturnValueCode (location: location_t; fndecl: Tree; value: Tree) ; + + +(* + BuildPushFunctionContext - pushes the current function context. + Maps onto push_function_context in ../function.c +*) + +PROCEDURE BuildPushFunctionContext ; + + +(* + BuildPopFunctionContext - pops the current function context. + Maps onto pop_function_context in ../function.c +*) + +PROCEDURE BuildPopFunctionContext ; + + +(* + BuildAssignmentTree - builds the assignment of, des, and, expr. + It returns, des. +*) + +PROCEDURE BuildAssignmentTree (location: location_t; des, expr: Tree) : Tree ; + + +(* + BuildAssignmentStatement builds the assignment of, des, and, expr. +*) + +PROCEDURE BuildAssignmentStatement (location: location_t; des, expr: Tree) ; + + +(* + BuildGoto - builds a goto operation. +*) + +PROCEDURE BuildGoto (location: location_t; name: ADDRESS) ; + + +(* + DeclareLabel - create a label, name. +*) + +PROCEDURE DeclareLabel (location: location_t; name: ADDRESS) ; + + +(* + BuildIfThenDoEnd - returns a tree which will only execute + statement, s, if, condition, is true. +*) + +PROCEDURE BuildIfThenDoEnd (condition: Tree; then_block: Tree) : Tree ; + + +(* + BuildIfThenElseEnd - returns a tree which will execute + then_block or else_block depending upon, + condition. +*) + +PROCEDURE BuildIfThenElseEnd (condition: Tree; then_block: Tree; else_block: Tree) : Tree ; + + +(* + BuildParam - build a list of parameters, ready for a subsequent procedure call. +*) + +PROCEDURE BuildParam (location: location_t; param: Tree) ; + + +(* + BuildFunctionCallTree - creates a procedure function call from + a procedure and parameter list and the + return type, rettype. No tree is returned + as the tree is held in the last_function + global variable. It is expected the + BuildFunctValue is to be called after + a call to BuildFunctionCallTree. +*) + +PROCEDURE BuildFunctionCallTree (location: location_t; procedure: Tree; rettype: Tree) ; + + +(* + BuildProcedureCallTree - creates a procedure call from a procedure and + parameter list and the return type, rettype. +*) + +PROCEDURE BuildProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ; + + +(* + BuildIndirectProcedureCallTree - creates a procedure call from a procedure and + parameter list and the return type, rettype. +*) + +PROCEDURE BuildIndirectProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ; + + +(* + BuildFunctValue - generates code for value := last_function(foobar); +*) + +PROCEDURE BuildFunctValue (location: location_t; value: Tree) : Tree ; + + +(* + BuildCall2 - builds a tree representing: function(arg1, arg2). +*) + +PROCEDURE BuildCall2 (location: location_t; + function, rettype, arg1, arg2: Tree) : Tree ; + + +(* + BuildCall3 - builds a tree representing: function(arg1, arg2, arg3). +*) + +PROCEDURE BuildCall3 (location: location_t; + function, rettype, arg1, arg2, arg3: Tree) : Tree ; + + +(* + SetLastFunction - set the last_function to, t. +*) + +PROCEDURE SetLastFunction (t: Tree) ; + + +(* + GetLastFunction - returns, last_function. +*) + +PROCEDURE GetLastFunction () : Tree ; + + +(* + GetParamTree - return parameter, i. +*) + +PROCEDURE GetParamTree (call: Tree; i: CARDINAL) : Tree ; + + +(* + BuildTryFinally - returns a TRY_FINALL_EXPR with the call and cleanups + attached. +*) + +PROCEDURE BuildTryFinally (location: location_t; call: Tree; cleanups: Tree) : Tree ; + + +(* + BuildCleanUp - return a CLEANUP_POINT_EXPR which will clobber, param. +*) + +PROCEDURE BuildCleanUp (param: Tree) : Tree ; + + +(* + BuildAsm - generates an inline assembler instruction. +*) + +PROCEDURE BuildAsm (location: location_t; instr: Tree; + isVolatile: BOOLEAN; isSimple: BOOLEAN; + inputs: Tree; outputs: Tree; trash: Tree; labels: Tree) ; + + +(* + BuildUnaryForeachWordDo - provides the large set operators. + Each word (or less) of the set can be + calculated by unop. + This procedure iterates over each word + of the large set invoking the unop. +*) + +PROCEDURE BuildUnaryForeachWordDo (location: location_t; type: Tree; op1: Tree; op2: Tree; + unop: BuildUnarySetFunction; + is_op1lvalue, is_op2lvalue, is_op1const, is_op2const: BOOLEAN) ; + + +(* + BuildExcludeVarConst - builds the EXCL(op1, 1<. + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2top ; + + +(* + SetFlagUnitAtATime - sets GCC flag_unit_at_a_time to b. +*) + +PROCEDURE SetFlagUnitAtATime (b: BOOLEAN) ; + + +(* + StartGlobalContext - initializes a dummy function for the global scope. +*) + +PROCEDURE StartGlobalContext ; + + +(* + EndGlobalContext - ends the dummy function for the global scope. +*) + +PROCEDURE EndGlobalContext ; + + +END m2top. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2tree.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2tree.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,41 @@ +(* m2tree.def definition module for m2tree.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2tree ; + +FROM SYSTEM IMPORT ADDRESS ; + +TYPE + Tree = ADDRESS ; + + +PROCEDURE IsAConstant (t: Tree) : BOOLEAN ; +PROCEDURE IsOrdinal (type: Tree) : BOOLEAN ; +PROCEDURE IsTreeOverflow (value: Tree) : BOOLEAN ; +PROCEDURE skip_const_decl (exp: Tree) : Tree ; +PROCEDURE skip_type_decl (type: Tree) : Tree ; +PROCEDURE is_type (type: Tree) : BOOLEAN ; +PROCEDURE is_array (array: Tree) : BOOLEAN ; +PROCEDURE is_var (var: Tree) : BOOLEAN ; +PROCEDURE debug_tree (t: Tree) ; + + +END m2tree. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2treelib.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2treelib.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,109 @@ +(* m2treelib.def definition module for m2treelib.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2treelib ; + +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; +FROM SYSTEM IMPORT ADDRESS ; + +TYPE + tree_code = INTEGER ; + + +(* + get_set_address_if_var - returns the address of, op, providing + it is not a constant. + NULL is returned if, op, is a constant. +*) + +PROCEDURE get_set_address_if_var (location: location_t; op: Tree; is_lvalue: INTEGER; is_const: INTEGER) : Tree ; + + +(* + get_set_field_rhs - returns the value of p->field. +*) + +PROCEDURE get_set_field_rhs (location: location_t; p: Tree; field: Tree) : Tree ; + + +(* + get_set_field_lhs - returns the address of p->field. +*) + +PROCEDURE get_set_field_lhs (location: location_t; p: Tree; field: Tree) : Tree ; + + +(* + get_set_address - returns the address of op1. +*) + +PROCEDURE get_set_address (location: location_t; op1: Tree; is_lvalue: INTEGER) : Tree ; + + +(* + get_set_value - returns the value indicated by, field, in the set. + Either p->field or the constant(op.fieldNo) is returned. +*) + +PROCEDURE get_set_value (location: location_t; p: Tree; field: Tree; is_const: INTEGER; op: Tree; fieldNo: CARDINAL) : Tree ; + + +(* + get_field_no - returns the field no for, op. The, op, is either + a constructor or a variable of type record. + If, op, is a constructor (a set constant in GNU Modula-2) + then this function is essentially a no-op and it returns op. + Else we iterate over the field list and return the + appropriate field number. +*) + +PROCEDURE get_field_no (type: Tree; op: Tree; is_const: INTEGER; fieldNo: CARDINAL) : Tree ; + + +(* + get_rvalue - returns the rvalue of t. The, type, is the object type to be + copied upon indirection. +*) + +PROCEDURE get_rvalue (location: location_t; t: Tree; type: Tree; is_lvalue: INTEGER) : Tree ; + + +(* + DoCall - build a call tree arranging the parameter list as a vector. +*) + +PROCEDURE DoCall (location: location_t; rettype: Tree; funcptr: Tree; param_list: Tree) : Tree ; + + + +PROCEDURE build_modify_expr (location: location_t; des: Tree; modifycode: tree_code; copy: Tree) : Tree ; + + +(* + do_jump_if_bit - tests bit in word against integer zero using operator, code. + If the result is true then jump to label. +*) + +PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: Tree; bit: Tree; label: ADDRESS) ; + + +END m2treelib. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2type.def --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2type.def 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,986 @@ +(* m2type.def definition module for m2type.cc. + +Copyright (C) 2011-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. *) + +DEFINITION MODULE FOR "C" m2type ; + +FROM SYSTEM IMPORT ADDRESS ; +FROM m2tree IMPORT Tree ; +FROM m2linemap IMPORT location_t ; + + +TYPE + Constructor = ADDRESS ; + + +(* + ValueInTypeRange - returns TRUE if the constant, value, lies in the range + of, type. +*) + +PROCEDURE ValueInTypeRange (type: Tree; value: Tree) : BOOLEAN ; + + +(* + ValueOutOfTypeRange - returns TRUE if the constant, value, exceed the range + of, type. +*) + +PROCEDURE ValueOutOfTypeRange (type: Tree; value: Tree) : BOOLEAN ; + + +(* + ExceedsTypeRange - return TRUE if low or high exceed the range of, type. +*) + +PROCEDURE ExceedsTypeRange (type: Tree; low, high: Tree) : BOOLEAN ; + + +(* + WithinTypeRange - return TRUE if low and high are within the range of, type. +*) + +PROCEDURE WithinTypeRange (type: Tree; low, high: Tree) : BOOLEAN ; + + +(* + BuildSubrangeType - creates a subrange of, type, with, lowval, highval. +*) + +PROCEDURE BuildSubrangeType (location: location_t; name: ADDRESS; type: Tree; lowval: Tree; highval: Tree) : Tree ; + + +(* + BuildCharConstant - creates a character constant given a, string. +*) + +PROCEDURE BuildCharConstant (location: location_t; string: ADDRESS) : Tree ; + + +(* + BuildCharConstantChar - creates a character constant given a character, ch. +*) + +PROCEDURE BuildCharConstantChar (location: location_t; ch: CHAR) : Tree ; + + +(* + BuildArrayConstructorElement - adds, value, to the constructor_element_list. +*) + +PROCEDURE BuildArrayConstructorElement (p: ADDRESS; value: Tree; indice: Tree) ; + + +(* + BuildEndArrayConstructor - returns a tree containing the array + compound literal. +*) + +PROCEDURE BuildEndArrayConstructor (p: Constructor) : Tree ; + + +(* + BuildEndArrayConstructor - returns a tree containing the array + compound literal. +*) + +PROCEDURE BuildStartArrayConstructor (type: Tree) : Constructor ; + + +(* + BuildRecordConstructorElement - adds, value, to the constructor_element_list. +*) + +PROCEDURE BuildRecordConstructorElement (p: Constructor; value: Tree) ; + + +(* + BuildEndRecordConstructor - returns a tree containing the record compound literal. +*) + +PROCEDURE BuildEndRecordConstructor (p: Constructor) : Tree ; + + +(* + BuildStartRecordConstructor - initializes a record compound + constructor frame. +*) + +PROCEDURE BuildStartRecordConstructor (type: Tree) : Constructor ; + + +(* + BuildEndSetConstructor - finishes building a set constant. +*) + +PROCEDURE BuildEndSetConstructor (p: Constructor) : Tree ; + + +(* + BuildSetConstructorElement - adds, value, to the constructor_element_list. +*) + +PROCEDURE BuildSetConstructorElement (p: Constructor; value: Tree) ; + + +(* + BuildStartSetConstructor - starts to create a set constant. + Remember that type is really a record type. +*) + +PROCEDURE BuildStartSetConstructor (type: Tree) : Constructor ; + + +(* + BuildSetType - creates a SET OF [lowval..highval] +*) + +PROCEDURE BuildSetType (location: location_t; name: ADDRESS; type: Tree; lowval: Tree; highval: Tree; ispacked: BOOLEAN) : Tree ; + + +(* + BuildConstPointerType - returns a type which is a const pointer to, totype. +*) + +PROCEDURE BuildConstPointerType (totype: Tree) : Tree ; + + +(* + BuildPointerType - returns a type which is a pointer to, totype. +*) + +PROCEDURE BuildPointerType (totype: Tree) : Tree ; + + +(* + BuildEnumerator - build an enumerator and add it to the, enumvalues, list. + It returns a copy of the value. --fixme-- why do this? +*) + +PROCEDURE BuildEnumerator (location: location_t; name: ADDRESS; value: Tree; + VAR enumvalues: Tree) : Tree ; + + +(* + BuildEndEnumeration - finish building the enumeration, it uses the enum + list, enumvalues, and returns a enumeration type tree. +*) + +PROCEDURE BuildEndEnumeration (location: location_t; type: Tree; enumvalues: Tree) : Tree ; + + +(* + BuildStartEnumeration - create an enumerated type in gcc. +*) + +PROCEDURE BuildStartEnumeration (location: location_t; name: ADDRESS; ispacked: BOOLEAN) : Tree ; + + +(* + BuildTypeDeclaration - adds the, type, to the current statement list. +*) + +PROCEDURE BuildTypeDeclaration (location: location_t; type: Tree) ; + + +(* + GetMaxFrom - given a, type, return a constant representing the maximum + legal value. +*) + +PROCEDURE GetMaxFrom (location: location_t; type: Tree) : Tree ; + + +(* + GetMinFrom - given a, type, return a constant representing the minimum + legal value. +*) + +PROCEDURE GetMinFrom (location: location_t; type: Tree) : Tree ; + + +(* + GetDefaultType - given a, type, with a, name, return a GCC declaration of this type. + Checks to see whether the type name has already been declared as a + default type and if so it returns this declaration. Otherwise it + declares the type. In Modula-2 this is equivalent to: + + TYPE + name = type ; + + We need this function as the initialization to gccgm2.c will + declare C default types and _some_ M2 default types. +*) + +PROCEDURE GetDefaultType (location: location_t; name: ADDRESS; type: Tree) : Tree ; + + +(* + BuildEndType - finish declaring, type, and return, type. +*) + +PROCEDURE BuildEndType (location: location_t; type: Tree) : Tree ; + + +(* + BuildStartType - given a, type, with a, name, return a GCC declaration of this type. + TYPE + name = foo ; + + the type, foo, maybe a partially created type (which has + yet to be 'gm2_finish_decl'ed. +*) + +PROCEDURE BuildStartType (location: location_t; name: ADDRESS; type: Tree) : Tree ; + + +(* + InitSystemTypes - +*) + +PROCEDURE InitSystemTypes (location: location_t; loc: INTEGER) ; + + +(* + InitBaseTypes - +*) + +PROCEDURE InitBaseTypes (location: location_t) ; + + +(* + BuildVariableArrayAndDeclare - creates a variable length array. + high is the maximum legal elements (which is a runtime variable). + This creates and array index, array type and local variable. +*) + +PROCEDURE BuildVariableArrayAndDeclare (location: location_t; elementtype: Tree; high: Tree; name: ADDRESS; scope: Tree) : Tree ; + + +(* + InitFunctionTypeParameters - resets the current function type parameter list. +*) + +PROCEDURE InitFunctionTypeParameters ; + + +(* + BuildProcTypeParameterDeclaration - creates and returns one parameter from, name, and, type. + It appends this parameter to the internal param_type_list. +*) + +PROCEDURE BuildProcTypeParameterDeclaration (location: location_t; type: Tree; isreference: BOOLEAN) : Tree ; + + +(* + BuildStartFunctionType - creates a pointer type, necessary to + create a function type. +*) + +PROCEDURE BuildStartFunctionType (location: location_t; name: ADDRESS) : Tree ; + + +(* + BuildEndFunctionType - build a function type which would return a, value. + The arguments have been created by BuildParameterDeclaration. +*) + +PROCEDURE BuildEndFunctionType (func: Tree; type: Tree; usesvarags: BOOLEAN) : Tree ; + + +(* + GetTreeType - returns TREE_TYPE (t). +*) + +PROCEDURE GetTreeType (type: Tree) : Tree ; + + +(* + DeclareKnownType - given a, type, with a, name, return a GCC declaration of this type. + TYPE + name = foo ; +*) + +PROCEDURE DeclareKnownType (location: location_t; name: ADDRESS; type: Tree) : Tree ; + + +(* + GetM2ZType - return the ISO Z data type, the longest int datatype. +*) + +PROCEDURE GetM2ZType () : Tree ; + + +(* + GetM2RType - return the ISO R data type, the longest real datatype. +*) + +PROCEDURE GetM2RType () : Tree ; + + +(* + BuildSetTypeFromSubrange - constructs a set type from a subrangeType. +*) + +PROCEDURE BuildSetTypeFromSubrange (location: location_t; name: ADDRESS; + subrangeType: Tree; + lowval: Tree; highval: Tree; + ispacked: BOOLEAN) : Tree ; + + +(* + BuildSmallestTypeRange - returns the smallest INTEGER_TYPE which is + sufficient to contain values: low..high. +*) + +PROCEDURE BuildSmallestTypeRange (location: location_t; low: Tree; high: Tree) : Tree ; + + +(* + GetBooleanType - +*) + +PROCEDURE GetBooleanType () : Tree ; + + +(* + GetBooleanFalse - +*) + +PROCEDURE GetBooleanFalse () : Tree ; + + +(* + GetBooleanTrue - +*) + +PROCEDURE GetBooleanTrue () : Tree ; + + +(* + GetPackedBooleanType - return the packed boolean data type node. +*) + +PROCEDURE GetPackedBooleanType () : Tree ; + + +(* + GetCharType - return the char type node. +*) + +PROCEDURE GetCharType () : Tree ; + + +(* + GetByteType - return the byte type node. +*) + +PROCEDURE GetByteType () : Tree ; + + +(* + GetVoidType - return the C void type. +*) + +PROCEDURE GetVoidType () : Tree ; + + +(* + GetBitnumType - return the ISO bitnum type. +*) + +PROCEDURE GetBitnumType () : Tree ; + + +(* + GetRealType - +*) + +PROCEDURE GetRealType () : Tree ; + + +(* + GetLongRealType - return the C long double data type. +*) + +PROCEDURE GetLongRealType () : Tree ; + + +(* + GetShortRealType - return the C float data type. +*) + +PROCEDURE GetShortRealType () : Tree ; + + +(* + GetLongIntType - return the C long int data type. +*) + +PROCEDURE GetLongIntType () : Tree ; + + +(* + GetPointerType - return the GCC ptr type node. Equivalent to (void * ). +*) + +PROCEDURE GetPointerType () : Tree ; + + +(* + GetCardinalType - return the cardinal type. +*) + +PROCEDURE GetCardinalType () : Tree ; + + +(* + GetIntegerType - return the integer type node. +*) + +PROCEDURE GetIntegerType () : Tree ; + + +(* + GetWordType - return the C unsigned data type. +*) + +PROCEDURE GetWordType () : Tree ; + + +(* + GetM2CardinalType - return the m2 cardinal data type. +*) + +PROCEDURE GetM2CardinalType () : Tree ; + + +(* + GetBitsetType - return the bitset type. +*) + +PROCEDURE GetBitsetType () : Tree ; + + +(* + GetM2CType - a test function. +*) + +PROCEDURE GetM2CType () : Tree ; + + +(* + GetProcType - return the m2 proc data type. +*) + +PROCEDURE GetProcType () : Tree ; + + +(* + GetM2ComplexType - return the complex type. +*) + +PROCEDURE GetM2ComplexType () : Tree ; + + +(* + GetM2LongComplexType - return the long complex type. +*) + +PROCEDURE GetM2LongComplexType () : Tree ; + + +(* + GetM2ShortComplexType - return the short complex type. +*) + +PROCEDURE GetM2ShortComplexType () : Tree ; + + +(* + GetM2Complex128Type - return the fixed size complex type. +*) + +PROCEDURE GetM2Complex128 () : Tree ; + + +(* + GetM2Complex96 - return the fixed size complex type. +*) + +PROCEDURE GetM2Complex96 () : Tree ; + + +(* + GetM2Complex64 - return the fixed size complex type. +*) + +PROCEDURE GetM2Complex64 () : Tree ; + + +(* + GetM2Complex32 - return the fixed size complex type. +*) + +PROCEDURE GetM2Complex32 () : Tree ; + + +(* + GetM2Real128 - return the real 128 bit type. +*) + +PROCEDURE GetM2Real128 () : Tree ; + + +(* + GetM2Real96 - return the real 96 bit type. +*) + +PROCEDURE GetM2Real96 () : Tree ; + + +(* + GetM2Real64 - return the real 64 bit type. +*) + +PROCEDURE GetM2Real64 () : Tree ; + + +(* + GetM2Real32 - return the real 32 bit type. +*) + +PROCEDURE GetM2Real32 () : Tree ; + + +(* + GetM2Bitset32 - return the bitset 32 bit type. +*) + +PROCEDURE GetM2Bitset32 () : Tree ; + + +(* + GetM2Bitset16 - return the bitset 16 bit type. +*) + +PROCEDURE GetM2Bitset16 () : Tree ; + + +(* + GetM2Bitset8 - return the bitset 8 bit type. +*) + +PROCEDURE GetM2Bitset8 () : Tree ; + + +(* + GetM2Word64 - return the word 64 bit type. +*) + +PROCEDURE GetM2Word64 () : Tree ; + + +(* + GetM2Word32 - return the word 32 bit type. +*) + +PROCEDURE GetM2Word32 () : Tree ; + + +(* + GetM2Word16 - return the word 16 bit type. +*) + +PROCEDURE GetM2Word16 () : Tree ; + + +(* + GetM2Cardinal64 - return the cardinal 64 bit type. +*) + +PROCEDURE GetM2Cardinal64 () : Tree ; + + +(* + GetM2Cardinal32 - return the cardinal 32 bit type. +*) + +PROCEDURE GetM2Cardinal32 () : Tree ; + + +(* + GetM2Cardinal16 - return the cardinal 16 bit type. +*) + +PROCEDURE GetM2Cardinal16 () : Tree ; + + +(* + GetM2Cardinal8 - return the cardinal 8 bit type. +*) + +PROCEDURE GetM2Cardinal8 () : Tree ; + + +(* + GetM2Integer64 - return the integer 64 bit type. +*) + +PROCEDURE GetM2Integer64 () : Tree ; + + +(* + GetM2Integer32 - return the integer 32 bit type. +*) + +PROCEDURE GetM2Integer32 () : Tree ; + + +(* + GetM2Integer16 - return the integer 16 bit type. +*) + +PROCEDURE GetM2Integer16 () : Tree ; + + +(* + GetM2Integer8 - return the integer 8 bit type. +*) + +PROCEDURE GetM2Integer8 () : Tree ; + + +(* + GetISOLocType - return the m2 loc word data type. +*) + +PROCEDURE GetISOLocType () : Tree ; + + +(* + GetISOByteType - return the m2 iso byte data type. +*) + +PROCEDURE GetISOByteType () : Tree ; + + +(* + GetISOWordType - return the m2 iso word data type. +*) + +PROCEDURE GetISOWordType () : Tree ; + + +(* + GetShortCardType - return the C short unsigned data type. +*) + +PROCEDURE GetShortCardType () : Tree ; + + +(* + GetM2ShortCardType - return the m2 short cardinal data type. +*) + +PROCEDURE GetM2ShortCardType () : Tree ; + + +(* + GetShortIntType - return the C short int data type. +*) + +PROCEDURE GetShortIntType () : Tree ; + + +(* + GetM2ShortIntType - return the m2 short integer data type. +*) + +PROCEDURE GetM2ShortIntType () : Tree ; + + +(* + GetM2LongCardType - return the m2 long cardinal data type. +*) + +PROCEDURE GetM2LongCardType () : Tree ; + + +(* + GetM2LongIntType - return the m2 long integer data type. +*) + +PROCEDURE GetM2LongIntType () : Tree ; + + +(* + GetM2LongRealType - return the m2 long real data type. +*) + +PROCEDURE GetM2LongRealType () : Tree ; + + +(* + GetM2RealType - return the m2 real data type. +*) + +PROCEDURE GetM2RealType () : Tree ; + + +(* + GetM2ShortRealType - return the m2 short real data type. +*) + +PROCEDURE GetM2ShortRealType () : Tree ; + + +(* + GetM2IntegerType - return the m2 integer data type. +*) + +PROCEDURE GetM2IntegerType () : Tree ; + + +(* + GetM2CharType - return the m2 char data type. +*) + +PROCEDURE GetM2CharType () : Tree ; + + +(* + GetCSizeTType - return a type representing, size_t on this system. +*) + +PROCEDURE GetCSizeTType () : Tree ; + + +(* + GetCSSizeTType - return a type representing, ssize_t on this system. +*) + +PROCEDURE GetCSSizeTType () : Tree ; + + +(* + BuildArrayStringConstructor - creates an array constructor for, arrayType, + consisting of the character elements + defined by, str, of, length, characters. +*) + +PROCEDURE BuildArrayStringConstructor (location: location_t; arrayType: Tree; str: Tree; length: Tree) : Tree ; + + +(* + RealToTree - convert a real number into a Tree. +*) + +PROCEDURE RealToTree (name: ADDRESS) : Tree ; + + +(* + BuildStartRecord - return a RECORD tree. +*) + +PROCEDURE BuildStartRecord (location: location_t; name: ADDRESS) : Tree ; + + +(* + BuildStartUnion - return a union tree. +*) + +PROCEDURE BuildStartUnion (location: location_t; name: ADDRESS) : Tree ; + + + +PROCEDURE BuildStartVarient (location: location_t; name: ADDRESS) : Tree ; + + + +PROCEDURE BuildEndVarient (location: location_t; varientField: Tree; varientList: Tree; isPacked: BOOLEAN) : Tree ; + + + +PROCEDURE BuildStartFieldVarient (location: location_t; name: ADDRESS) : Tree ; + + + +PROCEDURE BuildEndFieldVarient (location: location_t; varientField: Tree; varientList: Tree; isPacked: BOOLEAN) : Tree ; + + + +PROCEDURE BuildStartFieldRecord (location: location_t; name: ADDRESS; type: Tree) : Tree ; + + + +PROCEDURE BuildFieldRecord (location: location_t; name: ADDRESS; type: Tree) : Tree ; + + +(* + ChainOn - interface so that Modula-2 can also create chains of + declarations. +*) + +PROCEDURE ChainOn (t1: Tree; t2: Tree) : Tree ; + + +(* + ChainOnParamValue - adds a list node {{name, str}, value} into the tree list. +*) + +PROCEDURE ChainOnParamValue (list: Tree; name: Tree; str: Tree; value: Tree) : Tree ; + + +(* + AddStringToTreeList - adds, string, to list. +*) + +PROCEDURE AddStringToTreeList (list: Tree; string: Tree) : Tree ; + + +(* + BuildEndRecord - a heavily pruned finish_struct from c-decl.c. + It sets the context for each field to, t, + propagates isPacked throughout the fields in + the structure. +*) + +PROCEDURE BuildEndRecord (location: location_t; record: Tree; fieldlist: Tree; isPacked: BOOLEAN) : Tree ; + + +(* + SetAlignment - sets the alignment of a, node, to, align. + It duplicates the, node, and sets the alignment + to prevent alignment effecting behaviour elsewhere. +*) + +PROCEDURE SetAlignment (node: Tree; align: Tree) : Tree ; + + +(* + SetDeclPacked - sets the packed bit in decl TREE, node. + It returns the node. +*) + +PROCEDURE SetDeclPacked (node: Tree) : Tree ; + + +(* + SetTypePacked - sets the packed bit in type TREE, node. + It returns the node. +*) + +PROCEDURE SetTypePacked (node: Tree) : Tree ; + + +(* + SetRecordFieldOffset - returns field after the byteOffset and bitOffset + has been applied to it. +*) + +PROCEDURE SetRecordFieldOffset (field: Tree; byteOffset: Tree; bitOffset: Tree; fieldtype: Tree; nbits: Tree) : Tree ; + + +(* + BuildPackedFieldRecord - builds a packed field record of, + name, and, fieldtype. +*) + +PROCEDURE BuildPackedFieldRecord (location: location_t; name: ADDRESS; fieldtype: Tree) : Tree ; + + +(* + BuildNumberOfArrayElements - returns the number of elements in an + arrayType. +*) + +PROCEDURE BuildNumberOfArrayElements (location: location_t; arrayType: Tree) : Tree ; + + +(* + AddStatement - maps onto add_stmt. +*) + +PROCEDURE AddStatement (location: location_t; t: Tree) ; + + +(* + MarkFunctionReferenced - marks a function as referenced. +*) + +PROCEDURE MarkFunctionReferenced (f: Tree) ; + + +(* + GarbageCollect - force gcc to garbage collect. +*) + +PROCEDURE GarbageCollect ; + + +(* + BuildArrayIndexType - creates an integer index which accesses an array. + low and high are the min, max elements of the array. +*) + +PROCEDURE BuildArrayIndexType (low: Tree; high: Tree) : Tree ; + + +(* + GetArrayNoOfElements - returns the number of elements in, arraytype. +*) + +PROCEDURE GetArrayNoOfElements (location: location_t; arraytype: Tree) : Tree ; + + +(* + BuildEndArrayType - returns a type which is an array indexed by IndexType + and which has ElementType elements. +*) + +PROCEDURE BuildEndArrayType (arraytype: Tree; elementtype: Tree; indextype: Tree; type: INTEGER) : Tree ; + + +(* + PutArrayType - +*) + +PROCEDURE PutArrayType (array: Tree; type: Tree) ; + + +(* + BuildStartArrayType - creates an array with an indextype and elttype. The front end + symbol, type, is also passed to allow the gccgm2 to return the + canonical edition of the array type even if the GCC elttype is + NULL_TREE. +*) + +PROCEDURE BuildStartArrayType (index_type: Tree; elt_type: Tree; type: INTEGER) : Tree ; + + +(* + IsAddress - return TRUE if the type is an ADDRESS. +*) + +PROCEDURE IsAddress (type: Tree) : BOOLEAN ; + + +END m2type. diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/dynamicstrings.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/dynamicstrings.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,38 @@ +/* dynamicstrings.h provides a minimal interface to a string library. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(dynamicstrings_h) + +#define dynamicstrings_h +#if defined(dynamicstrings_c) +#define EXTERN +#else /* !dynamicstrings_c. */ +#define EXTERN extern +#endif /* !dynamicstrings_c. */ + +typedef void *dynamicstrings_string; + +EXTERN dynamicstrings_string DynamicStrings_Mark (dynamicstrings_string s); +EXTERN dynamicstrings_string +DynamicStrings_InitStringCharStar (dynamicstrings_string s); + +#undef EXTERN +#endif /* !dynamicstrings_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/gcc-consolidation.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/gcc-consolidation.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,92 @@ +/* gcc-consolidation.h provides a single header for required gcc headers. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "realmpfr.h" +#include "backend.h" +#include "stringpool.h" +#include "rtl.h" +#include "tree.h" +#include "predict.h" +#include "df.h" +#include "tm.h" +#include "hash-set.h" +#include "machmode.h" +#include "vec.h" +#include "double-int.h" +#include "input.h" +#include "alias.h" +#include "symtab.h" +#include "options.h" +#include "wide-int.h" +#include "inchash.h" +#include "stor-layout.h" +#include "attribs.h" +#include "intl.h" +#include "tree-iterator.h" +#include "diagnostic.h" +#include "wide-int-print.h" +#include "real.h" +#include "float.h" +#include "spellcheck.h" +#include "opt-suggestions.h" + +/* Utilize some of the C build routines. */ + +#include "fold-const.h" +#include "varasm.h" +#include "hashtab.h" +#include "hard-reg-set.h" +#include "function.h" + +#include "hash-map.h" +#include "langhooks.h" +#include "timevar.h" +#include "dumpfile.h" +#include "target.h" +#include "dominance.h" +#include "cfg.h" +#include "cfganal.h" +#include "predict.h" +#include "basic-block.h" +#include "df.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-expr.h" +#include "is-a.h" +#include "gimple.h" +#include "gimple-ssa.h" +#include "gimplify.h" +#include "stringpool.h" +#include "tree-nested.h" +#include "print-tree.h" +#include "except.h" +#include "toplev.h" +#include "convert.h" +#include "tree-dump.h" +#include "plugin-api.h" +#include "hard-reg-set.h" +#include "function.h" +#include "ipa-ref.h" +#include "cgraph.h" +#include "stmt.h" diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/init.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/init.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,35 @@ +/* init.h header file for init.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(init_h) +#define init_h + +#if defined(init_cpp) +extern "C" { +void init_FrontEndInit (void); +void init_PerCompilationInit (const char *filename); +} +#else /* !init_cpp. */ +void init_FrontEndInit (void); +void init_PerCompilationInit (const char *filename); +#endif /* !init_cpp. */ + +#endif /*! init_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2assert.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2assert.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,68 @@ +/* m2assert.h header file for m2assert.cc and assertion macros. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2assert_h) +#define m2assert_h +#if defined(m2assert_c) +#define EXTERN +#else /* !m2assert_c. */ +#define EXTERN extern +#endif /* !m2assert_c. */ + +#if !defined(ASSERT) +#define ASSERT(X, Y) \ + { \ + if (!(X)) \ + { \ + debug_tree (Y); \ + internal_error ("%s:%d:condition %s failed", __FILE__, __LINE__, \ + #X); \ + } \ + } +#endif + +#if !defined(ASSERT_BOOL) +#define ASSERT_BOOL(X) \ + { \ + if ((X != 0) && (X != 1)) \ + { \ + internal_error ( \ + "%s:%d:the value %s is not a BOOLEAN as the value is %d", \ + __FILE__, __LINE__, #X, X); \ + } \ + } +#endif + +#if !defined(ASSERT_CONDITION) +#define ASSERT_CONDITION(X) \ + { \ + if (!(X)) \ + { \ + internal_error ("%s:%d:condition %s failed", __FILE__, __LINE__, \ + #X); \ + } \ + } +#endif + +EXTERN void m2assert_AssertLocation (location_t location); + +#undef EXTERN +#endif /* m2assert_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2block.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2block.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,77 @@ +/* m2block.h header file for m2block.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2block_h) +#define m2block_h +#if defined(m2block_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2block_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !m2block_h. */ +#define EXTERN extern +#endif /* !m2block_c. */ +#endif /* !m2block_h. */ + +EXTERN tree m2block_getLabel (location_t location, char *name); +EXTERN void m2block_pushFunctionScope (tree fndecl); +EXTERN tree m2block_popFunctionScope (void); +EXTERN void m2block_pushGlobalScope (void); +EXTERN void m2block_popGlobalScope (void); +EXTERN tree m2block_pushDecl (tree decl); +EXTERN void m2block_addDeclExpr (tree t); + +EXTERN tree m2block_begin_statement_list (void); +EXTERN tree m2block_push_statement_list (tree t); +EXTERN tree m2block_pop_statement_list (void); + +EXTERN void m2block_finishFunctionDecl (location_t location, tree fndecl); +EXTERN void m2block_finishFunctionCode (tree fndecl); + +EXTERN tree m2block_RememberType (tree t); +EXTERN tree m2block_RememberConstant (tree t); +EXTERN tree m2block_DumpGlobalConstants (void); +EXTERN tree m2block_RememberInitModuleFunction (tree t); +EXTERN tree m2block_global_constant (tree t); +EXTERN int m2block_toplevel (void); +EXTERN tree m2block_GetErrorNode (void); + +EXTERN void m2block_addStmtNote (location_t location); + +EXTERN tree m2block_cur_stmt_list (void); +EXTERN tree *m2block_cur_stmt_list_addr (void); +EXTERN int m2block_is_building_stmt_list (void); +EXTERN tree m2block_GetGlobals (void); +EXTERN tree m2block_GetGlobalContext (void); +EXTERN void m2block_finishGlobals (void); +EXTERN void m2block_includeDecl (tree); +EXTERN tree m2block_add_stmt (location_t location, tree t); +EXTERN void m2block_addStmtNote (location_t location); +EXTERN void m2block_removeStmtNote (void); + +EXTERN void m2block_init (void); + +#undef EXTERN +#endif /* m2block_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2builtins.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2builtins.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,56 @@ +/* m2builtins.h header file for m2builtins.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2builtins_h) + +#define m2builtins_h +#if defined(m2builtins_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2builtins_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2builtins_c. */ + +EXTERN tree m2builtins_GetBuiltinConst (char *name); +EXTERN unsigned int m2builtins_GetBuiltinConstType (char *name); +EXTERN unsigned int m2builtins_GetBuiltinTypeInfoType (const char *ident); +EXTERN tree m2builtins_GetBuiltinTypeInfo (location_t location, tree type, + const char *ident); +EXTERN tree m2builtins_BuiltInMemCopy (location_t location, tree dest, + tree src, tree n); +EXTERN tree m2builtins_BuiltInAlloca (location_t location, tree n); +EXTERN tree m2builtins_BuiltInIsfinite (location_t location, tree e); +EXTERN int m2builtins_BuiltinExists (char *name); +EXTERN tree m2builtins_BuildBuiltinTree (location_t location, char *name); +EXTERN tree m2builtins_BuiltInHugeVal (location_t location); +EXTERN tree m2builtins_BuiltInHugeValShort (location_t location); +EXTERN tree m2builtins_BuiltInHugeValLong (location_t location); +EXTERN void m2builtins_init (location_t location); + +#undef EXTERN +#endif /* m2builtins_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2color.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2color.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,52 @@ +/* m2color.h interface to gcc colorization. + +Copyright (C) 2019-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2color_h) +#define m2color_h +#if defined(m2color_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2color_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2color_c. */ + + +EXTERN char * +m2color_colorize_start (bool show_color, char *name, unsigned int name_len); + +EXTERN char *m2color_colorize_stop (bool show_color); + +EXTERN char *m2color_open_quote (void); + +EXTERN char *m2color_close_quote (void); + +EXTERN void _M2_m2color_init (); +EXTERN void _M2_m2color_finish (); + + +#endif diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2configure.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2configure.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,44 @@ +/* m2configure.h header file for m2configure.cc. + +Copyright (C) 2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2configure_h) + +#define m2configure_h +#if defined(m2configure_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2configure_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2configure_c. */ + +#include "input.h" + +EXTERN char *m2configure_FullPathCPP (void); + +#undef EXTERN +#endif /* m2configure_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2convert.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2convert.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,54 @@ +/* m2convert.h header file for m2convert.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2convert_h) +#define m2convert_h +#if defined(m2convert_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* m2convert_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* m2convert_c. */ + +EXTERN tree m2convert_BuildConvert (location_t location, tree type, tree value, + int checkOverflow); +EXTERN tree m2convert_ConvertToPtr (location_t location_t, tree p); +EXTERN tree m2convert_ConvertString (tree type, tree expr); +EXTERN tree m2convert_ConvertConstantAndCheck (location_t location, tree type, + tree expr); +EXTERN tree m2convert_convertToPtr (location_t location, tree type); +EXTERN tree m2convert_ToCardinal (location_t location, tree expr); +EXTERN tree m2convert_ToInteger (location_t location, tree expr); +EXTERN tree m2convert_ToWord (location_t location, tree expr); +EXTERN tree m2convert_ToBitset (location_t location, tree expr); +EXTERN tree m2convert_ToLoc (location_t location, tree expr); +EXTERN tree m2convert_GenericToType (location_t location, tree type, + tree expr); + +#undef EXTERN +#endif /* m2convert_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2decl.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2decl.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,82 @@ +/* m2decl.h header file for m2decl.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2decl_h) + +#define m2decl_h +#if defined(m2decl_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2decl_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2decl_c. */ + + +EXTERN tree m2decl_DeclareM2linkStaticInitialization (location_t location, + int ScaffoldStatic); +EXTERN tree m2decl_DeclareM2linkForcedModuleInitOrder (location_t location, + const char *RuntimeOverride); +EXTERN tree m2decl_BuildPtrToTypeString (location_t location, const char *string, tree type); +EXTERN void m2decl_BuildModuleCtor (tree module_ctor); +EXTERN tree m2decl_DeclareModuleCtor (tree decl); +EXTERN tree m2decl_GetDeclContext (tree t); +EXTERN tree m2decl_BuildStringConstant (const char *string, int length); +EXTERN tree m2decl_BuildCStringConstant (const char *string, int length); +EXTERN tree m2decl_BuildConstLiteralNumber (location_t location, + const char *str, + unsigned int base); +EXTERN void m2decl_DetermineSizeOfConstant (location_t location, + const char *str, unsigned int base, + int *needsLong, + int *needsUnsigned); +EXTERN void m2decl_RememberVariables (tree l); + +EXTERN tree m2decl_BuildEndFunctionDeclaration ( + location_t location_begin, location_t location_end, const char *name, + tree returntype, int isexternal, int isnested, int ispublic); +EXTERN void m2decl_BuildStartFunctionDeclaration (int uses_varargs); +EXTERN tree m2decl_BuildParameterDeclaration (location_t location, char *name, + tree type, int isreference); +EXTERN tree m2decl_DeclareKnownConstant (location_t location, tree type, + tree value); +EXTERN tree m2decl_DeclareKnownVariable (location_t location, const char *name, + tree type, int exported, int imported, + int istemporary, int isglobal, + tree scope, tree initial); + +EXTERN tree m2decl_BuildStringConstantType (int length, const char *string, + tree type); +EXTERN tree m2decl_BuildIntegerConstant (int value); + +EXTERN int m2decl_GetBitsPerWord (void); +EXTERN int m2decl_GetBitsPerUnit (void); +EXTERN int m2decl_GetBitsPerInt (void); +EXTERN int m2decl_GetBitsPerBitset (void); + +#undef EXTERN +#endif /* m2decl_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2except.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2except.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,70 @@ +/* m2except.h header file for m2except.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2except_h) +#define m2except_h +#if defined(m2except_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2except_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2except_c. */ + +/* InitExceptions - initialize this module, it declares the external + functions and assigns them to the appropriate global tree + variables. */ + +EXTERN void m2except_InitExceptions (location_t location); + +/* BuildThrow - builds a throw statement and return the tree. */ + +EXTERN tree m2except_BuildThrow (location_t location, tree exp); + +/* BuildTryBegin - returns a tree representing the 'try' block. */ + +EXTERN tree m2except_BuildTryBegin (location_t location); + +/* BuildTryEnd - builds the end of the Try block and prepares for the + catch handlers. */ + +EXTERN void m2except_BuildTryEnd (tree tryBlock); + +/* BuildCatchBegin - creates a handler tree for the C++ statement + 'catch (...) {'. It returns the handler tree. */ + +EXTERN tree m2except_BuildCatchBegin (location_t location); + +/* BuildCatchEnd - completes a try catch block. It returns the, + try_block, tree. It creates the C++ statement + +'}' which matches the catch above. */ + +EXTERN tree m2except_BuildCatchEnd (location_t location, tree handler, + tree tryBlock); + +#endif /* m2except_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2expr.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2expr.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,244 @@ +/* m2expr.h header file for m2expr.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2expr_h) +#define m2expr_h +#if defined(m2expr_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2expr_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2expr_c. */ + +EXTERN void m2expr_BuildBinaryForeachWordDo ( + location_t location, tree type, tree op1, tree op2, tree op3, + tree (*binop) (location_t, tree, tree, int), int is_op1lvalue, + int is_op2lvalue, int is_op3lvalue, int is_op1const, int is_op2const, + int is_op3const); +EXTERN tree m2expr_BuildCmplx (location_t location, tree type, tree real, + tree imag); +EXTERN tree m2expr_BuildIm (tree op1); +EXTERN tree m2expr_BuildRe (tree op1); +EXTERN tree m2expr_BuildAbs (location_t location, tree t); +EXTERN tree m2expr_BuildCap (location_t location, tree t); +EXTERN int m2expr_DetermineSign (tree e); +EXTERN int m2expr_AreRealOrComplexConstantsEqual (tree e1, tree e2); +EXTERN int m2expr_AreConstantsEqual (tree e1, tree e2); +EXTERN int m2expr_IsFalse (tree t); +EXTERN int m2expr_IsTrue (tree t); +EXTERN tree m2expr_BuildIndirect (location_t location, tree target, tree type); +EXTERN tree m2expr_BuildComponentRef (location_t location, tree record, + tree field); +EXTERN tree m2expr_BuildArray (location_t location, tree type, tree array, + tree index, tree lowIndice); +EXTERN void m2expr_BuildIfNotInRangeGoto (location_t location, tree var, + tree low, tree high, char *label); +EXTERN void m2expr_BuildIfInRangeGoto (location_t location, tree var, tree low, + tree high, char *label); +EXTERN void m2expr_BuildForeachWordInSetDoIfExpr ( + location_t location, tree type, tree op1, tree op2, int is_op1lvalue, + int is_op2lvalue, int is_op1const, int is_op2const, + tree (*expr) (location_t, tree, tree), char *label); +EXTERN void m2expr_BuildIfNotVarInVar (location_t location, tree type, + tree varset, tree varel, int is_lvalue, + tree low, tree high ATTRIBUTE_UNUSED, + char *label); +EXTERN void m2expr_BuildIfVarInVar (location_t location, tree type, + tree varset, tree varel, int is_lvalue, + tree low, tree high ATTRIBUTE_UNUSED, + char *label); +EXTERN void m2expr_BuildIfNotConstInVar (location_t location, tree type, + tree varset, tree constel, + int is_lvalue, int fieldno, + char *label); +EXTERN void m2expr_BuildIfConstInVar (location_t location, tree type, + tree varset, tree constel, int is_lvalue, + int fieldno, char *label); +EXTERN tree m2expr_BuildIsNotSubset (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildIsSubset (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildIsNotSuperset (location_t location, tree op1, + tree op2); +EXTERN tree m2expr_BuildIsSuperset (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildNotEqualTo (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildEqualTo (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildGreaterThanOrEqual (location_t location, tree op1, + tree op2); +EXTERN tree m2expr_BuildLessThanOrEqual (location_t location, tree op1, + tree op2); +EXTERN tree m2expr_BuildGreaterThan (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildLessThan (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildLogicalDifference (location_t location, tree op1, + tree op2, int needconvert); +EXTERN tree m2expr_BuildSymmetricDifference (location_t location, tree op1, + tree op2, int needconvert); +EXTERN tree m2expr_BuildLogicalAnd (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildLogicalOr (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildLogicalOrAddress (location_t location, tree op1, + tree op2, int needconvert); +EXTERN tree m2expr_BuildOffset (location_t location, tree record, tree field, + int needconvert ATTRIBUTE_UNUSED); +EXTERN tree m2expr_BuildOffset1 (location_t location, tree field, + int needconvert ATTRIBUTE_UNUSED); +EXTERN tree m2expr_BuildAddr (location_t location, tree op1, int needconvert); +EXTERN tree m2expr_BuildSize (location_t location, tree op1, + int needconvert ATTRIBUTE_UNUSED); +EXTERN tree m2expr_BuildTBitSize (location_t location, tree type); +EXTERN tree m2expr_BuildSetNegate (location_t location, tree op1, + int needconvert); +EXTERN tree m2expr_BuildNegate (location_t location, tree op1, + int needconvert); +EXTERN tree m2expr_BuildNegateCheck (location_t location, tree arg, + tree lowest, tree min, tree max); +EXTERN tree m2expr_BuildTrunc (tree op1); +EXTERN tree m2expr_BuildCoerce (location_t location, tree des, tree type, + tree expr); +EXTERN tree m2expr_RemoveOverflow (tree t); +EXTERN int m2expr_TreeOverflow (tree t); + +EXTERN unsigned int m2expr_StringLength (tree string); +EXTERN tree m2expr_FoldAndStrip (tree t); +EXTERN int m2expr_interpret_integer (const char *str, unsigned int base, + unsigned HOST_WIDE_INT *low, + HOST_WIDE_INT *high); +EXTERN int m2expr_interpret_m2_integer (const char *str, unsigned int base, + unsigned int *low, int *high, + int *needsLong, int *needsUnsigned); + +EXTERN tree m2expr_BuildAddCheck (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); +EXTERN tree m2expr_BuildSubCheck (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); +EXTERN tree m2expr_BuildMultCheck (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); + +EXTERN tree m2expr_BuildAdd (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildSub (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildDivTrunc (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildDivTruncCheck (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); +EXTERN tree m2expr_BuildModTrunc (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildDivCeil (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildModCeil (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildDivFloor (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildModFloor (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildDivM2 (location_t location, tree op1, tree op2, + unsigned int needsconvert); +EXTERN tree m2expr_BuildModM2 (location_t location, tree op1, tree op2, + unsigned int needsconvert); +EXTERN tree m2expr_BuildDivM2Check (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); + +EXTERN tree m2expr_BuildModM2Check (location_t location, tree op1, tree op2, + tree lowest, tree min, tree max); + +EXTERN tree m2expr_BuildLSL (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildLSR (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN void m2expr_BuildLogicalShift (location_t location, tree op1, tree op2, + tree op3, tree nBits ATTRIBUTE_UNUSED, + int needconvert); + +EXTERN tree m2expr_BuildLRL (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildLRR (location_t location, tree op1, tree op2, + int needconvert); +EXTERN tree m2expr_BuildMult (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN tree m2expr_BuildRRotate (location_t location, tree op1, tree nBits, + int needconvert); +EXTERN tree m2expr_BuildLRotate (location_t location, tree op1, tree nBits, + int needconvert); + +EXTERN tree m2expr_BuildMask (location_t location, tree nBits, + int needconvert); +EXTERN tree m2expr_BuildLRLn (location_t location, tree op1, tree op2, + tree nBits, int needconvert); +EXTERN tree m2expr_BuildLRRn (location_t location, tree op1, tree op2, + tree nBits, int needconvert); +EXTERN void m2expr_BuildLogicalRotate (location_t location, tree op1, tree op2, + tree op3, tree nBits, int needconvert); +EXTERN void m2expr_BuildBinarySetDo ( + location_t location, tree settype, tree op1, tree op2, tree op3, + void (*binop) (location_t, tree, tree, tree, tree, int), int is_op1lvalue, + int is_op2lvalue, int is_op3lvalue, tree nBits, tree unbounded, + tree varproc, tree leftproc, tree rightproc); + +EXTERN tree m2expr_GetSizeOf (location_t location, tree type); +EXTERN tree m2expr_GetSizeOfInBits (tree type); + +EXTERN tree m2expr_GetCardinalZero (location_t location); +EXTERN tree m2expr_GetCardinalOne (location_t location); +EXTERN tree m2expr_GetIntegerZero (location_t location); +EXTERN tree m2expr_GetIntegerOne (location_t location); +EXTERN tree m2expr_GetWordZero (location_t location); +EXTERN tree m2expr_GetWordOne (location_t location); +EXTERN tree m2expr_GetPointerZero (location_t location); +EXTERN tree m2expr_GetPointerOne (location_t location); + +#if 0 +EXTERN tree m2expr_GetBooleanTrue (void); +EXTERN tree m2expr_GetBooleanFalse (void); +#endif + +EXTERN int m2expr_CompareTrees (tree e1, tree e2); +EXTERN tree m2expr_build_unary_op (location_t location ATTRIBUTE_UNUSED, + enum tree_code code, tree arg, + int flag ATTRIBUTE_UNUSED); +EXTERN tree m2expr_build_binary_op (location_t location, enum tree_code code, + tree op1, tree op2, int convert); +EXTERN tree m2expr_build_binary_op_check (location_t location, + enum tree_code code, tree op1, + tree op2, int needconvert, + tree lowest, tree min, tree max); +EXTERN void m2expr_ConstantExpressionWarning (tree value); +EXTERN tree m2expr_BuildAddAddress (location_t location, tree op1, tree op2); +EXTERN tree m2expr_BuildRDiv (location_t location, tree op1, tree op2, + int needconvert); + +EXTERN void m2expr_init (location_t location); + +#undef EXTERN +#endif /* m2expr_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2linemap.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2linemap.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,72 @@ +/* m2linemap.h header file for m2linemap.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2linemap_h) + +#include "input.h" + +#define m2linemap_h +#if defined(m2linemap_c) +#if (__cplusplus) +#define EXTERN extern "C" +#else /* !__cplusplus. */ +#define EXTERN +#endif /*!__cplusplus. */ +#else /* !m2linemap_c. */ +#if (__cplusplus) +#define EXTERN extern "C" +#else /* !__cplusplus. */ +#define EXTERN extern +#endif /* !__cplusplus. */ +#endif /* !m2linemap_c. */ + +EXTERN void m2linemap_StartFile (void *filename, unsigned int linebegin); +EXTERN void m2linemap_EndFile (void); +EXTERN void m2linemap_StartLine (unsigned int linenumber, + unsigned int linesize); +EXTERN location_t m2linemap_GetLocationColumn (unsigned int column); +EXTERN location_t m2linemap_GetLocationRange (unsigned int start, unsigned int end); +EXTERN location_t m2linemap_GetLocationBinary (location_t caret, + location_t start, location_t finish); + +EXTERN location_t m2linemap_UnknownLocation (void); +EXTERN location_t m2linemap_BuiltinsLocation (void); + +EXTERN location_t m2linemap_GetLocationColumn (unsigned int column); +EXTERN int m2linemap_GetLineNoFromLocation (location_t location); +EXTERN int m2linemap_GetColumnNoFromLocation (location_t location); +EXTERN const char *m2linemap_GetFilenameFromLocation (location_t location); +EXTERN void m2linemap_ErrorAt (location_t location, char *message); +EXTERN void m2linemap_ErrorAtf (location_t location, const char *message, ...); +EXTERN void m2linemap_WarningAtf (location_t location, const char *message, ...); +EXTERN void m2linemap_NoteAtf (location_t location, const char *message, ...); +EXTERN void m2linemap_internal_error (const char *message); + + +EXTERN location_t UnknownLocation (void); +EXTERN location_t BuiltinsLocation (void); +EXTERN void ErrorAt (location_t location, char *message); +EXTERN void ErrorAtf (location_t location, const char *message, ...); +EXTERN void WarningAtf (location_t location, const char *message, ...); +EXTERN void NoteAtf (location_t location, const char *message, ...); + +#undef EXTERN +#endif /* m2linemap_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2misc.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2misc.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,44 @@ +/* m2misc.h header file for m2misc.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2misc_h) + +#define m2misc_h +#if defined(m2misc_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2misc_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2misc_c. */ + +EXTERN void m2misc_DebugTree (tree t); +EXTERN void m2misc_printStmt (void); +EXTERN void m2misc_DebugTreeChain (tree t); + +#undef EXTERN +#endif /* m2misc_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2options.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2options.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,126 @@ +/* m2options.h header file for M2Options.mod. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2options_h) + +#define m2options_h +#if defined(m2options_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2options_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2options_c. */ + +#include "input.h" + +EXTERN void M2Options_SetMakeIncludePath (const char *arg); +EXTERN void M2Options_SetSearchPath (const char *arg); +EXTERN void M2Options_setdefextension (const char *arg); +EXTERN void M2Options_setmodextension (const char *arg); + +EXTERN void M2Options_SetISO (int value); +EXTERN void M2Options_SetPIM (int value); +EXTERN void M2Options_SetPIM2 (int value); +EXTERN void M2Options_SetPIM3 (int value); +EXTERN void M2Options_SetPIM4 (int value); +EXTERN void M2Options_SetFloatValueCheck (int value); +EXTERN void M2Options_SetWholeValueCheck (int value); + +EXTERN int M2Options_GetISO (void); +EXTERN int M2Options_GetPIM (void); +EXTERN int M2Options_GetPIM2 (void); +EXTERN int M2Options_GetPIM3 (void); +EXTERN int M2Options_GetPIM4 (void); +EXTERN int M2Options_GetPositiveModFloor (void); +EXTERN int M2Options_GetFloatValueCheck (void); +EXTERN int M2Options_GetWholeValueCheck (void); + +EXTERN void M2Options_Setc (int value); +EXTERN int M2Options_Getc (void); + +EXTERN void M2Options_SetUselist (int value, const char *filename); +EXTERN void M2Options_SetAutoInit (int value); +EXTERN void M2Options_SetPositiveModFloor (int value); +EXTERN void M2Options_SetNilCheck (int value); +EXTERN void M2Options_SetWholeDiv (int value); +EXTERN void M2Options_SetIndex (int value); +EXTERN void M2Options_SetRange (int value); +EXTERN void M2Options_SetReturnCheck (int value); +EXTERN void M2Options_SetCaseCheck (int value); +EXTERN void M2Options_SetCheckAll (int value); +EXTERN void M2Options_SetExceptions (int value); +EXTERN void M2Options_SetStyle (int value); +EXTERN void M2Options_SetPedantic (int value); +EXTERN void M2Options_SetPedanticParamNames (int value); +EXTERN void M2Options_SetPedanticCast (int value); +EXTERN void M2Options_SetExtendedOpaque (int value); +EXTERN void M2Options_SetVerboseUnbounded (int value); +EXTERN void M2Options_SetXCode (int value); +EXTERN void M2Options_SetCompilerDebugging (int value); +EXTERN void M2Options_SetQuadDebugging (int value); +EXTERN void M2Options_SetDebugTraceQuad (int value); +EXTERN void M2Options_SetDebugTraceAPI (int value); +EXTERN void M2Options_SetSources (int value); +EXTERN void M2Options_SetUnboundedByReference (int value); +EXTERN void M2Options_SetDumpSystemExports (int value); +EXTERN void M2Options_SetOptimizing (int value); +EXTERN void M2Options_SetQuiet (int value); +EXTERN void M2Options_SetCC1Quiet (int value); +EXTERN void M2Options_SetCpp (int value); +EXTERN void M2Options_SetSwig (int value); +EXTERN void M2Options_SetForcedLocation (location_t location); +EXTERN location_t M2Options_OverrideLocation (location_t location); +EXTERN void M2Options_SetStatistics (int on); +EXTERN void M2Options_CppProg (const char *program); +EXTERN void M2Options_CppArg (const char *opt, const char *arg, int joined); +EXTERN void M2Options_SetWholeProgram (int value); +EXTERN void M2Options_FinaliseOptions (void); +EXTERN void M2Options_SetDebugFunctionLineNumbers (int value); +EXTERN void M2Options_SetGenerateStatementNote (int value); +EXTERN int M2Options_GetCpp (void); +EXTERN int M2Options_GetM2g (void); +EXTERN void M2Options_SetM2g (int value); +EXTERN void M2Options_SetLowerCaseKeywords (int value); +EXTERN void M2Options_SetUnusedVariableChecking (int value); +EXTERN void M2Options_SetUnusedParameterChecking (int value); +EXTERN void M2Options_SetStrictTypeChecking (int value); +EXTERN void M2Options_SetWall (int value); +EXTERN void M2Options_SetSaveTemps (int value); +EXTERN void M2Options_SetSaveTempsDir (const char *arg); +EXTERN int M2Options_GetSaveTemps (void); +EXTERN void M2Options_SetScaffoldStatic (int value); +EXTERN void M2Options_SetScaffoldDynamic (int value); +EXTERN void M2Options_SetScaffoldMain (int value); +EXTERN void M2Options_SetRuntimeModuleOverride (const char *override); +EXTERN void M2Options_SetGenModuleList (int value, const char *filename); +EXTERN void M2Options_SetShared (int value); +EXTERN void M2Options_SetB (const char *arg); +EXTERN char *M2Options_GetB (void); + +#undef EXTERN +#endif /* m2options_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2range.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2range.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,40 @@ +/* m2range.h header file for M2Range.mod. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2range_h) +#define m2range_h +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ + +EXTERN tree M2Range_BuildIfCallWholeHandlerLoc (location_t location, + tree condition, + const char *scope, + const char *message); +EXTERN tree M2Range_BuildIfCallRealHandlerLoc (location_t location, + tree condition, + const char *scope, + const char *message); + +#undef EXTERN +#endif /* m2range_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2search.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2search.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,35 @@ +/* m2search.h header file for m2search.c. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2search_h) + +#define m2search_h +#if defined(m2search_h) +#define EXTERN +#else /* !m2search_h. */ +#define EXTERN extern +#endif /* !m2search_h. */ + +#include "dynamicstrings.h" + +EXTERN void M2Search_PrependSearchPath (dynamicstrings_string *s); + +#endif /* m2search_c. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2statement.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2statement.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,111 @@ +/* m2statement.h header file for m2statement.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2statement_h) +#define m2statement_h +#if defined(m2statement_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2statement_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2statement_c. */ + +EXTERN void m2statement_BuildCallInner (location_t location, tree fndecl); +EXTERN void m2statement_BuildEnd (location_t location, tree fndecl, + int nested); +EXTERN tree m2statement_BuildStart (location_t location, char *name, + int inner_module); +EXTERN void m2statement_BuildIncludeVarVar (location_t location, tree type, + tree varset, tree varel, + int is_lvalue, tree low); +EXTERN void m2statement_BuildIncludeVarConst (location_t location, tree type, + tree op1, tree op2, + int is_lvalue, int fieldno); +EXTERN void m2statement_BuildExcludeVarVar (location_t location, tree type, + tree varset, tree varel, + int is_lvalue, tree low); +EXTERN void m2statement_BuildExcludeVarConst (location_t location, tree type, + tree op1, tree op2, + int is_lvalue, int fieldno); +EXTERN void m2statement_BuildUnaryForeachWordDo ( + location_t location, tree type, tree op1, tree op2, + tree (*unop) (location_t, tree, int), int is_op1lvalue, int is_op2lvalue, + int is_op1const, int is_op2const); +EXTERN void m2statement_BuildAsm (location_t location, tree instr, + int isVolatile, int isSimple, tree inputs, + tree outputs, tree trash, tree labels); +EXTERN tree m2statement_BuildFunctValue (location_t location, tree value); +EXTERN tree m2statement_BuildIndirectProcedureCallTree (location_t location, + tree procedure, + tree rettype); +EXTERN tree m2statement_BuildProcedureCallTree (location_t location, + tree procedure, tree rettype); +EXTERN void m2statement_BuildFunctionCallTree (location_t location, + tree procedure, tree rettype); +EXTERN void m2statement_BuildParam (location_t location, tree param); + +EXTERN tree m2statement_BuildIfThenElseEnd (tree condition, tree then_block, + tree else_block); +EXTERN tree m2statement_BuildIfThenDoEnd (tree condition, tree then_block); + +EXTERN void m2statement_DeclareLabel (location_t location, char *name); +EXTERN void m2statement_BuildGoto (location_t location, char *name); +EXTERN tree m2statement_BuildAssignmentTree (location_t location, tree des, + tree expr); +EXTERN void m2statement_BuildAssignmentStatement (location_t location, tree des, + tree expr); +EXTERN void m2statement_BuildPopFunctionContext (void); +EXTERN void m2statement_BuildPushFunctionContext (void); +EXTERN void m2statement_BuildReturnValueCode (location_t location, tree fndecl, + tree value); +EXTERN void m2statement_BuildEndFunctionCode (location_t location, tree fndecl, + int nested); +EXTERN void m2statement_BuildStartFunctionCode (location_t location, + tree fndecl, int isexported, + int isinline); +EXTERN void m2statement_DoJump (location_t location, tree exp, + char *falselabel, char *truelabel); +EXTERN tree m2statement_BuildCall2 (location_t location, tree function, + tree rettype, tree arg1, tree arg2); +EXTERN tree m2statement_BuildCall3 (location_t location, tree function, + tree rettype, tree arg1, tree arg2, + tree arg3); +EXTERN void m2statement_SetLastFunction (tree t); +EXTERN tree m2statement_GetLastFunction (void); +EXTERN void m2statement_SetParamList (tree t); +EXTERN tree m2statement_GetParamList (void); +EXTERN tree m2statement_GetCurrentFunction (void); +EXTERN void m2statement_SetBeginLocation (location_t location); +EXTERN void m2statement_SetEndLocation (location_t location); +EXTERN tree m2statement_GetParamTree (tree call, unsigned int i); +EXTERN tree m2statement_BuildTryFinally (location_t location, tree call, + tree cleanups); +EXTERN tree m2statement_BuildCleanUp (tree param); + +#undef EXTERN +#endif /* m2statement_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2top.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2top.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,44 @@ +/* m2top.h header file for m2top.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2top_h) + +#define m2top_h +#if defined(m2top_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2top_c. */ + +EXTERN void m2top_StartGlobalContext (void); +EXTERN void m2top_EndGlobalContext (void); +EXTERN void m2top_SetFlagUnitAtATime (int b); + +#undef EXTERN +#endif /* m2top_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2tree.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2tree.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,58 @@ +/* m2tree.h header file for m2tree.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2tree_h) +#define m2tree_h +#if defined(m2tree_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* m2tree_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* m2tree_c. */ + +#include "input.h" + +EXTERN int m2tree_is_var (tree var); +EXTERN int m2tree_is_array (tree array); +EXTERN int m2tree_is_type (tree type); +EXTERN tree m2tree_skip_type_decl (tree type); +EXTERN tree m2tree_skip_const_decl (tree exp); +EXTERN int m2tree_IsTreeOverflow (tree value); +EXTERN int m2tree_IsOrdinal (tree type); +EXTERN int m2tree_IsAConstant (tree t); +EXTERN void m2tree_debug_tree (tree t); +EXTERN tree m2tree_skip_reference_type (tree exp); + + +#ifndef SET_WORD_SIZE +/* gross hack. */ +#define SET_WORD_SIZE INT_TYPE_SIZE +#endif /* SET_WORD_SIZE. */ + +#undef EXTERN +#endif /* m2tree_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2treelib.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2treelib.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,66 @@ +/* m2treelib.h header file for m2treelib.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2treelib_h) +#define m2treelib_h +#if defined(m2treelib_c) +#define EXTERN +#else /* !m2treelib_c. */ +#define EXTERN extern +#endif /* !m2treelib_c. */ + +EXTERN void m2treelib_do_jump_if_bit (location_t location, enum tree_code code, + tree word, tree bit, char *label); +EXTERN tree m2treelib_build_modify_expr (location_t location, tree des, + enum tree_code modifycode, tree copy); +EXTERN tree m2treelib_DoCall (location_t location, tree rettype, tree funcptr, + tree param_list); +EXTERN tree m2treelib_DoCall0 (location_t location, tree rettype, + tree funcptr); +EXTERN tree m2treelib_DoCall1 (location_t location, tree rettype, tree funcptr, + tree arg0); +EXTERN tree m2treelib_DoCall2 (location_t location, tree rettype, tree funcptr, + tree arg0, tree arg1); +EXTERN tree m2treelib_DoCall3 (location_t location, tree rettype, tree funcptr, + tree arg0, tree arg1, tree arg2); +EXTERN tree m2treelib_get_rvalue (location_t location, tree t, tree type, + int is_lvalue); +EXTERN tree m2treelib_get_field_no (tree type, tree op, int is_const, + unsigned int fieldNo); +EXTERN tree m2treelib_get_set_value (location_t location, tree p, tree field, + int is_const, int is_lvalue, tree op, + unsigned int fieldNo); +EXTERN tree m2treelib_get_set_address (location_t location, tree op1, + int is_lvalue); +EXTERN tree m2treelib_get_set_field_lhs (location_t location, tree p, + tree field); +EXTERN tree m2treelib_get_set_field_rhs (location_t location, tree p, + tree field); +EXTERN tree m2treelib_get_set_address_if_var (location_t location, tree op, + int is_lvalue, int is_const); +EXTERN tree m2treelib_get_set_field_des (location_t location, tree p, + tree field); + +EXTERN tree add_stmt (location_t location, tree t); +EXTERN tree build_stmt (location_t loc, enum tree_code code, ...); + +#undef EXTERN +#endif /* m2treelib_h. */ diff -ruw /dev/null gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2type.h --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/gcc/m2/gm2-gcc/m2type.h 2022-12-06 02:56:51.344774733 +0000 @@ -0,0 +1,222 @@ +/* m2type.h header file for m2type.cc. + +Copyright (C) 2012-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GNU Modula-2 is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Modula-2; see the file COPYING3. If not see +. */ + +#if !defined(m2type_h) +#define m2type_h +#if defined(m2type_c) +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN +#endif /* !__GNUG__. */ +#else /* !m2type_c. */ +#if defined(__GNUG__) +#define EXTERN extern "C" +#else /* !__GNUG__. */ +#define EXTERN extern +#endif /* !__GNUG__. */ +#endif /* !m2type_c. */ + +typedef void *m2type_Constructor; + +EXTERN int m2type_ValueInTypeRange (tree type, tree value); +EXTERN int m2type_ExceedsTypeRange (tree type, tree low, tree high); +EXTERN int m2type_ValueOutOfTypeRange (tree type, tree value); +EXTERN int m2type_WithinTypeRange (tree type, tree low, tree high); +EXTERN tree m2type_BuildStartArrayType (tree index_type, tree elt_type, + int type); +EXTERN void m2type_PutArrayType (tree array, tree type); +EXTERN tree m2type_BuildEndArrayType (tree arraytype, tree elementtype, + tree indextype, int type); +EXTERN tree m2type_GetArrayNoOfElements (location_t location, tree arraytype); +EXTERN tree m2type_BuildArrayIndexType (tree low, tree high); +EXTERN void m2type_GarbageCollect (void); +EXTERN void m2type_MarkFunctionReferenced (tree f); +EXTERN void m2type_AddStatement (location_t location, tree t); +EXTERN tree m2type_BuildNumberOfArrayElements (location_t location, + tree arrayType); +EXTERN tree m2type_BuildPackedFieldRecord (location_t location, char *name, + tree fieldtype); +EXTERN tree m2type_SetRecordFieldOffset (tree field, tree byteOffset, + tree bitOffset, tree fieldtype, + tree nbits); +EXTERN tree m2type_SetTypePacked (tree node); +EXTERN tree m2type_SetDeclPacked (tree node); +EXTERN tree m2type_SetAlignment (tree node, tree align); +EXTERN tree m2type_BuildEndRecord (location_t location, tree record, + tree fieldlist, int isPacked); +EXTERN tree m2type_AddStringToTreeList (tree list, tree string); +EXTERN tree m2type_ChainOnParamValue (tree list, tree name, tree str, + tree value); +EXTERN tree m2type_ChainOn (tree t1, tree t2); +EXTERN tree m2type_BuildFieldRecord (location_t location, char *name, + tree type); +EXTERN tree m2type_BuildStartFieldRecord (location_t location, char *name, + tree type); +EXTERN tree m2type_BuildEndFieldVarient (location_t location, + tree varientField, tree varientList, + int isPacked); +EXTERN tree m2type_BuildStartFieldVarient (location_t location, char *name); +EXTERN tree m2type_BuildEndVarient (location_t location, tree varientField, + tree varientList, int isPacked); +EXTERN tree m2type_BuildStartVarient (location_t location, char *name); +EXTERN tree m2type_BuildStartUnion (location_t location, char *name); +EXTERN tree m2type_BuildStartRecord (location_t location, char *name); +EXTERN tree m2type_RealToTree (char *name); +EXTERN tree m2type_BuildArrayStringConstructor (location_t location, + tree arrayType, tree str, + tree length); + +#if 0 +EXTERN tree m2type_GetPointerOne (void); +EXTERN tree m2type_GetPointerZero (void); +EXTERN tree m2type_GetWordOne (void); +EXTERN tree m2type_GetWordZero (void); +#endif + +EXTERN tree m2type_GetM2CharType (void); +EXTERN tree m2type_GetM2IntegerType (void); +EXTERN tree m2type_GetM2ShortRealType (void); +EXTERN tree m2type_GetM2RealType (void); +EXTERN tree m2type_GetM2LongRealType (void); +EXTERN tree m2type_GetM2LongIntType (void); +EXTERN tree m2type_GetM2LongCardType (void); +EXTERN tree m2type_GetM2ShortIntType (void); +EXTERN tree m2type_GetShortIntType (void); +EXTERN tree m2type_GetM2ShortCardType (void); +EXTERN tree m2type_GetShortCardType (void); +EXTERN tree m2type_GetISOWordType (void); +EXTERN tree m2type_GetISOByteType (void); +EXTERN tree m2type_GetISOLocType (void); +EXTERN tree m2type_GetM2Integer8 (void); +EXTERN tree m2type_GetM2Integer16 (void); +EXTERN tree m2type_GetM2Integer32 (void); +EXTERN tree m2type_GetM2Integer64 (void); +EXTERN tree m2type_GetM2Cardinal8 (void); +EXTERN tree m2type_GetM2Cardinal16 (void); +EXTERN tree m2type_GetM2Cardinal32 (void); +EXTERN tree m2type_GetM2Cardinal64 (void); +EXTERN tree m2type_GetM2Word16 (void); +EXTERN tree m2type_GetM2Word32 (void); +EXTERN tree m2type_GetM2Word64 (void); +EXTERN tree m2type_GetM2Bitset8 (void); +EXTERN tree m2type_GetM2Bitset16 (void); +EXTERN tree m2type_GetM2Bitset32 (void); +EXTERN tree m2type_GetM2Real32 (void); +EXTERN tree m2type_GetM2Real64 (void); +EXTERN tree m2type_GetM2Real96 (void); +EXTERN tree m2type_GetM2Real128 (void); +EXTERN tree m2type_GetM2Complex32 (void); +EXTERN tree m2type_GetM2Complex64 (void); +EXTERN tree m2type_GetM2Complex96 (void); +EXTERN tree m2type_GetM2Complex128 (void); +EXTERN tree m2type_GetM2ShortComplexType (void); +EXTERN tree m2type_GetM2LongComplexType (void); +EXTERN tree m2type_GetM2ComplexType (void); +EXTERN tree m2type_GetShortCardType (void); +EXTERN tree m2type_GetProcType (void); +EXTERN tree m2type_GetCSizeTType (void); +EXTERN tree m2type_GetCSSizeTType (void); + +EXTERN tree m2type_GetM2CType (void); + +EXTERN tree m2type_GetBitsetType (void); +EXTERN tree m2type_GetM2CardinalType (void); +EXTERN tree m2type_GetWordType (void); +EXTERN tree m2type_GetIntegerType (void); +EXTERN tree m2type_GetCardinalType (void); +EXTERN tree m2type_GetPointerType (void); +EXTERN tree m2type_GetLongIntType (void); +EXTERN tree m2type_GetShortRealType (void); +EXTERN tree m2type_GetLongRealType (void); +EXTERN tree m2type_GetRealType (void); +EXTERN tree m2type_GetBitnumType (void); +EXTERN tree m2type_GetVoidType (void); +EXTERN tree m2type_GetByteType (void); +EXTERN tree m2type_GetCharType (void); +EXTERN tree m2type_GetPackedBooleanType (void); +EXTERN tree m2type_GetBooleanTrue (void); +EXTERN tree m2type_GetBooleanFalse (void); +EXTERN tree m2type_GetBooleanType (void); +EXTERN tree m2type_BuildSmallestTypeRange (location_t location, tree low, + tree high); +EXTERN tree m2type_BuildSetTypeFromSubrange (location_t location, char *name, + tree subrangeType, tree lowval, + tree highval, int ispacked); +EXTERN int m2type_GetBitsPerBitset (void); +EXTERN tree m2type_GetM2RType (void); +EXTERN tree m2type_GetM2ZType (void); + +EXTERN tree m2type_DeclareKnownType (location_t location, char *name, + tree type); +EXTERN tree m2type_GetTreeType (tree type); +EXTERN tree m2type_BuildEndFunctionType (tree func, tree type, + int uses_varargs); +EXTERN tree m2type_BuildStartFunctionType ( + location_t location ATTRIBUTE_UNUSED, char *name ATTRIBUTE_UNUSED); +EXTERN void m2type_InitFunctionTypeParameters (void); +EXTERN tree m2type_BuildVariableArrayAndDeclare (location_t location, + tree elementtype, tree high, + char *name, tree scope); +EXTERN void m2type_InitSystemTypes (location_t location, int loc); +EXTERN void m2type_InitBaseTypes (location_t location); +EXTERN tree m2type_BuildStartType (location_t location, char *name, tree type); +EXTERN tree m2type_BuildEndType (location_t location, tree type); +EXTERN tree m2type_GetDefaultType (location_t location, char *name, tree type); +EXTERN tree m2type_GetMinFrom (location_t location, tree type); +EXTERN tree m2type_GetMaxFrom (location_t location, tree type); +EXTERN void m2type_BuildTypeDeclaration (location_t location, tree type); +EXTERN tree m2type_BuildStartEnumeration (location_t location, char *name, + int ispacked); +EXTERN tree m2type_BuildEndEnumeration (location_t location, tree enumtype, + tree enumvalues); +EXTERN tree m2type_BuildEnumerator (location_t location, char *name, + tree value, tree *enumvalues); +EXTERN tree m2type_BuildPointerType (tree totype); +EXTERN tree m2type_BuildConstPointerType (tree totype); +EXTERN tree m2type_BuildSetType (location_t location, char *name, tree type, + tree lowval, tree highval, int ispacked); +EXTERN void *m2type_BuildStartSetConstructor (tree type); +EXTERN void m2type_BuildSetConstructorElement (void *p, tree value); +EXTERN tree m2type_BuildEndSetConstructor (void *p); +EXTERN void *m2type_BuildStartRecordConstructor (tree type); +EXTERN tree m2type_BuildEndRecordConstructor (void *p); +EXTERN void m2type_BuildRecordConstructorElement (void *p, tree value); +EXTERN void *m2type_BuildStartArrayConstructor (tree type); +EXTERN tree m2type_BuildEndArrayConstructor (void *p); +EXTERN void m2type_BuildArrayConstructorElement (void *p, tree value, + tree indice); +EXTERN tree m2type_BuildCharConstant (location_t location, const char *string); +EXTERN tree m2type_BuildCharConstantChar (location_t location, char ch); +EXTERN tree m2type_BuildSubrangeType (location_t location, char *name, + tree type, tree lowval, tree highval); +EXTERN tree m2type_gm2_unsigned_type (tree type); +EXTERN tree m2type_gm2_signed_type (tree type); +EXTERN tree m2type_gm2_signed_or_unsigned_type (int unsignedp, tree type); +EXTERN tree m2type_gm2_type_for_size (unsigned int bits, int unsignedp); +EXTERN tree m2type_BuildProcTypeParameterDeclaration (location_t location, + tree type, + int isreference); +EXTERN int m2type_IsAddress (tree type); +EXTERN tree m2type_GetCardinalAddressType (void); + +#undef EXTERN +#endif /* m2type_h */