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
/* 80x86/expmacs.h */
32
 
33
/**********************************************************************
34
$Author: release $
35
$Date: 1998/01/17 15:55:51 $
36
$Revision: 1.1.1.1 $
37
$Log: expmacs.h,v $
38
 * Revision 1.1.1.1  1998/01/17  15:55:51  release
39
 * First version to be checked into rolling release.
40
 *
41
 * Revision 1.15  1997/10/23  09:37:00  pwe
42
 * extra_diags
43
 *
44
 * Revision 1.14  1997/10/10  18:25:07  pwe
45
 * prep ANDF-DE revision
46
 *
47
 * Revision 1.13  1997/04/23  16:24:42  pwe
48
 * added constovf
49
 *
50
 * Revision 1.12  1996/12/13  14:39:24  pwe
51
 * prep NEWDIAGS
52
 *
53
 * Revision 1.11  1996/12/10  15:11:34  pwe
54
 * prep NEWDIAGS
55
 *
56
 * Revision 1.10  1996/02/22  10:03:36  pwe
57
 * sco diag recursive struct (& clearinlined)
58
 *
59
 * Revision 1.9  1995/09/22  16:29:18  pwe
60
 * setoutpar introduced
61
 *
62
 * Revision 1.8  1995/09/05  16:24:48  pwe
63
 * specials and exception changes
64
 *
65
 * Revision 1.7  1995/09/01  17:30:01  pwe
66
 * traps and Build scripts
67
 *
68
 * Revision 1.6  1995/08/30  16:06:30  pwe
69
 * prepare exception trapping
70
 *
71
 * Revision 1.5  1995/08/14  13:53:33  pwe
72
 * several corrections, tail calls and error jumps
73
 *
74
 * Revision 1.4  1995/08/04  08:29:18  pwe
75
 * 4.0 general procs implemented
76
 *
77
 * Revision 1.3  1995/07/07  15:22:16  pwe
78
 * prepare for 4.0, and correct PIC switch
79
 *
80
 * Revision 1.2  1995/01/30  12:56:10  pwe
81
 * Ownership -> PWE, tidy banners
82
 *
83
 * Revision 1.1  1994/10/27  14:15:22  jmf
84
 * Initial revision
85
 *
86
 * Revision 1.1  1994/07/12  14:31:17  jmf
87
 * Initial revision
88
 *
89
**********************************************************************/
90
 
91
#ifndef expmacs_key
92
#define expmacs_key 1
93
 
94
 
95
#define nilexp (exp)0
96
 
97
/* main components of exp */
98
 
99
#define son(x) ((x)->sonf.e)
100
#define bro(x) ((x)->brof.e)
101
#define last(x) (int)((x)->lastf)
102
#define name(x) (x)->namef
103
#define sh(x) (x)->shf
104
#define pt(x) ((x)->ptf.e)
105
#define props(x) (x)->propsf
106
#define no(x) ((x)->numf.l)
107
#define parked(x) ((x)->park)
108
#ifdef NEWDIAGS
109
#define dgf(x) ((x)->diagf)
110
#endif
111
 
112
/* alternative components of exp */
113
 
114
#define brog(x) ((x)->brof.glob)
115
#define nostr(x) ((x)->numf.str)
116
#define ptno(x) ((x) ->ptf.l)
117
#define sonno(x) ((x) ->sonf.l)
118
#define fno(x) ((x) -> numf.f)
119
#ifndef NEWDIAGS
120
#define dno(x) ((x) -> numf.d)
121
#endif
122
#define uno(x) ((x) -> numf.ui)
123
 
124
/* ntests */
125
#define test_number(x) (ntest)((x)->propsf & 0x1f)
126
#define settest_number(x, t) (x)->propsf= (prop)(((x)->propsf & 0xe0) | (int)(t))
127
 
128
/* rounding */
129
#define round_number(x) ((x)->propsf >> 3)
130
#define setround_number(x,r) (x)->propsf=(prop)(((x)->propsf & 0x7) | (r << 3))
131
 
132
/* error handling macros */
133
#define errhandle(x) ((x)->propsf & 0x7)
134
#define optop(x) ((int)errhandle(x) <= 2) 
135
#define seterrhandle(x,e) (x)->propsf= (prop)(((x)->propsf & 0xf8) | (e))
136
 
