Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251
WebSVN – tendra.SVN – Diff – /trunk/src/installers/680x0/common/scan2.c – Rev 2 and 7

Subversion Repositories tendra.SVN

Rev

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

Rev 2 Rev 7
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) 1996
32
    		 Crown Copyright (c) 1996
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
Line 102... Line 132...
102
#ifndef tdf3
132
#ifndef tdf3
103
#include "68k_globals.h"
133
#include "68k_globals.h"
104
#include "special_exps.h"
134
#include "special_exps.h"
105
#endif
135
#endif
106
 
136
 
107
void scan2 PROTO_S ( ( bool, exp, exp ) ) ;
137
void scan2(bool, exp, exp);
108
 
138
 
109
/*
139
/*
110
    MACROS TO SET OR GET THE SON OR BRO
140
    MACROS TO SET OR GET THE SON OR BRO
111
*/
141
*/
112
 
142
 
113
#define  assexp( I, P, V )	if ( I ) setson ( P, V ) ; else setbro ( P, V )
143
#define assexp(I, P, V)	if (I) setson(P, V); else setbro(P, V)
114
#define  contexp( I, P )	( ( I ) ? son ( P ) : bro ( P ) )
144
#define contexp(I, P)	((I) ? son(P): bro(P))
115
 
145
 
116
 
146
 
117
/*
147
/*
118
  Transform a non-bit offset into a bit offset.
148
  Transform a non-bit offset into a bit offset.
119
  (borrowed from trans386)
149
  (borrowed from trans386)
120
*/
150
*/
121
static void make_bitfield_offset
151
static void
122
    PROTO_N ( (e,pe,spe,sha) )
-
 
123
    PROTO_T ( exp e X exp pe X int spe X shape sha )
152
make_bitfield_offset(exp e, exp pe, int spe, shape sha)
124
{
153
{
125
  exp omul;
154
	exp omul;
126
  exp val8;
155
	exp val8;
127
  if (name(e) == val_tag){
156
	if (name(e) == val_tag) {
128
    no(e) *= 8;
157
		no(e)*= 8;
129
    return;
158
		return;
130
  }
159
	}
131
  omul = getexp (sha, bro(e), (int)(last (e)), e, nilexp, 0, 0, offset_mult_tag);
160
	omul = getexp(sha, bro(e), (int)(last(e)), e, nilexp, 0, 0,
-
 
161
		      offset_mult_tag);
132
  val8 = getexp (slongsh, omul, 1, nilexp, nilexp, 0, 8, val_tag);
162
	val8 = getexp(slongsh, omul, 1, nilexp, nilexp, 0, 8, val_tag);
133
  clearlast(e);
163
	clearlast(e);
134
  setbro(e, val8);
164
	setbro(e, val8);
135
  if(spe) {
165
	if (spe) {
136
    son(pe) = omul;
166
		son(pe) = omul;
137
  }
-
 
138
  else{
167
	} else{
139
    bro(pe) = omul;
168
		bro(pe) = omul;
140
  }
169
	}
141
  return;
170
	return;
142
}
171
}
143
 
172
 
144
 
173
 
145
/*
174
/*
146
    INSERT AN IDENTITY DECLARATION
175
    INSERT AN IDENTITY DECLARATION
147
 
176
 
148
    This routine inserts an identity declaration of x at to and replaces
177
    This routine inserts an identity declaration of x at to and replaces
149
    x by a use of this identity.
178
    x by a use of this identity.
150
*/
179
*/
151
 
180
 
152
static void cca
181
static void
153
    PROTO_N ( ( sto, to, sx, x ) )
-
 
154
    PROTO_T ( bool sto X exp to X bool sx X exp x )
182
cca(bool sto, exp to, bool sx, exp x)
155
{
183
{
156
   exp d, a, id, tg;
184
	exp d, a, id, tg;
157
   d = contexp (sx, x);
185
	d = contexp(sx, x);
158
#ifndef tdf3
186
#ifndef tdf3
159
   if (name(d)==caller_tag) {	/* position sensitive */
187
	if (name(d)==caller_tag) {	/* position sensitive */
160
      cca (sto, to, 1, d);
188
		cca(sto, to, 1, d);
161
      return;
189
		return;
162
   }
190
	}
163
#endif
191
#endif
164
   d = contexp ( sx, x ) ;
192
	d = contexp(sx, x);
165
   a = contexp ( sto, to ) ;
193
	a = contexp(sto, to);
166
   id = getexp ( sh ( a ), bro ( a ), last(a), d, nilexp, 0, L1, ident_tag ) ;
194
	id = getexp(sh(a), bro(a), last(a), d, nilexp, 0, L1, ident_tag);
167
   tg = getexp ( sh ( d ), bro ( d ), last(d), id, nilexp, 0, L0, name_tag ) ;
195
	tg = getexp(sh(d), bro(d), last(d), id, nilexp, 0, L0, name_tag);
168
   pt ( id ) = tg ;
196
	pt(id) = tg;
169
   clearlast ( d ) ;
197
	clearlast(d);
170
   if ( d != a ) {
198
	if (d != a) {
171
      bro ( d ) = a ;
199
		bro(d) = a;
172
      bro ( a ) = id ;
200
		bro(a) = id;
173
      setlast ( a ) ;
201
		setlast(a);
174
      assexp ( sto, to, id ) ;
202
		assexp(sto, to, id);
175
      assexp ( sx, x, tg ) ;
203
		assexp(sx, x, tg);
176
   } else {
204
	} else {
177
      bro ( d ) = tg ;
205
		bro(d) = tg;
178
      bro ( tg ) = id ;
206
		bro(tg) = id;
179
      setlast ( tg ) ;
207
		setlast(tg);
180
      clearlast ( d ) ;
208
		clearlast(d);
181
      assexp ( sto, to, id ) ;
209
		assexp(sto, to, id);
182
   }
210
	}
183
   return ;
211
	return;
184
}
212
}
185
 
213
 
186
 
214
 
187
/*
215
/*
188
    INSERT AN IDENTITY DECLARATION IN A BRO-LIST
216
    INSERT AN IDENTITY DECLARATION IN A BRO-LIST
Line 191... Line 219...
191
    introduce an identity declaration when doit is 1.  It keeps count as
219
    introduce an identity declaration when doit is 1.  It keeps count as
192
    the index position along the list in order to pass it to doit.  If it
220
    the index position along the list in order to pass it to doit.  If it
193
    uses cca it scans the resulting declaration, using the same to.  If it
221
    uses cca it scans the resulting declaration, using the same to.  If it
194
    doesn't, it scans the list element, still using the same to.  This keeps
222
    doesn't, it scans the list element, still using the same to.  This keeps
195
    all operations in the same order.
223
    all operations in the same order.
196
*/
224
*/
197
 
225
 
198
static void cc
226
static void
199
    PROTO_N ( ( sto, to, se, e, doit, count ) )
-
 
