Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
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
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
	(1) Its Recipients shall ensure that this Notice is
43
	(1) Its Recipients shall ensure that this Notice is
14
	reproduced upon any copies or amended versions of it;
44
	reproduced upon any copies or amended versions of it;
15
    
45
 
16
	(2) Any amended version of it shall be clearly marked to
46
	(2) Any amended version of it shall be clearly marked to
17
	show both the nature of and the organisation responsible
47
	show both the nature of and the organisation responsible
18
	for the relevant amendment or amendments;
48
	for the relevant amendment or amendments;
19
    
49
 
20
	(3) Its onward transfer from a recipient to another
50
	(3) Its onward transfer from a recipient to another
21
	party shall be deemed to be that party's acceptance of
51
	party shall be deemed to be that party's acceptance of
22
	these conditions;
52
	these conditions;
23
    
53
 
24
	(4) DERA gives no warranty or assurance as to its
54
	(4) DERA gives no warranty or assurance as to its
25
	quality or suitability for any purpose and DERA accepts
55
	quality or suitability for any purpose and DERA accepts
26
	no liability whatsoever in relation to any use to which
56
	no liability whatsoever in relation to any use to which
27
	it may be put.
57
	it may be put.
28
*/
58
*/
Line 35... Line 65...
35
 *
65
 *
36
 * Revision 1.4  1996/11/14  15:22:26  wfs
66
 * Revision 1.4  1996/11/14  15:22:26  wfs
37
 *    Fixed a bug in regexps.c which was common to most of the installers and
67
 *    Fixed a bug in regexps.c which was common to most of the installers and
38
 * has only just come to light due to PWE's work on powertrans. (There was
68
 * has only just come to light due to PWE's work on powertrans. (There was
39
 * previously only a patch.) Cosmetic changes to other files.
69
 * previously only a patch.) Cosmetic changes to other files.
40
 *
70
 *
41
 * Revision 1.3  1996/01/23  15:26:07  wfs
71
 * Revision 1.3  1996/01/23  15:26:07  wfs
42
 * "current_env_tag" in "dependson()".
72
 * "current_env_tag" in "dependson()".
43
 *
73
 *
44
 * Revision 1.2  1995/12/18  13:12:30  wfs
74
 * Revision 1.2  1995/12/18  13:12:30  wfs
45
 * Put hppatrans uder cvs control. Major Changes made since last release
75
 * Put hppatrans uder cvs control. Major Changes made since last release
Line 52... Line 82...
52
 * Revision 5.2  1995/10/20  14:11:15  wfs
82
 * Revision 5.2  1995/10/20  14:11:15  wfs
53
 * gcc compilation changes.
83
 * gcc compilation changes.
54
 *
84
 *
55
 * Revision 5.1  1995/09/15  13:13:36  wfs
85
 * Revision 5.1  1995/09/15  13:13:36  wfs
56
 * Mike Gerrard's bug fix incorporated.
86
 * Mike Gerrard's bug fix incorporated.
57
 *
87
 *
58
 * Revision 5.0  1995/08/25  13:42:58  wfs
88
 * Revision 5.0  1995/08/25  13:42:58  wfs
59
 * Preperation for August 25 Glue release
89
 * Preperation for August 25 Glue release
60
 *
90
 *
61
 * Revision 3.4  1995/08/25  10:29:56  wfs
91
 * Revision 3.4  1995/08/25  10:29:56  wfs
62
 * Register synonyms changed
92
 * Register synonyms changed
63
 *
93
 *
64
 * Revision 3.4  1995/08/25  10:29:56  wfs
94
 * Revision 3.4  1995/08/25  10:29:56  wfs
65
 * Register synonyms changed
95
 * Register synonyms changed
66
 *
96
 *
67
 * Revision 3.1  95/04/10  16:28:04  16:28:04  wfs (William Simmonds)
97
 * Revision 3.1  95/04/10  16:28:04  16:28:04  wfs (William Simmonds)
68
 * Apr95 tape version.
98
 * Apr95 tape version.
69
 * 
99
 *
70
 * Revision 3.0  95/03/30  11:18:54  11:18:54  wfs (William Simmonds)
100
 * Revision 3.0  95/03/30  11:18:54  11:18:54  wfs (William Simmonds)
