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) 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
Line 71... Line 101...
71
 * Revision 1.24  1997/03/20  16:23:35  pwe
101
 * Revision 1.24  1997/03/20  16:23:35  pwe
72
 * dwarf2
102
 * dwarf2
73
 *
103
 *
74
 * Revision 1.23  1996/12/13  14:39:19  pwe
104
 * Revision 1.23  1996/12/13  14:39:19  pwe
75
 * prep NEWDIAGS
105
 * prep NEWDIAGS
76
 *
106
 *
77
 * Revision 1.22  1996/11/08  16:19:02  pwe
107
 * Revision 1.22  1996/11/08  16:19:02  pwe
78
 * check_stack to check before modifying stack
108
 * check_stack to check before modifying stack
79
 *
109
 *
80
 * Revision 1.21  1996/10/31  12:02:33  pwe
110
 * Revision 1.21  1996/10/31  12:02:33  pwe
81
 * correct env_offset used in constant evaluation
111
 * correct env_offset used in constant evaluation
82
 *
112
 *
83
 * Revision 1.20  1996/10/29  13:50:51  pwe
113
 * Revision 1.20  1996/10/29  13:50:51  pwe
84
 * correct space for patched instructions
114
 * correct space for patched instructions
85
 *
115
 *
86
 * Revision 1.19  1996/10/08  07:58:56  pwe
116
 * Revision 1.19  1996/10/08  07:58:56  pwe
87
 * revised correction to env_offset v id out_of_line
117
 * revised correction to env_offset v id out_of_line
88
 *
118
 *
89
 * Revision 1.18  1996/10/07  13:31:06  pwe
119
 * Revision 1.18  1996/10/07  13:31:06  pwe
90
 * push make_value, and env_offset v id out_of_line
120
 * push make_value, and env_offset v id out_of_line
91
 *
121
 *
92
 * Revision 1.17  1996/07/31  12:56:53  pwe
122
 * Revision 1.17  1996/07/31  12:56:53  pwe
93
 * restore alloca stack after longjump
123
 * restore alloca stack after longjump
94
 *
124
 *
95
 * Revision 1.16  1996/07/09  09:43:35  pwe
125
 * Revision 1.16  1996/07/09  09:43:35  pwe
96
 * caller env_offset if callees present, and tidy
126
 * caller env_offset if callees present, and tidy
97
 *
127
 *
98
 * Revision 1.15  1996/02/08  13:45:12  pwe
128
 * Revision 1.15  1996/02/08  13:45:12  pwe
99
 * Linux elf v aout option
129
 * Linux elf v aout option
100
 *
130
 *
101
 * Revision 1.14  1996/01/10  09:19:03  pwe
131
 * Revision 1.14  1996/01/10  09:19:03  pwe
102
 * profile const & envoffset correction
132
 * profile const & envoffset correction
103
 *
133
 *
104
 * Revision 1.13  1996/01/05  16:25:22  pwe
134
 * Revision 1.13  1996/01/05  16:25:22  pwe
105
 * env_size and env_offset within constant expressions
135
 * env_size and env_offset within constant expressions
Line 201... Line 231...
201
#define GLOBALTABLEMASK 0x8
231
#define GLOBALTABLEMASK 0x8
202
 
232
 
203
/* PROCEDURES */
233
/* PROCEDURES */
204
 
234
 
205
static void add_odd_bits
235
static void add_odd_bits
206
    PROTO_N ( (r) )
-
 
207
    PROTO_T ( outofline * r )
