Subversion Repositories tendra.SVN

Rev

Rev 6 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
/*
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific, prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * $Id$
30
 */
31
/*
32
    		 Crown Copyright (c) 1997
33
 
34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
42
 
43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
45
 
46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
49
 
50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
53
 
54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/* 80x86/expmacs.h */
62
 
63
/**********************************************************************
64
$Author: release $
65
$Date: 1998/01/17 15:55:51 $
66
$Revision: 1.1.1.1 $
67
$Log: expmacs.h,v $
68
 * Revision 1.1.1.1  1998/01/17  15:55:51  release
69
 * First version to be checked into rolling release.
70
 *
71
 * Revision 1.15  1997/10/23  09:37:00  pwe
72
 * extra_diags
73
 *
74
 * Revision 1.14  1997/10/10  18:25:07  pwe
75
 * prep ANDF-DE revision
76
 *
77
 * Revision 1.13  1997/04/23  16:24:42  pwe
78
 * added constovf
79
 *
80
 * Revision 1.12  1996/12/13  14:39:24  pwe
81
 * prep NEWDIAGS
82
 *
83
 * Revision 1.11  1996/12/10  15:11:34  pwe
84
 * prep NEWDIAGS
85
 *
86
 * Revision 1.10  1996/02/22  10:03:36  pwe
87
 * sco diag recursive struct (& clearinlined)
88
 *
89
 * Revision 1.9  1995/09/22  16:29:18  pwe
90
 * setoutpar introduced
91
 *
92
 * Revision 1.8  1995/09/05  16:24:48  pwe
93
 * specials and exception changes
94
 *
95
 * Revision 1.7  1995/09/01  17:30:01  pwe
96
 * traps and Build scripts
97
 *
98
 * Revision 1.6  1995/08/30  16:06:30  pwe
99
 * prepare exception trapping
100
 *
101
 * Revision 1.5  1995/08/14  13:53:33  pwe
102
 * several corrections, tail calls and error jumps
103
 *
104
 * Revision 1.4  1995/08/04  08:29:18  pwe
105
 * 4.0 general procs implemented
106
 *
107
 * Revision 1.3  1995/07/07  15:22:16  pwe
108
 * prepare for 4.0, and correct PIC switch
109
 *
110
 * Revision 1.2  1995/01/30  12:56:10  pwe
111
 * Ownership -> PWE, tidy banners
112
 *
113
 * Revision 1.1  1994/10/27  14:15:22  jmf
114
 * Initial revision
115
 *
116
 * Revision 1.1  1994/07/12  14:31:17  jmf
117
 * Initial revision
118
 *
119
**********************************************************************/
120
 
121
#ifndef expmacs_key
122
#define expmacs_key 1
123
 
124
 
125
#define nilexp (exp)0
126
 
127
/* main components of exp */
128
 
129
#define son(x)		((x)->sonf.e)
130
#define bro(x)		((x)->brof.e)
131
#define last(x)		(int)((x)->lastf)
132
#define name(x)		(x)->namef
133
#define sh(x)		(x)->shf
134
#define pt(x)		((x)->ptf.e)
135
#define props(x)	(x) ->propsf
136
#define no(x)		((x)->numf.l)
137
#define parked(x)	((x)->park)
138
#ifdef NEWDIAGS
139
#define dgf(x)		((x)->diagf)
140
#endif
141
 
142
/* alternative components of exp */
143
 
144
#define brog(x)		((x)->brof.glob)
145
#define nostr(x)	((x)->numf.str)
146
#define ptno(x)		((x)->ptf.l)
147
#define sonno(x)	((x)->sonf.l)
148
#define fno(x)		((x)->numf.f)
149
#ifndef NEWDIAGS
150
#define dno(x)		((x)->numf.d)
151
#endif
152
#define uno(x)		((x)->numf.ui)
153
 
154
/* ntests */
155
#define test_number(x)		(ntest)((x)->propsf & 0x1f)
156
#define settest_number(x, t)	(x)->propsf = (prop)(((x)->propsf & 0xe0) | \
157
						     (int)(t))
158
 
159
/* rounding */
160
#define round_number(x)		((x)->propsf >> 3)
161
#define setround_number(x, r)	(x)->propsf = (prop)(((x)->propsf & 0x7) | \
162
						     (r << 3))
163
 
