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) 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 105... Line 135...
105
#include "tags.h"
135
#include "tags.h"
106
#include "utility.h"
136
#include "utility.h"
107
#if have_diagnostics
137
#if have_diagnostics
108
#include "xdb_basics.h"
138
#include "xdb_basics.h"
109
#endif
139
#endif
110
extern dec *sort_decs PROTO_S ( ( dec * ) ) ;
140
extern dec *sort_decs(dec *);
111
static void output_all_exps PROTO_S ( ( void ) ) ;
141
static void output_all_exps(void);
112
 
142
 
113
/*
143
/*
114
    INCLUDE DEBUGGING ROUTINES
144
    INCLUDE DEBUGGING ROUTINES
115
 
145
 
116
    These are used to aid in debugging.
146
    These are used to aid in debugging.
Line 118... Line 148...
118
*/
148
*/
119
#ifdef EBUG
149
#ifdef EBUG
120
/*
150
/*
121
#include <misc/debug>
151
#include <misc/debug>
122
*/
152
*/
123
void breakpoint PROTO_Z () {}
153
void breakpoint(void) {}
124
#endif
154
#endif
125
 
155
 
126
#ifndef tdf3
156
#ifndef tdf3
127
#include "general_proc.h"
157
#include "general_proc.h"
128
#include "68k_globals.h"
158
#include "68k_globals.h"
129
int need_dummy_double = 0 ;
159
int need_dummy_double = 0;
130
#endif
160
#endif
131
 
161
 
132
/*
162
/*
133
    LOCAL AND GLOBAL NAME PREFIXES
163
    LOCAL AND GLOBAL NAME PREFIXES
134
*/
164
*/
135
 
165
 
136
char *local_prefix = "L" ;
166
char *local_prefix = "L";
137
char *name_prefix = "_" ;
167
char *name_prefix = "_";
138
 
168
 
139
 
169
 
140
/*
170
/*
141
    EXTERNAL POSITIONS
171
    EXTERNAL POSITIONS
142
*/
172
*/
143
 
173
 
144
static long crt_ext_off = 64 ;
174
static long crt_ext_off = 64;
145
static long crt_ext_pt = 10 ;
175
static long crt_ext_pt = 10;
146
 
176
 
147
 
177
 
148
/*
178
/*
149
    MARK AN EXPRESSION AS BEING STATIC AND UNALIASED
179
    MARK AN EXPRESSION AS BEING STATIC AND UNALIASED
150
*/
180
*/
151
 
181
 
152
static void mark_unaliased
182
static void mark_unaliased
153
    PROTO_N ( ( e ) )
-
 
154
    PROTO_T ( exp e )
183
(exp e)
155
{
184
{
156
    exp p = pt ( e ) ;
185
    exp p = pt(e);
157
    bool ca = 1 ;
186
    bool ca = 1;
158
    while ( p != nilexp && ca ) {
187
    while (p != nilexp && ca) {
159
	exp q = bro ( p ) ;
188
	exp q = bro(p);
160
	if ( q == nilexp ) {
189
	if (q == nilexp) {
161
	    ca = 0 ;
190
	    ca = 0;
162
	} else if ( !( last ( p ) && name ( q ) == cont_tag ) &&
191
	} else if (!(last(p) && name(q) == cont_tag) &&
163
		    !( !last ( p ) && last ( q ) &&
192
		    !(!last(p) && last(q) &&
164
		       name ( bro ( q ) ) == ass_tag ) ) {
193
		       name(bro(q)) == ass_tag)) {
165
	    ca = 0 ;
194
	    ca = 0;
166
	}
195
	}
167
	p = pt ( p ) ;
196
	p = pt(p);
168
    }
197
    }
169
    if ( ca ) setcaonly ( e ) ;
198
    if (ca)setcaonly(e);
170
    return ;
199
    return;
171
}
200
}
172
 
201
 
173
 
202
 
174
/*
203
/*
175
    PROCESS THE TDF
204
    PROCESS THE TDF
Line 177... Line 206...
177
    This routine gets all the TDF read into the correct operand form
206
    This routine gets all the TDF read into the correct operand form
178
    and applies the dead variable and register allocation analysis.
207
    and applies the dead variable and register allocation analysis.
179
*/
208
*/
180
 
209
 
181
void translate_capsule
210
void translate_capsule
182
    PROTO_Z ()