71
 * Mar95 tape version with CRCR95_178 bug fix.
101
 * Mar95 tape version with CRCR95_178 bug fix.
72
 * 
102
 *
73
 * Revision 2.0  95/03/15  15:28:43  15:28:43  wfs (William Simmonds)
103
 * Revision 2.0  95/03/15  15:28:43  15:28:43  wfs (William Simmonds)
74
 * spec 3.1 changes implemented, tests outstanding.
104
 * spec 3.1 changes implemented, tests outstanding.
75
 * 
105
 *
76
 * Revision 1.1  95/01/11  13:16:12  13:16:12  wfs (William Simmonds)
106
 * Revision 1.1  95/01/11  13:16:12  13:16:12  wfs (William Simmonds)
77
 * Initial revision
107
 * Initial revision
78
 * 
108
 *
79
*/
109
*/
80
 
110
 
81
 
111
 
82
#define HPPATRANS_CODE
112
#define HPPATRANS_CODE
83
/* regexps.c
113
/* regexps.c
Line 109... Line 139...
109
 
139
 
110
int line;
140
int line;
111
 
141
 
112
regpeep regexps[64];		/* [0:31] fix pt - [32:47] floating pt */
142
regpeep regexps[64];		/* [0:31] fix pt - [32:47] floating pt */
113
 
143
 
114
bool sim_exp PROTO_S ( ( exp, exp ) ) ;
144
bool sim_exp(exp, exp);
115
 
145
 
116
/* Same size and alignment and "both float or both fixed". */
146
/* Same size and alignment and "both float or both fixed". */
117
bool eq_sze 
147
bool eq_sze
118
    PROTO_N ( ( as, bs ) )
-
 
119
    PROTO_T ( shape as X shape bs )
148
(shape as, shape bs)
120
{
149
{
121
  if (is_floating(name(as)))
150
  if (is_floating(name(as)))
122
    return (name(as) == name(bs));
151
    return(name(as) == name(bs));
123
  if (is_floating(name(bs)))
152
  if (is_floating(name(bs)))
124
    return 0;
153
    return 0;
125
  return (shape_size(as) == shape_size(bs) && shape_align(as) == shape_align(bs));
154
  return(shape_size(as) == shape_size(bs) && shape_align(as) == shape_align(bs));
126
}
155
}
127
 
156
 
128
bool sim_explist 
157
bool sim_explist
129
    PROTO_N ( ( al, bl ) )
-
 
130
    PROTO_T ( exp al X exp bl )
158
(exp al, exp bl)
131
{
159
{
132
  if (al == nilexp && bl == nilexp)
160
  if (al == nilexp && bl == nilexp)
133
    return (1);
161
    return(1);
134
  if (al == nilexp || bl == nilexp)
162
  if (al == nilexp || bl == nilexp)
135
    return (0);
163
    return(0);
136
  if (!sim_exp(al, bl))
164
  if (!sim_exp(al, bl))
137
    return (0);
165
    return(0);
138
  if (last(al) && last(bl))
166
  if (last(al) && last(bl))
139
    return (1);
167
    return(1);
140
  if (last(al) || last(bl))
168
  if (last(al) || last(bl))
141
    return (0);
169
    return(0);
142
  return (sim_explist(bro(al), bro(bl)));
170
  return(sim_explist(bro(al), bro(bl)));
143
}
171
}
144
 
172
 
145
bool sim_exp 
173
bool sim_exp
146
    PROTO_N ( ( a, b ) )
-
 
147
    PROTO_T ( exp a X exp b )
174
(exp a, exp b)
148
 
175
 
149
 /*
176
 /*
150
  * basically eq_exp except equal shapes requirement  is weakened to equal
177
  * basically eq_exp except equal shapes requirement  is weakened to equal
151
  * sizes and alignments
178
  * sizes and alignments
152
  */
179
  */