200
    PROTO_T ( bool sto X exp to X bool se X exp e X
-
 
201
	      bool ( *doit ) PROTO_S ( ( exp, int ) ) X int count )
227
cc(bool sto, exp to, bool se, exp e, bool(*doit)(exp, int), int count)
202
{
228
{
203
  exp ec = contexp ( se, e ) ;
229
	exp ec = contexp(se, e);
204
 
230
 
205
  if ( last ( ec ) ) {
231
	if (last(ec)) {
206
    if ( doit ( ec, count ) ) {
232
		if (doit(ec, count)) {
207
      cca ( sto, to, se, e ) ;
233
			cca(sto, to, se, e);
208
      ec = contexp ( sto, to ) ;
234
			ec = contexp(sto, to);
209
      scan2 ( 1, ec, son ( ec ) ) ;
235
			scan2(1, ec, son(ec));
210
    } else {
236
		} else {
211
      scan2 ( sto, to, ec ) ;
237
			scan2(sto, to, ec);
212
    }
238
		}
213
  } else {
239
	} else {
214
    cc ( sto, to, 0, ec, doit, count + 1 ) ;
240
		cc(sto, to, 0, ec, doit, count + 1);
215
    ec = contexp ( se, e ) ;
241
		ec = contexp(se, e);
216
    if ( doit ( ec, count ) ) {
242
		if (doit(ec, count)) {
217
      cca ( sto, to, se, e ) ;
243
			cca(sto, to, se, e);
218
      ec = contexp ( sto, to ) ;
244
			ec = contexp(sto, to);
219
      scan2 ( 1, ec, son ( ec ) ) ;
245
			scan2(1, ec, son(ec));
220
    } else {
246
		} else {
221
      scan2 ( sto, to, ec ) ;
247
			scan2(sto, to, ec);
222
    }
248
		}
223
  }
249
	}
224
  return ;
250
	return;
225
}
251
}
226
 
252
 
227
 
253
 
228
/*
254
/*
229
    INSERT AN IDENTITY DECLARATION
255
    INSERT AN IDENTITY DECLARATION
230
 
256
 
231
    This routine is the same as cca, but forces the declaration into
257
    This routine is the same as cca, but forces the declaration into
232
    a register.
258
    a register.
233
*/
259
*/
234
 
260
 
235
static void ccp
261
static void
236
    PROTO_N ( ( sto, to, sx, x ) )
-
 
237
    PROTO_T ( bool sto X exp to X bool sx X exp x )
262
ccp(bool sto, exp to, bool sx, exp x)
238
{
263
{
239
    exp xc = contexp ( sx, x ) ;
264
	exp xc = contexp(sx, x);
240
    exp toc ;
265
	exp toc;
241
    if ( name ( xc ) != name_tag || !isusereg ( son ( xc ) ) ) {
266
	if (name(xc)!= name_tag || !isusereg(son(xc))) {
242
	cca ( sto, to, sx, x ) ;
267
		cca(sto, to, sx, x);
243
	toc = contexp ( sto, to ) ;
268
		toc = contexp(sto, to);
244
	setusereg ( toc ) ;
269
		setusereg(toc);
245
	scan2 ( 1, toc, son ( toc ) ) ;
270
		scan2(1, toc, son(toc));
246
    }
271
	}
247
    return ;
272
	return;
248
}
273
}
249
 
274
 
250
 
275
 
251
/*
276
/*
252
    IS THE EXP e AN OPERAND?
277
    IS THE EXP e AN OPERAND?
253
*/
278
*/
254
 
279
 
255
static bool is_opnd
280
static bool
256
    PROTO_N ( ( e ) )
-
 
257
    PROTO_T ( exp e )
281
is_opnd(exp e)
258
{
-
 
259
    switch ( name ( e ) ) {
-
 
260
 
-
 
261
	case name_tag : {
-
 
262
	    exp s = son ( e ) ;
-
 
263
	    return ( !isvar ( s ) && (son(son(e))!=nilexp) && !isparam ( son ( son ( e ) ) ) ) ;
-
 
264
	}
-
 
265
 
-
 
266
	case val_tag :
-
 
267
	case real_tag :
-
 
268
        case env_size_tag :
-
 
269
        case general_proc_tag:
-
 
270
        case proc_tag :
-
 
271
	case cont_tag :
-
 
272
	case string_tag :
-
 
273
	case null_tag : {
-
 
274
	    return ( 1 ) ;
-
 
275
	}
-
 
276
    }
-
 
277
    return ( 0 ) ;
-
 
278
}
-
 
279
 
-
 
280
 
-
 
281
/*
-
 
282
    CHECK THE POINTER ARGUMENT OF AN ADDPTR
-
 
283
*/
-
 
284
 
-
 
285
static void ap_arg1
-
 
286
    PROTO_N ( ( sto, to, sa, a, b ) )
-
 
287
    PROTO_T ( bool sto X exp to X bool sa X exp a X bool b )
-
 
288
{
282
{
-
 
283
	switch (name(e)) {
-
 
284
	case name_tag: {
289
    exp ac = contexp ( sa, a ) ;
285
		exp s = son(e);
-
 
286
		return (!isvar(s) && (son(son(e)) != nilexp) &&
-
 
287
			!isparam(son(son(e))));
-
 
288
	}
-
 
289
 
-
 
290
	case val_tag:
-
 
291
	case real_tag:
-
 
292
	case env_size_tag:
-
 
293
	case general_proc_tag:
-
 
294
	case proc_tag:
-
 
295
	case cont_tag:
-
 
296
	case string_tag:
-
 
297
	case null_tag:
-
 
298
		return (1);
-
 
299
	}
-
 
300
	return (0);
-
 
301
}
-
 
302
 
290
 
303
 
-
 
304
/*
-
 
305
    CHECK THE POINTER ARGUMENT OF AN ADDPTR
-
 
306
*/
-
 
307
 
-
 
308
static void
-
 
309
ap_arg1(bool sto, exp to, bool sa, exp a, bool b)
-
 
310
{
-
 
311
	exp ac = contexp(sa, a);
-
 
312
 
291
    if ( !b && name ( ac ) == cont_tag && name ( son ( ac ) ) == name_tag &&
313
	if (!b && name(ac) == cont_tag && name(son(ac)) == name_tag &&
292
	 isvar ( son ( son ( ac ) ) ) ) return ;
314
	    isvar(son(son(ac)))) {
-
 
315
		return;
-
 
316
	}
293
 
317
 
294
    if ( !b && name ( ac ) == name_tag ) return ;
318
	if (!b && name(ac) == name_tag) {
-
 
319
		return;
-
 
320
	}
295
 
321
 
296
    /* The pointer has to go into a register */
322
	/* The pointer has to go into a register */
297
    ccp ( sto, to, sa, a ) ;
323
	ccp(sto, to, sa, a);
298
    return ;
324
	return;
299
}
325
}
300
 
326
 
301
 