236
(outofline * r)
208
{
237
{
209
  if (r != (outofline*)0) {
238
  if (r != (outofline*)0) {
210
    if (r -> next == (outofline*)0)
239
    if (r -> next == (outofline*)0)
211
      last_odd_bit = 1;
240
      last_odd_bit = 1;
212
    add_odd_bits(r -> next);
241
    add_odd_bits(r -> next);
Line 220... Line 249...
220
  simple_set_label(r->labno);
249
  simple_set_label(r->labno);
221
  clear_reg_record(crt_reg_record);
250
  clear_reg_record(crt_reg_record);
222
#ifdef NEWDWARF
251
#ifdef NEWDWARF
223
  if (dwarf2) {
252
  if (dwarf2) {
224
#if 1
253
#if 1
225
    dw2_start_extra_bit (r->body);
254
    dw2_start_extra_bit(r->body);
226
#else
255
#else
227
    dw2_start_extra_bit (r->dw2_slave);
256
    dw2_start_extra_bit(r->dw2_slave);
228
#endif
257
#endif
229
    START_BB ();
258
    START_BB();
230
  }
259
  }
231
#endif
260
#endif
232
 
261
 
233
  regsinuse = r->regsinuse;
262
  regsinuse = r->regsinuse;
234
  fstack_pos = r->fstack_pos;
263
  fstack_pos = r->fstack_pos;
Line 238... Line 267...
238
  cond2a = r->cond2a;
267
  cond2a = r->cond2a;
239
  cond2b = r->cond2b;
268
  cond2b = r->cond2b;
240
  repeat_level = r->repeat_level;
269
  repeat_level = r->repeat_level;
241
  scale = r->scale;
270
  scale = r->scale;
242
  coder(r->dest, r->stack, r->body);
271
  coder(r->dest, r->stack, r->body);
243
  if (name(sh(r->body)) != bothd)  {
272
  if (name(sh(r->body))!= bothd) {
244
    clean_stack();
273
    clean_stack();
245
    jump(r->jr, 0);
274
    jump(r->jr, 0);
246
  }
275
  }
247
  else
276
  else
248
    stack_dec = 0;
277
    stack_dec = 0;
249
#ifdef NEWDWARF
278
#ifdef NEWDWARF
250
  if (dwarf2)
279
  if (dwarf2)
251
#if 1
280
#if 1
252
    dw2_end_extra_bit (r->body);
281
    dw2_end_extra_bit(r->body);
253
#else
282
#else
254
    dw2_end_extra_bit (r->dw2_hi);
283
    dw2_end_extra_bit(r->dw2_hi);
255
#endif
284
#endif
256
#endif
285
#endif
257
  return;
286
  return;
258
}
287
}
259
 
288
 
260
static void out_pops
289
static void out_pops
261
    PROTO_N ( (tot_sp, push_space, extra, dpos) )
-
 
262
    PROTO_T ( int tot_sp X int push_space X int extra X int dpos )
290
(int tot_sp, int push_space, int extra, int dpos)
263
{
291
{
264
#ifdef NEWDWARF
292
#ifdef NEWDWARF
265
  int st;
293
  int st;
266
  long dwl0 = 0, dwl1 = 0, dwl2 = 0, dwl3 = 0, dwl4 = 0;
294
  long dwl0 = 0, dwl1 = 0, dwl2 = 0, dwl3 = 0, dwl4 = 0;
267
#endif
295
#endif
268
  tot_sp -= extra;
296
  tot_sp -= extra;
269
  if (no_frame && !stack_aligned_8byte) {
297
  if (no_frame && !stack_aligned_8byte) {
270
    if (tot_sp != push_space) {
298
    if (tot_sp != push_space) {
271
      outs (" addl $");
299
      outs(" addl $");
272
      outn ((long)(tot_sp - push_space));
300
      outn((long)(tot_sp - push_space));
273
      outs (",%esp");
301
      outs(",%esp");
274
      outnl();
302
      outnl();
275
#ifdef NEWDWARF
303
#ifdef NEWDWARF
276
      if (diagnose && dwarf2)
304
      if (diagnose && dwarf2)
277
	dwl0 = set_dw_text_label ();
305
	dwl0 = set_dw_text_label();
278
#endif
306
#endif
279
    };
307
    };
280
  }
308
  }
281
  else {
309
  else {
282
    if (tot_sp != push_space || has_alloca || stack_aligned_8byte) {
310
    if (tot_sp != push_space || has_alloca || stack_aligned_8byte) {
283
      outs (" leal -");
311
      outs(" leal -");
284
      outn ((long)push_space);
312
      outn((long)push_space);
285
      outs ("(%ebp),%esp");
313
      outs("(%ebp),%esp");
286
      outnl();
314
      outnl();
287
    };
315
    };
288
  };
316
  };
289
 
317
 
290
  /* pop the registers at the end */
318
  /* pop the registers at the end */
291
  if (no_frame && (min_rfree & 0x40)) {
319
  if (no_frame && (min_rfree & 0x40)) {
292
    outs (" pop %ebp");
320
    outs(" pop %ebp");
293
    outnl();
321
    outnl();
294
#ifdef NEWDWARF
322
#ifdef NEWDWARF
295
    if (diagnose && dwarf2)
323
    if (diagnose && dwarf2)
296
      dwl1 = set_dw_text_label ();
324
      dwl1 = set_dw_text_label();
297
#endif
325
#endif
298
  };
326
  };
299
  if (min_rfree & 0x20) {
327
  if (min_rfree & 0x20) {
300
    outs (" pop %esi");
328
    outs(" pop %esi");
301
    outnl();
329
    outnl();
302
#ifdef NEWDWARF
330
#ifdef NEWDWARF
303
    if (diagnose && dwarf2)
331
    if (diagnose && dwarf2)
304
      dwl2 = set_dw_text_label ();
332
      dwl2 = set_dw_text_label();
305
#endif
333
#endif
306
  };
334
  };
307
  if (min_rfree & 0x10) {
335
  if (min_rfree & 0x10) {
308
    outs (" pop %edi");
336
    outs(" pop %edi");
309
    outnl();
337
    outnl();
310
#ifdef NEWDWARF
338
#ifdef NEWDWARF
311
    if (diagnose && dwarf2)
339
    if (diagnose && dwarf2)
312
      dwl3 = set_dw_text_label ();
340
      dwl3 = set_dw_text_label();
313
#endif
341
#endif
314
  };
342
  };
315
  if (min_rfree & 0x8) {
343
  if (min_rfree & 0x8) {
316
    outs (" pop %ebx");
344
    outs(" pop %ebx");
317
    outnl();
345
    outnl();
318
#ifdef NEWDWARF
346
#ifdef NEWDWARF
319
    if (diagnose && dwarf2)
347
    if (diagnose && dwarf2)
320
      dwl4 = set_dw_text_label ();
348
      dwl4 = set_dw_text_label();
321
#endif
349
#endif
322
  };
350
  };
323
 
351
 
324
  if (!no_frame)  {
352
  if (!no_frame) {
325
    outs (" pop %ebp");
353
    outs(" pop %ebp");
326
    outnl();
354
    outnl();
327
#ifdef NEWDWARF
355
#ifdef NEWDWARF
328
    if (diagnose && dwarf2)
356
    if (diagnose && dwarf2)
329
      dwl1 = set_dw_text_label ();
357
      dwl1 = set_dw_text_label();
330
#endif
358
#endif
331
  };
359
  };
332
  outnl();
360
  outnl();
333
#ifdef NEWDWARF
361
#ifdef NEWDWARF
334
  if (diagnose && dwarf2) {
362
  if (diagnose && dwarf2) {
335
    st = fseek (fpout, dpos, 0);
363
    st = fseek(fpout, dpos, 0);
336
    if (st == -1) {
364
    if (st == -1) {
337
      failer (SEEK_FAILURE);
365
      failer(SEEK_FAILURE);
338
      exit(EXIT_FAILURE);
366
      exit(EXIT_FAILURE);
339
    };
367
    };
340
    dw2_fde_restore_args (dwl0, dwl1, dwl2, dwl3, dwl4, push_space);
368
    dw2_fde_restore_args(dwl0, dwl1, dwl2, dwl3, dwl4, push_space);
341
  }
369
  }
342
#endif
370
#endif
343
  return;
371
  return;
344
}
372
}
345
 
373
 
346
static void out_untidy_pops
374
static void out_untidy_pops
347
    PROTO_N ( (tot_sp, push_space) )
-
 
348
    PROTO_T ( int tot_sp X int push_space )
375
(int tot_sp, int push_space)
349
{
376
{
350
  if (no_frame) {
377
  if (no_frame) {
351
    int s_offset = tot_sp - push_space;
378
    int s_offset = tot_sp - push_space;
352
    if (min_rfree & 0x40) {
379
    if (min_rfree & 0x40) {
353
      outs (" movl ");
380
      outs(" movl ");
354
      outn ((long)s_offset);
381
      outn((long)s_offset);
355
      outs ("(%esp),%ebp");
382
      outs("(%esp),%ebp");
356
      outnl();
383
      outnl();
357
      s_offset += 4;
384
      s_offset += 4;
358
    };
385
    };
359
    if (min_rfree & 0x20) {
386
    if (min_rfree & 0x20) {
360
      outs (" movl ");
387
      outs(" movl ");
361
      outn ((long)s_offset);
388
      outn((long)s_offset);
362
      outs ("(%esp),%esi");
389
      outs("(%esp),%esi");
363
      outnl();
390
      outnl();
364
      s_offset += 4;
391
      s_offset += 4;
365
    };
392
    };
366
    if (min_rfree & 0x10) {
393
    if (min_rfree & 0x10) {
367
      outs (" movl ");
394
      outs(" movl ");
368
      outn ((long)s_offset);
395
      outn((long)s_offset);
369
      outs ("(%esp),%edi");
396
      outs("(%esp),%edi");
370
      outnl();
397
      outnl();
371
      s_offset += 4;
398
      s_offset += 4;
372
    };
399
    };
373
    if (min_rfree & 0x8) {
400
    if (min_rfree & 0x8) {
374
      outs (" movl ");
401
      outs(" movl ");
375
      outn ((long)s_offset);
402
      outn((long)s_offset);
376
      outs ("(%esp),%ebx");
403
      outs("(%esp),%ebx");
377
      outnl();
404
      outnl();
378
      /* s_offset += 4; */
405
      /* s_offset += 4; */
379
    };
406
    };
380
  }
407
  }
381
  else {
408
  else {
382
    int fm_offset = - push_space;
409
    int fm_offset = - push_space;
383
    if (min_rfree & 0x20) {
410
    if (min_rfree & 0x20) {
384
      outs (" movl ");
411
      outs(" movl ");
385
      outn ((long)fm_offset);
412
      outn((long)fm_offset);
386
      outs ("(%ebp),%esi");
413
      outs("(%ebp),%esi");
387
      outnl();
414
      outnl();
388
      fm_offset += 4;
415
      fm_offset += 4;
389
    };
416
    };
390
    if (min_rfree & 0x10) {
417
    if (min_rfree & 0x10) {
391
      outs (" movl ");
418
      outs(" movl ");
392
      outn ((long)fm_offset);
419
      outn((long)fm_offset);
393
      outs ("(%ebp),%edi");
420
      outs("(%ebp),%edi");
394
      outnl();
421
      outnl();
395
      fm_offset += 4;
422
      fm_offset += 4;
396
    };
423
    };
397
    if (min_rfree & 0x8) {
424
    if (min_rfree & 0x8) {
398
      outs (" movl ");
425
      outs(" movl ");
399
      outn ((long)fm_offset);
426
      outn((long)fm_offset);
400
      outs ("(%ebp),%ebx");
427
      outs("(%ebp),%ebx");
401
      outnl();
428
      outnl();
402
      /* fm_offset += 4; */
429
      /* fm_offset += 4; */
403
    };
430
    };
404
    outs (" movl 0(%ebp),%ebp");
431
    outs(" movl 0(%ebp),%ebp");
405
    outnl();
432
    outnl();
406
  };
433
  };
407
  return;
434
  return;
408
}
435
}
409
 
436
 
410
 
437
 
411
int cproc
438
int cproc
412
    PROTO_N ( (p, pname, cname, global, diag_props) )
-
 
413
    PROTO_T ( exp p X char *pname X int cname X int global X diag_global * diag_props )
439
(exp p, char *pname, int cname, int global, diag_global * diag_props)
414
{
440
{
415
  exp jr, t, body;
441
  exp jr, t, body;
416
  ash stack;
442
  ash stack;
417
  int  ms;
443
  int  ms;
418
  int tot_sp;
444
  int tot_sp;
Line 448... Line 474...
448
  scale = (float)1.0;
474
  scale = (float)1.0;
449
  not_in_params = 1;
475
  not_in_params = 1;
450
  not_in_postlude = 1;
476
  not_in_postlude = 1;
451
  keep_short = 0;
477
  keep_short = 0;
452
  repeat_level = 0;
478
  repeat_level = 0;
453
  callee_size = (proc_has_vcallees(p) ? -1 : 0);
479
  callee_size = (proc_has_vcallees(p)? -1 : 0);
454
  ferrsize = 0;
480
  ferrsize = 0;
455
  fpucon = normal_fpucon;
481
  fpucon = normal_fpucon;
456
 
482
 
457
  has_dy_callees = 0;		/* set by scan2 when stack_dec indeterminable */
483
  has_dy_callees = 0;		/* set by scan2 when stack_dec indeterminable */
458
  has_tail_call = 0;		/* set by scan2, used in coder */
484
  has_tail_call = 0;		/* set by scan2, used in coder */
Line 463... Line 489...
463
  comp_weights(p);
489
  comp_weights(p);
464
 
490
 
465
/* 8byte align */
491
/* 8byte align */
466
  request_align_8byte = permit_8byte_align && useful_double;
492
  request_align_8byte = permit_8byte_align && useful_double;
467
 
493
 
468
  if (pname[0] != local_prefix[0])
494
  if (pname[0]!= local_prefix[0])
469
    proc_type(pname);
495
    proc_type(pname);
470
 
496
 
471
  has_alloca = proc_has_alloca(p);
497
  has_alloca = proc_has_alloca(p);
472
 
498
 
473
  must_use_bp = (has_alloca || proc_has_lv(p));
499
  must_use_bp = (has_alloca || proc_has_lv(p));
Line 475... Line 501...
475
  regsinuse = 0;
501
  regsinuse = 0;
476
 
502
 
477
  no_frame = 1;
503
  no_frame = 1;
478
  if (always_use_frame || do_profile || must_use_bp || has_dy_callees ||
504
  if (always_use_frame || do_profile || must_use_bp || has_dy_callees ||
479
        proc_uses_crt_env(p) || proc_has_setjmp(p) || proc_has_asm
505
        proc_uses_crt_env(p) || proc_has_setjmp(p) || proc_has_asm
480
     )
506
    )
481
     no_frame = 0;
507
     no_frame = 0;
482
 
508
 
483
  if (request_align_8byte && no_frame) {
509
  if (request_align_8byte && no_frame) {
484
    no_frame = 0;
510
    no_frame = 0;
485
    stack_aligned_8byte = 1;
511
    stack_aligned_8byte = 1;
Line 498... Line 524...
498
  min_rfree = 0;		/* total registers used */
524
  min_rfree = 0;		/* total registers used */
499
  stack_dec = 0;		/* current stack decrement */
525
  stack_dec = 0;		/* current stack decrement */
500
  cond1_set = 0;
526
  cond1_set = 0;
501
  cond2_set = 0;		/* state of condition flags is not known
527
  cond2_set = 0;		/* state of condition flags is not known
502
				*/
528
				*/
503
  clear_reg_record (crt_reg_record);
529
  clear_reg_record(crt_reg_record);
504
  stack.ashsize = 0;
530
  stack.ashsize = 0;
505
  stack.ashalign = 0;
531
  stack.ashalign = 0;
506
 
532
 
507
 
533
 
508
 
534
 
509
  vc_pointer = nilexp;
535
  vc_pointer = nilexp;
510
				/* set up params before any diagnostics */
536
				/* set up params before any diagnostics */
511
  t = son(p);
537
  t = son(p);
512
  param_pos = 0;
538
  param_pos = 0;
513
  while (name(t) == ident_tag && isparam(t) && name(son(t)) != formal_callee_tag)
539
  while (name(t) == ident_tag && isparam(t) && name(son(t))!= formal_callee_tag)
514
   {
540
   {
515
     t = bro(son(t));
541
     t = bro(son(t));
516
   };
542
   };
517
  if (name(t) == ident_tag && name(son(t)) == formal_callee_tag)
543
  if (name(t) == ident_tag && name(son(t)) == formal_callee_tag)
518
   {
544
   {
519
     if (callee_size < 0)
545
     if (callee_size < 0)
520
	vc_pointer = t;
546
	vc_pointer = t;
521
     while (name(t) == ident_tag && name(son(t)) == formal_callee_tag)
547
     while (name(t) == ident_tag && name(son(t)) == formal_callee_tag)
Line 524... Line 550...
524
	no(t) = param_pos;
550
	no(t) = param_pos;
525
	if (isenvoff(t))
551
	if (isenvoff(t))
526
	  set_env_off(param_pos+64, t);
552
	  set_env_off(param_pos+64, t);
527
	param_pos = rounder(param_pos + shape_size(sh(son(t))), param_align);
553
	param_pos = rounder(param_pos + shape_size(sh(son(t))), param_align);
528
	t = bro(son(t));
554
	t = bro(son(t));
529
      };
555
      };
530
     if (callee_size == 0)
556
     if (callee_size == 0)
531
	callee_size = param_pos;
557
	callee_size = param_pos;
532
   };
558
   };
533
   {
559
   {
534
     exp pp = son(p);
560
     exp pp = son(p);
535
     while (name(pp) == ident_tag && isparam(pp) && name(son(pp)) != formal_callee_tag)
561
     while (name(pp) == ident_tag && isparam(pp) && name(son(pp))!= formal_callee_tag)
536
      {
562
      {
537
	ptno(pp) = par_pl;
563
	ptno(pp) = par_pl;
538
	no(pp) = param_pos;
564
	no(pp) = param_pos;
539
	if (isenvoff(pp))
565
	if (isenvoff(pp))
540
	  set_env_off(param_pos+64, pp);
566
	  set_env_off(param_pos+64, pp);
Line 547... Line 573...
547
 
573
 
548
 
574
 
549
 
575
 
550
 
576
 
551
  if (global) {
577
  if (global) {
552
    outs (".globl ");
578
    outs(".globl ");
553
    outs (pname);
579
    outs(pname);
554
    outnl ();
580
    outnl();
555
  };
581
  };
556
 
582
 
557
  if (is80486)
583
  if (is80486)
558
    dot_align(16);
584
    dot_align(16);
559
  else
585
  else
560
    dot_align(4);
586
    dot_align(4);
561
 
587
 
562
  if (diagnose)
588
  if (diagnose)
563
#ifdef NEWDWARF
589
#ifdef NEWDWARF
564
    DIAG_PROC_BEGIN (diag_props, global, cname, pname, p);
590
    DIAG_PROC_BEGIN(diag_props, global, cname, pname, p);
565
#else
591
#else
566
    diag_proc_begin (diag_props, global, cname, pname);
592
    diag_proc_begin(diag_props, global, cname, pname);
567
#endif
593
#endif
568
 
594
 
569
  if (cname == -1)
595
  if (cname == -1)
570
    outs (pname);
596
    outs(pname);
571
  else
597
  else
572
    {
598
    {
573
      outs(local_prefix);
599
      outs(local_prefix);
574
      outn((long)cname);
600
      outn((long)cname);
575
    };
601
    };
576
  outs (":");
602
  outs(":");
577
  outnl ();
603
  outnl();
578
#ifdef NEWDWARF
604
#ifdef NEWDWARF
579
  if (diagnose && dwarf2) {
605
  if (diagnose && dwarf2) {
580
    START_BB ();
606
    START_BB();
581
    dwl0 = set_dw_text_label ();
607
    dwl0 = set_dw_text_label();
582
  }
608
  }
583
#endif
609
#endif
584
 
610
 
585
/* space for setting local displacement label */
611
/* space for setting local displacement label */
586
  if (flush_before_tell)
612
  if (flush_before_tell)
587
    IGNORE fflush(fpout);
613
    IGNORE fflush(fpout);
588
  old_pos1 = ftell (fpout);
614
  old_pos1 = ftell(fpout);
589
  outs ("                          ");
615
  outs("                          ");
590
     /* ".set .LdispNNNN, SSSSS\n" */
616
     /* ".set .LdispNNNN, SSSSS\n" */
591
  outnl ();
617
  outnl();
592
  if (flush_before_tell)
618
  if (flush_before_tell)
593
    IGNORE fflush(fpout);
619
    IGNORE fflush(fpout);
594
  old_pos1a = ftell (fpout);
620
  old_pos1a = ftell(fpout);
595
  outs ("                             ");
621
  outs("                             ");
596
     /* ".set .LfcwdispNNNN, SSSSS\n" */
622
     /* ".set .LfcwdispNNNN, SSSSS\n" */
597
  outnl ();
623
  outnl();
598
 
624
 
599
  if (!no_frame) {
625
  if (!no_frame) {
600
    outs (" pushl %ebp");
626
    outs(" pushl %ebp");
601
    outnl ();
627
    outnl();
602
    outs (" movl %esp,%ebp");
628
    outs(" movl %esp,%ebp");
603
    outnl ();
629
    outnl();
604
#ifdef NEWDWARF
630
#ifdef NEWDWARF
605
    if (diagnose && dwarf2)
631
    if (diagnose && dwarf2)
606
      dwl1 = set_dw_text_label ();
632
      dwl1 = set_dw_text_label();
607
#endif
633
#endif
608
  };
634
  };
609
 
635
 
610
/* space for pushing fixed point registers */
636
/* space for pushing fixed point registers */
611
  if (flush_before_tell)
637
  if (flush_before_tell)
612
    IGNORE fflush(fpout);
638
    IGNORE fflush(fpout);
613
  old_pos2 = ftell (fpout);
639
  old_pos2 = ftell(fpout);
614
  outs ("               ");
640
  outs("               ");
615
     /* " pushl %ebx\n" */
641
     /* " pushl %ebx\n" */
616
#ifdef NEWDWARF
642
#ifdef NEWDWARF
617
  if (diagnose && dwarf2)
643
  if (diagnose && dwarf2)
618
    outs (dw_labroom);
644
    outs(dw_labroom);
619
#endif
645
#endif
620
  outnl ();
646
  outnl();
621
  if (flush_before_tell)
647
  if (flush_before_tell)
622
    IGNORE fflush(fpout);
648
    IGNORE fflush(fpout);
623
  old_pos3 = ftell (fpout);
649
  old_pos3 = ftell(fpout);
624
  outs ("               ");
650
  outs("               ");
625
     /* " pushl %edi\n" */
651
     /* " pushl %edi\n" */
626
#ifdef NEWDWARF
652
#ifdef NEWDWARF
627
  if (diagnose && dwarf2)
653
  if (diagnose && dwarf2)
628
    outs (dw_labroom);
654
    outs(dw_labroom);
629
#endif
655
#endif
630
  outnl ();
656
  outnl();
631
  if (flush_before_tell)
657
  if (flush_before_tell)
632
    IGNORE fflush(fpout);
658
    IGNORE fflush(fpout);
633
  old_pos4 = ftell (fpout);
659
  old_pos4 = ftell(fpout);
634
  outs ("               ");
660
  outs("               ");
635
     /* " pushl %esi\n" */
661
     /* " pushl %esi\n" */
636
#ifdef NEWDWARF
662
#ifdef NEWDWARF
637
  if (diagnose && dwarf2)
663
  if (diagnose && dwarf2)
638
    outs (dw_labroom);
664
    outs(dw_labroom);
639
#endif
665
#endif
640
  outnl ();
666
  outnl();
641
  if (no_frame) {
667
  if (no_frame) {
642
    if (flush_before_tell)
668
    if (flush_before_tell)
643
      IGNORE fflush(fpout);
669
      IGNORE fflush(fpout);
644
    old_pos5 = ftell (fpout);
670
    old_pos5 = ftell(fpout);
645
    outs ("               ");
671
    outs("               ");
646
       /* " pushl %ebp\n" */
672
       /* " pushl %ebp\n" */
647
#ifdef NEWDWARF
673
#ifdef NEWDWARF
648
    if (diagnose && dwarf2)
674
    if (diagnose && dwarf2)
649
      outs (dw_labroom);
675
      outs(dw_labroom);
650
#endif
676
#endif
651
    outnl ();
677
    outnl();
652
  }
678
  }
653
 
679
 
654
/* space for subtract from stack pointer */
680
/* space for subtract from stack pointer */
655
  if (flush_before_tell)
681
  if (flush_before_tell)
656
    IGNORE fflush(fpout);
682
    IGNORE fflush(fpout);
657
  old_pos8 = ftell (fpout);
683
  old_pos8 = ftell(fpout);
658
  outs ("                     ");
684
  outs("                     ");
659
     /* " subl $SSSSS,%esp\n" */
685
     /* " subl $SSSSS,%esp\n" */
660
     /* " movl $SSSSS,%eax\n" */
686
     /* " movl $SSSSS,%eax\n" */
661
  outnl ();
687
  outnl();
662
  if (proc_has_checkstack(p)) {
688
  if (proc_has_checkstack(p)) {
663
    checkalloc_stack (reg0, 1);
689
    checkalloc_stack(reg0, 1);
664
  };
690
  };
665
#ifdef NEWDWARF
691
#ifdef NEWDWARF
666
  if (diagnose && dwarf2) {
692
  if (diagnose && dwarf2) {
667
    dwl8 = set_dw_text_label ();
693
    dwl8 = set_dw_text_label();
668
    dw_entry_pos = dw2_start_fde (dwl0, dwl1);
694
    dw_entry_pos = dw2_start_fde(dwl0, dwl1);
669
  }
695
  }
670
#endif
696
#endif
671
 
697
 
672
  if (stack_aligned_8byte) {
698
  if (stack_aligned_8byte) {
673
    outs(" andl $-8,%esp");
699
    outs(" andl $-8,%esp");
674
    outnl();
700
    outnl();
675
  };
701
  };
676
 
702
 
677
  if (flush_before_tell)
703
  if (flush_before_tell)
678
    IGNORE fflush(fpout);
704
    IGNORE fflush(fpout);
679
  old_pos9 = ftell (fpout);
705
  old_pos9 = ftell(fpout);
680
  outs ("                                    ");
706
  outs("                                    ");
681
     /* "movw $DDDD,0-.LfcwdispNNNN(%ebp)\n" */
707
     /* "movw $DDDD,0-.LfcwdispNNNN(%ebp)\n" */
682
  outnl ();
708
  outnl();
683
 
709
 
684
 
710
 
685
#if islinux || isfreebsd
711
#if isdragonfly || isfreebsd || islinux
686
  if (
712
  if (
-
 
713
#if isdragonfly
-
 
714
  !dragonfly_elf &&
-
 
715
#elif isfreebsd
-
 
716
  !freebsd_elf &&
687
#if islinux
717
#elif islinux
688
	!linux_elf &&
718
	!linux_elf &&
689
#endif
719
#endif
690
	pname[0] != local_prefix[0] &&
720
	pname[0]!= local_prefix[0] &&
691
	!strcmp (pname+prefix_length, "main")) {
721
	!strcmp(pname+prefix_length, "main")) {
692
    out_main_prelude();
722
    out_main_prelude();
693
  }
723
  }
694
#endif
724
#endif
695
 
725
 
696
  if (do_profile) {
726
  if (do_profile) {
697
    int  labl = next_lab ();	/* output profile procedure header */
727
    int  labl = next_lab ();	/* output profile procedure header */
698
    outs (".data");
728
    outs(".data");
699
    outnl ();
729
    outnl();
700
    dot_align(4);
730
    dot_align(4);
701
    outs(local_prefix);
731
    outs(local_prefix);
702
    outs ("P");
732
    outs("P");
703
    outn ((long)labl);
733
    outn((long)labl);
704
    outs (":");
734
    outs(":");
705
    outnl ();
735
    outnl();
706
    outs (" .long 0");
736
    outs(" .long 0");
707
    outnl ();
737
    outnl();
708
    outs (".text");
738
    outs(".text");
709
    outnl ();
739
    outnl();
710
    outs (" leal ");
740
    outs(" leal ");
711
    outs(local_prefix);
741
    outs(local_prefix);
712
    outs ("P");
742
    outs("P");
713
    outn ((long)labl);
743
    outn((long)labl);
714
    outs (",%edx");
744
    outs(",%edx");
715
    outnl ();
745
    outnl();
716
    outs (" call _mcount");
746
    outs(" call _mcount");
717
    outnl ();
747
    outnl();
718
  };
748
  };
719
 
749
 
720
 
750
 
721
  if (PIC_code && proc_uses_external(p))
751
  if (PIC_code && proc_uses_external(p))
722
   {
752
   {
Line 729... Line 759...
729
  if (proc_uses_crt_env(p) && proc_has_lv(p) && has_alloca)
759
  if (proc_uses_crt_env(p) && proc_has_lv(p) && has_alloca)
730
   {
760
   {
731
     need_preserve_stack = 1;
761
     need_preserve_stack = 1;
732
     stack.ashsize += 32;
762
     stack.ashsize += 32;
733
     max_stack = stack.ashsize;
763
     max_stack = stack.ashsize;
734
     save_stack ();
764
     save_stack();
735
   };
765
   };
736
 
766
 
737
  scale = (float)1.0;
767
  scale = (float)1.0;
738
  last_odd_bit = 0;
768
  last_odd_bit = 0;
739
  doing_odd_bits = 0;
769
  doing_odd_bits = 0;
Line 748... Line 778...
748
    add_odd_bits(ol);
778
    add_odd_bits(ol);
749
  }
779
  }
750
 
780
 
751
 
781
 
752
  if (crt_ret_lab_used) {
782
  if (crt_ret_lab_used) {
753
    jr = getexp (f_bottom, nilexp, 0, nilexp, nilexp, 0,
783
    jr = getexp(f_bottom, nilexp, 0, nilexp, nilexp, 0,
754
                0, 0);
784
                0, 0);
755
    sonno(jr) = stack_dec;
785
    sonno(jr) = stack_dec;
756
    ptno(jr) = crt_ret_lab;
786
    ptno(jr) = crt_ret_lab;
757
    fstack_pos_of(jr) = (prop)first_fl_reg;
787
    fstack_pos_of(jr) = (prop)first_fl_reg;
758
    set_label (jr);
788
    set_label(jr);
759
  };
789
  };
760
 
790
 
761
	/* If the procedure loads the current env and uses make_lv
791
	/* If the procedure loads the current env and uses make_lv
762
	   it may be the destination of a long_jump. In that case
792
	   it may be the destination of a long_jump. In that case
763
	   ebx, esi and edi must be saved at and restored at exit.
793
	   ebx, esi and edi must be saved at and restored at exit.
Line 766... Line 796...
766
	*/
796
	*/
767
  if (proc_uses_crt_env(p) && proc_has_lv(p))
797
  if (proc_uses_crt_env(p) && proc_has_lv(p))
768
    min_rfree |= 0x38;
798
    min_rfree |= 0x38;
769
 
799
 
770
  /* compute space needed for local variables in memory */
800
  /* compute space needed for local variables in memory */
771
  ms = ((max_stack + 31) / 32) * 4;
801
  ms = ((max_stack + 31) / 32)* 4;
772
  /* compute space needed for pushing registers */
802
  /* compute space needed for pushing registers */
773
  if (no_frame && min_rfree & 0x40)
803
  if (no_frame && min_rfree & 0x40)
774
    push_space += 4;
804
    push_space += 4;
775
  if (min_rfree & 0x20)
805
  if (min_rfree & 0x20)
776
    push_space += 4;
806
    push_space += 4;
Line 784... Line 814...
784
 
814
 
785
  if (crt_ret_lab_used) {
815
  if (crt_ret_lab_used) {
786
#ifdef NEWDWARF
816
#ifdef NEWDWARF
787
    long over_lab;
817
    long over_lab;
788
    if (diagnose && dwarf2) {
818
    if (diagnose && dwarf2) {
789
      over_lab = next_dwarf_label ();
819
      over_lab = next_dwarf_label();
790
      dw2_return_pos (over_lab);
820
      dw2_return_pos(over_lab);
791
    }
821
    }
792
#endif
822
#endif
793
    restore_callregs (0);
823
    restore_callregs(0);
794
    retins();
824
    retins();
795
    outnl ();
825
    outnl();
796
#ifdef NEWDWARF
826
#ifdef NEWDWARF
797
    if (diagnose && dwarf2)
827
    if (diagnose && dwarf2)
798
      dw2_after_fde_exit (over_lab);
828
      dw2_after_fde_exit(over_lab);
799
#endif
829
#endif
800
  };
830
  };
801
  outnl ();
831
  outnl();
802
 
832
 
803
  this_pos = ftell (fpout);
833
  this_pos = ftell(fpout);
804
  while (returns_list != nilexp) {
834
  while (returns_list != nilexp) {
805
    st = fseek (fpout, (long)no(returns_list), 0);
835
    st = fseek(fpout,(long)no(returns_list), 0);
806
    if (st == -1) {
836
    if (st == -1) {
807
      failer (SEEK_FAILURE);
837
      failer(SEEK_FAILURE);
808
      exit(EXIT_FAILURE);
838
      exit(EXIT_FAILURE);
809
    };
839
    };
810
    if (name(returns_list) == 1)
840
    if (name(returns_list) == 1)
811
      out_untidy_pops (tot_sp, push_space);
841
      out_untidy_pops(tot_sp, push_space);
812
    else
842
    else
813
      out_pops(tot_sp, push_space, ptno(returns_list)/8, sonno(returns_list));
843
      out_pops(tot_sp, push_space, ptno(returns_list) /8, sonno(returns_list));
814
    returns_list = bro(returns_list);
844
    returns_list = bro(returns_list);
815
  };
845
  };
816
  fseek(fpout, this_pos, 0);
846
  fseek(fpout, this_pos, 0);
817
 
847
 
818
  locals_offset = tot_sp;
848
  locals_offset = tot_sp;
819
  if (diagnose) {
849
  if (diagnose) {
820
    no (p) = tot_sp;	/* may be used by delayed diagnostics */
850
    no (p) = tot_sp;	/* may be used by delayed diagnostics */
821
#ifdef NEWDWARF
851
#ifdef NEWDWARF
822
    DIAG_PROC_END (diag_props, p);
852
    DIAG_PROC_END(diag_props, p);
823
#else
853
#else
824
    diag_proc_end (diag_props);
854
    diag_proc_end(diag_props);
825
#endif
855
#endif
826
#ifdef NEWDWARF
856
#ifdef NEWDWARF
827
  if (dwarf2)
857
  if (dwarf2)
828
    dw2_complete_fde ();
858
    dw2_complete_fde();
829
#endif
859
#endif
830
  }
860
  }
831
 
861
 
832
  /* now set in the information at the head of the procedure */
862
  /* now set in the information at the head of the procedure */
833
  {
863
  {
834
 
864
 
835
    if (flush_before_tell)
865
    if (flush_before_tell)
836
      IGNORE fflush(fpout);
866
      IGNORE fflush(fpout);
837
    this_pos = ftell (fpout);
867
    this_pos = ftell(fpout);
838
    st = fseek (fpout, old_pos1, 0);
868
    st = fseek(fpout, old_pos1, 0);
839
    if (st == -1) {
869
    if (st == -1) {
840
      failer (SEEK_FAILURE);
870
      failer(SEEK_FAILURE);
841
      exit(EXIT_FAILURE);
871
      exit(EXIT_FAILURE);
842
    };
872
    };
843
 
873
 
844
    /* set the label which says how much the stack was decreased, in case
874
    /* set the label which says how much the stack was decreased, in case
845
       frame pointer addressing is used  */
875
       frame pointer addressing is used  */
846
    outs (".set ");
876
    outs(".set ");
847
    outs(local_prefix);
877
    outs(local_prefix);
848
    outs ("disp");
878
    outs("disp");
849
    outn ((long)crt_proc_id);
879
    outn((long)crt_proc_id);
850
    outs (", ");
880
    outs(", ");
851
    outn ((long)tot_sp);
881
    outn((long)tot_sp);
852
 
882
 
853
    if (ferrsize != 0) {
883
    if (ferrsize != 0) {
854
	/* set label for displacement to fpu control local store */
884
	/* set label for displacement to fpu control local store */
855
      st = fseek (fpout, old_pos1a, 0);
885
      st = fseek(fpout, old_pos1a, 0);
856
      if (st == -1) {
886
      if (st == -1) {
857
        failer (SEEK_FAILURE);
887
        failer(SEEK_FAILURE);
858
        exit(EXIT_FAILURE);
888
        exit(EXIT_FAILURE);
859
      };
889
      };
860
      outs (".set ");
890
      outs(".set ");
861
      outs(local_prefix);
891
      outs(local_prefix);
862
      outs ("fcwdisp");
892
      outs("fcwdisp");
863
      outn ((long)crt_proc_id);
893
      outn((long)crt_proc_id);
864
      outs (", ");
894
      outs(", ");
865
      outn ((long)((no_frame) ? (tot_sp - push_space - ferrsize) : (push_space + ferrsize)));
895
      outn((long)((no_frame)?(tot_sp - push_space - ferrsize):(push_space + ferrsize)));
866
    }
896
    }
867
 
897
 
868
    st = fseek (fpout, this_pos, 0);
898
    st = fseek(fpout, this_pos, 0);
869
    if (st == -1) {
899
    if (st == -1) {
870
      failer (SEEK_FAILURE);
900
      failer(SEEK_FAILURE);
871
      exit(EXIT_FAILURE);
901
      exit(EXIT_FAILURE);
872
    };
902
    };
873
  };
903
  };
874
 
904
 
875
  if (tot_sp != push_space || proc_has_checkstack(p)) {
905
  if (tot_sp != push_space || proc_has_checkstack(p)) {
876
    if (flush_before_tell)
906
    if (flush_before_tell)
877
      IGNORE fflush(fpout);
907
      IGNORE fflush(fpout);
878
    this_pos = ftell (fpout);
908
    this_pos = ftell(fpout);
879
    st = fseek (fpout, old_pos8, 0);
909
    st = fseek(fpout, old_pos8, 0);
880
    if (st == -1) {
910
    if (st == -1) {
881
      failer (SEEK_FAILURE);
911
      failer(SEEK_FAILURE);
882
      exit(EXIT_FAILURE);
912
      exit(EXIT_FAILURE);
883
    };
913
    };
884
 
914
 
885
    /* decrease the stack if necessary */
915
    /* decrease the stack if necessary */
886
    if (proc_has_checkstack(p)) {
916
    if (proc_has_checkstack(p)) {
887
      outs (" movl $");
917
      outs(" movl $");
888
      outn ((long)(tot_sp - push_space));
918
      outn((long)(tot_sp - push_space));
889
      outs (",%eax");
919
      outs(",%eax");
890
    }
920
    }
891
    else {
921
    else {
892
      outs (" subl $");
922
      outs(" subl $");
893
      outn ((long)(tot_sp - push_space));
923
      outn((long)(tot_sp - push_space));
894
      outs (",%esp");
924
      outs(",%esp");
895
    };
925
    };
896
    outnl();
926
    outnl();
897
 
927
 
898
    if (ferrsize != 0) {	/* record FPU control word */
928
    if (ferrsize != 0) {	/* record FPU control word */
899
      st = fseek (fpout, old_pos9, 0);
929
      st = fseek(fpout, old_pos9, 0);
900
      if (st == -1) {
930
      if (st == -1) {
901
        failer (SEEK_FAILURE);
931
        failer(SEEK_FAILURE);
902
        exit(EXIT_FAILURE);
932
        exit(EXIT_FAILURE);
903
      };
933
      };
904
      move (uwordsh, mw(zeroe, normal_fpucon), mw(ferrmem, 0));
934
      move(uwordsh, mw(zeroe, normal_fpucon), mw(ferrmem, 0));
905
    }
935
    }
906
 
936
 
907
    st = fseek (fpout, this_pos, 0);
937
    st = fseek(fpout, this_pos, 0);
908
    if (st == -1) {
938
    if (st == -1) {
909
      failer (SEEK_FAILURE);
939
      failer(SEEK_FAILURE);
910
      exit(EXIT_FAILURE);
940
      exit(EXIT_FAILURE);
911
    };
941
    };
912
  };
942
  };
913
 
943
 
914
  /* push registers as necessary */
944
  /* push registers as necessary */
915
  if (min_rfree & 0x8) {
945
  if (min_rfree & 0x8) {
916
    st = fseek (fpout, old_pos2, 0);
946
    st = fseek(fpout, old_pos2, 0);
917
    if (st == -1) {
947
    if (st == -1) {
918
      failer (SEEK_FAILURE);
948
      failer(SEEK_FAILURE);
919
      exit(EXIT_FAILURE);
949
      exit(EXIT_FAILURE);
920
    };
950
    };
921
    outs (" pushl %ebx");
951
    outs(" pushl %ebx");
922
    outnl();
952
    outnl();
923
#ifdef NEWDWARF
953
#ifdef NEWDWARF
924
    if (diagnose && dwarf2)
954
    if (diagnose && dwarf2)
925
      dwl2 = set_dw_text_label ();
955
      dwl2 = set_dw_text_label();
926
#endif
956
#endif
927
  };
957
  };
928
 
958
 
929
  if (min_rfree & 0x10) {
959
  if (min_rfree & 0x10) {
930
    st = fseek (fpout, old_pos3, 0);
960
    st = fseek(fpout, old_pos3, 0);
931
    if (st == -1) {
961
    if (st == -1) {
932
      failer (SEEK_FAILURE);
962
      failer(SEEK_FAILURE);
933
      exit(EXIT_FAILURE);
963
      exit(EXIT_FAILURE);
934
    };
964
    };
935
    outs (" pushl %edi");
965
    outs(" pushl %edi");
936
    outnl();
966
    outnl();
937
#ifdef NEWDWARF
967
#ifdef NEWDWARF
938
    if (diagnose && dwarf2)
968
    if (diagnose && dwarf2)
939
      dwl3 = set_dw_text_label ();
969
      dwl3 = set_dw_text_label();
940
#endif
970
#endif
941
  };
971
  };
942
 
972
 
943
 
973
 
944
  if (min_rfree & 0x20) {
974
  if (min_rfree & 0x20) {
945
    st = fseek (fpout, old_pos4, 0);
975
    st = fseek(fpout, old_pos4, 0);
946
    if (st == -1) {
976
    if (st == -1) {
947
      failer (SEEK_FAILURE);
977
      failer(SEEK_FAILURE);
948
      exit(EXIT_FAILURE);
978
      exit(EXIT_FAILURE);
949
    };
979
    };
950
    outs (" pushl %esi");
980
    outs(" pushl %esi");
951
    outnl();
981
    outnl();
952
#ifdef NEWDWARF
982
#ifdef NEWDWARF
953
    if (diagnose && dwarf2)
983
    if (diagnose && dwarf2)
954
      dwl4 = set_dw_text_label ();
984
      dwl4 = set_dw_text_label();
955
#endif
985
#endif
956
  };
986
  };
957
 
987
 
958
  if (no_frame && (min_rfree & 0x40)) {
988
  if (no_frame && (min_rfree & 0x40)) {
959
    st = fseek (fpout, old_pos5, 0);
989
    st = fseek(fpout, old_pos5, 0);
960
    if (st == -1) {
990
    if (st == -1) {
961
      failer (SEEK_FAILURE);
991
      failer(SEEK_FAILURE);
962
      exit(EXIT_FAILURE);
992
      exit(EXIT_FAILURE);
963
    };
993
    };
964
    outs (" pushl %ebp");
994
    outs(" pushl %ebp");
965
    outnl();
995
    outnl();
966
#ifdef NEWDWARF
996
#ifdef NEWDWARF
967
    if (diagnose && dwarf2)
997
    if (diagnose && dwarf2)
968
      dwl1 = set_dw_text_label ();
998
      dwl1 = set_dw_text_label();
969
#endif
999
#endif
970
  };
1000
  };
971
 
1001
 
972
#ifdef NEWDWARF
1002
#ifdef NEWDWARF
973
  if (diagnose && dwarf2) {
1003
  if (diagnose && dwarf2) {
974
    st = fseek (fpout, dw_entry_pos, 0);
1004
    st = fseek(fpout, dw_entry_pos, 0);
975
    if (st == -1) {
1005
    if (st == -1) {
976
      failer (SEEK_FAILURE);
1006
      failer(SEEK_FAILURE);
977
      exit(EXIT_FAILURE);
1007
      exit(EXIT_FAILURE);
978
    };
1008
    };
979
    dw2_fde_entry (dwl0, dwl1, dwl2, dwl3, dwl4, dwl8, tot_sp);
1009
    dw2_fde_entry(dwl0, dwl1, dwl2, dwl3, dwl4, dwl8, tot_sp);
980
  };
1010
  };
981
#endif
1011
#endif
982
 
1012
 
983
  st = fseek (fpout, this_pos, 0);
1013
  st = fseek(fpout, this_pos, 0);
984
  if (st == -1) {
1014
  if (st == -1) {
985
    failer (SEEK_FAILURE);
1015
    failer(SEEK_FAILURE);
986
    exit(EXIT_FAILURE);
1016
    exit(EXIT_FAILURE);
987
  };
1017
  };
988
 
1018
 
989
  if (pname[0] != local_prefix[0])
1019
  if (pname[0]!= local_prefix[0])
990
    proc_size (pname);
1020
    proc_size(pname);
991
 
1021
 
992
  if (proc_needs_envsize(p)) {
1022
  if (proc_needs_envsize(p)) {
993
    outs (".set ");
1023
    outs(".set ");
994
    outs(local_prefix);
1024
    outs(local_prefix);
995
    outs ("ESZ");
1025
    outs("ESZ");
996
    outs (pname);
1026
    outs(pname);
997
    outs (", ");
1027
    outs(", ");
998
    outn ((long)(tot_sp + 4 + max_extra_stack/8));
1028
    outn((long)(tot_sp + 4 + max_extra_stack/8));
999
    outnl ();
1029
    outnl();
1000
  }
1030
  }
1001
 
1031
 
1002
#if islinux || isfreebsd
1032
#if isdragonfly || isfreebsd || islinux
1003
  if (
1033
  if (
-
 
1034
#if isdragonfly
-
 
1035
  !dragonfly_elf &&
-
 
1036
#elif isfreebsd
-
 
1037
  !freebsd_elf &&
1004
#if islinux
1038
#elif islinux
1005
	!linux_elf &&
1039
	!linux_elf &&
1006
#endif
1040
#endif
1007
	pname[0] != local_prefix[0] &&
1041
	pname[0]!= local_prefix[0] &&
1008
	!strcmp (pname+prefix_length, "main")) {
1042
	!strcmp(pname+prefix_length, "main")) {
1009
    out_main_postlude();
1043
    out_main_postlude();
1010
  }
1044
  }
1011
#endif
1045
#endif
1012
 
1046
 
1013
  /* now prepare params with env_offset for possible constant evaluation */
1047
  /* now prepare params with env_offset for possible constant evaluation */
Line 1032... Line 1066...
1032
  if (no_frame)			/* hold info for later diagnostics */
1066
  if (no_frame)			/* hold info for later diagnostics */
1033
    clear_proc_has_fp(p);
1067
    clear_proc_has_fp(p);
1034
  else
1068
  else
1035
    set_proc_has_fp(p);
1069
    set_proc_has_fp(p);
1036
 
1070
 
1037
  return (proc_needs_envsize(p) ? tot_sp + 4 + max_extra_stack/8 : 0);
1071
  return(proc_needs_envsize(p)? tot_sp + 4 + max_extra_stack/8 : 0);
1038
}
1072
}
1039
 
1073
 
1040
 
1074
 
1041
/* Restore call_save registers (%ebp, %esi, %edi, %ebx)
1075
/* Restore call_save registers (%ebp, %esi, %edi, %ebx)
1042
   when we know which ones are reused.
1076
   when we know which ones are reused.
1043
   This preserves %eax, %ecx, %edx */
1077
   This preserves %eax, %ecx, %edx */
1044
void restore_callregs
1078
void restore_callregs
1045
    PROTO_N ( (untidy) )
-
 
1046
    PROTO_T ( int untidy )
1079
(int untidy)
1047
{
1080
{
1048
  char *sp50 = "                                                  ";
1081
  char *sp50 = "                                                  ";
1049
  long retpos = ftell(fpout);
1082
  long retpos = ftell(fpout);
1050
  outs("?");	/* will be overwritten, to cause assembler fail if sco bug */
1083
  outs("?");	/* will be overwritten, to cause assembler fail if sco bug */
1051
  outs(sp50); outs(sp50); outs(sp50);
1084
  outs(sp50); outs(sp50); outs(sp50);
1052
  outnl();
1085
  outnl();
1053
  returns_list = getexp(f_top, returns_list, 0, nilexp,
1086
  returns_list = getexp(f_top, returns_list, 0, nilexp,
1054
				nilexp, 0, 0, (unsigned char)untidy);
1087
				nilexp, 0, 0,(unsigned char)untidy);
1055
  no(returns_list) = (int)retpos;
1088
  no(returns_list) = (int)retpos;
1056
  ptno(returns_list) = stack_dec;
1089
  ptno(returns_list) = stack_dec;
1057
#ifdef NEWDWARF
1090
#ifdef NEWDWARF
1058
  if (diagnose && dwarf2)
1091
  if (diagnose && dwarf2)
1059
    sonno(returns_list) = (int)dw2_prep_fde_restore_args (untidy);
1092
    sonno(returns_list) = (int)dw2_prep_fde_restore_args(untidy);
1060
#endif
1093
#endif
1061
  return;
1094
  return;
1062
}
1095
}