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 |
/* expmacs.h,v 1.10 1995/09/29 07:54:42 john Exp */
|
|
|
32 |
|
|
|
33 |
/*
|
|
|
34 |
expmacs.h,v
|
|
|
35 |
* Revision 1.10 1995/09/29 07:54:42 john
|
|
|
36 |
* Added call_has_vcallers
|
|
|
37 |
*
|
|
|
38 |
* Revision 1.9 1995/09/25 08:59:54 john
|
|
|
39 |
* Added new macros
|
|
|
40 |
*
|
|
|
41 |
* Revision 1.8 1995/09/15 16:23:25 john
|
|
|
42 |
* New exception handling
|
|
|
43 |
*
|
|
|
44 |
* Revision 1.7 1995/09/04 16:22:04 john
|
|
|
45 |
* Fix to general procs
|
|
|
46 |
*
|
|
|
47 |
* Revision 1.6 1995/07/27 09:37:55 john
|
|
|
48 |
* Changed optop & added call_is_untidy
|
|
|
49 |
*
|
|
|
50 |
* Revision 1.5 1995/06/30 07:59:22 john
|
|
|
51 |
* New macro
|
|
|
52 |
*
|
|
|
53 |
* Revision 1.4 1995/06/28 10:23:55 john
|
|
|
54 |
* Incorporated definitions which were formerly in extra_expmacs.h
|
|
|
55 |
*
|
|
|
56 |
* Revision 1.3 1995/06/21 14:25:22 john
|
|
|
57 |
* Changed value of machine division markers to accomodate new spec.
|
|
|
58 |
*
|
|
|
59 |
* Revision 1.2 1995/05/16 10:47:59 john
|
|
|
60 |
* Additions for spec 3.1
|
|
|
61 |
*
|
|
|
62 |
* Revision 1.1.1.1 1995/03/23 10:39:06 john
|
|
|
63 |
* Entered into CVS
|
|
|
64 |
*
|
|
|
65 |
* Revision 1.13 1995/03/23 10:04:16 john
|
|
|
66 |
* Added definition of clearinlined
|
|
|
67 |
*
|
|
|
68 |
* Revision 1.12 1995/01/19 14:01:26 john
|
|
|
69 |
* Changed definition of isov
|
|
|
70 |
*
|
|
|
71 |
* Revision 1.11 1995/01/12 15:13:53 john
|
|
|
72 |
* Changed definition of test_number
|
|
|
73 |
*
|
|
|
74 |
*/
|
|
|
75 |
#include "fail.h"
|
|
|
76 |
#ifndef expmacs_key
|
|
|
77 |
#define expmacs_key 1
|
|
|
78 |
|
|
|
79 |
#define nilexp (exp)0
|
|
|
80 |
#ifdef __STDC__
|
|
|
81 |
#define Assert(x) if(!(x)) failer(#x)
|
|
|
82 |
#else
|
|
|
83 |
#define Assert(x) if(!(x)) failer("x") /* might work, if not, who cares */
|
|
|
84 |
#endif
|
|
|
85 |
/* main components of exp */
|
|
|
86 |
|
|
|
87 |
#define son(x) ((x)->sonf.e)
|
|
|
88 |
#define bro(x) ((x)->brof.e)
|
|
|
89 |
#define last(x) (x)->lastf
|
|
|
90 |
#define name(x) (x)->namef
|
|
|
91 |
#define sh(x) (x)->shf
|
|
|
92 |
#define pt(x) ((x)->ptf.e)
|
|
|
93 |
#define props(x) (x)->propsf
|
|
|
94 |
#define no(x) ((x)->numf.l)
|
|
|
95 |
#define parked(x) ((x)->park)
|
|
|
96 |
|
|
|
97 |
/* alternative components of exp */
|
|
|
98 |
|
|
|
99 |
#define brog(x) ((x)->brof.glob)
|
|
|
100 |
#define nostr(x) ((x)->numf.str)
|
|
|
101 |
#define ptno(x) ((x) ->ptf.l)
|
|
|
102 |
#define sonno(x) ((x) ->sonf.l)
|
|
|
103 |
#define fno(x) ((x) -> numf.f)
|
|
|
104 |
#define dno(x) ((x) -> numf.d)
|
|
|
105 |
#define uno(x) ((x) -> numf.ui)
|
|
|
106 |
|
|
|
107 |
/* ntests */
|
|
|
108 |
#define test_number(x) (ntest)((x)->propsf & 0x1f)
|
|
|
109 |
#define settest_number(x, t) props(x) = (t)
|
|
|
110 |
|
|
|
111 |
/* rounding */
|
|
|
112 |
#define round_number(x) ((x)->propsf >> 3)
|
|
|
113 |
#define setround_number(x,r) (x)->propsf=(((x)->propsf & 0x7) | (r << 3))
|
|
|
114 |
|
|
|
115 |
/* error handling macros */
|
|
|
116 |
#define errhandle(x) ((x)->propsf & 0x7)
|
|
|
117 |
#define optop(x) ((int)errhandle(x) <= 2)
|
|
|
118 |
#define seterrhandle(x,e) (x)->propsf= ((x)->propsf & 0xf8) | (e)
|
|
|
119 |
|
|
|
120 |
/* properties of constructions with EXCEPTIONS */
|
|
|
121 |
#define setjmp_dest(r,d) {(r)->ptf.e = (d); ++no(son(d));}
|
|
|
122 |
#define isov(x) (errhandle(x) == 0x4)
|
|
|
123 |
|
|
|
124 |
/* setting macros for components of exp */
|
|
|
125 |
|
|
|
126 |
#define setbro(x,b) (x)->brof.e = (b)
|
|
|
127 |
#define setsh(x,b) (x)->shf = (b)
|
|
|
128 |
#define setson(x,b) (x)->sonf.e = (b)
|
|
|
129 |
#define setpt(x,b) (x)->ptf.e = (b)
|
|
|
130 |
#define setlast(x) (x)->lastf = 1
|
|
|
131 |
#define clearlast(x) (x)->lastf = 0
|
|
|
132 |
#define setname(x,n) (x)->namef = (n)
|
|
|
133 |
#define setfather(f,s) (s)->brof.e = (f); (s)->lastf = 1
|
|
|
134 |
|
|
|
135 |
/* components of shapes */
|
|
|
136 |
#define shape_size(x) ((x)->numf.l)
|
|
|
137 |
#define shape_align(x) ((unsigned long)((x)->brof.ald->al.al_val.al))
|
|
|
138 |
#define align_of(x) ((x)->brof.ald)
|
|
|
139 |
#define al1(x) ((unsigned long)((x)->sonf.ald->al.al_val.al))
|
|
|
140 |
#define al1_of(x) ((x)->sonf.ald)
|
|
|
141 |
#define al2(x) ((unsigned long)((x)->ptf.ald->al.al_val.al))
|
|
|
142 |
#define al2_of(x) ((x)->ptf.ald)
|
|
|
143 |
#define is_signed(x) (x)->lastf
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
/* properties of IDENT */
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
#define setvar(e) props(e) |= 0x01
|
|
|
150 |
/* sets the property of a declaration to isvar (is a variable)*/
|
|
|
151 |
#define clearvar(e) props(e) &= ~0x01
|
|
|
152 |
/* sets the property of a declaration to !isvar */
|
|
|
153 |
#define setid(e) props(e) &= ~0x01
|
|
|
154 |
/* sets the property of a declaration to !isvar */
|
|
|
155 |
#define isvar(e) (props(e)&0x01)
|
|
|
156 |
/* tests the property of a declaration as above */
|
|
|
157 |
|
|
|
158 |
#define setvis(e) props(e) |= 0x02
|
|
|
159 |
/* sets the property of a declaration to in memory */
|
|
|
160 |
#define isvis(e) (props(e)&0x02)
|
|
|
161 |
/* tests if a declaration is to be in memory */
|
|
|
162 |
|
|
|
163 |
#define setenvoff(e) props(e) |= 0x04
|
|
|
164 |
/* sets the property of a declaration to visible */
|
|
|
165 |
#define isenvoff(e) (props(e)&0x04)
|
|
|
166 |
/* tests if a declaration is to be visible */
|
|
|
167 |
|
|
|
168 |
#define setcaonly(e) props(e) |= 0x08
|
|
|
169 |
/* sets the property of a variable declaration to show that it is only
|
|
|
170 |
operated on by contents and assign operations */
|
|
|
171 |
#define clearcaonly(e) props(e) = (prop)(props(e) & ~0x08)
|
|
|
172 |
#define iscaonly(e) (props(e)&0x08)
|
|
|
173 |
/* tests the above property */
|
|
|
174 |
|
|
|
175 |
#define setusereg(e) props(e) |= 0x10
|
|
|
176 |
/* sets the property of a declaration to recommend the use of
|
|
|
177 |
a register */
|
|
|
178 |
#define isusereg(e) (props(e)&0x10)
|
|
|
179 |
/* tests a declaration for a register recommendation */
|
|
|
180 |
#define clearusereg(e) props(e) &= ~0x10
|
|
|
181 |
|
|
|
182 |
#define setparam(x) props(x) |= 0x20
|
|
|
183 |
#define clearparam(x) props(x) &= ~0x20
|
|
|
184 |
#define isparam(x) (props(x) & 0x20)
|
|
|
185 |
|
|
|
186 |
#define setglob(e) props(e) |= 0x40
|
|
|
187 |
/* sets property of declaration to be global, in this case
|
|
|
188 |
bro(e) will be the index of the declaration */
|
|
|
189 |
#define clearglob(e) props(e) &= ~0x40
|
|
|
190 |
#define isglob(e) (props(e)&0x40)
|
|
|
191 |
/* tests the above property */
|
|
|
192 |
|
|
|
193 |
#define setcopy(e) props(e) |= 0x80
|
|
|
194 |
/* set a flag used during copy */
|
|
|
195 |
#define clearcopy(e) props(e) &= ~0x80
|
|
|
196 |
/* clear a flag used during copy */
|
|
|
197 |
#define copying(e) (props(e)&0x80)
|
|
|
198 |
/* test the flag used during copying */
|
|
|
199 |
|
|
|
200 |
#define setinlined(x) props(x) = (prop)(props(x) | 0x200)
|
|
|
201 |
#define isinlined(x) (props(x) & 0x200)
|
|
|
202 |
#define clearinlined(x) props(x) &= ~0x200
|
|
|
203 |
|
|
|
204 |
#define setoutpar(x) props(x) |= 0x8000
|
|
|
205 |
#define isoutpar(x) ((props(x) & 0x8000) != 0)
|
|
|
206 |
#define clearoutpar(x) props(x) &= ~0x8000
|
|
|
207 |
|
|
|
208 |
/* Set in weights and used in coder. At this time no copying */
|
|
|
209 |
#define set_intnl_call(x) props(x) |= 0x80
|
|
|
210 |
#define has_intnl_call(x) (props(x) & 0x80)
|
|
|
211 |
|
|
|
212 |
/* properties of MAKE_PROC construction */
|
|
|
213 |
|
|
|
214 |
#define set_struct_res(x) props(x) |= 0x1
|
|
|
215 |
#define has_struct_res(x) (props(x) & 0x1)
|
|
|
216 |
|
|
|
217 |
#define set_loc_address(x) props(x) |= 0x2
|
|
|
218 |
#define loc_address(x) (props(x) & 0x2)
|
|
|
219 |
|
|
|
220 |
#define set_proc_has_setjmp(x) props(x) |= 0x4
|
|
|
221 |
#define proc_has_setjmp(x) (props(x) & 0x4)
|
|
|
222 |
|
|
|
223 |
#define set_proc_has_alloca(x) props(x) |= 0x8
|
|
|
224 |
#define proc_has_alloca(x) (props(x) & 0x8)
|
|
|
225 |
|
|
|
226 |
#define set_proc_has_lv(x) props(x) |= 0x10
|
|
|
227 |
#define proc_has_lv(x) (props(x) & 0x10)
|
|
|
228 |
|
|
|
229 |
#define isrecursive(x) (props(x) & 0x20)
|
|
|
230 |
#define setrecursive(x) props(x) |= 0x20
|
|
|
231 |
|
|
|
232 |
#define set_proc_uses_crt_env(x) props(x) |= 0x40
|
|
|
233 |
#define proc_uses_crt_env(x) (props(x) & 0x40)
|
|
|
234 |
|
|
|
235 |
#define set_proc_uses_external(x) props(x) |= 0x80
|
|
|
236 |
#define proc_uses_external(x) (props(x) & 0x80)
|
|
|
237 |
|
|
|
238 |
#define set_proc_has_float(x) props(x) |= 0x100
|
|
|
239 |
#define proc_has_float(x) (props(x) & 0x100)
|
|
|
240 |
|
|
|
241 |
/*set property of SOLVE construction */
|
|
|
242 |
#define setcrtsolve(x) props(x)=1
|
|
|
243 |
|
|
|
244 |
/* properties of pt of REP and SOLVE during copy */
|
|
|
245 |
#define set_copying_solve(x) props(x) |= 1
|
|
|
246 |
#define clear_copying_solve(x) props(x) &= ~0x01
|
|
|
247 |
|
|
|
248 |
/* properties of MOVE_SOME construction */
|
|
|
249 |
#define setnooverlap(x) props(x) |= 0x01
|
|
|
250 |
#define isnooverlap(x) (props(x) & 0x01)
|
|
|
251 |
|
|
|
252 |
/* properties of CONT construction */
|
|
|
253 |
#define set_propagate(x) props(x) |= 0x1
|
|
|
254 |
#define to_propagate(x) (props(x) & 0x1)
|
|
|
255 |
#define clear_propagate(x) props(x) &= ~0x01
|
|
|
256 |
|
|
|
257 |
/* various properties of LABST construction are used in exp.c */
|
|
|
258 |
#define set_loaded_lv(x) props(x) |= 0x10
|
|
|
259 |
#define is_loaded_lv(x) (props(x) & 0x10)
|
|
|
260 |
#define setunroll(x) props(x) = (prop)(props(x) | 0x04)
|
|
|
261 |
#define clearunroll(x) props(x) = (prop)(props(x) & ~0x04)
|
|
|
262 |
#define isunroll(x) (props(x) & 0x04)
|
|
|
263 |
|
|
|
264 |
/* properties of NAME construction */
|
|
|
265 |
#define setlastuse(x) props(x) |= 0x01
|
|
|
266 |
#define islastuse(x) (props(x) & 0x01)
|
|
|
267 |
|
|
|
268 |
#define setloadparam(x) props(x) |= 0x02
|
|
|
269 |
#define isloadparam(x) (props(x) & 0x02)
|
|
|
270 |
|
|
|
271 |
#define setreallyass(x) props(x) |= 0x04
|
|
|
272 |
#define isreallyass(x) (props(x) & 0x04)
|
|
|
273 |
|
|
|
274 |
#define set_vararg(x) props(x)|=0x08
|
|
|
275 |
#define is_vararg(x) (props(x) & 0x08)
|
|
|
276 |
|
|
|
277 |
/* properties of STRING construction */
|
|
|
278 |
#define string_char_size(e) props(e)
|
|
|
279 |
|
|
|
280 |
/* properties of VAL construction */
|
|
|
281 |
#define setbigval(x) props(x) |= 0x01
|
|
|
282 |
#define clearbigval(x) props(x) &= ~0x01
|
|
|
283 |
#define isbigval(x) (props(x) & 0x01)
|
|
|
284 |
#define setconstovf(x) props(x) |= 0x02
|
|
|
285 |
#define constovf(x) (props(x) & 0x02)
|
|
|
286 |
|
|
|
287 |
/* properties of REP construction */
|
|
|
288 |
#define setunrolled(x) props(x) = (prop)(props(x) | 0x01)
|
|
|
289 |
#define isunrolled(x) (props(x) & 0x01)
|
|
|
290 |
|
|
|
291 |
/* properties of APPLY construction */
|
|
|
292 |
#define settoinline(x) props(x) = (prop)(props(x) | 0x01)
|
|
|
293 |
#define istoinline(x) (props(x) & 0x01)
|
|
|
294 |
|
|
|
295 |
/* properties of jump record */
|
|
|
296 |
#define fstack_pos_of(x) (x)->propsf
|
|
|
297 |
|
|
|
298 |
#if 0
|
|
|
299 |
#define proc_has_gen_call(e) (props(e) & 0x4000)
|
|
|
300 |
#define set_proc_has_gen_call(e) props(e) |= 0x4000
|
|
|
301 |
#endif
|
|
|
302 |
#define set_has_c_vararg(x) props(x)|=0x400
|
|
|
303 |
#define clear_has_c_vararg(x) props(x) &= ~0x400
|
|
|
304 |
#define has_c_vararg(x) (props(x)&0x400)
|
|
|
305 |
#define set_has_machine_division(x) props(x)|=0x2000
|
|
|
306 |
#define has_machine_division(x) (props(x)&0x2000)
|
|
|
307 |
#define has_float(x) (props(x)&0x1000)
|
|
|
308 |
#define set_has_float(x) props(x)|=0x1000
|
|
|
309 |
|
|
|
310 |
#define frame_al_of_ptr(x) (x)->sonf.ald->al.al_val.al_frame
|
|
|
311 |
#define frame_al1_of_offset(x) (x)->sonf.ald->al.al_val.al_frame
|
|
|
312 |
#define includes_vcallees(x) ((x & 16) != 0)
|
|
|
313 |
#define l_or_cees(x) ((x &25) !=0)
|
|
|
314 |
|
|
|
315 |
/* rounding for alignment */
|
|
|
316 |
|
|
|
317 |
#define rounder(n,a) (((n)+(a)-1)/(a))*(a)
|
|
|
318 |
|
|
|
319 |
#define align64 ((unsigned long) 64)
|
|
|
320 |
#define align32 ((unsigned long) 32)
|
|
|
321 |
#define align16 ((unsigned long) 16)
|
|
|
322 |
#define align8 ((unsigned long) 8)
|
|
|
323 |
#define align1 ((unsigned long) 1)
|
|
|
324 |
|
|
|
325 |
#define size64 ((long) 64)
|
|
|
326 |
#define size32 ((long) 32)
|
|
|
327 |
#define size16 ((long) 16)
|
|
|
328 |
#define size8 ((long) 8)
|
|
|
329 |
#define Z (long)0
|
|
|
330 |
|
|
|
331 |
#define set_callee(id) setname(son(id), formal_callee_tag)
|
|
|
332 |
#define set_make_procprops(e, p) props(e) |= ((p)<<8)
|
|
|
333 |
#define proc_has_vcallees(e) ((props(e) & 0x200)!=0)
|
|
|
334 |
#define postlude_has_call(e) (props(e) & 1)
|
|
|
335 |
#define call_has_vcallees(e) ((props(e) & 2) != 0)
|
|
|
336 |
#define call_has_vcallers(e) ((props(e) & 1) != 0)
|
|
|
337 |
#define proc_has_checkstack(e) ((props(e) & 0x800)!=0)
|
|
|
338 |
#define proc_has_vcallers(e) ((props(e) & 0x100) != 0)
|
|
|
339 |
#define proc_has_nolongj(e) ((props(e) & 0x1000) !=0)
|
|
|
340 |
#define call_is_untidy(e) ((props(e) & 4) != 0)
|
|
|
341 |
|
|
|
342 |
#define set_checkalloc(x) props(x) |= 1
|
|
|
343 |
#define checkalloc(x) (props(x) & 1)
|
|
|
344 |
#endif
|
|
|
345 |
|
|
|
346 |
|