164
/* error handling macros */
165
#define errhandle(x)		((x)->propsf & 0x7)
166
#define optop(x)		((int)errhandle(x) <= 2)
167
#define seterrhandle(x, e)	(x)->propsf = (prop)(((x)->propsf & 0xf8) | \
168
						     (e))
169
 
170
/* properties of constructions with EXCEPTIONS */
171
#define setjmp_dest(r, d)	{(r)->ptf.e = (d); ++no(son(d));}
172
#define isov(x)			(errhandle(x) == 0x4)
173
#define istrap(x)		(((x)->propsf & 0x3) == 0x3)
174
 
175
/* setting macros for components of exp */
176
 
177
#define setbro(x, b)	(x)->brof.e = (b)
178
#define setsh(x, b)	(x)->shf = (b)
179
#define setson(x, b)	(x)->sonf.e = (b)
180
#define setpt(x, b)	(x)->ptf.e = (b)
181
#define setlast(x)	(x)->lastf = 1
182
#define clearlast(x)	(x)->lastf = 0
183
#define setname(x, n)	(x)->namef = (n)
184
#define setfather(f, s)	(s)->brof.e = (f); (s)->lastf = 1
185
 
186
/* components of shapes */
187
#define shape_size(x)	((x)->numf.l)
188
#define shape_align(x)	((x)->brof.ald->al.al_val.al)
189
#define align_of(x)	((x)->brof.ald)
190
#define al1(x)		((x)->sonf.ald->al.al_val.al)
191
#define al1_of(x)	((x)->sonf.ald)
192
#define al2(x)		((x)->ptf.ald->al.al_val.al)
193
#define al2_of(x)	((x)->ptf.ald)
194
#define is_signed(x)	(int)((x)->lastf)
195
 
196
#define frame_al_of_ptr(x)	(x)->sonf.ald->al.al_val.al_frame
197
#define frame_al1_of_offset(x)	(x)->sonf.ald->al.al_val.al_frame
198
#define al_includes_vcallees 16
199
#define al_includes_caller_args 6
200
 
201
 
202
/* properties of IDENT_TAG */
203
 
204
 
205
#define setvar(e)	props(e) = (prop)(props(e) | 0x01)
206
  /* sets the property of a declaration to isvar (is a variable)*/
207
#define clearvar(e)	props(e) = (prop)(props(e) & ~0x01)
208
  /* sets the property of a declaration to !isvar */
209
#define setid(e)	props(e) = (prop)(props(e) & ~0x01)
210
  /* sets the property of a declaration to !isvar */
211
#define isvar(e)	(props(e) & 0x01)
212
  /* tests the property of a declaration as above */
213
 
214
#define setvis(e)	props(e) = (prop)(props(e) | 0x02)
215
  /* sets the property of a declaration to in memory */
216
#define isvis(e)	(props(e) & 0x02)
217
  /* tests if a declaration is to be in memory */
218
 
219
#define setenvoff(e)	props(e) = (prop)(props(e) | 0x04)
220
  /* sets the property of a declaration to visible */
221
#define isenvoff(e)	(props(e) & 0x04)
222
  /* tests if a declaration is to be visible */
223
 
224
#define setcaonly(e)	props(e) = (prop)(props(e) | 0x08)
225
  /* sets the property of a variable declaration to show that it is only
226
     operated on by contents and assign operations */
227
#define clearcaonly(e)	props(e) = (prop)(props(e) & ~0x08)
228
#define iscaonly(e)	(props(e) & 0x08)
229
  /* tests the above property */
230
 
231
#define setusereg(e)	props(e) = (prop)(props(e) | 0x10)
232
  /* sets the property of a declaration to recommend the use of
233
     a register */
234
#define isusereg(e)	(props(e) & 0x10)
235
  /* tests a declaration for a register recommendation */
236
#define clearusereg(e)	props(e) = (prop)(props(e) & ~0x10)
237
 
238
#define setparam(x)	props(x) = (prop)(props(x) | 0x20)
239
#define clearparam(x)	props(x) = (prop)(props(x) & ~0x20)
240
#define isparam(x)	(props(x) & 0x20)
241
 
242
#define setglob(e)	props(e) = (prop)(props(e) | 0x40)
243
  /* sets property of declaration to be global, in this case
244
     bro(e) will be the index of the declaration */
245
#define clearglob(e)	props(e) &= ~0x40
246
#define isglob(e)	(props(e) & 0x40)
247
  /* tests the above property */
248
 
249
#define setcopy(e)	props(e) = (prop)(props(e) | 0x80)
250
  /* set a flag used during copy : also used for LABST_TAG */
