Subversion Repositories tendra.SVN

Rev

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

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*
32
$Log: expmacs.h,v $
33
 * Revision 1.1.1.1  1998/01/17  15:56:02  release
34
 * First version to be checked into rolling release.
35
 *
36
 * Revision 1.3  1997/08/04  14:44:53  wfs
37
 * "PROPERTIES OF VAL_TAG CONSTRUCT" insert as requested by PWE
38
 *
39
 * Revision 1.2  1995/12/18  13:11:12  wfs
40
 * Put hppatrans uder cvs control. Major Changes made since last release
41
 * include:
42
 * (i) PIC code generation.
43
 * (ii) Profiling.
44
 * (iii) Dynamic Initialization.
45
 * (iv) Debugging of Exception Handling and Diagnostics.
46
 *
47
 * Revision 5.2  1995/09/26  13:07:27  wfs
48
 * *** empty log message ***
49
 *
50
 * Revision 5.1  95/09/23  18:36:35  18:36:35  wfs
51
 * Added the "outpar" macros.
52
 * 
53
 * Revision 5.0  1995/08/25  13:42:58  wfs
54
 * Preperation for August 25 Glue release
55
 *
56
 * Revision 3.4  1995/08/25  11:12:16  wfs
57
 * *** empty log message ***
58
 *
59
 * Revision 3.4  1995/08/25  11:12:16  wfs
60
 * *** empty log message ***
61
 *
62
 * Revision 3.1  95/04/10  16:26:09  16:26:09  wfs (William Simmonds)
63
 * Apr95 tape version.
64
 * 
65
 * Revision 3.0  95/03/30  11:16:54  11:16:54  wfs (William Simmonds)
66
 * Mar95 tape version with CRCR95_178 bug fix.
67
 * 
68
 * Revision 2.0  95/03/15  15:25:44  15:25:44  wfs (William Simmonds)
69
 * spec 3.1 changes implemented, tests outstanding.
70
 * 
71
 * Revision 1.3  95/01/23  18:33:50  18:33:50  wfs (William Simmonds)
72
 * corrected bug in setjmp_dest macro
73
 * 
74
 * Revision 1.2  95/01/19  15:33:43  15:33:43  wfs (William Simmonds)
75
 * Changed definition of isov macro.
76
 * 
77
 * Revision 1.1  95/01/11  13:37:40  13:37:40  wfs (William Simmonds)
78
 * Initial revision
79
 * 
80
*/
81
 
82
 
83
#ifndef EXPMACS_INCLUDED
84
#define EXPMACS_INCLUDED
85
 
86
#include "bitsmacs.h"
87
 
88
/*
89
    THE NIL EXPRESSION
90
*/
91
 
92
#define nilexp				null
93
 
94
 
95
/*
96
    MAIN COMPONENTS OF AN EXPRESSION
97
*/
98
 
99
 
100
 
101
#define son( x )			( ( x )->sonf.e )
102
#define bro( x )			( ( x )->brof.e )
103
#define last( x )			( ( x )->lastf )
104
#define name( x )                       ( ( x )->namef )
105
#define sh( x )				( ( x )->shf )
106
#define pt( x )				( ( x )->ptf.e )
107
#define props( x )			( ( x )->propsf )
108
#define no( x )				( ( x )->numf.l )
109
#define parked( x )			( ( x )->park )
110
 
111
#define setse_opt(x) props(x) = (prop)(props(x) | 0x400)
112
#define isse_opt(x) (props(x) & 0x400)
113
 
114
/*
115
    ALTERNATIVE COMPONENTS OF AN EXPRESSION
116
*/
117
 
118
#define brog( x )			( ( x )->brof.glob )
119
#define nostr( x )			( ( x )->numf.str )
120
#define ptno( x )			( ( x )->ptf.l )
121
#define sonno( x )			( ( x )->sonf.l )
122
#define fno( x )			( ( x )->numf.f )
123
#define dno( x )			( ( x )->numf.d )
124
#define uno( x )			( ( x )->numf.ui )
125
 
126
 