153
{
180
{
154
   if (name(a) == name(b))
181
   if (name(a) == name(b))
155
   {
182
   {
156
      if (name(a) == name_tag)
183
      if (name(a) == name_tag)
157
      {
184
      {
158
	 return (son(a) == son(b) && no(a) == no(b) &&
185
	 return(son(a) == son(b) && no(a) == no(b) &&
159
	      eq_sze(sh(a), sh(b)));
186
	      eq_sze(sh(a), sh(b)));
160
      }
187
      }
161
      if (!is_a(name(a)) || !eq_sze(sh(a), sh(b)))
188
      if (!is_a(name(a)) || !eq_sze(sh(a), sh(b)))
162
	 return (0);
189
	 return(0);
163
      if(name(a)==float_tag)/* NEW bit */
190
      if(name(a)==float_tag)/* NEW bit */
164
      {
191
      {
165
	return eq_exp(son(a),son(b));
192
	return eq_exp(son(a),son(b));
166
      }
193
      }
167
      return (no(a) == no(b) && sim_explist(son(a), son(b)));
194
      return(no(a) == no(b) && sim_explist(son(a), son(b)));
168
  };
195
  };
169
  return (0);
196
  return(0);
170
}
197
}
171
 
198
 
172
/* forget all register - exp associations */
199
/* forget all register - exp associations */
173
void clear_all 
200
void clear_all
174
    PROTO_Z ()