211
(void)
183
{
212
{
184
    dec *d ;
213
    dec *d;
185
 
214
 
186
    /* Fix procedure handling (copied from trans386) */
215
    /* Fix procedure handling (copied from trans386) */
187
    d = top_def;
216
    d = top_def;
188
#if 0
217
#if 0
189
    while (d != (dec *) 0) {
218
    while (d != (dec *)0) {
190
    exp crt_exp = d -> dec_u.dec_val.dec_exp;
219
    exp crt_exp = d -> dec_u.dec_val.dec_exp;
191
    exp idval;
220
    exp idval;
192
      if (!(d -> dec_u.dec_val.dec_var) && (name(sh(crt_exp)) != prokhd ||
221
      if (!(d -> dec_u.dec_val.dec_var) && (name(sh(crt_exp))!= prokhd ||
193
           ( idval = son(crt_exp) ,
222
          (idval = son(crt_exp),
194
             idval != nilexp && name(idval) != null_tag &&
223
             idval != nilexp && name(idval)!= null_tag &&
195
               name(idval) != proc_tag && name(idval) != general_proc_tag )) ){
224
               name(idval)!= proc_tag && name(idval)!= general_proc_tag))) {
196
	/* make variable, and change all uses to contents */
225
	/* make variable, and change all uses to contents */
197
        exp p = pt(crt_exp);
226
        exp p = pt(crt_exp);
198
        if (d -> dec_u.dec_val.extnamed)
227
        if (d -> dec_u.dec_val.extnamed)
199
          sh(crt_exp) = f_pointer(f_alignment(sh(crt_exp)));
228
          sh(crt_exp) = f_pointer(f_alignment(sh(crt_exp)));
200
	else
229
	else
201
          setvar(crt_exp);
230
          setvar(crt_exp);
202
        while (p != nilexp) {
231
        while (p != nilexp) {
203
          exp np = pt(p);
232
          exp np = pt(p);
204
          exp* ptr = refto (father(p), p);
233
          exp* ptr = refto(father(p), p);
205
          exp c = getexp (sh(p), bro(p), last(p), p, nilexp, 0, 0, cont_tag);
234
          exp c = getexp(sh(p), bro(p), last(p), p, nilexp, 0, 0, cont_tag);
206
          setfather (c, p);
235
          setfather(c, p);
207
          if (no(p) != 0) {
236
          if (no(p)!= 0) {
208
            exp r = getexp (sh(p), c, 1, p, nilexp, 0, no(p), reff_tag);
237
            exp r = getexp(sh(p), c, 1, p, nilexp, 0, no(p), reff_tag);
209
            no(p) = 0;
238
            no(p) = 0;
210
            son(c) = r;
239
            son(c) = r;
211
            setfather (r, p);
240
            setfather(r, p);
212
          }
241
          }
213
          *ptr = c;
242
          *ptr = c;
214
          p = np;
243
          p = np;
215
        }
244
        }
216
      }
245
      }
217
      d = d->def_next;
246
      d = d->def_next;
218
    }
247
    }
219
#endif
248
#endif
220
 
249
 
221
 
250
 
222
    make_transformations () ;
251
    make_transformations();
223
 
252
 
224
#ifndef EBUG
253
#ifndef EBUG
225
    opt_all_exps () ;
254
    opt_all_exps();
226
#endif
255
#endif
227
 
256
 
228
    /* Mark static unaliases declarations */
257
    /* Mark static unaliases declarations */
229
    if ( !separate_units ) {
258
    if (!separate_units) {
230
	for ( d = top_def ; d ; d = d->def_next ) {
259
	for (d = top_def; d; d = d->def_next) {
231
	    exp c = d->dec_u.dec_val.dec_exp ;
260
	    exp c = d->dec_u.dec_val.dec_exp;
232
	    if ( son ( c ) != nilexp &&
261
	    if (son(c)!= nilexp &&
233
		 !( d->dec_u.dec_val.extnamed ) && isvar ( c ) ) {
262
		 !(d->dec_u.dec_val.extnamed) && isvar(c)) {
234
		mark_unaliased ( c ) ;
263
		mark_unaliased(c);
235
	    }
264
	    }
236
	}
265
	}
237
    }
266
    }
238
 
267
 
239
    /* Mark locations for all globals */
268
    /* Mark locations for all globals */
240
    for ( d = top_def ; d ; d = d->def_next ) {
269
    for (d = top_def; d; d = d->def_next) {
241
	if ( d->dec_u.dec_val.processed ) {
270
	if (d->dec_u.dec_val.processed) {
242
	    exp c = d->dec_u.dec_val.dec_exp ;
271
	    exp c = d->dec_u.dec_val.dec_exp;
243
	    ptno ( c ) = crt_ext_pt++ ;
272
	    ptno(c) = crt_ext_pt++;
244
	    no ( c ) = crt_ext_off ;
273
	    no(c) = crt_ext_off;
245
	    crt_ext_off += shape_size ( d->dec_u.dec_val.dec_shape ) ;
274
	    crt_ext_off += shape_size(d->dec_u.dec_val.dec_shape);
246
	}
275
	}
247
    }
276
    }
248
 
277
 
249
    /* Output all code */
278
    /* Output all code */
250
    output_all_exps () ;
279
    output_all_exps();
251
 
280
 
252
    return ;
281
    return;
253
}
282
}
254
 
