Debian Codegraph @

gcc/m2/gm2-compiler/M2GCCDeclare.def

raw
1 (* M2GCCDeclare.def declares Modula-2 types to GCC.
2
3 Copyright (C) 2001-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
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 M2GCCDeclare ;
23
24 (*
25 Title : M2GCCDeclare
26 Author : Gaius Mulley
27 System : UNIX (gm2)
28 Date : Sat Jul 17 10:28:43 1999
29 Description: declares Modula-2 types to GCC,
30 only declares a type once all subcomponents are known.
31 *)
32
33 FROM SYSTEM IMPORT WORD ;
34 FROM gcctypes IMPORT tree ;
35 FROM M2BasicBlock IMPORT BasicBlock ;
36
37 TYPE
38 WalkAction = PROCEDURE (WORD) ;
39 IsAction = PROCEDURE (WORD) : BOOLEAN ;
40
41
42 (*
43 FoldConstants - a wrapper for ResolveConstantExpressions.
44 *)
45
46 PROCEDURE FoldConstants (bb: BasicBlock) ;
47
48
49 (*
50 StartDeclareScope - declares types, variables associated with this scope.
51 *)
52
53 PROCEDURE StartDeclareScope (scope: CARDINAL) ;
54
55
56 (*
57 EndDeclareScope -
58 *)
59
60 PROCEDURE EndDeclareScope ;
61
62
63 (*
64 DeclareParameters -
65 *)
66
67 PROCEDURE DeclareParameters (sym: CARDINAL) ;
68
69
70 (*
71 DeclareConstant - if, sym, is a constant then declare it.
72 The constant must be solvable at this point.
73 *)
74
75 PROCEDURE DeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;
76
77
78 (*
79 DeclareConstructor - if, sym, is a constructor then declare it.
80 The constructor must be solvable at this point.
81 *)
82
83 PROCEDURE DeclareConstructor (tokenno: CARDINAL; quad: CARDINAL; sym: CARDINAL) ;
84
85
86 (*
87 TryDeclareConstant - try and declare a constant. If, sym, is a
88 constant try and declare it, if we cannot
89 then enter it into the to do list.
90 *)
91
92 PROCEDURE TryDeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;
93
94
95 (*
96 TryDeclareType - try and declare a type. If sym is a
97 type try and declare it, if we cannot
98 then enter it into the to do list.
99 *)
100
101 PROCEDURE TryDeclareType (type: CARDINAL) ;
102
103
104 (*
105 TryDeclareConstructor - try and declare a constructor. If, sym, is a
106 constructor try and declare it, if we cannot
107 then enter it into the to do list.
108 *)
109
110 PROCEDURE TryDeclareConstructor (tokenno: CARDINAL; sym: CARDINAL) ;
111
112
113 (*
114 DeclareLocalVariables - lists the Local variables for procedure
115 together with their offset.
116 *)
117
118 PROCEDURE DeclareLocalVariables (procedure: CARDINAL) ;
119
120
121 (*
122 DeclareLocalVariable - declare a local variable var.
123 *)
124
125 PROCEDURE DeclareLocalVariable (var: CARDINAL) ;
126
127
128 (*
129 DeclareProcedure - declares procedure, sym, or all procedures inside
130 module sym.
131 *)
132
133 PROCEDURE DeclareProcedure (sym: WORD) ;
134
135
136 (*
137 DeclareModuleVariables - declares Module variables for a module
138 which inside a procedure.
139 *)
140
141 PROCEDURE DeclareModuleVariables (sym: CARDINAL) ;
142
143
144 (*
145 IsProcedureGccNested - returns TRUE if procedure, sym, will be considered
146 as nested by GCC.
147 This will occur if either its outer defining scope
148 is a procedure or is a module which is inside a
149 procedure.
150 *)
151
152 PROCEDURE IsProcedureGccNested (sym: CARDINAL) : BOOLEAN ;
153
154
155 (*
156 PoisonSymbols - poisons all gcc symbols from procedure, sym.
157 A debugging aid.
158 *)
159
160 PROCEDURE PoisonSymbols (sym: CARDINAL) ;
161
162
163 (*
164 PromoteToString - declare, sym, and then promote it to a string.
165 Note that if sym is a single character we do
166 *not* record it as a string
167 but as a char however we always
168 return a string constant.
169 *)
170
171 PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
172
173
174 (*
175 PromoteToCString - declare, sym, and then promote it to a string.
176 Note that if sym is a single character we do
177 *not* record it as a string
178 but as a char however we always
179 return a string constant.
180 *)
181
182 PROCEDURE PromoteToCString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
183
184
185 (*
186 CompletelyResolved - returns TRUE if a symbol has been completely resolved
187 and is not partially declared (such as a record,
188 array or procedure type).
189 *)
190
191 PROCEDURE CompletelyResolved (sym: CARDINAL) : BOOLEAN ;
192
193
194 (*
195 ConstantKnownAndUsed -
196 *)
197
198 PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: tree) ;
199
200
201 (*
202 PutToBeSolvedByQuads - places, sym, in this list.
203 *)
204
205 PROCEDURE PutToBeSolvedByQuads (sym: CARDINAL) ;
206
207
208 (*
209 MarkExported - tell GCC to mark all exported procedures in module sym.
210 *)
211
212 PROCEDURE MarkExported (sym: CARDINAL) ;
213
214
215 (*
216 GetTypeMin - returns a symbol corresponding to MIN(type)
217 *)
218
219 PROCEDURE GetTypeMin (type: CARDINAL) : CARDINAL ;
220
221
222 (*
223 GetTypeMax - returns a symbol corresponding to MAX(type)
224 *)
225
226 PROCEDURE GetTypeMax (type: CARDINAL) : CARDINAL ;
227
228
229 (*
230 PrintSym - prints limited information about a symbol.
231 *)
232
233 PROCEDURE PrintSym (sym: CARDINAL) ;
234
235
236 (*
237 IncludeDumpSymbol - include sym into the watch list and all syms dependants.
238 *)
239
240 PROCEDURE IncludeDumpSymbol (sym: CARDINAL) ;
241
242
243 (*
244 DumpFilteredResolver - dumps the gimple or tree representation of all watched symbols.
245 *)
246
247 PROCEDURE DumpFilteredResolver ;
248
249
250 (*
251 DumpFilteredDefinitive - dumps the gimple or tree representation of all watched symbols.
252 *)
253
254 PROCEDURE DumpFilteredDefinitive ;
255
256
257 (*
258 InitDeclarations - initializes default types and the source filename.
259 *)
260
261 PROCEDURE InitDeclarations ;
262
263
264 END M2GCCDeclare.