137
/* properties of constructions with EXCEPTIONS */
138
#define setjmp_dest(r,d) {(r)->ptf.e = (d); ++no(son(d));}
139
#define isov(x) (errhandle(x) == 0x4)
140
#define istrap(x) (((x)->propsf & 0x3) == 0x3)
141
 
142
/* setting macros for components of exp */
143
 
144
#define setbro(x,b) (x)->brof.e = (b)
145
#define setsh(x,b) (x)->shf = (b)
146
#define setson(x,b) (x)->sonf.e = (b)
147
#define setpt(x,b) (x)->ptf.e = (b)
148
#define setlast(x) (x)->lastf = 1
149
#define clearlast(x) (x)->lastf = 0
150
#define setname(x,n) (x)->namef = (n)
151
#define setfather(f,s) (s)->brof.e = (f); (s)->lastf = 1
152
 
153
/* components of shapes */
154
#define shape_size(x) ((x)->numf.l)
155
#define shape_align(x) ((x)->brof.ald->al.al_val.al)
156
#define align_of(x) ((x)->brof.ald)
157
#define al1(x) ((x)->sonf.ald->al.al_val.al)
158
#define al1_of(x) ((x)->sonf.ald)
159
#define al2(x) ((x)->ptf.ald->al.al_val.al)
160
#define al2_of(x) ((x)->ptf.ald)
161
#define is_signed(x) (int)((x)->lastf)
162
 
163
#define frame_al_of_ptr(x) (x)->sonf.ald->al.al_val.al_frame
164
#define frame_al1_of_offset(x) (x)->sonf.ald->al.al_val.al_frame
165
#define al_includes_vcallees 16
166
#define al_includes_caller_args 6
167
 
168
 
169
/* properties of IDENT_TAG */
170
 
171
 
172
#define setvar(e) props(e) = (prop)(props(e) | 0x01)
173
  /* sets the property of a declaration to isvar (is a variable)*/
174
#define clearvar(e) props(e) = (prop)(props(e) & ~0x01)
175
  /* sets the property of a declaration to !isvar */
176
#define setid(e) props(e) = (prop)(props(e) & ~0x01)
177
  /* sets the property of a declaration to !isvar */
178
#define isvar(e) (props(e)&0x01)
179
  /* tests the property of a declaration as above */
180
 
181
#define setvis(e) props(e) = (prop)(props(e) | 0x02)
182
  /* sets the property of a declaration to in memory */
183
#define isvis(e) (props(e)&0x02)
184
  /* tests if a declaration is to be in memory */
185
 
186
#define setenvoff(e) props(e) = (prop)(props(e) | 0x04)
187
  /* sets the property of a declaration to visible */
188
#define isenvoff(e) (props(e)&0x04)
189
  /* tests if a declaration is to be visible */
190
 
191
#define setcaonly(e) props(e) = (prop)(props(e) | 0x08)
192
  /* sets the property of a variable declaration to show that it is only
193
     operated on by contents and assign operations */
194
#define clearcaonly(e) props(e) = (prop)(props(e) & ~0x08)
195
#define iscaonly(e) (props(e)&0x08)
196
  /* tests the above property */
197
 
198
#define setusereg(e) props(e) = (prop)(props(e) | 0x10)
199
  /* sets the property of a declaration to recommend the use of
200
     a register */
201
#define isusereg(e) (props(e)&0x10)
202
  /* tests a declaration for a register recommendation */
203
#define clearusereg(e) props(e) = (prop)(props(e) & ~0x10)
204
 
205
#define setparam(x) props(x) = (prop)(props(x) | 0x20)
206
#define clearparam(x) props(x) = (prop)(props(x) & ~0x20)
207
#define isparam(x) (props(x) & 0x20)
208
 
209
#define setglob(e) props(e) = (prop)(props(e) | 0x40)
210
  /* sets property of declaration to be global, in this case
211
     bro(e) will be the index of the declaration */
212
#define clearglob(e) props(e) &= ~0x40
213
#define isglob(e) (props(e)&0x40)
214
  /* tests the above property */
215
 
216
#define setcopy(e) props(e) = (prop)(props(e) | 0x80)
217
  /* set a flag used during copy : also used for LABST_TAG */