127
/*
128
    MACROS FOR SETTING COMPONENTS OF AN EXPRESSION
129
*/
130
 
131
#define setbro( x, b )			bro ( x ) = ( b )
132
#define setsh( x, b )			sh ( x ) = ( b )
133
#define setson( x, b )			son ( x ) = ( b )
134
#define setpt( x, b )			pt ( x ) = ( b )
135
#define setlast( x )			last ( x ) = 1 
136
#define clearlast( x )			last ( x ) = 0 
137
#define setname( x, n )			name ( x ) = ( n )
138
#define setfather( f, s )		setbro ( s, f ) ; setlast ( s )
139
#define setbyteuse(x)                   props(x) = (prop)(props(x) | 0x800)
140
 
141
/*
142
    COMPONENTS OF SHAPES
143
*/
144
 
145
#define shape_size( x )			( ( x )->numf.l )
146
#define al2ul( x )			( ( unsigned long )\
147
					 ( ( x )->al.al_val.al ) )
148
#define align_of( x )			( ( x )->brof.ald )
149
#define shape_align( x )		al2ul ( align_of ( x ) )
150
#define al1_of( x )			( ( x )->sonf.ald )
151
#define al1( x )			al2ul ( al1_of ( x ) )
152
#define al2_of( x )			( ( x )->ptf.ald )
153
#define al2( x )			al2ul ( al2_of ( x ) )
154
#define is_signed( x )			( ( x )->lastf )
155
 
156
#define frame_al_of_ptr(x) (x)->sonf.ald->al.al_val.al_frame
157
#define frame_al1_of_offset(x) (x)->sonf.ald->al.al_val.al_frame
158
#define includes_vcallees(x) ((x & 16) != 0)
159
#define l_or_cees(x) ((x &25) !=0)
160
 
161
 
162
/*
163
    ALTERNATIVE USES OF PROPS FIELD
164
*/
165
 
166
#define test_number( x )		(props ( x ) & 127)
167
#define settest_number( x, t )		props ( x ) = ( t )
168
 
169
#define setntest( x, t )		props ( x ) = ( t )
170
#define round_number( x )		( props ( x ) >> 3 )
171
#define setround_number( x, r )		props ( x ) = ( props ( x ) & 0x7 ) |\
172
						      ( ( r ) << 3 )
173
#define fstack_pos_of( x )		props ( x )
174
 
175
 
176
/*
177
    MACROS FOR MANIPULATING PROPERTIES
178
*/
179
 
180
#define pset( x, m )			props ( x ) |= ( m )
181
#define pclr( x, m )			props ( x ) &= ~( m )
182
#define ptst( x, m )			( props ( x ) & ( m ) )
183
 
184
 
185
/*
186
    PROPERTIES OF CONSTRUCTS WITH EXCEPTIONS
187
*/
188
 
189
#define setjmp_dest( x, d )		{ setpt ( x, d ) ;\
190
					  no ( son ( d ) )++ ; }
191
#define seterr_code( x, d )		props ( x ) = ( d )
192
#define errhandle( x )			( props ( x ) & 0x7 )
193
#define isov(x)                         (errhandle(x) == 0x4)
194
#define optop( x )			( errhandle ( x ) <= 2 )
195
#define seterrhandle( x, r )		props ( x ) =\
196
					  ( props ( x ) & ~0x7 ) | ( r )
197
 
198
/*
199
    PROPERTIES OF IDENT CONSTRUCTS
200
*/
201
 
202
#define setvar( x )			pset ( x, 0x01 )
203
#define clearvar( x )			pclr ( x, 0x01 )
204
#define isvar( x )			ptst ( x, 0x01 )
205
#define setid( x )			clearvar ( x )
206
 
207
#define setvis( x )			pset ( x, 0x02 )
208
#define clearvis( x )			pclr ( x, 0x02 )
209
#define isvis( x )			ptst ( x, 0x02 )
210
 
211
#define setenvoff( x )			pset ( x, 0x04 )
212
#define clearenvoff( x )		pclr ( x, 0x04 )
213
#define isenvoff( x )			ptst ( x, 0x04 )
214
 