283
 
255
 
284
 
256
/*
285
/*
257
    TRANSLATE A SINGLE TAG DEFINITION
286
    TRANSLATE A SINGLE TAG DEFINITION
258
*/
287
*/
259
 
288
 
260
void translate_tagdef
289
void translate_tagdef
261
    PROTO_Z ()
290
(void)
262
{
291
{
263
    return ;
292
    return;
264
}
293
}
265
 
294
 
266
 
295
 
267
/*
296
/*
268
    TRANSLATE A SINGLE UNIT
297
    TRANSLATE A SINGLE UNIT
269
*/
298
*/
270
 
299
 
271
void translate_unit
300
void translate_unit
272
    PROTO_Z ()
301
(void)
273
{
302
{
274
    if ( separate_units ) {
303
    if (separate_units) {
275
	dec *d ;
304
	dec *d;
276
	translate_capsule () ;
305
	translate_capsule();
277
	d = top_def ;
306
	d = top_def;
278
	while ( d ) {
307
	while (d) {
279
	    exp c = d->dec_u.dec_val.dec_exp ;
308
	    exp c = d->dec_u.dec_val.dec_exp;
280
	    no ( c ) = 0 ;
309
	    no(c) = 0;
281
	    pt ( c ) = nilexp ;
310
	    pt(c) = nilexp;
282
	    d = d->def_next ;
311
	    d = d->def_next;
283
	}
312
	}
284
	crt_repeat = nilexp ;
313
	crt_repeat = nilexp;
285
	repeat_list = nilexp ;
314
	repeat_list = nilexp;
286
    }
315
    }
287
    return ;
316
    return;
288
}
317
}
289
 
318
 
290
 
319
 
291
/*
320
/*
292
    ENCODE A PROCEDURE
321
    ENCODE A PROCEDURE
Line 294... Line 323...
294
    The procedure with declaration d, name id, definition c and body s
323
    The procedure with declaration d, name id, definition c and body s
295
    is encoded.
324
    is encoded.
296
*/
325
*/
297
 
326
 
298
static void code_proc
327
static void code_proc
299
    PROTO_N ( ( d, id, c, s ) )
-
 
300
    PROTO_T ( dec *d X char *id X exp c X exp s )