201
(void)
175
{
202
{
176
  int i;
203
  int i;
177
 
204
 
178
  for (i = 0; i < 48; i++)
205
  for (i = 0; i < 48; i++)
179
  {
206
  {
Line 183... Line 210...
183
}
210
}
184
 
211
 
185
 
212
 
186
 
213
 
187
/* forget reg i - exp association */
214
/* forget reg i - exp association */
188
void clear_reg 
215
void clear_reg
189
    PROTO_N ( ( i ) )
-
 
190
    PROTO_T ( int i )
216
(int i)
191
{
217
{
192
  i = ABS_OF(i);
218
  i = ABS_OF(i);
193
  if (i >= 0 && i < 48)
219
  if (i >= 0 && i < 48)
194
  {
220
  {
195
    regexps[i].keptexp = nilexp;
221
    regexps[i].keptexp = nilexp;
Line 197... Line 223...
197
  }
223
  }
198
}
224
}
199
 
225
 
200
 
226
 
201
/* find if e has already been evaluated into a register */
227
/* find if e has already been evaluated into a register */
202
ans iskept 
228
ans iskept
203
    PROTO_N ( ( e ) )
-
 
204
    PROTO_T ( exp e )
229
(exp e)
205
{
230
{
206
  int i;
231
  int i;
207
  ans nilans;
232
  ans nilans;
208
 
233
 
209
  setregalt(nilans, 0);		/* init nilans */
234
  setregalt(nilans, 0);		/* init nilans */
Line 228... Line 253...
228
 
253
 
229
    if (ke != nilexp)
254
    if (ke != nilexp)
230
    {
255
    {
231
      /* there is an accociation with reg i */
256
      /* there is an accociation with reg i */
232
      if (
257
      if (
233
	  ((!isc && sim_exp(ke, e)) ||
258
	 ((!isc && sim_exp(ke, e)) ||
234
	   (name(e) == cont_tag && isc && eq_sze(sh(ke), sh(e))
259
	  (name(e) == cont_tag && isc && eq_sze(sh(ke), sh(e))
235
	    && sim_exp(ke, son(e)))
260
	    && sim_exp(ke, son(e)))
236
	   )
261
	  )
237
	)
262
	)
238
      {
263
      {
239
	ans aa ;
264
	ans aa;
240
	aa = (regexps[i].inans);
265
	aa = (regexps[i].inans);
241
 
266
 
242
#if 0
267
#if 0
243
	FULLCOMMENT4("iskept found: reg=%d isc=%d name(e)=%d name(son(e))=%d", i, isc, name(e), name(son(e)));
268
	FULLCOMMENT4("iskept found: reg=%d isc=%d name(e) =%d name(son(e)) =%d", i, isc, name(e), name(son(e)));
244
	FULLCOMMENT3("	hd(e)=%d hd(son(e))=%d hd(ke)=%d", name(sh(e)), name(sh(son(e))), name(sh(ke)));
269
	FULLCOMMENT3("	hd(e) =%d hd(son(e)) =%d hd(ke) =%d", name(sh(e)), name(sh(son(e))), name(sh(ke)));
245
	FULLCOMMENT3("	sim_exp(ke, e)=%d sim_exp(ke, son(e))=%d eq_size(sh(ke), sh(e))=%d",
270
	FULLCOMMENT3("	sim_exp(ke, e) =%d sim_exp(ke, son(e)) =%d eq_size(sh(ke), sh(e)) =%d",
246
		sim_exp(ke, e), sim_exp(ke, son(e)), eq_size(sh(ke), sh(e)));
271
		sim_exp(ke, e), sim_exp(ke, son(e)), eq_size(sh(ke), sh(e)));
247
#endif
272
#endif
248
 
273
 
249
	switch (discrim ( aa ))
274
	switch (discrim(aa))
250
	{
275
	{
251
	case notinreg:
276
	case notinreg:
252
	  {
277
	  {
253
	    if (!aa.val.instoreans.adval)
278
	    if (!aa.val.instoreans.adval)
254
	    {
279
	    {
Line 269... Line 294...
269
      else if (name(ke) == cont_tag && !isc)
294
      else if (name(ke) == cont_tag && !isc)
270
      {
295
      {
271
	ans aq;
296
	ans aq;
272
 
297
 
273
	aq = regexps[i].inans;
298
	aq = regexps[i].inans;
274
	if (discrim ( aq ) == notinreg)
299
	if (discrim(aq) == notinreg)
275
	{
300
	{
276
	  instore is;
301
	  instore is;
277
 
302
 
278
	  is = insalt(aq);
303
	  is = insalt(aq);
279
	  if (!is.adval && is.b.offset == 0 && IS_FIXREG(is.b.base)
304
	  if (!is.adval && is.b.offset == 0 && IS_FIXREG(is.b.base)
Line 289... Line 314...
289
      else if (name(ke) == reff_tag && !isc)
314
      else if (name(ke) == reff_tag && !isc)
290
      {
315
      {
291
	ans aq;
316
	ans aq;
292
 
317
 
293
	aq = regexps[i].inans;
318
	aq = regexps[i].inans;
294
	if (discrim ( aq ) == notinreg)
319
	if (discrim(aq) == notinreg)
295
	{
320
	{
296
	  instore is;
321
	  instore is;
297
 
322
 
298
	  is = insalt(aq);
323
	  is = insalt(aq);
299
	  if (is.adval && is.b.offset == (no(ke) / 8)
324
	  if (is.adval && is.b.offset == (no(ke) / 8)
Line 312... Line 337...
312
  }
337
  }
313
  return nilans;
338
  return nilans;
314
}
339
}
315
 
340
 
316
/* set up exp - address association */
341
/* set up exp - address association */
317
void keepexp 
342
void keepexp
318
    PROTO_N ( ( e, loc ) )
-
 
319
    PROTO_T ( exp e X ans loc )
343
(exp e, ans loc)
320
{
344
{
321
  int reg=0;
345
  int reg=0;
322
 
346
 
323
  switch (discrim ( loc ))
347
  switch (discrim(loc))
324
  {
348
  {
325
  case insomereg:
349
  case insomereg:
326
  case insomefreg:
350
  case insomefreg:
327
    {
351
    {
328
      fail("keep ? reg");
352
      fail("keep ? reg");
Line 360... Line 384...
360
  regexps[reg].inans = loc;
384
  regexps[reg].inans = loc;
361
  regexps[reg].iscont = 0;
385
  regexps[reg].iscont = 0;
362
}
386
}
363
 
387
 
364
/* set up cont(e)-reg association */
388
/* set up cont(e)-reg association */
365
void keepcont 
389
void keepcont
366
    PROTO_N ( ( e, regcode ) )
-
 
367
    PROTO_T ( exp e X int regcode )
390
(exp e, int regcode)
368
{
391
{
369
  freg fr;
392
  freg fr;
370
  int reg = ABS_OF(regcode);
393
  int reg = ABS_OF(regcode);
371
 
394
 
372
  assert(reg >= 0 && reg < 48);
395
  assert(reg >= 0 && reg < 48);
373
  assert(reg != GR1);
396
  assert(reg != GR1);
374
 
397
 
375
  if (reg > 31)
398
  if (reg > 31)
376
  {
399
  {
377
    fr.dble = ((regcode < 0) ? 1 : 0);
400
    fr.dble = ((regcode < 0)? 1 : 0);
378
    fr.fr = reg - 32;
401
    fr.fr = reg - 32;
379
    setfregalt(regexps[reg].inans, fr);
402
    setfregalt(regexps[reg].inans, fr);
380
  }
403
  }
381
  else
404
  else
382
  {
405
  {
Line 391... Line 414...
391
  regexps[reg].keptexp = e;
414
  regexps[reg].keptexp = e;
392
  regexps[reg].iscont = 1;
415
  regexps[reg].iscont = 1;
393
}
416
}
394
 
417
 
395
/* set up e-reg association */
418
/* set up e-reg association */
396
void keepreg 
419
void keepreg
397
    PROTO_N ( ( e, regcode ) )
-
 
398
    PROTO_T ( exp e X int regcode )
420
(exp e, int regcode)
399
{
421
{
400
  freg fr;
422
  freg fr;
401
  int reg = ABS_OF(regcode);
423
  int reg = ABS_OF(regcode);
402
 
424
 
403
  assert(reg >= 0 && reg < 48);
425
  assert(reg >= 0 && reg < 48);
404
  assert(reg != GR1);
426
  assert(reg != GR1);
405
 
427
 
406
  if (reg > 31)
428
  if (reg > 31)
407
  {
429
  {
408
    fr.dble = ((regcode < 0) ? 1 : 0);
430
    fr.dble = ((regcode < 0)? 1 : 0);
409
    fr.fr = reg - 32;
431
    fr.fr = reg - 32;
410
    setfregalt(regexps[reg].inans, fr);
432
    setfregalt(regexps[reg].inans, fr);
411
  }
433
  }
412
  else
434
  else
413
  {
435
  {
Line 422... Line 444...
422
  regexps[reg].keptexp = e;
444
  regexps[reg].keptexp = e;
423
  regexps[reg].iscont = 0;
445
  regexps[reg].iscont = 0;
424
}
446
}
425
 
447
 
426
 
448
 
427
bool couldeffect PROTO_S ( ( exp, exp ) ) ;
449
bool couldeffect(exp, exp);
428
 
450
 
429
 
451
 
430
/* could e be lhs */
452
/* could e be lhs */
431
bool couldbe 
453
bool couldbe
432
    PROTO_N ( ( e, lhs ) )
-
 
433
    PROTO_T ( exp e X exp lhs )
454
(exp e, exp lhs)
434
{
455
{
435
  int ne = name(e);
456
  int ne = name(e);
436
  exp s = son(e);
457
  exp s = son(e);
437
 
458
 
438
  if (ne == name_tag)
459
  if (ne == name_tag)
Line 441... Line 462...
441
    {
462
    {
442
      return 1;
463
      return 1;
443
    }
464
    }
444
    if (isvar(s))
465
    if (isvar(s))
445
    {
466
    {
446
      return (lhs == 0 && (isvis(s) || isglob(s)));
467
      return(lhs == 0 && (isvis(s) || isglob(s)));
447
    }
468
    }
448
    if (IS_A_PROC(s))
469
    if (IS_A_PROC(s))
449
      return (lhs == 0);
470
      return(lhs == 0);
450
    if (son(s) == nilexp)
471
    if (son(s) == nilexp)
451
      return 1;
472
      return 1;
452
    return couldbe(son(s), lhs);
473
    return couldbe(son(s), lhs);
453
  }
474
  }
454
  if (ne == cont_tag)
475
  if (ne == cont_tag)
455
  {
476
  {
456
    if (lhs != 0 && name(s) == name_tag && son(s) != nilexp)
477
    if (lhs != 0 && name(s) == name_tag && son(s)!= nilexp)
457
    {
478
    {
458
      return (son(s) == son(lhs) || isvis(son(lhs)) || isvis(son(s)));
479
      return(son(s) == son(lhs) || isvis(son(lhs)) || isvis(son(s)));
459
    }
480
    }
460
    return 1;
481
    return 1;
461
  }
482
  }
462
  if (ne == reff_tag || ne == field_tag)
483
  if (ne == reff_tag || ne == field_tag)
463
  {
484
  {
464
    return couldbe(s, lhs);
485
    return couldbe(s, lhs);
465
  }
486
  }
466
  if (ne == addptr_tag || ne == subptr_tag)
487
  if (ne == addptr_tag || ne == subptr_tag)
467
  {
488
  {
468
    return (couldbe(s, lhs) || couldeffect(bro(s), lhs));
489
    return(couldbe(s, lhs) || couldeffect(bro(s), lhs));
469
  }
490
  }
470
 
491
 
471
  return 1;
492
  return 1;
472
 
493
 
473
}
494
}
474
 
495
 
475
/* could alteration to z effect e? */
496
/* could alteration to z effect e? */
476
bool couldeffect 
497
bool couldeffect
477
    PROTO_N ( ( e, z /* a name or zero */ ) )
498
    PROTO_N ( ( e, z /* a name or zero */ ) )
478
    PROTO_T ( exp e X exp z /* a name or zero */ )
499
    PROTO_T ( exp e X exp z /* a name or zero */ )
479
{
500
{
480
  int ne = name(e);
501
  int ne = name(e);
481
  if (ne == cont_tag)
502
  if (ne == cont_tag)
Line 483... Line 504...
483
    return couldbe(son(e), z);
504
    return couldbe(son(e), z);
484
  }
505
  }
485
  if (ne == name_tag)
506
  if (ne == name_tag)
486
  {
507
  {
487
    if (isvar(son(e)))
508
    if (isvar(son(e)))
488
      return (z == 0 && isvis(son(e)));
509
      return(z == 0 && isvis(son(e)));
489
    if ( IS_A_PROC(son(e)) )
510
    if (IS_A_PROC(son(e)))
490
      return 0;
511
      return 0;
491
    if (son(son(e)) == nilexp)
512
    if (son(son(e)) == nilexp)
492
      return 1 /* could it happen? */ ;
513
      return 1 /* could it happen? */ ;
493
 
514
 
494
    return couldeffect(son(son(e)), z);
515
    return couldeffect(son(son(e)), z);
Line 508... Line 529...
508
    e = bro(e);
529
    e = bro(e);
509
  }
530
  }
510
  return 0;
531
  return 0;
511
}
532
}
512
 
533
 
513
bool dependson 
534
bool dependson
514
    PROTO_N ( ( e, isc, z ) )
-
 
515
    PROTO_T ( exp e X bool isc X exp z )
535
(exp e, bool isc, exp z)
516
{				/* does e depend on z */
536
{				/* does e depend on z */
517
  if (e == nilexp)
537
  if (e == nilexp)
518
  {
538
  {
519
    return 0;
539
    return 0;
520
  }
540
  }
Line 524... Line 544...
524
	name(z) == subptr_tag)
544
	name(z) == subptr_tag)
525
    {
545
    {
526
      z = son(z);
546
      z = son(z);
527
    }
547
    }
528
 
548
 
529
    if (name(z) != name_tag)
549
    if (name(z)!= name_tag)
530
    {
550
    {
531
      if (name(z) != cont_tag)
551
      if (name(z)!= cont_tag)
532
	return 1;
552
	return 1;
533
      z = 0;
553
      z = 0;
534
      break;
554
      break;
535
    }
555
    }
536
 
556
 
537
    if (isvar(son(z)))
557
    if (isvar(son(z)))
538
      break;
558
      break;
539
    if ( IS_A_PROC(son(z)) )
559
    if (IS_A_PROC(son(z)))
540
    {
560
    {
541
      z = 0;
561
      z = 0;
542
      break;
562
      break;
543
    }
563
    }
544
    if (son(son(z)) == nilexp)
564
    if (son(son(z)) == nilexp)
Line 546... Line 566...
546
    z = son(son(z));
566
    z = son(son(z));
547
  }
567
  }
548
 
568
 
549
  /* z is now unambiguous variable name or 0 meaning some contents */
569
  /* z is now unambiguous variable name or 0 meaning some contents */
550
 
570
 
551
  return ((isc) ? couldbe(e, z) : couldeffect(e, z));
571
  return((isc)? couldbe(e, z): couldeffect(e, z));
552
}
572
}
553
 
573
 
554
 
574
 
555
/* remove association of any register which depends on lhs */
575
/* remove association of any register which depends on lhs */
556
void clear_dep_reg 
576
void clear_dep_reg
557
    PROTO_N ( ( lhs ) )
-
 
558
    PROTO_T ( exp lhs )
577
(exp lhs)
559
{
578
{
560
  int i;
579
  int i;
561
 
580
 
562
  for (i = 0; i < 48; i++)
581
  for (i = 0; i < 48; i++)
563
  {
582
  {