215
#define setcaonly( x )			pset ( x, 0x08 )
216
#define clearcaonly( x )		pclr ( x, 0x08 )
217
#define ClearCaonly(e)                  props(e) &= ~0x08
218
#define iscaonly( x )			ptst ( x, 0x08 )
219
 
220
#define setusereg( x )			pset ( x, 0x10 )
221
#define clearusereg( x )		pclr ( x, 0x10 )
222
#define isusereg( x )			ptst ( x, 0x10 )
223
 
224
#define setparam( x )			pset ( x, 0x20 )
225
#define clearparam( x )			pclr ( x, 0x20 )
226
#define isparam( x )			ptst ( x, 0x20 )
227
 
228
#define setglob( x )			pset ( x, 0x40 )
229
#define clearglob( x )			pclr ( x, 0x40 )
230
#define isglob( x )			ptst ( x, 0x40 )
231
 
232
 
233
#define setcopy( x )			pset ( x, 0x80 )
234
#define clearcopy( x )			pclr ( x, 0x80 )
235
#define copying( x )			ptst ( x, 0x80 )
236
 
237
#define set_intnl_call( x )		pset ( x, 0x80 )
238
#define has_intnl_call( x )		ptst ( x, 0x80 )
239
 
240
 
241
				/* inlined in bitmacs.h, note also used in
242
				 scan_cond() */
243
#define setinlined(x)			pset(x, inlined)
244
#define isinlined(x)			ptst(x, inlined)
245
#define clearinlined(x)			pclr(x, inlined)
246
 
247
#define setoutpar(x) props(x) = (prop)(props(x) | 0x8000)
248
#define isoutpar(x) ((props(x) & 0x8000) != 0)
249
#define clearoutpar(x) props(x) &= ~0x8000
250
 
251
/*
252
    PROPERTIES OF MAKE_PROC CONSTRUCTS
253
*/
254
 
255
#define set_struct_res( x )		pset ( x, 0x01 )
256
#define has_struct_res( x )		ptst ( x, 0x01 )
257
 
258
#define set_loc_address( x )		pset ( x, 0x02 )
259
#define loc_address( x )		ptst ( x, 0x02 )
260
 
261
#define set_proc_has_setjmp( x )	pset ( x, 0x04 )
262
#define proc_has_setjmp( x )		ptst ( x, 0x04 )
263
 
264
#define set_proc_has_alloca( x )	pset ( x, 0x08 )
265
#define proc_has_alloca( x )		ptst ( x, 0x08 )
266
#define set_checkalloc(x)               props(x) |= 1;
267
#define checkalloc(x)                   (props(x) & 1)
268
 
269
#define set_proc_has_lv( x )		pset ( x, 0x10 )
270
#define proc_has_lv( x )		ptst ( x, 0x10 )
271
 
272
#define isrecursive( x )		ptst ( x, 0x20 )
273
#define setrecursive( x )		pset ( x, 0x20 )
274
 
275
#define set_proc_uses_crt_env( x )	pset ( x, 0x40 )
276
#define proc_uses_crt_env( x )		ptst ( x, 0x40 )
277
 
278
#define set_proc_uses_external( x )	pset ( x, 0x80 )
279
#define proc_uses_external( x )		ptst ( x, 0x80 )
280
 
281
 
282
/*
283
    PROPERTIES OF SOLVE CONSTRUCT
284
*/
285
 
286
#define setcrtsolve( x )		props ( x ) = 0x01
287
#define set_copying_solve( x )		pset ( x, 0x01 )
288
#define clear_copying_solve( x )	pclr ( x, 0x01 )
289
#define is_copying_solve( x )		ptst ( x, 0x01 )
290
 
291
 
292
/*
293
    PROPERTIES OF MOVE_SOME CONSTRUCT
294
*/
295
 
296
#define setnooverlap( x )		pset ( x, 0x01 )
297
#define isnooverlap( x )		ptst ( x, 0x01 )
298
 
299
 
300
/*
301
    PROPERTIES OF CONTENTS CONSTRUCT
302
*/
303
 