327
 
302
/*
328
/*
303
    CHECK THE INTEGER ARGUMENT OF AN ADDPTR
329
    CHECK THE INTEGER ARGUMENT OF AN ADDPTR
304
*/
330
*/
305
 
331
 
306
static void ap_argsc
332
static void
307
    PROTO_N ( ( sto, to, se, e, sz, b ) )
-
 
308
    PROTO_T ( bool sto X exp to X bool se X exp e X int sz X bool b )
333
ap_argsc(bool sto, exp to, bool se, exp e, int sz, bool b)
309
{
334
{
310
    exp ec = contexp ( se, e ) ;
335
	exp ec = contexp(se, e);
311
    exp p = son ( ec ) ;
336
	exp p = son(ec);
312
    exp a = bro ( p ) ;
337
	exp a = bro(p);
313
    exp temp ;
338
	exp temp;
314
 
339
 
315
    /* Check for multiplication by constant scale factor */
340
	/* Check for multiplication by constant scale factor */
316
    if ( name ( a ) == offset_mult_tag &&
-
 
317
	 name ( bro ( son ( a ) ) ) == val_tag ) {
341
	if (name(a) == offset_mult_tag && name(bro(son(a))) == val_tag) {
318
 
-
 
319
	long k = no ( bro ( son ( a ) ) ) ;
342
		long k = no(bro(son(a)));
320
	if ( ( k == 8 || k == 16 || k == 32 || k == 64 ) && k == sz ) {
343
		if ((k == 8 || k == 16 || k == 32 || k == 64) && k == sz) {
321
	    ccp ( sto, to, 1, a ) ;
344
			ccp(sto, to, 1, a);
322
	    ap_arg1 ( sto, to, 1, ec, b ) ;
345
			ap_arg1(sto, to, 1, ec, b);
323
	    return ;
346
			return;
324
	}
347
		}
325
 
348
 
326
    }
349
	}
327
 
350
 
328
    if ( sz == 8 ) {
351
	if (sz == 8) {
329
	ccp ( sto, to, 0, son ( ec ) ) ;
352
		ccp(sto, to, 0, son(ec));
330
	ap_arg1 ( sto, to, 1, ec, b ) ;
353
		ap_arg1(sto, to, 1, ec, b);
331
	return ;
354
		return;
332
    }
355
	}
333
 
356
 
334
    if ( b ) {
357
	if (b) {
335
	ccp ( sto, to, se, e ) ;
358
		ccp(sto, to, se, e);
336
	return ;
359
		return;
337
    }
360
	}
338
 
361
 
339
    cca ( sto, to, se, e ) ;
362
	cca(sto, to, se, e);
340
    temp = contexp ( sto, to ) ;
363
	temp = contexp(sto, to);
341
    scan2 ( 1, temp, son ( temp ) ) ;
364
	scan2(1, temp, son(temp));
342
    return ;
365
	return;
343
}
366
}
344
 
367
 
345
 
368
 
346
/*
369
/*
347
    CHECK THE ARGUMENT OF A CONT OR THE DESTINATION OF AN ASSIGN
370
    CHECK THE ARGUMENT OF A CONT OR THE DESTINATION OF AN ASSIGN
348
*/
371
*/
349
 
372
 
350
static void cont_arg
373
static void
351
    PROTO_N ( ( sto, to, e, sa ) )
-
 
352
    PROTO_T ( bool sto X exp to X exp e X shape sa )
374
cont_arg(bool sto, exp to, exp e, shape sa)
353
{
375
{
354
    unsigned char n = name ( son ( e ) ) ;
376
	unsigned char n = name(son(e));
355
    if ( n == name_tag ) return ;
377
	if (n == name_tag) {
-
 
378
		return;
-
 
379
	}
356
 
380
 
357
    if ( n == cont_tag ) {
381
	if (n == cont_tag) {
358
	exp s = son ( son ( e ) ) ;
382
		exp s = son(son(e));
359
	if ( name ( s ) == name_tag &&
383
		if (name(s) == name_tag &&
360
	     ( isvar ( son ( s ) ) || isglob ( son ( s ) ) ||
384
		    (isvar(son(s)) || isglob(son(s)) || isusereg(son(s)))) {
361
	       isusereg ( son ( s ) ) ) ) return ;
385
			return;
-
 
386
		}
362
 
387
 
363
	if ( name ( s ) == reff_tag &&
-
 
364
	    name ( son ( s ) ) == name_tag &&
388
		if (name(s) == reff_tag && name(son(s)) == name_tag &&
365
	    ( isvar ( son ( son ( s ) ) ) || isglob ( son ( son ( s ) ) ) ||
389
		    (isvar(son(son(s))) || isglob(son(son(s))) ||
366
	      isusereg ( son ( son ( s ) ) ) ) ) return ;
390
		     isusereg(son(son(s))))) {
-
 
391
			return;
-
 
392
		}
367
 
393
 
368
	ccp ( sto, to, 1, e ) ;
394
		ccp(sto, to, 1, e);
369
	return ;
395
		return;
-
 
396
	}
-
 
397
 
-
 
398
	if (n == reff_tag) {
-
 
399
		exp s = son(e);
-
 
400
		if (name(son(s)) == name_tag && isusereg(son(son(s)))) {
-
 
401
			return;
-
 
402
		}
-
 
403
 
-
 
404
		if (name(son(s)) == addptr_tag) {
-
 
405
			ap_argsc(sto, to, 1, s, shape_size(sa), 1);
-
 
406
			return;
370
    }
407
		}
371
 
408
 
372
    if ( n == reff_tag ) {
-
 
373
	exp s = son ( e ) ;
409
		ccp(sto, to, 1, s);
374
	if ( name ( son ( s ) ) == name_tag &&
-
 
375
	     isusereg ( son ( son ( s ) ) ) ) return ;
410
		return;
-
 
411
	}
376
 
412
 
377
	if ( name ( son ( s ) ) == addptr_tag ) {
413
	if (n == addptr_tag) {
378
	    ap_argsc ( sto, to, 1, s, shape_size ( sa ), 1 ) ;
414
		ap_argsc(sto, to, 1, e, shape_size(sa), 0);
379
	    return ;
415
		return;
380
	}
416
	}
381
 
417
 
382
	ccp ( sto, to, 1, s ) ;
418
	ccp(sto, to, 1, e);
383
	return ;
-
 
384
    }
-
 
385
 
-
 
386
    if ( n == addptr_tag ) {
-
 
387
	ap_argsc ( sto, to, 1, e, shape_size ( sa ), 0 ) ;
-
 
388
	return ;
419
	return;
389
    }
-
 
390
 
-
 
391
    ccp ( sto, to, 1, e ) ;
-
 
392
    return ;
-
 
393
}
420
}
394
 
421
 
395
 
422
 
396
/*
423
/*
397
    DOIT ROUTINE, IS t NOT AN OPERAND?
424
    DOIT ROUTINE, IS t NOT AN OPERAND?
398
*/
425
*/
399
 