251
#define clearcopy(e)	props(e) = (prop)(props(e) & ~0x80)
252
  /* clear a flag used during copy */
253
#define copying(e)	(props(e) & 0x80)
254
  /* test the flag used during copying */
255
 
256
/* Set in weights and used in coder. At this time no copying */
257
#define set_intnl_call(x)	props(x) = (prop)(props(x) | 0x80)
258
#define has_intnl_call(x)	(props(x) & 0x80)
259
 
260
/* variable has had the no-sign-extension opt. (80x86 only) */
261
#define setse_opt(x)	props(x) = (prop)(props(x) | 0x400)
262
#define isse_opt(x)	(props(x) & 0x400)
263
 
264
#define setinlined(x)	props(x) = (prop)(props(x) | 0x200)
265
#define isinlined(x)	(props(x) & 0x200)
266
#define clearinlined(x)	props(x) &= ~0x200
267
 
268
/* variable is used both as byte and long (80x86 only) */
269
#define setbyteuse(x)	props(x) = (prop)(props(x) | 0x800)
270
#define isbyteuse(x)	(props(x) & 0x800)
271
 
272
/* parameter used for output (needs only to be in memory for 80x86) */
273
#define setoutpar(x)	setvis(x)
274
#define isoutpar(x)	isvis(x)
275
#define clearoutpar(x)
276
 
277
/* properties of PROC_TAG construction */
278
 
279
#define set_struct_res(x)	props(x) = (prop)(props(x) | 0x1)
280
#define has_struct_res(x)	(props(x) & 0x1)
281
 
282
#define set_loc_address(x)	props(x) = (prop)(props(x) | 0x2)
283
#define loc_address(x)		(props(x) & 0x2)
284
 
285
#define set_proc_has_setjmp(x)	props(x) = (prop)(props(x) | 0x4)
286
#define proc_has_setjmp(x)	(props(x) & 0x4)
287
 
288
#define set_proc_has_alloca(x)	props(x) = (prop)(props(x) | 0x8)
289
#define proc_has_alloca(x)	(props(x) & 0x8)
290
 
291
#define set_proc_has_lv(x)	props(x) = (prop)(props(x) | 0x10)
292
#define proc_has_lv(x)		(props(x) & 0x10)
293
 
294
#define isrecursive(x)		(props(x) & 0x20)
295
#define setrecursive(x)		props(x) = (prop)(props(x) | 0x20)
296
 
297
#define set_proc_uses_crt_env(x)	props(x) = (prop)(props(x) | 0x40)
298
#define proc_uses_crt_env(x)		(props(x) & 0x40)
299
 
300
#define set_proc_uses_external(x)	props(x) = (prop)(props(x) | 0x80)
301
#define proc_uses_external(x)		(props(x) & 0x80)
302
 
303
	/* used for diags, after code production */
304
#define set_proc_has_fp(x)	props(x) = (prop)(props(x) | 0x100)
305
#define clear_proc_has_fp(x)	props(x) &= ~0x100
306
#define proc_has_fp(x)		(props(x) & 0x100)
307
 
308
 
309
/*set property of SOLVE_TAG construction */
310
#define setcrtsolve(x)	props(x) =1
311
 
312
/* properties of pt of REP_TAG and SOLVE_TAG during copy */
313
#define set_copying_solve(x)	props(x) = (prop)(props(x) | 1)
314
#define clear_copying_solve(x)	props(x) = (prop)(props(x) & ~0x01)
315
 
316
/* properties of MOVECONT_TAG construction */
317
#define setnooverlap(x)	props(x) = (prop)(props(x) | 0x01)
318
#define isnooverlap(x)	(props(x) & 0x01)
319
 
320
/* properties of CONT_TAG construction */
321
#define set_propagate(x)	props(x) = (prop)(props(x) | 0x1)
322
#define to_propagate(x)		(props(x) & 0x1)
323
#define clear_propagate(x)	props(x) = (prop)(props(x) & ~0x01)
324
 
325
/* various properties of LABST_TAG construction are used in exp.c */
326
#define set_loaded_lv(x)	props(x) = (prop)(props(x) | 0x10)
327
#define is_loaded_lv(x)		(props(x) & 0x10)
328
#define setunroll(x)		props(x) = (prop)(props(x) | 0x04)
329
#define clearunroll(x)		props(x) = (prop)(props(x) & ~0x04)
330
#define isunroll(x)		(props(x) & 0x04)
331
	/* see also setcopy */