304
#define set_propagate( x )		pset ( x, 0x01 )
305
#define clear_propagate( x )		pclr ( x, 0x01 )
306
#define to_propagate( x )		ptst ( x, 0x01 )
307
 
308
 
309
/*
310
    PROPERTIES OF LABST CONSTRUCT
311
*/
312
 
313
#define set_loaded_lv( x )		pset ( x, 0x10 )
314
#define is_loaded_lv( x )		ptst ( x, 0x10 )
315
#define clearunroll(x)  props(x) = (prop)(props(x) & ~0x04)
316
#define isunroll(x) (props(x) & 0x04)
317
#define setunroll(x) props(x) = (prop)(props(x) | 0x04)
318
#define setunrolled(x)  props(x) = (prop)(props(x) | 0x01)
319
#define isunrolled(x) (props(x) & 0x01)
320
 
321
/*
322
    PROPERTIES OF NAME CONSTRUCT
323
*/
324
 
325
#define setlastuse( x )			pset ( x, 0x01 )
326
#define islastuse( x )			ptst ( x, 0x01 )
327
 
328
#define setloadparam( x )		pset ( x, 0x02 )
329
#define isloadparam( x )		ptst ( x, 0x02 )
330
 
331
#define setreallyass( x )		/* not used */
332
#define isreallyass( x )		( 0 )
333
 
334
/*
335
    PROPERTIES OF VAL_TAG CONSTRUCT
336
*/
337
 
338
#define setconstovf( x )                pset ( x, 0x02 )
339
#define constovf( x )                   ptst ( x, 0x02 )
340
 
341
/*
342
    USEFUL CONSTANTS
343
*/
344
 
345
#define align1				( ( unsigned long ) 1 )
346
#define align8				( ( unsigned long ) 8 )
347
#define align16				( ( unsigned long ) 16 )
348
#define align32				( ( unsigned long ) 32 )
349
 
350
#define Z				( ( long ) 0 )
351
#define size8				( ( long ) 8 )
352
#define size16				( ( long ) 16 )
353
#define size32				( ( long ) 32 )
354
#define size64				( ( long ) 64 )
355
 
356
#define isbigval( x ) ( props(x) & 0x01 )
357
#define setbigval( x ) ( props(x)|=0x01 )
358
#define clearbigval( x ) (props(x) &= ~0x01 )
359
 
360
/* properties of APPLY construction */
361
#define settoinline(x)  props(x) = (prop)(props(x) | 0x01)
362
#define istoinline(x) (props(x) & 0x01)
363
 
364
 
365
/*
366
    ROUNDING
367
*/
368
 
369
#define rounder(n,a) ((a)==0 ? n : ((((n)+(a)-1)/(a))*(a)))
370
 
371
 
372
/* previously in extra_expmacs.h */
373
#define set_callee(id)	setname(son(id), formal_callee_tag)
374
#define set_make_procprops(e, p) props(e) |= ((p)<<8)
375
#define proc_has_vcallees(e) ((props(e) & 0x200)!=0)
376
#define postlude_has_call(e) (props(e) & 1)
377
#define call_has_vcallees(e) ((props(e) & 2) != 0)
378
#define proc_has_checkstack(e) ((props(e) & 0x800)!=0)
379
#define proc_has_vcallers(e) ((props(e) & 0x100) != 0)
380
#define proc_has_nolongj(e) ((props(e) & 0x1000) !=0)
381
#define is_fn_glob(e) ( name(e)==name_tag && name(son(e))==ident_tag\
382
			&& ( son(son(e))==nilexp ||\
383
                             name(son(son(e)))==proc_tag ||\
384
                             name(son(son(e)))==general_proc_tag ) )
385
#define call_is_untidy(e) ((props(e) & 4) != 0)
386
 
387
#define IS_A_PROC(e) ( name(e)==proc_tag || name(e)==general_proc_tag )
388
 
389
 
390
 
391
#endif /* EXPMACS_INCLUDED */
392
 
393
 
394
 
395
 
396
 
397
 
398
 
399
 
400
 
401
 
402
 
403
 
404
 
405