426
 
400
static bool notopnd
427
static bool
401
    PROTO_N ( ( t, i ) )
-
 
402
    PROTO_T ( exp t X int i )
428
notopnd(exp t, int i)
403
{
429
{
404
    return ( i >= 0 && !is_opnd ( t ) ) ;
430
	return (i >= 0 && !is_opnd(t));
405
}
431
}
406
 
432
 
407
#ifndef tdf3
433
#ifndef tdf3
408
static int scan_for_alloca PROTO_S ( ( exp ) ) ;
434
static int scan_for_alloca(exp);
409
 
435
 
410
static int scan_alloc_args
436
static int
411
    PROTO_N ( (s) )
-
 
412
    PROTO_T ( exp s )
437
scan_alloc_args(exp s)
413
{
438
{
414
  if (scan_for_alloca(s))
439
	if (scan_for_alloca(s)) {
415
    return 1;
440
		return 1;
-
 
441
	}
416
  if (last(s))
442
	if (last(s)) {
417
    return 0;
443
		return 0;
-
 
444
	}
418
  return scan_alloc_args(bro(s));
445
	return scan_alloc_args(bro(s));
419
}
446
}
420
 
447
 
421
static int scan_for_alloca
448
static int
422
    PROTO_N ( (t) )
-
 
423
    PROTO_T ( exp t )
449
scan_for_alloca(exp t)
424
{
450
{
425
   switch (name(t)) {
451
	switch (name(t)) {
426
   case local_free_all_tag:
452
	case local_free_all_tag:
427
   case local_free_tag:
453
	case local_free_tag:
428
   case last_local_tag:
454
	case last_local_tag:
429
   case alloca_tag:
455
	case alloca_tag:
430
   case make_lv_tag:
456
	case make_lv_tag:
431
      return 1;
457
		return 1;
432
   case case_tag:
458
	case case_tag:
433
      return scan_for_alloca(son(t));
459
		return scan_for_alloca(son(t));
434
   case labst_tag:
460
	case labst_tag:
435
      return scan_for_alloca(bro(son(t)));
461
		return scan_for_alloca(bro(son(t)));
436
   case env_offset_tag:
462
	case env_offset_tag:
437
   case string_tag:
463
	case string_tag:
438
   case name_tag:
464
	case name_tag:
439
      return 0;
465
		return 0;
440
   case apply_general_tag:
466
	case apply_general_tag:
441
      if call_is_untidy(t)
467
		if call_is_untidy(t) {
442
      return 1;
468
			return 1;
-
 
469
		}
443
      return scan_alloc_args(son(t));
470
		return scan_alloc_args(son(t));
444
   default:
471
	default:
445
      if (son(t) == nilexp)
472
		if (son(t) == nilexp) {
446
      return 0;
473
			return 0;
-
 
474
		}
447
      return scan_alloc_args(son(t));
475
		return scan_alloc_args(son(t));
448
   };
476
	}
449
}
477
}
450
 
478
 
451
static bool no_alloca
479
static bool
452
    PROTO_N ( ( t, i ) )
-
 
453
    PROTO_T ( exp t X int i )
480
no_alloca(exp t, int i)
454
{
481
{
455
    UNUSED ( i ) ;
482
	UNUSED(i);
456
    return ( scan_for_alloca ( t ) ) ;
483
	return (scan_for_alloca(t));
457
}
484
}
458
 
485
 
459
#endif
486
#endif
460
 
487
 
461
/*
488
/*
462
    APPLY cc, DOING IT WITH OPERANDS
489
    APPLY cc, DOING IT WITH OPERANDS
463
*/
490
*/
464
 
491
 
465
static void all_opnd
492
static void
466
    PROTO_N ( ( sto, to, e ) )
-
 
467
    PROTO_T ( bool sto X exp to X exp e )
493
all_opnd(bool sto, exp to, exp e)
468
{
494
{
469
#if 0
495
#if 0
470
  if(!last(bro(son(e)))) {
496
	if (!last(bro(son(e)))) {
471
 
497
 
472
    /* Operation has more than two parameters.  Make it diadic */
498
		/* Operation has more than two parameters.  Make it diadic */
473
    exp opn = getexp(sh(e),e,0,bro(son(e)),nilexp,0,0,name(e));
499
		exp opn = getexp(sh(e), e, 0, bro(son(e)), nilexp, 0, 0,
-
 
500
				 name(e));
474
    exp nd = getexp(sh(e),bro(e),last(e),opn,nilexp,0,1,ident_tag);
501
		exp nd = getexp(sh(e), bro(e), last(e), opn, nilexp, 0, 1,
-
 
502
				ident_tag);
475
    exp id = getexp(sh(e),e,1,nd,nilexp,0,0,name_tag);
503
		exp id = getexp(sh(e), e, 1, nd, nilexp, 0, 0, name_tag);
476
    pt(nd) = id;
504
		pt(nd) = id;
477
    bro(son(e)) = id;
505
		bro(son(e)) = id;
478
    setlast(e);
506
		setlast(e);
479
    bro(e) = nd;
507
		bro(e) = nd;
480
    while (!last(bro(son(e)))) {
508
		while (!last(bro(son(e)))) {
481
      bro(son(e)) = bro(bro(son(e)));
509
			bro(son(e)) = bro(bro(son(e)));
482
    }
510
		}
483
    bro(bro(son(e))) = opn;
511
		bro(bro(son(e))) = opn;
484
    e = nd;
512
		e = nd;
485
    scan2(sto,e,e);
513
		scan2(sto, e, e);
486
  }
514
	}
487
#endif
515
#endif
488
  cc ( sto, to, 1, e, notopnd, 1 ) ;
516
	cc(sto, to, 1, e, notopnd, 1);
489
  return ;
517
	return;
490
}
518
}
491
 
519
 
492
 
520
 
493
/*
521
/*
494
    IS e ASSIGNABLE?
522
    IS e ASSIGNABLE?
495
*/
523
*/
496
 
524
 
497
static bool is_assable
525
static bool
498
    PROTO_N ( ( e ) )
-
 
499
    PROTO_T ( exp e )
526
is_assable(exp e)
500
{
527
{
501
    long sz ;
528
	long sz;
502
    unsigned char n = name ( e ) ;
529
	unsigned char n = name(e);
503
    if ( is_a ( n ) ) return ( 1 ) ;
530
	if (is_a(n)) {
-
 
531
		return (1);
-
 
532
	}
504
    if ( n != apply_tag && n != apply_general_tag ) return ( 0 ) ;
533
	if (n != apply_tag && n != apply_general_tag) {
-
 
534
		return (0);
-
 
535
	}
505
    n = name ( sh ( e ) ) ;
536
	n = name(sh(e));
506
    sz = shape_size ( sh ( e ) ) ;
537
	sz = shape_size(sh(e));
507
    return ( n <= ulonghd || ( n == ptrhd && sz == 32 ) ) ;
538
	return (n <= ulonghd || (n == ptrhd && sz == 32));
508
}
539
}
509
 
