]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-compiler/M2GenGCC.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / M2GenGCC.def
1 (* M2GenGCC.def convert the quadruples into GCC trees.
2
3 Copyright (C) 2001-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
21
22 DEFINITION MODULE M2GenGCC ;
23
24 (*
25 Title : M2GenGCC
26 Author : Gaius Mulley
27 System : UNIX (gm2)
28 Date : Fri Jul 9 13:05:13 1999
29 Last edit : Fri Jul 9 13:05:13 1999
30 Description: provides an interface to GCC, essentially convert the
31 internal quadruples of m2f into a GCC tree structure.
32 *)
33
34 FROM M2GCCDeclare IMPORT WalkAction ;
35 FROM m2tree IMPORT Tree ;
36 FROM m2linemap IMPORT location_t ;
37 EXPORT QUALIFIED ConvertQuadsToTree, ResolveConstantExpressions,
38 GetHighFromUnbounded, StringToChar,
39 LValueToGenericPtr, ZConstToTypedConst,
40 PrepareCopyString ;
41
42
43 (*
44 ConvertQuadsToTree - runs through the quadruple list, Start..End, and converts it into
45 the GCC tree structure.
46 *)
47
48 PROCEDURE ConvertQuadsToTree (Scope: CARDINAL; Start, End: CARDINAL) ;
49
50
51 (*
52 ResolveConstantExpressions - resolves constant expressions from the quadruple list.
53 It returns TRUE if one or more constants were folded.
54 When a constant symbol value is solved, the call back
55 p(sym) is invoked.
56 *)
57
58 PROCEDURE ResolveConstantExpressions (p: WalkAction; start, end: CARDINAL) : BOOLEAN ;
59
60
61 (*
62 GetHighFromUnbounded - returns a Tree containing the value of
63 param.HIGH.
64 *)
65
66 PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : Tree ;
67
68
69 (*
70 StringToChar - if type=Char and str is a string (of size <= 1)
71 then convert the string into a character constant.
72 *)
73
74 PROCEDURE StringToChar (t: Tree; type, str: CARDINAL) : Tree ;
75
76
77 (*
78 LValueToGenericPtr - returns a Tree representing symbol, sym.
79 It coerces a lvalue into an internal pointer type
80 *)
81
82 PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : Tree ;
83
84
85 (*
86 ZConstToTypedConst - checks whether op1 and op2 are constants and
87 coerces, t, appropriately.
88 *)
89
90 PROCEDURE ZConstToTypedConst (t: Tree; op1, op2: CARDINAL) : Tree ;
91
92
93 (*
94 PrepareCopyString - returns two trees:
95 length number of bytes to be copied (including the nul if room)
96 srcTreeType the new string type (with the extra nul character).
97
98 Pre condition: destStrType the dest type string.
99 src is the original string (without a nul)
100 to be copied.
101 Post condition: TRUE or FALSE is returned.
102 if true length and srcTreeType will be assigned
103 else length is set to the maximum length to be
104 copied and srcTree is set to the max length
105 which fits in dest.
106 *)
107
108 PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: Tree;
109 src, destStrType: CARDINAL) : BOOLEAN ;
110
111
112 END M2GenGCC.