]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-gcc/m2statement.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-gcc / m2statement.def
1 (* m2statement.def definition module for m2statement.cc.
2
3 Copyright (C) 2011-2023 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 FOR "C" m2statement ;
23
24
25 FROM SYSTEM IMPORT ADDRESS ;
26 FROM m2tree IMPORT Tree ;
27 FROM m2linemap IMPORT location_t ;
28 FROM m2expr IMPORT BuildUnarySetFunction ;
29
30
31 (*
32 DoJump - jump to the appropriate label depending whether
33 result of the expression is TRUE or FALSE.
34 *)
35
36 PROCEDURE DoJump (location: location_t; exp: Tree; falselabel: ADDRESS; truelabel: ADDRESS) ;
37
38
39 (*
40 BuildStartFunctionCode - generate function entry code.
41 *)
42
43 PROCEDURE BuildStartFunctionCode (location: location_t; fndecl: Tree; isexported: BOOLEAN; isinline: BOOLEAN) ;
44
45
46 (*
47 BuildEndFunctionCode - generates the function epilogue.
48 *)
49
50 PROCEDURE BuildEndFunctionCode (location: location_t; fndecl: Tree; nested: BOOLEAN) ;
51
52
53 (*
54 BuildReturnValueCode - generates the code associated with: RETURN( value )
55 *)
56
57 PROCEDURE BuildReturnValueCode (location: location_t; fndecl: Tree; value: Tree) ;
58
59
60 (*
61 BuildPushFunctionContext - pushes the current function context.
62 Maps onto push_function_context in ../function.c
63 *)
64
65 PROCEDURE BuildPushFunctionContext ;
66
67
68 (*
69 BuildPopFunctionContext - pops the current function context.
70 Maps onto pop_function_context in ../function.c
71 *)
72
73 PROCEDURE BuildPopFunctionContext ;
74
75
76 (*
77 BuildAssignmentTree - builds the assignment of, des, and, expr.
78 It returns, des.
79 *)
80
81 PROCEDURE BuildAssignmentTree (location: location_t; des, expr: Tree) : Tree ;
82
83
84 (*
85 BuildAssignmentStatement builds the assignment of, des, and, expr.
86 *)
87
88 PROCEDURE BuildAssignmentStatement (location: location_t; des, expr: Tree) ;
89
90
91 (*
92 BuildGoto - builds a goto operation.
93 *)
94
95 PROCEDURE BuildGoto (location: location_t; name: ADDRESS) ;
96
97
98 (*
99 DeclareLabel - create a label, name.
100 *)
101
102 PROCEDURE DeclareLabel (location: location_t; name: ADDRESS) ;
103
104
105 (*
106 BuildIfThenDoEnd - returns a tree which will only execute
107 statement, s, if, condition, is true.
108 *)
109
110 PROCEDURE BuildIfThenDoEnd (condition: Tree; then_block: Tree) : Tree ;
111
112
113 (*
114 BuildIfThenElseEnd - returns a tree which will execute
115 then_block or else_block depending upon,
116 condition.
117 *)
118
119 PROCEDURE BuildIfThenElseEnd (condition: Tree; then_block: Tree; else_block: Tree) : Tree ;
120
121
122 (*
123 BuildParam - build a list of parameters, ready for a subsequent procedure call.
124 *)
125
126 PROCEDURE BuildParam (location: location_t; param: Tree) ;
127
128
129 (*
130 BuildFunctionCallTree - creates a procedure function call from
131 a procedure and parameter list and the
132 return type, rettype. No tree is returned
133 as the tree is held in the last_function
134 global variable. It is expected the
135 BuildFunctValue is to be called after
136 a call to BuildFunctionCallTree.
137 *)
138
139 PROCEDURE BuildFunctionCallTree (location: location_t; procedure: Tree; rettype: Tree) ;
140
141
142 (*
143 BuildProcedureCallTree - creates a procedure call from a procedure and
144 parameter list and the return type, rettype.
145 *)
146
147 PROCEDURE BuildProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ;
148
149
150 (*
151 BuildIndirectProcedureCallTree - creates a procedure call from a procedure and
152 parameter list and the return type, rettype.
153 *)
154
155 PROCEDURE BuildIndirectProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ;
156
157
158 (*
159 BuildFunctValue - generates code for value := last_function(foobar);
160 *)
161
162 PROCEDURE BuildFunctValue (location: location_t; value: Tree) : Tree ;
163
164
165 (*
166 BuildCall2 - builds a tree representing: function(arg1, arg2).
167 *)
168
169 PROCEDURE BuildCall2 (location: location_t;
170 function, rettype, arg1, arg2: Tree) : Tree ;
171
172
173 (*
174 BuildCall3 - builds a tree representing: function(arg1, arg2, arg3).
175 *)
176
177 PROCEDURE BuildCall3 (location: location_t;
178 function, rettype, arg1, arg2, arg3: Tree) : Tree ;
179
180
181 (*
182 SetLastFunction - set the last_function to, t.
183 *)
184
185 PROCEDURE SetLastFunction (t: Tree) ;
186
187
188 (*
189 GetLastFunction - returns, last_function.
190 *)
191
192 PROCEDURE GetLastFunction () : Tree ;
193
194
195 (*
196 GetParamTree - return parameter, i.
197 *)
198
199 PROCEDURE GetParamTree (call: Tree; i: CARDINAL) : Tree ;
200
201
202 (*
203 BuildTryFinally - returns a TRY_FINALL_EXPR with the call and cleanups
204 attached.
205 *)
206
207 PROCEDURE BuildTryFinally (location: location_t; call: Tree; cleanups: Tree) : Tree ;
208
209
210 (*
211 BuildCleanUp - return a CLEANUP_POINT_EXPR which will clobber, param.
212 *)
213
214 PROCEDURE BuildCleanUp (param: Tree) : Tree ;
215
216
217 (*
218 BuildAsm - generates an inline assembler instruction.
219 *)
220
221 PROCEDURE BuildAsm (location: location_t; instr: Tree;
222 isVolatile: BOOLEAN; isSimple: BOOLEAN;
223 inputs: Tree; outputs: Tree; trash: Tree; labels: Tree) ;
224
225
226 (*
227 BuildUnaryForeachWordDo - provides the large set operators.
228 Each word (or less) of the set can be
229 calculated by unop.
230 This procedure iterates over each word
231 of the large set invoking the unop.
232 *)
233
234 PROCEDURE BuildUnaryForeachWordDo (location: location_t; type: Tree; op1: Tree; op2: Tree;
235 unop: BuildUnarySetFunction;
236 is_op1lvalue, is_op2lvalue, is_op1const, is_op2const: BOOLEAN) ;
237
238
239 (*
240 BuildExcludeVarConst - builds the EXCL(op1, 1<<op2) operation for a small sets. Large
241 sets call this routine to exclude the bit in the particular word.
242 op2 is a constant.
243 *)
244
245 PROCEDURE BuildExcludeVarConst (location: location_t; type: Tree; op1: Tree; op2: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
246
247
248 (*
249 BuildExcludeVarVar - builds the EXCL(varset, 1<<varel) operation for a small and large sets.
250 varel is a variable.
251 *)
252
253 PROCEDURE BuildExcludeVarVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree) ;
254
255
256 (*
257 BuildIncludeVarConst - builds the INCL(op1, 1<<op2) operation for a small sets. Large
258 sets call this routine to include the bit in the particular word.
259 op2 is a constant.
260 *)
261
262 PROCEDURE BuildIncludeVarConst (location: location_t; type: Tree; op1: Tree; op2: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
263
264
265 (*
266 BuildIncludeVarVar - builds the INCL(varset, 1<<varel) operation for a small and large sets.
267 op2 is a variable.
268 *)
269
270 PROCEDURE BuildIncludeVarVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree) ;
271
272
273 (*
274 BuildStart - creates a module initialization function. We make
275 this function public if it is not an inner module.
276 The linker will create a call list for all linked
277 modules which determines the initialization
278 sequence for all modules.
279 *)
280
281 PROCEDURE BuildStart (location: location_t; name: ADDRESS; inner_module: BOOLEAN) : Tree ;
282
283
284 (*
285 BuildEnd - complete the initialisation function for this module.
286 *)
287
288 PROCEDURE BuildEnd (location: location_t; fndecl: Tree; nested: BOOLEAN) ;
289
290
291 (*
292 BuildCallInner - call the inner module function. It has no parameters and no return value.
293 *)
294
295 PROCEDURE BuildCallInner (location: location_t; fndecl: Tree) ;
296
297
298 (*
299 SetBeginLocation - sets the begin location for the function to obtain good debugging info.
300 *)
301
302 PROCEDURE SetBeginLocation (location: location_t) ;
303
304
305 (*
306 SetEndLocation - sets the end location for the function to obtain good debugging info.
307 *)
308
309 PROCEDURE SetEndLocation (location: location_t) ;
310
311
312 END m2statement.