540
 
510
 
541
 
511
/*
542
/*
512
    DOIT ROUTINE, IS t NOT ASSIGNABLE?
543
    DOIT ROUTINE, IS t NOT ASSIGNABLE?
513
*/
544
*/
514
 
545
 
515
static bool notass
546
static bool
516
    PROTO_N ( ( t, i ) )
-
 
517
    PROTO_T ( exp t X int i )
547
notass(exp t, int i)
518
{
-
 
519
    return ( i >= 0 && !is_assable ( t ) ) ;
-
 
520
}
-
 
521
 
-
 
522
 
-
 
523
/*
-
 
524
    APPLY cc, DOING IT WITH ASSIGNABLES
-
 
525
*/
-
 
526
 
-
 
527
static void all_assable
-
 
528
    PROTO_N ( ( sto, to, e ) )
-
 
529
    PROTO_T ( bool sto X exp to X exp e )
-
 
530
{
548
{
531
    cc ( sto, to, 1, e, notass, 1 ) ;
549
	return (i >= 0 && !is_assable(t));
532
    return ;
-
 
533
}
550
}
534
 
551
 
535
 
552
 
536
/*
553
/*
537
    IS e DIRECTLY ADDRESSABLE?
554
    APPLY cc, DOING IT WITH ASSIGNABLES
538
*/
555
*/
539
 
556
 
540
static bool is_direct
557
static void
541
    PROTO_N ( ( e ) )
-
 
542
    PROTO_T ( exp e )
558
all_assable(bool sto, exp to, exp e)
543
{
559
{
544
    unsigned char s = name ( e ) ;
560
	cc(sto, to, 1, e, notass, 1);
545
    return ( ( s == name_tag && !isglob ( son ( e ) ) &&
-
 
546
	       !isvar ( son ( e ) ) ) ||
561
	return;
547
	     ( s == cont_tag && name ( son ( e ) ) == name_tag &&
-
 
548
	       !isglob ( son ( son ( e ) ) ) &&
-
 
549
	       isvar ( son ( son ( e ) ) ) ) ) ;
-
 
550
}
562
}
551
 
563
 
552
 
564
 
553
/*
565
/*
554
    IS e INDIRECTLY ADDRESSABLE?
566
    IS e DIRECTLY ADDRESSABLE?
555
*/
567
*/
556
 
568
 
557
static bool is_indable
569
static bool
558
    PROTO_N ( ( e ) )
-
 
559
    PROTO_T ( exp e )
570
is_direct(exp e)
560
{
571
{
561
    unsigned char s = name ( e ) ;
572
    unsigned char s = name(e);
562
    if ( s == name_tag ) return ( 1 ) ;
-
 
563
 
-
 
564
    if ( s == cont_tag ) {
-
 
565
	unsigned char t = name ( son ( e ) ) ;
-
 
566
	return ( ( t == name_tag && isvar ( son ( son ( e ) ) ) ) ||
573
    return ((s == name_tag && !isglob(son(e)) && !isvar(son(e))) ||
567
		 ( t == cont_tag && name ( son ( son ( e ) ) ) == name_tag &&
574
	    (s == cont_tag && name(son(e)) == name_tag &&
568
		   isvar ( son ( son ( son ( e ) ) ) ) ) ||
575
	     !isglob(son(son(e))) && isvar(son(son(e)))));
569
		 ( t == reff_tag && is_direct ( son ( son ( e ) ) ) ) ) ;
-
 
570
    }
576
}
571
 
577
 
-
 
578
 
-
 
579
/*
-
 
580
    IS e INDIRECTLY ADDRESSABLE?
-
 
581
*/
-
 
582
 
-
 
583
static bool
-
 
584
is_indable(exp e)
-
 
585
{
-
 
586
	unsigned char s = name(e);
-
 
587
	if (s == name_tag) {
-
 
588
		return (1);
-
 
589
	}
-
 
590
 
-
 
591
	if (s == cont_tag) {
-
 
592
		unsigned char t = name(son(e));
572
    return ( ( s == reff_tag && is_direct ( son ( e ) ) ) ||
593
		return ((t == name_tag && isvar(son(son(e)))) ||
-
 
594
			(t == cont_tag && name(son(son(e))) == name_tag &&
573
	     s == addptr_tag ) ;
595
			 isvar(son(son(son(e))))) ||
-
 
596
			(t == reff_tag && is_direct(son(son(e)))));
-
 
597
	}
-
 
598
 
-
 
599
	return ((s == reff_tag && is_direct(son(e))) || s == addptr_tag);
574
}
600
}
575
 
601
 
576
#ifndef tdf3
602
#ifndef tdf3
577
/*
603
/*
578
    MAKES son ( e ) INDIRECTLY ADDRESSABLE
604
    MAKES son ( e ) INDIRECTLY ADDRESSABLE
579
*/
605
*/
580
static void indable_son
606
static void
581
    PROTO_N ( ( sto, to, e ) )
-
 
582
    PROTO_T ( bool sto X exp to X exp e )
607
indable_son(bool sto, exp to, exp e)
583
{
-
 
584
  if (!is_indable (son (e))) {
-
 
585
    exp ec;
-
 
586
    cca (sto, to, 1, e);
-
 
587
    ec = contexp (sto, to);
-
 
588
    scan2 (1, ec, son (ec));
-
 
589
  }
-
 
590
  else
-
 
591
    scan2 (sto, to, son (e));
-
 
592
  return;
-
 
593
}
-
 
594
 
-
 
595
#endif
-
 
596
 
-
 
597
/*
-
 
598
    APPLY scan2 TO A BRO LIST
-
 
599
*/
-
 
600
 
-
 
601
static void scanargs
-
 
602
    PROTO_N ( ( st, e ) )
-
 
603
    PROTO_T ( bool st X exp e )
-
 
604
{
608
{
-
 
609
	if (!is_indable(son(e))) {
-
 
610
		exp ec;
-
 
611
		cca(sto, to, 1, e);
-
 
612
		ec = contexp(sto, to);
-
 
613
		scan2(1, ec, son(ec));
-
 
614
	} else {
-
 
615
		scan2(sto, to, son(e));
-
 
616
	}
-
 
617
	return;
-
 
618
}
-
 
619
 
-
 
620
#endif
-
 
621
 
-
 
622
/*
-
 
623
    APPLY scan2 TO A BRO LIST
-
 
624
*/
-
 
625
 
-
 
626
static void
-
 
627
scanargs(bool st, exp e)
-
 
628
{
605
    exp t = e ;
629
	exp t = e;
606
    exp temp ;
630
	exp temp;
607
 
631
 
608
    while ( temp = contexp ( st, t ), scan2 ( st, t, temp ),
632
	while (temp = contexp(st, t), scan2(st, t, temp),
609
	    temp = contexp ( st, t ), !last ( temp ) ) {
633
	       temp = contexp(st, t), !last(temp)) {
610
	t = contexp ( st, t ) ;
634
		t = contexp(st, t);
611
	st = 0 ;
635
		st = 0;
612
    }
636
	}
613
    return ;
637
	return;
614
}
638
}
615
 