332
#define set_dg_labmark(x)	props(x) = (prop)(props(x) | 0x800)
333
#define dg_labmark(x)		(props(x) & 0x800)
334
#define clear_dg_labmark(x)	props(x) = (prop)(props(x) & ~0x800)
335
 
336
/* properties of NAME_TAG construction */
337
#define setlastuse(x)	props(x) = (prop)(props(x) | 0x01)
338
#define islastuse(x)	(props(x) & 0x01)
339
 
340
#define setloadparam(x)	props(x) = (prop)(props(x) | 0x02)
341
#define isloadparam(x)	(props(x) & 0x02)
342
 
343
#define setreallyass(x)	props(x) = (prop)(props(x) | 0x04)
344
#define isreallyass(x)	(props(x) & 0x04)
345
 
346
#ifdef NEWDIAGS
347
#define setisdiaginfo(x)	props(x) = (prop)(props(x) | 0x08)
348
#define isdiaginfo(x)		(props(x) & 0x08)
349
 
350
#define setdiscarded(x)	props(x) = (prop)(props(x) | 0x10)
351
#define isdiscarded(x)	(props(x) & 0x10)
352
#endif
353
 
354
/* properties of STRING_TAG construction */
355
#define string_char_size(e)	props(e)
356
 
357
/* properties of VAL_TAG construction */
358
#define setbigval(x)	props(x) = (prop)(props(x) | 0x01)
359
#define clearbigval(x)	props(x) = (prop)(props(x) & ~0x01)
360
#define isbigval(x)	(props(x) & 0x01)
361
 
362
#define setconstovf(x)	props(x) = (prop)(props(x) | 0x02)
363
#define constovf(x)	(props(x) & 0x02)
364
 
365
/* properties of REP_TAG construction */
366
#define setunrolled(x)	props(x) = (prop)(props(x) | 0x01)
367
#define isunrolled(x)	(props(x) & 0x01)
368
 
369
/* properties of APPLY_TAG construction */
370
#define settoinline(x)	props(x) = (prop)(props(x) | 0x01)
371
#define istoinline(x)	(props(x) & 0x01)
372
 
373
#define setbuiltin(x)	props(x) = (prop)(props(x) | 0x8000)
374
#define builtinproc(x)	(props(x) & 0x8000)	/* trans386 special */
375
 
376
/* properties of ASM construction */
377
#define asm_string(x)	(props(x) & 0x01)
378
#define asm_in(x)	(props(x) & 0x02)
379
#define asm_out(x)	(props(x) & 0x04)
380
#define asm_ptr(x)	(props(x) & 0x08)
381
#define asm_var(x)	(props(x) & 0x0c)	/* out | ptr */
382
 
383
/* properties of alloca constructions */
384
#define set_checkalloc(x)	props(x) |= 1;
385
#define checkalloc(x)		(props(x) & 1)
386
 
387
 
388
/* properties of jump record */
389
 
390
#define fstack_pos_of(x)	(x)->propsf
391
 
392
 
393
#define set_callee(id)			setname(son(id), formal_callee_tag)
394
#define set_make_procprops(e, p)	props(e) |= ((p) <<8)
395
#define proc_has_vcallees(e)		(props(e) & 0x200)
396
#define postlude_has_call(e)		(props(e) & 1)
397
#define call_has_vcallees(e)		(props(e) & 2)
398
#define proc_has_checkstack(e)		(props(e) & 0x800)
399
#define proc_has_vcallers(e)		(props(e) & 0x100)
400
#define proc_has_nolongj(e)		(props(e) & 0x1000)
401
 
402
#define set_proc_needs_envsize(x)	props(x) = (prop)(props(x) | 0x8000)
403
#define proc_needs_envsize(x)		(props(x) & 0x8000)
404
 
405
#define call_is_untidy(e)		(props(bro(son(e))) & 4)
406
#define call_has_checkstack(e)		(props(bro(son(e))) & 8)
407
 
408
 
409
/* rounding for alignment */
410
 
411
#define rounder(n,a)	(((n) + (a) - 1) / (a)) * (a)
412
 
413
#define align32	(32)
414
#define align16	(16)
415
#define align8	(8)
416
#define align1	(1)
417
 
418
#define size64	(64)
419
#define size32	(32)
420
#define size16	(16)
421
#define size8	(8)
422
 
423
#endif
424
 
425