218
#define clearcopy(e) props(e) = (prop)(props(e) & ~0x80)
219
  /* clear a flag used during copy */
220
#define copying(e) (props(e)&0x80)
221
  /* test the flag used during copying */
222
 
223
/* Set in weights and used in coder. At this time no copying */
224
#define set_intnl_call(x) props(x) = (prop)(props(x) | 0x80)
225
#define has_intnl_call(x) (props(x) & 0x80)
226
 
227
/* variable has had the no-sign-extension opt. (80x86 only) */
228
#define setse_opt(x) props(x) = (prop)(props(x) | 0x400)
229
#define isse_opt(x) (props(x) & 0x400)
230
 
231
#define setinlined(x) props(x) = (prop)(props(x) | 0x200)
232
#define isinlined(x) (props(x) & 0x200)
233
#define clearinlined(x) props(x) &= ~0x200
234
 
235
/* variable is used both as byte and long (80x86 only) */
236
#define setbyteuse(x) props(x) = (prop)(props(x) | 0x800)
237
#define isbyteuse(x) (props(x) & 0x800)
238
 
239
/* parameter used for output (needs only to be in memory for 80x86) */
240
#define setoutpar(x) setvis(x)
241
#define isoutpar(x) isvis(x)
242
#define clearoutpar(x) 
243
 
244
/* properties of PROC_TAG construction */
245
 
246
#define set_struct_res(x) props(x) = (prop)(props(x) | 0x1)
247
#define has_struct_res(x) (props(x) & 0x1)
248
 
249
#define set_loc_address(x) props(x) = (prop)(props(x) | 0x2)
250
#define loc_address(x) (props(x) & 0x2)
251
 
252
#define set_proc_has_setjmp(x) props(x) = (prop)(props(x) | 0x4)
253
#define proc_has_setjmp(x) (props(x) & 0x4)
254
 
255
#define set_proc_has_alloca(x) props(x) = (prop)(props(x) | 0x8)
256
#define proc_has_alloca(x) (props(x) & 0x8)
257
 
258
#define set_proc_has_lv(x) props(x) = (prop)(props(x) | 0x10)
259
#define proc_has_lv(x) (props(x) & 0x10)
260
 
261
#define isrecursive(x) (props(x) & 0x20)
262
#define setrecursive(x) props(x) = (prop)(props(x) | 0x20)
263
 
264
#define set_proc_uses_crt_env(x) props(x) = (prop)(props(x) | 0x40)
265
#define proc_uses_crt_env(x) (props(x) & 0x40)
266
 
267
#define set_proc_uses_external(x) props(x) = (prop)(props(x) | 0x80)
268
#define proc_uses_external(x) (props(x) & 0x80)
269
 
270
	/* used for diags, after code production */
271
#define set_proc_has_fp(x) props(x) = (prop)(props(x) | 0x100)
272
#define clear_proc_has_fp(x) props(x) &= ~0x100
273
#define proc_has_fp(x) (props(x) & 0x100)
274
 
275
 
276
/*set property of SOLVE_TAG construction */
277
#define setcrtsolve(x) props(x)=1
278
 
279
/* properties of pt of REP_TAG and SOLVE_TAG during copy */
280
#define set_copying_solve(x) props(x) = (prop)(props(x) | 1)
281
#define clear_copying_solve(x) props(x) = (prop)(props(x) & ~0x01)
282
 
283
/* properties of MOVECONT_TAG construction */
284
#define setnooverlap(x) props(x) = (prop)(props(x) | 0x01)
285
#define isnooverlap(x) (props(x) & 0x01)
286
 
287
/* properties of CONT_TAG construction */
288
#define set_propagate(x) props(x) = (prop)(props(x) | 0x1)
289
#define to_propagate(x) (props(x) & 0x1)
290
#define clear_propagate(x) props(x) = (prop)(props(x) & ~0x01)
291
 
292
/* various properties of LABST_TAG construction are used in exp.c */
293
#define set_loaded_lv(x) props(x) = (prop)(props(x) | 0x10)
294
#define is_loaded_lv(x) (props(x) & 0x10)
295
#define setunroll(x) props(x) = (prop)(props(x) | 0x04)
296
#define clearunroll(x)  props(x) = (prop)(props(x) & ~0x04)
297
#define isunroll(x) (props(x) & 0x04)
298
	/* see also setcopy */