639
 
616
 
640
 
617
/*
641
/*
618
    DOIT ROUTINE FOR APPLY
642
    DOIT ROUTINE FOR APPLY
619
*/
643
*/
620
 
644
 
621
#if 0
645
#if 0
622
static bool apdo
646
static bool
623
    PROTO_N ( ( t, i ) )
-
 
624
    PROTO_T ( exp t X int i )
647
apdo(exp t, int i)
625
{
648
{
626
    /* The first argument needs special treatment */
649
	/* The first argument needs special treatment */
-
 
650
	if (i == 1) {
627
    if ( i == 1 ) return ( !is_indable ( t ) ) ;
651
		return (!is_indable(t));
-
 
652
	}
628
    return ( 0 ) ;
653
	return (0);
629
}
654
}
630
#endif
655
#endif
631
 
656
 
632
 
657
 
633
/*
658
/*
634
    DOIT ROUTINE FOR PLUS
659
    DOIT ROUTINE FOR PLUS
635
*/
660
*/
636
 
661
 
637
static bool plusdo
662
static bool
638
    PROTO_N ( ( t, i ) )
-
 
639
    PROTO_T ( exp t X int i )
663
plusdo(exp t, int i)
640
{
664
{
641
    /* Can't negate first argument */
665
	/* Can't negate first argument */
-
 
666
	if (i == 1) {
642
    if ( i == 1 ) return ( !is_opnd ( t ) ) ;
667
		return (!is_opnd(t));
-
 
668
	}
643
    /* But can negate the rest */
669
	/* But can negate the rest */
644
    if ( name ( t ) == neg_tag ) return ( 0 ) ;
670
	if (name(t) == neg_tag) {
-
 
671
		return (0);
-
 
672
	}
645
    return ( !is_opnd ( t ) ) ;
673
	return (!is_opnd(t));
646
}
674
}
647
 
675
 
648
 
676
 
649
/*
677
/*
650
    DOIT ROUTINE FOR MULT
678
    DOIT ROUTINE FOR MULT
651
*/
679
*/
652
 
680
 
653
static bool multdo
681
static bool
654
    PROTO_N ( ( t, i ) )
-
 
655
    PROTO_T ( exp t X int i )
682
multdo(exp t, int i)
656
{
683
{
657
    return ( i >= 0 && !is_o ( name ( t ) ) ) ;
684
	return (i >= 0 && !is_o(name(t)));
658
}
685
}
659
 
686
 
660
 
687
 
661
/*
688
/*
662
    DOIT ROUTINE FOR AND
689
    DOIT ROUTINE FOR AND
663
*/
690
*/
664
 
691
 
665
static bool anddo
692
static bool
-
 
693
anddo(exp t, int i)
-
 
694
{
-
 
695
#if 0
-
 
696
	/* Can't negate first argument */
-
 
697
	if (i == 1) {
-
 
698
		return (!is_o(name(t)));
-
 
699
	}
-
 
700
	/* But can negate the rest */
-
 
701
	if (name(t) == not_tag) {
-
 
702
		return (0);
-
 
703
	}
-
 
704
#endif
-
 
705
	return (!is_o(name(t)));
-
 
706
}
-
 
707
 
-
 
708
 
-
 
709
/*
666
    PROTO_N ( ( t, i ) )
710
    DOIT ROUTINE FOR XOR
-
 
711
*/
-
 
712
 
-
 
713
static bool
667
    PROTO_T ( exp t X int i )
714
notado(exp t, int i)
668
{
715
{
669
#if 0
-
 
670
    /* Can't negate first argument */
-
 
671
    if ( i == 1 ) return ( !is_o ( name ( t ) ) ) ;
-
 
672
    /* But can negate the rest */
-
 
673
    if ( name ( t ) == not_tag ) return ( 0 ) ;
-
 
674
#endif
-
 
675
    return ( !is_o ( name ( t ) ) ) ;
-
 
676
}
-
 
677
 
-
 
678
 
-
 
679
/*
-
 
680
    DOIT ROUTINE FOR XOR
-
 
681
*/
-
 
682
 
-
 
683
static bool notado
-
 
684
    PROTO_N ( ( t, i ) )
-
 
685
    PROTO_T ( exp t X int i )
-
 
686
{
-
 
687
    return ( i >= 0 && !is_o ( name ( t ) ) ) ;
716
	return (i >= 0 && !is_o(name(t)));
688
}
717
}
689
 
718
 
690
 
719
 
691
/*
720
/*
692
    MAIN SCAN ROUTINE
721
    MAIN SCAN ROUTINE
693
*/
722
*/
694
 
723
 
695
void scan2
724
void
696
    PROTO_N ( ( sto, to, e ) )
-
 
697
    PROTO_T ( bool sto X exp to X exp e )