328
(dec *d, char *id, exp c, exp s)
301
{
329
{
302
    diag_global *di = d->dec_u.dec_val.diag_info ;
330
    diag_global *di = d->dec_u.dec_val.diag_info;
303
    int reg_res = ( has_struct_res ( s ) ? 0 : 1 ) ;
331
    int reg_res = (has_struct_res(s)? 0 : 1);
304
    int is_ext = ( d->dec_u.dec_val.extnamed ? 1 : 0 ) ;
332
    int is_ext = (d->dec_u.dec_val.extnamed ? 1 : 0);
305
 
333
 
306
    area ( ptext ) ;
334
    area(ptext);
307
 
335
 
308
    cur_proc_dec = d ;
336
    cur_proc_dec = d;
309
    cur_proc_callees_size = 0 ;
337
    cur_proc_callees_size = 0;
310
    cur_proc_has_vcallees = 0 ;
338
    cur_proc_has_vcallees = 0;
311
 
339
 
312
    /* Code procedure body */
340
    /* Code procedure body */
313
#if 0
341
#if 0
314
    if ( name ( s ) == proc_tag )
342
    if (name(s) == proc_tag)
315
    cproc ( s, id, -1, is_ext, reg_res, di ) ;
343
    cproc(s, id, -1, is_ext, reg_res, di);
316
    else
344
    else
317
#endif
345
#endif
318
    gcproc ( s, id, -1, is_ext, reg_res, di) ;
346
    gcproc(s, id, -1, is_ext, reg_res, di);
319
 
347
 
320
 
348
 
321
    d -> dec_u.dec_val.index = cur_proc_env_size ; /* for use in constant evaluation */
349
    d -> dec_u.dec_val.index = cur_proc_env_size ; /* for use in constant evaluation */
322
 
350
 
323
    output_env_size(d, cur_proc_env_size);
351
    output_env_size(d, cur_proc_env_size);
Line 330... Line 358...
330
    The constant with declaration d, name id, definition c and body s
358
    The constant with declaration d, name id, definition c and body s
331
    is encoded.
359
    is encoded.
332
*/
360
*/
333
 
361
 
334
static void code_const
362
static void code_const
335
    PROTO_N ( ( d ) )
-
 
336
    PROTO_T ( dec *d )
363
(dec *d)
337
{
364
{
338
   exp c = d->dec_u.dec_val.dec_exp ;
365
   exp c = d->dec_u.dec_val.dec_exp;
339
   exp s = son ( c ) ;
366
   exp s = son(c);
340
   char *id = d->dec_u.dec_val.dec_id ;
367
   char *id = d->dec_u.dec_val.dec_id;
341
 
368
 
342
   diag_global *di = d->dec_u.dec_val.diag_info ;
369
   diag_global *di = d->dec_u.dec_val.diag_info;
343
   area ( isvar ( c ) ? pdata : ptext ) ;
370
   area(isvar(c)? pdata : ptext);
344
#ifndef no_align_directives
371
#ifndef no_align_directives
345
   make_instr ( m_as_align4, null, null, 0 ) ;
372
   make_instr(m_as_align4, null, null, 0);
346
#endif
373
#endif
347
   evaluate ( s, L_1 , id, !isvar ( c ), 1, di ) ;
374
   evaluate(s, L_1 , id, !isvar(c), 1, di);
348
}
375
}
349
 
376
 
350
 
377
 
351
/*
378
/*
352
    ENCODE THE CONSTANTS IN const_list
379
    ENCODE THE CONSTANTS IN const_list
Line 354... Line 381...
354
    All auxiliary constants are formed into a list, const_list.  This
381
    All auxiliary constants are formed into a list, const_list.  This
355
    routine applies evaluate to each element of this list.
382
    routine applies evaluate to each element of this list.
356
*/
383
*/
357
 
384
 
358
static void code_const_list
385
static void code_const_list
359
    PROTO_Z ()
386
(void)
360
{
387
{
361
    while ( const_list != nilexp ) {
388
    while (const_list != nilexp) {
362
	exp t = const_list ;
389
	exp t = const_list;
363
	exp s = son ( t ) ;
390
	exp s = son(t);
364
	bool b = ( name ( s ) != res_tag ) ;
391
	bool b = (name(s)!= res_tag);
365
	const_list = bro ( const_list ) ;
392
	const_list = bro(const_list);
366
	if ( name ( s ) == proc_tag || name ( s ) == general_proc_tag ) {
393
	if (name(s) == proc_tag || name(s) == general_proc_tag) {
367
	    char *id = alloc_nof ( char, 30 ) ;
394
	    char *id = alloc_nof(char, 30);
368
	    sprintf ( id, "%s%ld", local_prefix, no ( t ) ) ;
395
	    sprintf(id, "%s%ld", local_prefix, no(t));
369
	    gcproc ( s, null, no ( t ), 0, 1, null ) ;
396
	    gcproc(s, null, no(t), 0, 1, null);
370
	} else {
397
	} else {
371
	    area ( b ? pdata : ptext ) ;
398
	    area(b ? pdata : ptext);
372
	    evaluate ( s, no ( t ), null, b, 0, null ) ;
399
	    evaluate(s, no(t), null, b, 0, null);
373
	}
400
	}
374
    }
401
    }
375
    return ;
402
    return;
376
}
403
}
377
 
404
 
378
/*
405
/*
379
   CONST_READY
406
   CONST_READY
380
 
407
 
381
   Returns TRUE if it is possible to evaluate the value of the constant now
408
   Returns TRUE if it is possible to evaluate the value of the constant now
382
*/
409
*/
383
 
410
 
384
static int const_ready
411
static int const_ready
385
    PROTO_N ( (e) )
-
 
386
    PROTO_T ( exp e )
412
(exp e)
387
{
413
{
388
  unsigned char  n = name (e);
414
  unsigned char  n = name(e);
389
  if (n == env_size_tag)
415
  if (n == env_size_tag)
390
    return (brog(son(son(e))) -> dec_u.dec_val.processed);
416
    return(brog(son(son(e))) -> dec_u.dec_val.processed);
391
  if (n == env_offset_tag)
417
  if (n == env_offset_tag)
392
    return (ismarked(son(e)));
418
    return(ismarked(son(e)));
393
  if (n == name_tag || son(e) == nilexp)
419
  if (n == name_tag || son(e) == nilexp)
394
    return 1;
420
    return 1;
395
  e = son(e);
421
  e = son(e);
396
  while (!last(e)) {
422
  while (!last(e)) {
397
    if (!const_ready(e))
423
    if (!const_ready(e))
398
      return 0;
424
      return 0;
399
    e = bro(e);
425
    e = bro(e);
400
  }
426
  }
401
  return (const_ready(e));
427
  return(const_ready(e));
402
}
428
}
403
 
429
 
404
typedef struct delayedconst{
430
typedef struct delayedconst{
405
   dec* This;
431
   dec* This;
406
   struct delayedconst* next;
432
   struct delayedconst* next;
407
} delayed_const ;
433
} delayed_const;
408
 
434
 
409
static delayed_const* delayed_const_list = 0;
435
static delayed_const* delayed_const_list = 0;
410
 
436
 
411
static void eval_if_ready
437
static void eval_if_ready
412
    PROTO_N ( ( d ) )
-
 
413
    PROTO_T ( dec *d )
438
(dec *d)
414
{
439
{
415
   exp c = d->dec_u.dec_val.dec_exp ;
440
   exp c = d->dec_u.dec_val.dec_exp;
416
   if ( const_ready( c ) ) {
441
   if (const_ready(c)) {
417
      code_const ( d ) ;
442
      code_const(d);
418
   }
443
   }
419
   else {
444
   else {
420
      delayed_const* p = (delayed_const*)xmalloc (sizeof(delayed_const));
445
      delayed_const* p = (delayed_const*)xmalloc(sizeof(delayed_const));
421
      p->This = d;
446
      p->This = d;
422
      p->next = delayed_const_list;
447
      p->next = delayed_const_list;
423
      delayed_const_list = p;
448
      delayed_const_list = p;
424
   }
449
   }
425
}
450
}
426
 
451
 
427
void eval_delayed_const_list
452
void eval_delayed_const_list
428
    PROTO_Z ()
453
(void)
429
{
454
{
430
   delayed_const* p;
455
   delayed_const* p;
431
   bool done = 0;
456
   bool done = 0;
432
   while (! done) {
457
   while (! done) {
433
      done = 1;
458
      done = 1;
434
      for (p = delayed_const_list; p; p = p->next) {
459
      for (p = delayed_const_list; p; p = p->next) {
435
         dec* d = p->This;
460
         dec* d = p->This;
436
         if ( !d->dec_u.dec_val.processed ) {
461
         if (!d->dec_u.dec_val.processed) {
437
            exp c = d->dec_u.dec_val.dec_exp ;
462
            exp c = d->dec_u.dec_val.dec_exp;
438
            if ( const_ready( c ) ) {
463
            if (const_ready(c)) {
439
               code_const ( d ) ;
464
               code_const(d);
440
               d->dec_u.dec_val.processed = 1 ;
465
               d->dec_u.dec_val.processed = 1;
441
            }
466
            }
442
            done = 0;
467
            done = 0;
443
         }
468
         }
444
      }
469
      }
445
   }
470
   }
Line 451... Line 476...
451
 
476
 
452
    This routine scans through all the declarations encoding suitably.
477
    This routine scans through all the declarations encoding suitably.
453
*/
478
*/
454
 
479
 
455
static void output_all_exps
480
static void output_all_exps
456
    PROTO_Z ()
481
(void)
457
{
482
{
458
    dec *d = top_def ;
483
    dec *d = top_def;
459
    if ( diagnose ) d = sort_decs ( d ) ;
484
    if (diagnose)d = sort_decs(d);
460
 
485
 
461
    area ( ptext ) ;
486
    area(ptext);
462
 
487
 
463
    /* Clear any existing output */
488
    /* Clear any existing output */
464
    output_all () ;
489
    output_all();
465
    free_all_ins () ;
490
    free_all_ins();
466
 
491
 
467
    /* Scan through the declarations */
492
    /* Scan through the declarations */
468
    while ( d ) {
493
    while (d) {
469
 
494
 
470
	if ( !d->dec_u.dec_val.processed ) {
495
	if (!d->dec_u.dec_val.processed) {
471
	    exp c = d->dec_u.dec_val.dec_exp ;
496
	    exp c = d->dec_u.dec_val.dec_exp;
472
	    exp s = son ( c ) ;
497
	    exp s = son(c);
473
	    char *id = d->dec_u.dec_val.dec_id ;
498
	    char *id = d->dec_u.dec_val.dec_id;
474
 
499
 
475
	    init_output () ;
500
	    init_output();
476
 
501
 
477
	    if ( s != nilexp ) {
502
	    if (s != nilexp) {
478
		if ( name ( s ) == proc_tag ||
503
		if (name(s) == proc_tag ||
479
                    name ( s ) == general_proc_tag) {
504
                    name(s) == general_proc_tag) {
480
		    code_proc ( d, id, c, s ) ;
505
		    code_proc(d, id, c, s);
481
		    code_const_list () ;
506
		    code_const_list();
482
                    d->dec_u.dec_val.processed = 1 ;
507
                    d->dec_u.dec_val.processed = 1;
483
		} else {
508
		} else {
484
		    eval_if_ready ( d ) ;
509
		    eval_if_ready(d);
485
		    code_const_list () ;
510
		    code_const_list();
486
		}
511
		}
487
	    } else {
512
	    } else {
488
		shape sha = d->dec_u.dec_val.dec_shape ;
513
		shape sha = d->dec_u.dec_val.dec_shape;
489
		long sz = round ( shape_size ( sha ) / 8, 4 ) ;
514
		long sz = round(shape_size(sha) / 8, 4);
490
		area ( ptext ) ;
515
		area(ptext);
491
		if ( !is_local ( id ) && isvar ( c ) &&
516
		if (!is_local(id) && isvar(c) &&
492
		     varsize ( sha ) && !reserved ( id ) ) {
517
		     varsize(sha) && !reserved(id)) {
493
		    if ( sz ) {
518
		    if (sz) {
494
			mach_op *op1 = make_extern_data ( id, 0 ) ;
519
			mach_op *op1 = make_extern_data(id, 0);
495
			mach_op *op2 = make_int_data ( sz ) ;
520
			mach_op *op2 = make_int_data(sz);
496
			make_instr ( m_as_common, op1, op2, 0 ) ;
521
			make_instr(m_as_common, op1, op2, 0);
497
		    }
522
		    }
498
		} else {
523
		} else {
499
		    if ( is_local ( id ) && no ( c ) ) {
524
		    if (is_local(id) && no(c)) {
500
			mach_op *op1 = make_extern_data ( id, 0 ) ;
525
			mach_op *op1 = make_extern_data(id, 0);
501
			mach_op *op2 = make_int_data ( sz ) ;
526
			mach_op *op2 = make_int_data(sz);
502
			make_instr ( m_as_local, op1, op2, 0 ) ;
527
			make_instr(m_as_local, op1, op2, 0);
503
		    }
528
		    }
504
		}
529
		}
505
                d->dec_u.dec_val.processed = 1 ;
530
                d->dec_u.dec_val.processed = 1;
506
	    }
531
	    }
507
 
532
 
508
	    output_all () ;
533
	    output_all();
509
	    free_all_ins () ;
534
	    free_all_ins();
510
	}
535
	}
511
	d = d->def_next ;
536
	d = d->def_next;
512
    }
537
    }
513
 
538
 
514
    eval_delayed_const_list();
539
    eval_delayed_const_list();
515
    output_all () ;
540
    output_all();
516
    free_all_ins () ;
541
    free_all_ins();
517
 
542
 
518
    /* Add final touches */
543
    /* Add final touches */
519
    init_output () ;
544
    init_output();
520
    if ( need_dummy_double )  {
545
    if (need_dummy_double) {
521
       mach_op *op1 = make_extern_data ("___m68k_dummy_double", 0 ) ;
546
       mach_op *op1 = make_extern_data("___m68k_dummy_double", 0);
522
       mach_op *op2 = make_int_data ( 8 ) ;
547
       mach_op *op2 = make_int_data(8);
523
       make_instr ( m_as_common, op1, op2, 0 ) ;
548
       make_instr(m_as_common, op1, op2, 0);
524
    }
549
    }
525
 
550
 
526
    if ( do_profile ) profile_hack () ;
551
    if (do_profile)profile_hack();
527
 
552
 
528
    area ( pdata ) ;
553
    area(pdata);
529
    output_all () ;
554
    output_all();
530
    free_all_ins () ;
555
    free_all_ins();
531
    return ;
556
    return;
532
}
557
}