299
#define set_dg_labmark(x) props(x) = (prop)(props(x) | 0x800)
300
#define dg_labmark(x)(props(x) & 0x800)
301
#define clear_dg_labmark(x) props(x) = (prop)(props(x) & ~0x800)
302
 
303
/* properties of NAME_TAG construction */
304
#define setlastuse(x) props(x) = (prop)(props(x) | 0x01)
305
#define islastuse(x) (props(x) & 0x01)
306
 
307
#define setloadparam(x) props(x) = (prop)(props(x) | 0x02)
308
#define isloadparam(x) (props(x) & 0x02)
309
 
310
#define setreallyass(x) props(x) = (prop)(props(x) | 0x04)
311
#define isreallyass(x) (props(x) & 0x04)
312
 
313
#ifdef NEWDIAGS
314
#define setisdiaginfo(x) props(x) = (prop)(props(x) | 0x08)
315
#define isdiaginfo(x) (props(x) & 0x08)
316
 
317
#define setdiscarded(x) props(x) = (prop)(props(x) | 0x10)
318
#define isdiscarded(x) (props(x) & 0x10)
319
#endif
320
 
321
/* properties of STRING_TAG construction */
322
#define string_char_size(e) props(e)
323
 
324
/* properties of VAL_TAG construction */
325
#define setbigval(x)  props(x) = (prop)(props(x) | 0x01)
326
#define clearbigval(x) props(x) = (prop)(props(x) & ~0x01)
327
#define isbigval(x) (props(x) & 0x01)
328
 
329
#define setconstovf(x)  props(x) = (prop)(props(x) | 0x02)
330
#define constovf(x) (props(x) & 0x02)
331
 
332
/* properties of REP_TAG construction */
333
#define setunrolled(x)  props(x) = (prop)(props(x) | 0x01)
334
#define isunrolled(x) (props(x) & 0x01)
335
 
336
/* properties of APPLY_TAG construction */
337
#define settoinline(x)  props(x) = (prop)(props(x) | 0x01)
338
#define istoinline(x) (props(x) & 0x01)
339
 
340
#define setbuiltin(x)  props(x) = (prop)(props(x) | 0x8000)
341
#define builtinproc(x) (props(x) & 0x8000)	/* trans386 special */
342
 
343
/* properties of ASM construction */
344
#define asm_string(x) (props(x) & 0x01)
345
#define asm_in(x) (props(x) & 0x02)
346
#define asm_out(x) (props(x) & 0x04)
347
#define asm_ptr(x) (props(x) & 0x08)
348
#define asm_var(x) (props(x) & 0x0c)	/* out | ptr */
349
 
350
/* properties of alloca constructions */
351
#define set_checkalloc(x) props(x) |= 1;
352
#define checkalloc(x) (props(x) & 1)
353
 
354
 
355
/* properties of jump record */
356
 
357
#define fstack_pos_of(x) (x)->propsf
358
 
359
 
360
#define set_callee(id)	setname(son(id), formal_callee_tag)
361
#define set_make_procprops(e, p) props(e) |= ((p)<<8)
362
#define proc_has_vcallees(e) (props(e) & 0x200)
363
#define postlude_has_call(e) (props(e) & 1)
364
#define call_has_vcallees(e) (props(e) & 2)
365
#define proc_has_checkstack(e) (props(e) & 0x800)
366
#define proc_has_vcallers(e) (props(e) & 0x100)
367
#define proc_has_nolongj(e) (props(e) & 0x1000)
368
 
369
#define set_proc_needs_envsize(x) props(x) = (prop)(props(x) | 0x8000)
370
#define proc_needs_envsize(x) (props(x) & 0x8000)
371
 
372
#define call_is_untidy(e) (props(bro(son(e))) & 4)
373
#define call_has_checkstack(e) (props(bro(son(e))) & 8)
374
 
375
 
376
/* rounding for alignment */
377
 
378
#define rounder(n,a) (((n)+(a)-1)/(a))*(a)
379
 
380
#define align32 ( 32)
381
#define align16 ( 16)
382
#define align8 ( 8)
383
#define align1 ( 1)
384
 
385
#define size64 ( 64)
386
#define size32 ( 32)
387
#define size16 ( 16)
388
#define size8 ( 8)
389
 
390
#endif
391
 
392