725
scan2(bool sto, exp to, exp e)
698
{
726
{
699
    switch ( name ( e ) ) {
727
	switch (name(e)) {
700
 
-
 
701
	case cond_tag :
728
	case cond_tag:
702
	case rep_tag :
729
	case rep_tag:
703
	case compound_tag :
730
	case compound_tag:
704
#ifdef rscope_tag
731
#ifdef rscope_tag
705
	case rscope_tag :
732
	case rscope_tag:
706
#endif
733
#endif
707
	case solve_tag :
734
	case solve_tag:
708
	case concatnof_tag :
735
	case concatnof_tag:
709
	case nof_tag :
736
	case nof_tag:
710
	case diagnose_tag :
737
	case diagnose_tag:
711
#ifndef tdf3
738
#ifndef tdf3
712
     case caller_tag: {
739
	case caller_tag:
713
        if (son(e) == nilexp) /* empty make_nof */
740
		if (son(e) == nilexp) {
-
 
741
			/* empty make_nof */
714
        return ;
742
			return;
-
 
743
		}
715
        scanargs (1, e);
744
		scanargs(1, e);
716
        return ;
745
		return;
717
     };
-
 
718
#else
746
#else
829
	}
855
	}
830
 
-
 
831
	case ass_tag :
-
 
832
	case assvol_tag : {
-
 
833
	    exp toc ;
-
 
834
	    /* Change assvol into ass */
-
 
835
	    if ( name ( e ) == assvol_tag ) setname ( e, ass_tag ) ;
-
 
836
	    if ( !is_assable ( bro ( son ( e ) ) ) ) {
-
 
837
		cca ( sto, to, 0, son ( e ) ) ;
-
 
838
		toc = contexp ( sto, to ) ;
-
 
839
		scan2 ( 1, toc, son ( toc ) ) ;
-
 
840
	    } else {
-
 
841
		scan2 ( sto, to, bro ( son ( e ) ) ) ;
-
 
842
	    }
-
 
843
	    cont_arg ( sto, to, e, sh ( bro ( son ( e ) ) ) ) ;
-
 
844
	    return ;
-
 
845
	}
-
 
846
 
-
 
847
#ifndef tdf3
856
#ifndef tdf3
848
       case tail_call_tag: {
857
	case tail_call_tag: {
849
          exp cees = bro(son(e));
858
		exp cees = bro(son(e));
850
          cur_proc_has_tail_call = 1;
859
		cur_proc_has_tail_call = 1;
851
          cur_proc_use_same_callees  = (name(cees) == same_callees_tag);
860
		cur_proc_use_same_callees = (name(cees) == same_callees_tag);
852
 
861
 
853
          if (son(cees) != nilexp)
862
		if (son(cees) != nilexp) {
854
          cc (sto, to, 1, cees, no_alloca, 1);
863
			cc(sto, to, 1, cees, no_alloca, 1);
-
 
864
		}
855
 
865
 
856
          indable_son (sto, to, e);
866
		indable_son(sto, to, e);
857
 
867
 
858
          return ;
868
		return;
859
       };
-
 
860
 
869
	}
861
       case apply_general_tag : {
870
	case apply_general_tag: {
862
 
-
 
863
             exp cees = bro(bro(son(e)));
871
		exp cees = bro(bro(son(e)));
864
             exp p_post = cees;	/* bro(p_post) is postlude */
872
		exp p_post = cees;	/* bro(p_post) is postlude */
865
 
873
 
866
             cur_proc_use_same_callees  = (name(cees) == same_callees_tag);
874
		cur_proc_use_same_callees = (name(cees) == same_callees_tag);
867
 
875
 
-
 
876
		while (name(bro(p_post)) == ident_tag &&
868
             while (name(bro(p_post)) == ident_tag && name(son(bro(p_post))) == caller_name_tag)
877
		       name(son(bro(p_post))) == caller_name_tag) {
869
             p_post = son(bro(p_post));
878
			p_post = son(bro(p_post));
-
 
879
		}
870
             scan2 (0, p_post, bro(p_post));
880
		scan2(0, p_post, bro(p_post));
871
             if (son(cees) != nilexp)
881
		if (son(cees) != nilexp) {
872
             scanargs (1, cees);
882
			scanargs(1, cees);
-
 
883
		}
873
             if (no(bro(son(e))) != 0)
884
		if (no(bro(son(e))) != 0) {
874
             scanargs (1, bro(son(e)));
885
			scanargs(1, bro(son(e)));
-
 
886
		}
875
 
887
 
876
             if ( !is_indable ( son(e) ) ) {
888
		if (!is_indable(son(e))) {
877
		exp ec ;
889
			exp ec;
878
		cca ( sto, to, 1, e ) ;
890
			cca(sto, to, 1, e);
879
		ec = contexp ( sto, to ) ;
891
			ec = contexp(sto, to);
880
		scan2 ( 1, ec, son ( ec ) ) ;
892
			scan2(1, ec, son(ec));
881
             } else {
893
		} else {
882
		scan2 ( sto, to, son ( e ) ) ;
894
			scan2(sto, to, son(e));
883
             }
895
		}
884
             return ;
896
		return;
885
          }
897
	}
886
#endif
898
#endif
887
 
-
 
888
	case apply_tag : {
899
	case apply_tag:
889
	    scanargs ( 1, e ) ;
900
		scanargs(1, e);
890
	    /* Fall through */
901
		/* Fall through */
891
	}
-
 
892
 
-
 
893
	case goto_lv_tag : {
902
	case goto_lv_tag:
894
	    if ( !is_indable ( son ( e ) ) ) {
903
		if (!is_indable(son(e))) {
895
		exp ec ;
904
			exp ec;
896
		cca ( sto, to, 1, e ) ;
905
			cca(sto, to, 1, e);
897
		ec = contexp ( sto, to ) ;
906
			ec = contexp(sto, to);
898
		scan2 ( 1, ec, son ( ec ) ) ;
907
			scan2(1, ec, son(ec));
899
	    } else {
908
		} else {
900
		scan2 ( sto, to, son ( e ) ) ;
909
			scan2(sto, to, son(e));
901
	    }
910
		}
902
	    return ;
911
		return;
903
	}
-
 
904
 
-
 
905
#ifndef tdf3
912
#ifndef tdf3
906
        case untidy_return_tag:
913
	case untidy_return_tag:
907
#endif
914
#endif
908
	case res_tag : {
915
	case res_tag: {
909
	    long sz ;
916
		long sz;
-
 
917
 
-
 
918
		if (name(son(e)) == apply_tag ||
-
 
919
		    name(son(e)) == apply_general_tag)
-
 
920
		{
-
 
921
			scan2(sto, to, son(e));
-
 
922
			return;
-
 
923
		}
-
 
924
 
-
 
925
		sz = shape_size(sh(son(e)));
910
 
926
 
911
	    if ( name ( son ( e ) ) == apply_tag
-
 
912
              || name ( son ( e ) ) == apply_general_tag )
-
 
913
            {
-
 
914
		scan2 ( sto, to, son ( e ) ) ;
-
 
915
		return ;
-
 
916
	    }
-
 
917
 
-
 
918
	    sz = shape_size ( sh ( son ( e ) ) ) ;
-
 
919
 
-
 
920
	    if ( sz <= 64 ) {
927
		if (sz <= 64) {
921
		all_assable ( sto, to, e ) ;
928
			all_assable(sto, to, e);
922
		return ;
-
 
923
	    }
-
 
924
	    all_opnd ( sto, to, e ) ;
-
 
925
	    return ;
-
 
926
	}
-
 
927
 
-
 
928
	case case_tag : {
-
 
929
	    exp toc ;
-
 
930
	    if ( !is_opnd ( son ( e ) ) ) {
-
 
931
		cca ( sto, to, 1, e ) ;
-
 
932
		toc = contexp ( sto, to ) ;
-
 
933
		scan2 ( 1, toc, son ( toc ) ) ;
-
 
934
	    } else {
-
 
935
		scan2 ( sto, to, son ( e ) ) ;
-
 
936
	    }
-
 
937
	    return ;
-
 
938
	}
-
 
939
 
-
 
940
	case plus_tag : {
-
 
941
	    if ( name ( son ( e ) ) == neg_tag &&
-
 
942
		 name ( bro ( son ( e ) ) ) == val_tag ) {
-
 
943
		scan2 ( sto, to, son ( e ) ) ;
-
 
944
		return ;
929
			return;
945
	    }
-
 
946
	    cc ( sto, to, 1, e, plusdo, 1 ) ;
-
 
947
	    return ;
-
 
948
	}
-
 
949
 
-
 
950
	case addptr_tag : {
-
 
951
	    exp a = bro ( son ( e ) ) ;
-
 
952
 
-
 
953
	    if ( name ( a ) == offset_mult_tag &&
-
 
954
		 name ( bro ( son ( a ) ) ) == val_tag ) {
-
 
955
		long k = no ( bro ( son ( a ) ) ) / 8 ;
-
 
956
		if ( k == 1 || k == 2 || k == 4 || k == 8 ) {
-
 
957
		    ccp ( sto, to, 1, a ) ;
-
 
958
		    ap_arg1 ( sto, to, 1, e, 0 ) ;
-
 
959
		    return ;
-
 
960
		}
930
		}
961
	    }
-
 
962
 
-
 
963
	    ccp ( sto, to, 0, son ( e ) ) ;
-
 
964
	    ap_arg1 ( sto, to, 1, e, 0 ) ;
931
		all_opnd(sto, to, e);
965
	    return ;
-
 
966
	}
-
 
967
 
-
 
968
	case mult_tag : {
-
 
969
	    cc ( sto, to, 1, e, multdo, 1 ) ;
-
 
970
	    return ;
932
		return;
971
	}
933
	}
972
 
-
 
973
	case and_tag : {
934
	case case_tag: {
974
	    cc ( sto, to, 1, e, anddo, 1 ) ;
-
 
975
	    return ;
-
 
976
	}
-
 
977
 
-
 
978
	case or_tag :
-
 
979
	case xor_tag : {
-
 
980
	    cc ( sto, to, 1, e, notado, 1 ) ;
-
 
981
	    return ;
935
		exp toc;
982
	}
-
 
983
 
-
 
984
	case cont_tag :
-
 
985
	case contvol_tag : {
936
		if (!is_opnd(son(e))) {
986
	    /* Change contvol into cont */
-
 
987
	    if ( name ( e ) == contvol_tag ) setname ( e, cont_tag ) ;
-
 
988
	    cont_arg ( sto, to, e, sh ( e ) ) ;
-
 
989
	    return ;
-
 
990
	}
-
 
991
 
-
 
992
	case field_tag : {
-
 
993
	    if ( !is_o ( name ( son ( e ) ) ) || name ( e ) == cont_tag ) {
-
 
994
		exp temp ;
-
 
995
		cca ( sto, to, 1, e ) ;
937
			cca(sto, to, 1, e);
996
		temp = contexp ( sto, to ) ;
938
			toc = contexp(sto, to);
997
		scan2 ( 1, temp, son ( temp ) ) ;
939
			scan2(1, toc, son(toc));
998
	    } else {
940
		} else {
999
		scan2 ( sto, to, son ( e ) ) ;
941
			scan2(sto, to, son(e));
1000
	    }
-
 
1001
	    return ;
-
 
1002
	}
942
		}
1003
 
-
 
1004
	case reff_tag : {
-
 
1005
	    exp s = son ( e ) ;
-
 
1006
	    if ( name ( s ) == name_tag ||
-
 
1007
		 ( name ( s ) == cont_tag &&
-
 
1008
		   name ( son ( s ) ) == name_tag ) ) return ;
-
 
1009
	    ccp ( sto, to, 1, e ) ;
-
 
1010
	    return ;
943
		return;
1011
	}
944
	}
-
 
945
	case plus_tag:
-
 
946
		if (name(son(e)) == neg_tag &&
-
 
947
		    name(bro(son(e))) == val_tag) {
-
 
948
			scan2(sto, to, son(e));
-
 
949
			return;
-
 
950
		}
-
 
951
		cc(sto, to, 1, e, plusdo, 1);
-
 
952
		return;
-
 
953
	case addptr_tag: {
-
 
954
		exp a = bro(son(e));
1012
 
955
 
-
 
956
		if (name(a) == offset_mult_tag &&
-
 
957
		    name(bro(son(a))) == val_tag) {
-
 
958
			long k = no(bro(son(a))) / 8;
-
 
959
			if (k == 1 || k == 2 || k == 4 || k == 8) {
-
 
960
				ccp(sto, to, 1, a);
-
 
961
				ap_arg1(sto, to, 1, e, 0);
-
 
962
				return;
-
 
963
			}
-
 
964
		}
-
 
965
 
-
 
966
		ccp(sto, to, 0, son(e));
-
 
967
		ap_arg1(sto, to, 1, e, 0);
-
 
968
		return;
-
 
969
	}
-
 
970
	case mult_tag:
-
 
971
		cc(sto, to, 1, e, multdo, 1);
-
 
972
		return;
-
 
973
	case and_tag:
-
 
974
		cc(sto, to, 1, e, anddo, 1);
-
 
975
		return;
-
 
976
	case or_tag:
-
 
977
	case xor_tag:
-
 
978
		cc(sto, to, 1, e, notado, 1);
-
 
979
		return;
-
 
980
	case cont_tag:
-
 
981
	case contvol_tag:
-
 
982
		/* Change contvol into cont */
-
 
983
		if (name(e) == contvol_tag) {
-
 
984
			setname(e, cont_tag);
-
 
985
		}
-
 
986
		cont_arg(sto, to, e, sh(e));
-
 
987
		return;
-
 
988
	case field_tag:
-
 
989
		if (!is_o(name(son(e))) || name(e) == cont_tag) {
-
 
990
			exp temp;
-
 
991
			cca(sto, to, 1, e);
-
 
992
			temp = contexp(sto, to);
-
 
993
			scan2(1, temp, son(temp));
-
 
994
		} else {
-
 
995
			scan2(sto, to, son(e));
-
 
996
		}
-
 
997
		return;
-
 
998
	case reff_tag: {
-
 
999
		exp s = son(e);
-
 
1000
		if (name(s) == name_tag || (name(s) == cont_tag &&
-
 
1001
		     name(son(s)) == name_tag)) {
-
 
1002
			return;
-
 
1003
		}
-
 
1004
		ccp(sto, to, 1, e);
-
 
1005
		return;
-
 
1006
	}
1013
	case general_proc_tag:
1007
	case general_proc_tag:
1014
	case proc_tag : {
1008
	case proc_tag:
1015
	    scan2 ( 1, e, son ( e ) ) ;
1009
		scan2(1, e, son(e));
1016
	    return ;
1010
		return;
1017
	}
-
 
1018
#if 0
1011
#if 0
1019
	case val_tag :{
1012
	case val_tag:
1020
	  if(name(sh(e)) == offsethd && al2(sh(e))>=8){
1013
		if (name(sh(e)) == offsethd && al2(sh(e)) >= 8) {
1021
	    no(e) = no(e)>>3;
1014
			no(e) = no(e) >> 3;
1022
	  }
1015
		}
1023
	  return;
1016
		return;
1024
	}
-
 
1025
#endif
1017
#endif
1026
 
1018
	default:
1027
	default : return ;
1019
		return;
1028
    }
1020
	}
1029
}
1021
}