Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
33
 
34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
42
 
43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
45
 
46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
49
 
50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
53
 
54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/**********************************************************************
62
$Author: pwe $
63
$Date: 1998/03/15 16:00:35 $
64
$Revision: 1.5 $
65
$Log: dw2_info.c,v $
66
 * Revision 1.5  1998/03/15  16:00:35  pwe
67
 * regtrack dwarf dagnostics added
68
 *
69
 * Revision 1.4  1998/03/11  11:03:43  pwe
70
 * DWARF optimisation info
71
 *
72
 * Revision 1.3  1998/02/18  11:22:20  pwe
73
 * test corrections
74
 *
75
 * Revision 1.2  1998/01/21  10:30:06  pwe
76
 * labdiff change
77
 *
78
 * Revision 1.1.1.1  1998/01/17  15:55:48  release
79
 * First version to be checked into rolling release.
80
 *
81
 * Revision 1.13  1998/01/09  09:31:32  pwe
82
 * prep restructure
83
 *
84
 * Revision 1.12  1997/12/04  19:41:31  pwe
85
 * ANDF-DE V1.9
86
 *
87
 * Revision 1.11  1997/11/06  09:22:14  pwe
88
 * ANDF-DE V1.8
89
 *
90
 * Revision 1.10  1997/10/28  10:14:22  pwe
91
 * local location corrections
92
 *
93
 * Revision 1.9  1997/10/23  09:27:40  pwe
94
 * ANDF-DE v1.7, extra diags
95
 *
96
 * Revision 1.8  1997/10/10  18:18:38  pwe
97
 * prep ANDF-DE revision
98
 *
99
 * Revision 1.7  1997/08/23  13:36:45  pwe
100
 * initial ANDF-DE
101
 *
102
 * Revision 1.6  1997/06/25  13:05:39  pwe
103
 * constant global floats as well as local
104
 *
105
 * Revision 1.5  1997/06/25  12:16:16  pwe
106
 * constant floats supported, 4-byte only
107
 *
108
 * Revision 1.4  1997/04/17  11:50:25  pwe
109
 * Sparc and 80x86 support
110
 *
111
 * Revision 1.3  1997/04/04  15:17:13  pwe
112
 * another (long)
113
 *
114
 * Revision 1.2  1997/04/01  17:19:40  pwe
115
 * diagnose pl_tests and locate -> platform specific
116
 *
117
 * Revision 1.1  1997/03/20  16:09:18  pwe
118
 * first version
119
 *
120
**********************************************************************/
121
 
122
#include "config.h"
123
#include "common_types.h"
124
#include "dg_aux.h"
125
#include "dw2_config.h"
126
#include "dw2_entries.h"
127
#include "dw2_codes.h"
128
#include "dw2_info.h"
129
#include "dw2_basic.h"
130
#include "dw2_types.h"
131
#include "dw2_lines.h"
132
#include "dw2_iface.h"
133
#include "tags.h"
134
#include "expmacs.h"
135
#include "shapemacs.h"
136
#include "basicread.h"
137
#include "flags.h"
138
#include "flpt.h"
139
#include "flpttypes.h"
140
#include "externs.h"
141
#include "xalloc.h"
142
#include "dg_globs.h"
143
#include "f64.h"
144
#include "dw2_locdata.h"
145
 
146
 
147
long dw2_scope_start = 0;
148
long dw2_scope_end = 0;
149
int dw_doing_branch_tests = 0;
150
 
151
static long local_var_place;
152
static int doing_abstract = 0;
153
static int doing_inline = 0;	/* consistency check only */
154
static dg_info proc_dg_info = (dg_info)0;
155
static dg_type return_type = (dg_type)0;
156
 
7 7u83 157
static dg_default *default_span_list = (dg_default *)0;
2 7u83 158
 
7 7u83 159
static void
160
fail_unimplemented(void)
2 7u83 161
{
7 7u83 162
	failer("unimplemented attribute");
163
	return;
2 7u83 164
}
165
 
7 7u83 166
static exp
167
find_id(exp e)
2 7u83 168
{
7 7u83 169
	if (name(e) == name_tag && !isdiscarded(e) && !isvar(son(e))) {
170
		return son(e);
171
	}
172
	if (name(e) == cont_tag && name(son(e)) == name_tag &&
173
	    !isdiscarded(son(e)) && (isvar(son(son(e))) ||
174
				     isparam(son(son(e))))) {
175
		return son(son(e));
176
	}
177
	return nilexp;
2 7u83 178
}
179
 
180
 
7 7u83 181
void
182
dw_out_const(exp e)
2 7u83 183
{
7 7u83 184
	switch (name(e)) {
185
	case real_tag: {
186
		int sw = (shape_size(sh(e)) <= 32 ? 0 : 1);
187
		/* DWARF cannot represent extended reals */
188
		r2l real_parts;
189
		real_parts = real2longs_IEEE(&flptnos[no(e)], sw);
190
		dw_at_form((sw ? DW_FORM_data8 : DW_FORM_data4));
191
		d_outnl();
192
		dw_at_data(4, (long)(real_parts.i1));
193
		if (sw) {
194
			dw_at_data(4, (long)(real_parts.i2));
195
		}
196
		break;
197
	}
198
	case val_tag:
199
	case null_tag:
200
		if (isbigval(e)) {
201
			flt64 x;
202
			int ov;
203
			x = flt_to_f64(no(e), is_signed(sh(e)), &ov);
204
			dw_at_form(DW_FORM_data8);
205
			d_outnl();
206
			dw_at_data(4, (long)(x.small));
207
			dw_at_data(4, (long)(x.big));
208
		} else if (is_signed(sh(e))) {
209
			dw_at_form(DW_FORM_sdata);
210
			outs(", ");
211
			sleb128((long)no(e));
212
			d_outnl();
213
		} else {
214
			dw_at_form(DW_FORM_udata);
215
			outs(", ");
216
			uleb128((unsigned long)no(e));
217
			d_outnl();
218
		}
219
		break;
220
	default:
221
		dw_at_form(DW_FORM_block1);
222
		d_outnl();
223
		dw2_locate_exp(e, 1, 0);
224
	}
225
	return;
2 7u83 226
}
227
 
228
 
7 7u83 229
void
230
dw_out_default(dg_default *d)
2 7u83 231
{
7 7u83 232
	if (d->val && dw_is_const(son(d->val))) {
233
		dw_out_const(son(d->val));
234
	} else if (d->span.sp_key != SP_SPAN) {
235
		dw_at_form(DW_FORM_flag);
236
		d_outnl();
237
		dw_at_flag(1);
238
	} else {
239
		if (!d->lab) {
240
			d->lab = next_dwarf_label();
241
			d->next = default_span_list;
242
			default_span_list = d;
243
		}
244
		dw_at_form(DW_FORM_ref_addr);
245
		d_outnl();
246
		dw_at_address(d->lab);
247
	}
248
	return;
2 7u83 249
}
250
 
251
 
7 7u83 252
void
253
complete_defaults(void)
2 7u83 254
{
7 7u83 255
	while (default_span_list) {
256
		out_dwf_label(default_span_list->lab, 1);
257
		IGNORE dw_entry(dwe_span, (long)0);
258
		IGNORE dw_entry(dwe_span_strt, (long)0);
259
		dw_at_decl(shorten_sourcepos(default_span_list->span));
260
		IGNORE dw_entry(dwe_span_end, (long)0);
261
		dw_at_decl(end_sourcepos(default_span_list->span));
262
		dw_sibling_end();
263
		default_span_list = default_span_list->next;
264
	}
265
	return;
2 7u83 266
}
267
 
268
 
7 7u83 269
/* Not certain this is needed! */
270
static void
271
out_refblock(objset *objs, int assgn)
2 7u83 272
{
7 7u83 273
	int count = 0;
2 7u83 274
#ifdef NEEDS_DEBUG_ALIGN
7 7u83 275
	long over_lab;
2 7u83 276
#endif
7 7u83 277
	objset * p = objs;
278
	while (p) {
279
		if (p->ass == assgn) {
280
			count++;
281
		}
282
		p = p->next;
283
	}
284
	out16();
2 7u83 285
#ifdef NEEDS_DEBUG_ALIGN
7 7u83 286
	if (count) {
287
		over_lab = next_dwarf_label();
288
		out_dwf_label(over_lab, 0);
289
		outs(" - . - 2");
290
	} else
2 7u83 291
#endif
7 7u83 292
		outn(count * 4);
293
	d_outnl();
294
	if (count) {
295
		p = objs;
296
		while (p) {
297
			if (p->ass == assgn) {
298
				dw_at_ext_address(p->tg);
299
			}
300
			p = p->next;
301
		}
2 7u83 302
#ifdef NEEDS_DEBUG_ALIGN
7 7u83 303
		out_dwf_label(over_lab, 1);
2 7u83 304
#endif
7 7u83 305
	}
306
	return;
2 7u83 307
}
308
 
309
 
7 7u83 310
static void
311
check_trivial(exp e)
2 7u83 312
{
313
#if 0
314
	/* This is still far too strong; e may be anything with equivalent
7 7u83 315
	   already in a register! */
316
	if (e && name(e) != val_tag && name(e) != name_tag &&
317
	    (name(e) != cont_tag || name(son(e)) != name_tag) &&
318
	    name(e) != goto_tag && name(e) != top_tag) {
319
		if (name(e) == chvar_tag || name(e) == chfl_tag)
320
			check_trivial(son(e));
321
		else
322
			failer("lost information?");
323
	}
2 7u83 324
#endif
7 7u83 325
	return;
2 7u83 326
}
327
 
7 7u83 328
static void output_detch(detch_info *dl);
2 7u83 329
 
7 7u83 330
static detch_info *sub_detch = (detch_info *)0;
2 7u83 331
 
332
 
7 7u83 333
static void
334
output_info(exp e, dg_info d)
2 7u83 335
{
7 7u83 336
	/* within info section */
337
	if (!d) {
338
		exp t;
339
		if (!e) {
340
			if (sub_detch) {
341
				output_detch(sub_detch);
342
			}
343
			return;
344
		}
345
		if (name(e) == name_tag || name(e) == env_size_tag ||
346
		    name(e) == env_offset_tag || (t = son(e), !t)) {
347
			return;
348
		}
349
		for (;;) {
350
			output_info(t, dgf(t));
351
			if (last(t) || name(e) == case_tag) {
352
				return;
353
			}
354
			t = bro(t);
355
		}
356
	}
2 7u83 357
 
7 7u83 358
	switch (d->key) {
359
	case DGA_COMP:
360
		if (!(d->data.i_comp.lo_pc)) {
361
			/* optimised away */
362
			check_trivial(e);
363
			output_info(e, d->more);
364
			break;
365
		}
366
		if (d->data.i_comp.is_tag) {
367
			IGNORE dw_entry(dwe_for_unit, (long)0);
368
			dw_at_address(d->data.i_comp.lo_pc);
369
			dw_at_address(d->data.i_comp.hi_pc);
370
			dw_at_ext_address(d->data.i_comp.corl.comp_tag);
371
		}
372
		else {
373
			IGNORE dw_entry(dwe_for_lang, (long)0);
374
			dw_at_address(d->data.i_comp.lo_pc);
375
			dw_at_address(d->data.i_comp.hi_pc);
376
			dw_at_udata((unsigned long)d->data.i_comp.corl.comp_lang);
377
		}
378
		output_info(e, d->more);
379
		break;
2 7u83 380
 
7 7u83 381
	case DGA_PARAMS:
382
		output_info(e, d->more);
383
		break;
2 7u83 384
 
7 7u83 385
	case DGA_SRC:
386
		output_info(e, d->more);
387
		break;
2 7u83 388
 
7 7u83 389
	case DGA_SCOPE: {
390
		long old_scope1 = dw2_scope_start;
391
		long old_scope2 = dw2_scope_end;
392
		long attr1 = 0, attr2;
393
		char * lexname = d->data.i_scope.lexname;
394
		if (!doing_abstract) {
395
			if (!(d->data.i_scope.start)) {
396
				/* optimised away */
397
				check_trivial(e);
398
				output_info(e, d->more);
399
				break;
400
			}
401
			if (lexname && lexname[0]) {
402
				attr1 |= (H_NM | H_XY);
403
			}
404
			attr1 |= H_PC;
405
			if (d->data.i_scope.begin_st) {
406
				if (d->data.i_scope.begin_st == (long)(-1)) {
407
					/* old diags */
408
					d->data.i_scope.begin_st = (long)0;
409
				} else {
410
					attr1 |= H_BG;
411
				}
412
			}
413
		}
414
		dw2_scope_start = d->data.i_scope.start;
415
		dw2_scope_end = d->data.i_scope.end;
416
		attr2 = dw_entry(dwe_scope, attr1);
417
		if (attr2 & ~(H_NM|H_XY|H_PC|H_BG)) {
418
			fail_unimplemented();
419
		}
420
		if (attr2 & H_NM) {
421
			dw_at_string(lexname);
422
		}
423
		if (attr2 & H_XY) {
424
			dw_at_decl(d->data.i_scope.lexpos);
425
		}
426
		if (attr2 & H_PC) {
427
			dw_at_address(dw2_scope_start);
428
			dw_at_address(dw2_scope_end);
429
		}
430
		if (attr2 & H_BG) {
431
			dw_at_address(d->data.i_scope.begin_st);
432
		}
433
		output_info(e, d->more);
434
		dw_sibling_end();
435
		dw2_scope_start = old_scope1;
436
		dw2_scope_end = old_scope2;
437
		break;
438
	}
2 7u83 439
 
7 7u83 440
	case DGA_EXTRA: {
441
		long old_scope1 = dw2_scope_start;
442
		long old_scope2 = dw2_scope_end;
443
		dw2_scope_start = d->data.i_scope.start;
444
		dw2_scope_end = d->data.i_scope.end;
445
		if (!doing_abstract) {
446
			IGNORE dw_entry(dwe_fragment, (long)0);
447
			dw_at_address(dw2_scope_start);
448
			dw_at_address(dw2_scope_end);
449
		}
450
		output_info(e, d->more);
451
		if (!doing_abstract) {
452
			dw_sibling_end();
453
		}
454
		dw2_scope_start = old_scope1;
455
		dw2_scope_end = old_scope2;
456
		break;
2 7u83 457
	}
458
 
7 7u83 459
	case DGA_LAB:
460
		if (!doing_abstract) {
461
			if (d->data.i_scope.start) {
462
				IGNORE dw_entry(dwe_label, (long)0);
463
				dw_at_string(d->data.i_scope.lexname);
464
				dw_at_decl(d->data.i_scope.lexpos);
465
				dw_at_address(d->data.i_scope.start);
466
			} else {
467
				check_trivial(e);
468
			}
469
		}
470
		output_info(e, d->more);
471
		break;
2 7u83 472
 
7 7u83 473
	case DGA_NAME:
474
		local_var_place = d->data.i_nam.scope_start;
475
		dw2_out_name(d->data.i_nam.dnam, (e ? LOCAL_NAME : DEAD_NAME));
476
		output_info(e, d->more);
477
		break;
2 7u83 478
 
7 7u83 479
	case DGA_WITH:
480
		if (!doing_abstract) {
481
			if (!(d->data.i_with.lo_pc) || !e) {
482
				/* optimised away */
483
				check_trivial(e);
484
				output_info(e, d->more);
485
				break;
486
			}
487
			IGNORE dw_entry(dwe_with, (long)0);
488
			dw_at_ext_lab(dw2_find_type_label(d->data.i_with.w_typ));
489
			dw2_locate_exp(son(d->data.i_with.w_exp), 0, 0);
490
			dw_at_address(d->data.i_with.lo_pc);
491
			dw_at_address(d->data.i_with.hi_pc);
492
		}
493
		output_info(e, d->more);
494
		if (!doing_abstract) {
495
			dw_sibling_end();
496
		}
497
		break;
2 7u83 498
 
7 7u83 499
	case DGA_CALL:
500
		if (doing_abstract) {
501
			output_info(e, d->more);
502
		} else {
503
			if (!(d->data.i_call.brk)) {
504
				/* optimised away */
505
				check_trivial(e);
506
				output_info(e, d->more);
507
				break;
508
			}
509
			IGNORE dw_entry(dwe_call, (long)0);
510
			dw_at_string(d->data.i_call.clnam);
511
			dw_at_decl(d->data.i_call.pos);
512
			dw_at_udata((unsigned long)d->data.i_call.ck);
513
			dw_at_address(d->data.i_call.brk);
514
			dw2_locate_val(d->data.i_call.p);
515
			output_info(e, d->more);
516
		}
517
		break;
2 7u83 518
 
7 7u83 519
	case DGA_INL_CALL: {
520
		int old_il = doing_inline;
521
		dg_type old_res = return_type;
522
		dg_name_list args = d->data.i_inl.args;
523
		dg_name di;
524
		dg_type p_t, res_t;
525
		long brk = d->data.i_inl.lo_pc;
526
		if (doing_abstract) {
527
			/* no recursion */
528
			break;
529
		}
530
		di = d->data.i_inl.proc->p.nam;
531
		p_t = find_proc_type(di->data.n_proc.typ);
532
		res_t = p_t->data.t_proc.res_type;
533
		return_type = res_t;
534
		if (brk) {
535
			/* sometimes lo = hi */
536
			IGNORE dw_entry(dwe_inl_call, (long)0);
537
			dw_at_ext_address(d->data.i_inl.proc);
538
			dw_at_address(d->data.i_inl.lo_pc);
539
			dw_at_address(d->data.i_inl.hi_pc);
540
		} else {
541
			/* call compressed into operand, so no breakpoint */
542
			check_trivial(e);
543
			IGNORE dw_entry(dwe_inl_opnd, (long)0);
544
			dw_at_ext_address(d->data.i_inl.proc);
545
		}
546
		doing_inline = 1;
547
		while (args) {
548
			dw2_out_name(args, INL_PARAM_NAME);
549
			args = args->next;
550
		}
551
		if (extra_diags && brk) {
552
			dg_info rets = d->data.i_inl.resref;
553
			long attr1 = H_XY, attr2;
554
			if (rets) {
555
				attr1 |= H_PC;
556
				if (res_t) {
557
					attr1 |= H_LC;
558
				}
559
			}
560
			do {
561
				attr2 = dw_entry(dwe_return, attr1);
562
				if (attr2 & ~(H_XY|H_PC|H_LC)) {
563
					fail_unimplemented();
564
				}
565
				if (attr2 & H_XY) {
566
					dw_at_decl(di->mor->end_pos);
567
				}
568
				if (attr2 & H_PC) {
569
					dw_at_address(rets->data.i_res.brk);
570
				}
571
				if (attr2 & H_LC) {
572
					dw2_locate_val(rets->data.i_res.res);
573
				}
574
				if (!rets) {
575
					break;
576
				}
577
				rets = rets->data.i_res.next;
578
			} while (rets);
579
		}
580
		output_info(e, d->more);
581
		doing_inline = old_il;
582
		dw_sibling_end();
583
		return_type = old_res;
584
		break;
2 7u83 585
	}
586
 
7 7u83 587
	case DGA_INL_RES:
588
		output_info(e, d->more);
589
		break;
2 7u83 590
 
7 7u83 591
	case DGA_X_TRY:
592
		if (!doing_abstract) {
593
			if (!(d->data.i_try.lo_pc)) {
594
				/* optimised away */
595
				check_trivial(e);
596
				output_info(e, d->more);
597
				break;
598
			}
599
			IGNORE dw_entry(dwe_try, (long)0);
600
			dw_at_address(d->data.i_try.lo_pc);
601
			dw_at_address(d->data.i_try.hi_pc);
602
		}
603
		output_info(e, d->more);
604
		if (!doing_abstract) {
605
			dw_sibling_end();
606
		}
607
		break;
2 7u83 608
 
7 7u83 609
	case DGA_X_CATCH:
610
		if (!doing_abstract) {
611
			if (!(d->data.i_catch.lo_pc)) {
612
				/* optimised away */
613
				check_trivial(e);
614
				output_info(e, d->more);
615
				break;
616
			}
617
			IGNORE dw_entry(dwe_catch, (long)0);
618
			dw_at_address(d->data.i_catch.lo_pc);
619
			dw_at_address(d->data.i_catch.hi_pc);
620
			if (d->data.i_catch.ex) {
621
				dw2_out_name(d->data.i_catch.ex, EXCEPT_NAME);
622
			} else {
623
				IGNORE dw_entry(dwe_opt_par, (long)0);
624
			}
625
		}
626
		output_info(e, d->more);
627
		if (!doing_abstract) {
628
			dw_sibling_end();
629
		}
630
		break;
2 7u83 631
 
7 7u83 632
	case DGA_X_RAISE:
633
		if (!doing_abstract) {
634
			long attr1 = H_XY, attr2;
635
			if (d->data.i_raise.x_typ) {
636
				attr1 |= H_TP;
637
			}
638
			if (d->data.i_raise.x_val) {
639
				attr1 |=
640
				    (dw_is_const(son(d->data.i_raise.x_val)) ?
641
				     H_CV : H_LC);
642
			}
643
			attr2 = dw_entry(dwe_throw, attr1);
644
			if (attr2 & ~(H_XY|H_TP|H_LC|H_CV)) {
645
				fail_unimplemented();
646
			}
647
			if (attr2 & H_XY) {
648
				dw_at_decl(d->data.i_raise.pos);
649
			}
650
			if (attr2 & H_TP) {
651
				dw_at_ext_lab(dw2_find_type_label(d->data.i_raise.x_typ));
652
			}
653
			if (attr2 & H_LC) {
654
				dw2_locate_exp(son(d->data.i_raise.x_val), 0,
655
					       0);
656
			}
657
			if (attr2 & H_CV) {
658
				dw_out_const(son(d->data.i_raise.x_val));
659
			}
660
		}
661
		output_info(e, d->more);
662
		break;
2 7u83 663
 
7 7u83 664
	case DGA_BRANCH:
665
		if (doing_abstract) {
666
			output_info(e, d->more);
667
		} else {
668
			long brk = d->data.i_brn.brk;
669
			if (brk) {
670
				IGNORE dw_entry(dwe_branch, (long)0);
671
				dw_at_decl(d->data.i_brn.pos);
672
				dw_at_address(brk);
673
				dw_at_address(d->data.i_brn.cont);
674
				trace_dw_branch_exits(e);
675
			} else {
676
				check_trivial(e);
677
				IGNORE dw_entry(dwe_branch_0, (long)0);
678
				dw_at_decl(d->data.i_brn.pos);
679
			}
680
			output_info(e, d->more);
681
			if (brk) {
682
				dw_sibling_end();
683
			}
684
		}
685
		break;
2 7u83 686
 
7 7u83 687
	case DGA_TEST:
688
		if (doing_abstract) {
689
			output_info(e, d->more);
690
		} else {
691
			long brk = d->data.i_tst.brk;
692
			if (brk) {
693
				IGNORE dw_entry(dwe_test, (long)0);
694
				dw_at_decl(d->data.i_tst.pos);
695
				dw_at_address(d->data.i_tst.brk);
696
				dw_at_address(d->data.i_tst.cont);
697
				dw_at_ext_lab(d->data.i_tst.jlab);
698
			} else {
699
				check_trivial(e);
700
				IGNORE dw_entry(dwe_test_0, (long)0);
701
				dw_at_decl(d->data.i_tst.pos);
702
			}
703
			output_info(e, d->more);
704
		}
705
		break;
2 7u83 706
 
7 7u83 707
	case DGA_JUMP:
708
		if (doing_abstract) {
709
			output_info(e, d->more);
710
		} else {
711
			long brk = d->data.i_tst.brk;
712
			if (brk) {
713
				IGNORE dw_entry(dwe_jump, (long)0);
714
				dw_at_decl(d->data.i_tst.pos);
715
				dw_at_address(d->data.i_tst.brk);
716
				dw_at_ext_lab(d->data.i_tst.jlab);
717
			} else {
718
				check_trivial(e);
719
				IGNORE dw_entry(dwe_jump_0, (long)0);
720
				dw_at_decl(d->data.i_tst.pos);
721
			}
722
			output_info(e, d->more);
723
		}
724
		break;
2 7u83 725
 
7 7u83 726
	case DGA_LJ:
727
		if (doing_abstract) {
728
			output_info(e, d->more);
729
		} else {
730
			long brk = d->data.i_lj.brk;
731
			if (brk) {
732
				IGNORE dw_entry(dwe_lj, (long)0);
733
				dw_at_decl(d->data.i_lj.pos);
734
				dw_at_address(d->data.i_lj.brk);
735
				dw2_locate_val(d->data.i_lj.j);
736
			} else {
737
				check_trivial(e);
738
				IGNORE dw_entry(dwe_lj_0, (long)0);
739
				dw_at_decl(d->data.i_lj.pos);
740
			}
741
			output_info(e, d->more);
742
		}
743
		break;
2 7u83 744
 
7 7u83 745
	case DGA_DEST:
746
		if (!doing_abstract) {
747
			long attr1 = 0, attr2;
748
			if (!(d->data.i_dest.brk)) {
749
				/* optimised away */
750
				check_trivial(e);
751
				output_info(e, d->more);
752
				break;
753
			}
754
			if (d->data.i_dest.val) {
755
				attr1 |= H_TP;
756
				attr1 |= (dw_is_const(son(d->data.i_dest.val)) ?
757
					  H_CV : H_LC);
758
			}
759
			attr2 = dw_entry(dwe_destruct, attr1);
760
			if (attr2 & ~(H_XY|H_TP|H_LC|H_CV)) {
761
				fail_unimplemented();
762
			}
763
			dw_at_decl(d->data.i_dest.pos);
764
			dw_at_address(d->data.i_dest.brk);
765
			if (attr2 & H_TP) {
766
				dw_at_ext_lab(dw2_find_type_label(return_type));
767
			}
768
			if (attr2 & H_LC) {
769
				dw2_locate_exp(son(d->data.i_dest.val), 0, 0);
770
			}
771
			if (attr2 & H_CV) {
772
				dw_out_const(son(d->data.i_dest.val));
773
			}
774
		}
775
		output_info(e, d->more);
776
		if (!doing_abstract) {
777
			dw_sibling_end();
778
		}
779
		break;
2 7u83 780
 
7 7u83 781
	case DGA_RVS:
782
		if (d->data.i_rvs.has_iv) {
783
			/* inverse ref, so don't output here */
784
			break;
785
		}
786
		if (!doing_abstract) {
787
			abbrev_entry dwe;
788
			int w_alt = 0, w_en = 0, w_kind = 0;
789
			switch (d->data.i_rvs.rvs_key) {
790
			case DGR_SEL:
791
				dwe = (d->data.i_rvs.async ? dwe_asynchsel :
792
				       dwe_select);
793
				break;
794
			case DGR_ACC:
795
				dwe = (d->data.i_rvs.n_code ? dwe_accept_c :
796
				       dwe_accept);
797
				w_alt = w_en = 1;
798
				break;
799
			case DGR_RTS:
800
				dwe = dwe_rts;
801
				w_alt = w_kind = 1;
802
				if (d->data.i_rvs.en) {
803
					dwe = dwe_rts_en;
804
					w_en = 1;
805
				}
806
				break;
807
			case DGR_ALT:
808
				dwe = (d->data.i_rvs.n_code ? dwe_sel_alt_c :
809
				       dwe_sel_alt);
810
				w_kind = 1;
811
				break;
812
			case DGR_SGD:
813
				dwe = dwe_sel_guard;
814
				break;
815
			case DGR_TRIG:
816
				dwe = (d->data.i_rvs.n_code ? dwe_trigger_c :
817
				       dwe_trigger);
818
				w_kind = 1;
819
				break;
820
			case DGR_ABTL:
821
				dwe = (d->data.i_rvs.n_code ? dwe_abort_ptc :
822
				       dwe_abort_pt);
823
				break;
824
			case DGR_REQUE:
825
				dwe = dwe_requeue;
826
				w_en = 1;
827
				break;
828
			}
829
			IGNORE dw_entry(dwe, (long)0);
830
			dw_at_decl(d->data.i_rvs.pos);
831
			if (d->data.i_rvs.n_code) {
832
				dw_at_address(d->data.i_rvs.lo_pc);
833
				if (d->data.i_rvs.n_code >= 2) {
834
					dw_at_address(d->data.i_rvs.hi_pc);
835
				}
836
			}
837
			if (w_alt) {
838
				dw_at_flag(d->data.i_rvs.alt);
839
			}
840
			if (w_en) {
841
				dw_at_ext_address(d->data.i_rvs.en);
842
			}
843
			if (w_kind) {
844
				dw_at_udata((unsigned long)d->data.i_rvs.kind);
845
			}
846
			if (d->data.i_rvs.rvs_key == DGR_ALT) {
847
				dw_out_const(d->data.i_rvs.u2.e);
848
			}
849
			if (d->data.i_rvs.rvs_key == DGR_REQUE) {
850
				dw_at_flag(d->data.i_rvs.w_abort);
851
			}
852
			if (d->data.i_rvs.rvs_key == DGR_ACC &&
853
			    d->data.i_rvs.n_code) {
854
				dg_name_list args = d->data.i_rvs.u2.p;
855
				while (args) {
856
					dw2_out_name(args, INL_PARAM_NAME);
857
					args = args->next;
858
				}
859
			}
860
			if (d->data.i_rvs.holder) {
861
				dg_info inner = d->data.i_rvs.u.iv;
862
				while (inner) {
863
					if (!inner->data.i_rvs.has_iv) {
864
						failer("bad RVS invert");
865
					}
866
					inner->data.i_rvs.has_iv = 0;
867
					output_info(inner->data.i_rvs.info_e,
868
						    inner);
869
					inner->data.i_rvs.has_iv = 1;
870
					inner = inner->data.i_rvs.u.iv;
871
				}
872
			}
873
		}
874
		output_info(e, d->more);
875
		if (!doing_abstract && d->data.i_rvs.rvs_key != DGR_RTS &&
876
		    (d->data.i_rvs.n_code ||
877
		     (d->data.i_rvs.rvs_key == DGR_ALT ||
878
		      d->data.i_rvs.rvs_key == DGR_TRIG))) {
879
			dw_sibling_end();
880
		}
881
		break;
2 7u83 882
	}
883
 
7 7u83 884
	case DGA_DETCH:
885
		if (d->data.i_detch.posn < 0) {
886
			output_detch(d->data.i_detch.dl);
887
			output_info(e, d->more);
888
		}
889
		else {
890
			output_info(e, d->more);
891
			output_detch(d->data.i_detch.dl);
892
		}
893
		break;
2 7u83 894
 
7 7u83 895
	case DGA_MOVD:
896
	case DGA_HOIST:
897
		if (!doing_abstract) {
898
			dg_tag tg = d->data.i_movd.tg;
899
			if (d->this_tag) {
900
				set_ext_address(d->this_tag);
901
			}
902
			if (d->data.i_movd.lo_pc) {
903
				IGNORE dw_entry((tg ? dwe_moved_r : dwe_moved),
904
						(long)0);
905
				dw_at_udata((unsigned long)d->data.i_movd.reason);
906
				if (tg) {
907
					dw_at_ext_address(tg);
908
				}
909
				dw_at_address(d->data.i_movd.lo_pc);
910
				dw_at_address(d->data.i_movd.hi_pc);
911
			} else {
912
				check_trivial(e);
913
				IGNORE dw_entry((tg ? dwe_moved_xr :
914
						 dwe_moved_x), (long)0);
915
				dw_at_udata((unsigned long)d->data.i_movd.reason);
916
				if (tg) {
917
					dw_at_ext_address(tg);
918
				}
919
			}
920
		}
921
		output_info(e, d->more);
922
		if (!doing_abstract) {
923
			dw_sibling_end();
924
		}
925
		break;
2 7u83 926
 
7 7u83 927
	case DGA_OPTIM: {
928
		if (!doing_abstract) {
929
			if (d->this_tag) {
930
				set_ext_address(d->this_tag);
931
			}
932
			if (d->data.i_optim.lo_pc) {
933
				IGNORE dw_entry(dwe_optim, (long)0);
934
				dw_at_udata((unsigned long)d->data.i_optim.reason);
935
				dw_at_address(d->data.i_optim.lo_pc);
936
				dw_at_address(d->data.i_optim.hi_pc);
937
				/* unassigned refs */
938
				out_refblock (d->data.i_optim.objs, 0);
939
				/* assigned refs */
940
				out_refblock (d->data.i_optim.objs, 1);
941
			} else {
942
				check_trivial(e);
943
				IGNORE dw_entry(dwe_moved_x, (long)0);
944
				dw_at_udata((unsigned long)d->data.i_movd.reason);
945
			}
946
		}
947
		output_info(e, d->more);
948
		if (!doing_abstract) {
949
			dw_sibling_end();
950
		}
951
		break;
2 7u83 952
	}
953
 
7 7u83 954
	case DGA_REMVAL:
955
	case DGA_BEG:
956
	case DGA_BAR:
957
	case DGA_NONE:
958
		output_info(e, d->more);
959
		break;
960
 
961
	default:
962
		failer("unexpected dg_info");
2 7u83 963
	}
7 7u83 964
	return;
965
}
2 7u83 966
 
967
 
7 7u83 968
static void
969
output_detch(detch_info *dl)
2 7u83 970
{
7 7u83 971
	while (dl) {
972
		int has_child = 0;
973
		int has_dest = 0;
974
		int reason = dl->why;
975
		dg_info d_src = dl->info;
976
		dg_info more_src = (dg_info)0;
977
		dg_tag tg = dl->tg;
978
		while (tg && tg->copy) {
979
			tg = tg->copy;
980
		}
981
		if (tg && tg->p.info->key == DGA_MOVD) {
982
			d_src = tg->p.info;
983
			reason = d_src->data.i_movd.reason;
984
			if (d_src->data.i_movd.lost) {
985
				tg = d_src->data.i_movd.tg;
986
			} else {
987
				has_dest = 1;
988
			}
989
			d_src = d_src->more;
990
		}
991
		if (has_dest) {
992
			if (d_src->key == DGA_SRC && !doing_abstract) {
993
				IGNORE dw_entry(dwe_displ_x, (long)0);
994
				dw_at_ext_address(tg);
995
				dw_at_decl(d_src->data.i_src.startpos);
996
			} else if (!doing_abstract &&
997
				   d_src->key != DGA_INL_RES &&
998
				   (d_src->key != DGA_RVS ||
999
				    !d_src->data.i_rvs.has_iv) &&
1000
				   d_src->key != DGA_BEG &&
1001
				   d_src->key != DGA_BAR) {
1002
				IGNORE dw_entry(dwe_displaced, (long)0);
1003
				dw_at_ext_address(tg);
1004
			}
1005
		} else {
1006
			if (d_src->key == DGA_SRC && !doing_abstract) {
1007
				IGNORE dw_entry((tg ? dwe_absent_xr :
1008
						 dwe_absent_x), (long)0);
1009
				dw_at_udata((unsigned long)reason);
1010
				if (tg) {
1011
					dw_at_ext_address(tg);
1012
				}
1013
				dw_at_decl(d_src->data.i_src.startpos);
1014
			} else if (d_src->key == DGA_NAME) {
1015
				/* included when doing_abstract */
1016
				more_src = d_src;
1017
			} else if (!doing_abstract &&
1018
				   d_src->key != DGA_INL_RES &&
1019
				   (d_src->key != DGA_RVS ||
1020
				    !d_src->data.i_rvs.has_iv) &&
1021
				   d_src->key != DGA_BEG &&
1022
				   d_src->key != DGA_BAR) {
1023
				has_child = 1;
1024
				more_src = d_src;
1025
				more_src->more = (dg_info)0;
1026
				IGNORE dw_entry((tg ? dwe_absent_r :
1027
						 dwe_absent), (long)0);
1028
				dw_at_udata((unsigned long)reason);
1029
				if (tg) {
1030
					dw_at_ext_address(tg);
1031
				}
1032
			}
1033
		}
1034
		{
1035
			detch_info *old = sub_detch;
1036
			sub_detch = dl->sub;
1037
			output_info(nilexp, more_src);
1038
			sub_detch = old;
1039
		}
1040
		if (has_child) {
1041
			dw_sibling_end();
1042
		}
1043
		dl = dl->next;
1044
	}
1045
	return;
2 7u83 1046
}
1047
 
1048
 
7 7u83 1049
static void
1050
out_param(dg_param p)
2 7u83 1051
{
7 7u83 1052
	/* within debug_info */
1053
	/* used for declarations only */
1054
	long attr1 = (H_TP | H_VP), attr2;
1055
	if (p.pnam[0]) {
1056
		attr1 |= H_NM;
1057
	}
1058
	if (p.ppos.file) {
1059
		attr1 |= H_XY;
1060
	}
2 7u83 1061
#ifdef H_DX
7 7u83 1062
	if (p.p_dflt) {
1063
		if (p.p_dflt->span.sp_key == SP_SPAN ||
1064
		    (p.p_dflt->val && dw_is_const(son(p.p_dflt->val)))) {
1065
			attr1 |= H_DF;
1066
		} else {
1067
			attr1 |= H_DX;
1068
		}
1069
	}
2 7u83 1070
#else
7 7u83 1071
	if (p.p_dflt) {
1072
		attr1 |= H_DF;
1073
	}
2 7u83 1074
#endif
7 7u83 1075
	attr2 = dw_entry(dwe_param, attr1);
2 7u83 1076
#ifdef H_DX
7 7u83 1077
	if (attr2 & ~(H_NM|H_XY|H_TP|H_VP|H_DF|H_DX)) {
2 7u83 1078
#else
7 7u83 1079
	if (attr2 & ~(H_NM|H_XY|H_TP|H_VP|H_DF)) {
2 7u83 1080
#endif
7 7u83 1081
			fail_unimplemented();
1082
	}
1083
	if (attr2 & H_NM) {
1084
		dw_at_string(p.pnam);
1085
	}
1086
	if (attr2 & H_XY) {
1087
		dw_at_decl(p.ppos);
1088
	}
1089
	if (attr2 & H_TP) {
1090
		dw_at_ext_lab(dw2_find_type_label(p.p_typ));
1091
	}
1092
	if (attr2 & H_VP) {
1093
		int vp = 0;
1094
		if (p.pmode == DG_OUT_MODE || p.pmode == DG_INOUT_MODE) {
1095
			vp = 1;
1096
		}
1097
		dw_at_flag(vp);
1098
	}
2 7u83 1099
#ifdef H_DX
7 7u83 1100
	if (attr2 & H_DX) {
1101
		dw_at_flag((p.p_dflt && !(attr2 & H_DF))? 1 : 0);
1102
	}
2 7u83 1103
#endif
7 7u83 1104
	if (attr2 & H_DF) {
1105
		dw_out_default(p.p_dflt);
1106
	}
1107
	return;
2 7u83 1108
}
1109
 
1110
 
7 7u83 1111
static void
1112
dw2_out_proc(dg_name di)
2 7u83 1113
{
7 7u83 1114
	/* within debug_info section */
1115
	int old_il = doing_inline;
1116
	int old_ab = doing_abstract;
1117
	long infolab = 0;
1118
	exp id;
1119
	dg_type p_t, res_t;
1120
	dg_type old_res = return_type;
1121
	long is_callable = DW_CC_normal;
1122
	char *nam;
1123
	char *gnam = "";
1124
	long attr1, attr2;
1125
	dg_instantn *generic = (dg_instantn *)0;
1126
	dg_info old_di = proc_dg_info;
1127
	proc_dg_info = (dg_info)0;
1128
	if (di->idnam.id_key == DG_ID_INST) {
1129
		generic = di->idnam.idd.instance;
1130
		if (generic->nam.id_key == DG_ID_ANON) {
1131
			nam = generic->spec.idd.nam;
1132
		} else {
1133
			nam = generic->nam.idd.nam;
1134
			gnam = generic->spec.idd.nam;
1135
		}
1136
	} else {
1137
		nam = di->idnam.idd.nam;
1138
	}
1139
	p_t = find_proc_type(di->data.n_proc.typ);
1140
	res_t = p_t->data.t_proc.res_type;
1141
	return_type = res_t;
1142
	id = di->data.n_proc.obtain_val;
1143
	if (id) {
1144
		exp p;
1145
		if (name(id) != hold_tag || name(son(id)) != name_tag) {
1146
			failer("wrong proc obtain_tag");
1147
			return;
1148
		}
1149
		id = son(son(id));
1150
		p = son(id);
1151
		if (p) {
1152
			exp t = son(p);
1153
			dw2_prepare_locate(id);
1154
			proc_dg_info = dgf(p);
1155
			if (proc_dg_info && proc_dg_info->key != DGA_PRC) {
1156
				failer("inconsistent proc info");
1157
			}
1158
			if (proc_has_vcallees(p)) {
1159
				is_callable = DW_CC_nocall;
1160
			}
1161
			while (name(t) == ident_tag && isparam(t) &&
1162
			       name(son(t)) != formal_callee_tag) {
1163
				t = bro(son(t));
1164
			}
1165
			if (name(t) == ident_tag &&
1166
			    name(son(t)) == formal_callee_tag) {
1167
				is_callable = DW_CC_nocall;
1168
			}
1169
			if (brog(id)->dec_u.dec_val.extnamed) {
1170
				infolab = next_dwarf_label();
1171
				exit_section();
1172
				enter_section("debug_pubnames");
1173
				out32();
1174
				out_dwf_labdiff(dw_info_start, infolab);
1175
				d_outnl();
1176
				out_string(nam);
1177
				exit_section();
1178
				enter_section("debug_info");
1179
			}
1180
		}
1181
	}
2 7u83 1182
 
7 7u83 1183
	if (p_t->data.t_proc.prps & (f_untidy | f_var_callees)) {
1184
		is_callable = DW_CC_nocall;
1185
	}
1186
	if (di->mor && di->mor->refspec) {
1187
		attr1 = H_SP | H_XY;
1188
	} else {
1189
		attr1 = H_NM | H_XY;
1190
		if (res_t) {
1191
			attr1 |= H_TP;
1192
		}
1193
		switch (di->idnam.id_key) {
1194
		case DG_ID_EXT:
1195
			attr1 |= H_EX;
1196
			break;
1197
		case DG_ID_ARTFL:
1198
			attr1 |= H_AT;
1199
			break;
1200
		case DG_ID_INST:
1201
			if (gnam[0]) {
1202
				attr1 |= H_GN;
1203
			}
1204
			break;
1205
		default:
1206
			break;
1207
		}
1208
		if (p_t->data.t_proc.knowpro) {
1209
			attr1 |= H_PT;
1210
		}
1211
		if (p_t->data.t_proc.lang) {
1212
			attr1 |= H_LN;
1213
		}
1214
		if (p_t->data.t_proc.ccv) {
1215
			attr1 |= H_CC;
1216
			if (p_t->data.t_proc.ccv != DW_CC_normal) {
1217
				is_callable = p_t->data.t_proc.ccv;
1218
			}
1219
		}
1220
	}
1221
	if (is_callable |= DW_CC_normal) {
1222
		attr1 |= H_CC;
1223
	}
1224
	if (di->mor && di->mor->isspec) {
1225
		attr1 |= H_DC;
1226
	}
1227
	if (di->mor && di->mor->issep) {
1228
		attr1 |= H_SE;
1229
	}
1230
	if (di->mor && di->mor->acc) {
1231
		attr1 |= H_AC;
1232
	}
1233
	if (di->mor && di->mor->virt) {
1234
		attr1 |= H_VT;
1235
	}
1236
	if (di->mor && di->mor->vslot) {
1237
		attr1 |= H_VL;
1238
	}
1239
	if (di->mor && di->mor->repn) {
1240
		attr1 |= H_RP;
1241
	}
1242
	doing_abstract = 0;
1243
	if (di->mor && di->mor->this_tag) {
1244
		set_ext_address(di->mor->this_tag);
1245
		if (di->mor->this_tag->any_inl) {
1246
			doing_abstract = 1;
1247
			attr1 |= H_IL;
1248
		}
1249
	}
2 7u83 1250
 
7 7u83 1251
	do {
1252
		if (!doing_abstract && proc_dg_info) {
1253
			if (infolab) {
1254
				out_dwf_label(infolab, 1);
1255
			}
1256
			attr1 |= H_PC;
1257
			if (proc_dg_info->data.i_prc.p &&
1258
			    proc_dg_info->data.i_prc.p->data.i_param.o_env) {
1259
				attr1 |= H_SL;
1260
			}
1261
			if (di->mor && di->mor->elabn) {
1262
				attr1 |= H_EL;
1263
			}
1264
		}
2 7u83 1265
 
7 7u83 1266
		attr2 = dw_entry(dwe_proc, attr1);
2 7u83 1267
 
7 7u83 1268
		if (attr2 & ~(H_AO|H_SP|H_DC|H_NM|H_XY|H_EX|H_AT|H_AC|H_CC|
1269
			      H_TP|H_PT|H_IL|H_VT|H_VL|H_PC|H_SL|H_EXTN)) {
1270
			fail_unimplemented();
1271
		}
1272
		if (attr2 & H_AO) {
1273
			dw_at_ext_address(di->mor->this_tag);
1274
		}
1275
		if (attr2 & H_SP) {
1276
			dw_at_ext_address(di->mor->refspec);
1277
		}
1278
		if (attr2 & H_DC) {
1279
			dw_at_flag((di->mor && di->mor->isspec ? 1 : 0));
1280
		}
1281
		if (attr2 & H_NM) {
1282
			dw_at_string(nam);
1283
		}
1284
		if (attr2 & H_XY) {
1285
			dw_at_decl(di->whence);
1286
		}
1287
		if (attr2 & H_EX) {
1288
			dw_at_flag((di->idnam.id_key == DG_ID_EXT ? 1 : 0));
1289
		}
1290
		if (attr2 & H_AT) {
1291
			dw_at_flag((di->idnam.id_key == DG_ID_ARTFL ? 1 : 0));
1292
		}
1293
		if (attr2 & H_AC) {
1294
			dw_at_data(1, (long)(di->mor ? di->mor->acc : 0));
1295
		}
1296
		if (attr2 & H_CC) {
1297
			dw_at_data(1, is_callable);
1298
		}
1299
		if (attr2 & H_TP) {
1300
			dw_at_ext_lab(dw2_find_type_label(res_t));
1301
		}
1302
		if (attr2 & H_PT) {
1303
			dw_at_flag(p_t->data.t_proc.yespro);
1304
		}
1305
		if (attr2 & H_IL) {
1306
			dw_at_data(1, (long)(di->mor->isinline ?
1307
					     DW_INL_declared_inlined :
1308
					     DW_INL_inlined));
1309
		}
1310
		if (attr2 & H_VT) {
1311
			dw_at_data(1, (long)(di->mor ? di->mor->virt : 0));
1312
		}
1313
		if (attr2 & H_VL) {
1314
			dw2_locate_exp(son(di->mor->vslot), 0, 0);
1315
		}
1316
		if (attr2 & H_PC) {
1317
			dw_at_address(proc_dg_info->data.i_prc.prc_start);
1318
			dw_at_address(proc_dg_info->data.i_prc.prc_end);
1319
			/* return address and frame_base */
1320
			dw_at_procdetails();
1321
		}
1322
		if (attr2 & H_SL) {
1323
			dw2_locate_exp(son(proc_dg_info->data.i_prc.p->data.i_param.o_env), 1, 0);
1324
		}
2 7u83 1325
 
7 7u83 1326
		if (attr2 & H_EXTN) {
1327
			long block_end = next_dwarf_label();
1328
			attr1 &= ~attr2;
1329
			if (attr1 & ~(H_EL|H_GN|H_RP|H_LN|H_SE)) {
1330
				fail_unimplemented();
1331
			}
1332
			out16();
1333
			out_dwf_dist_to_label(block_end);
1334
			d_outnl();
1335
			if (attr1 & H_EL) {
1336
				set_attribute(DW_AT_DD_elaboration,
1337
					      DW_FORM_ref_addr);
1338
				dw_at_ext_address(di->mor->elabn);
1339
			}
1340
			if (attr1 & H_GN) {
1341
				set_attribute(DW_AT_DD_generic_name,
1342
					      DW_FORM_string);
1343
				dw_at_string(gnam);
1344
			}
1345
			if (attr1 & H_RP) {
1346
				set_attribute(DW_AT_DD_repn, 0);
1347
				dw_out_const(son(di->mor->repn));
1348
			}
1349
			if (attr1 & H_LN) {
1350
				set_attribute(DW_AT_language, DW_FORM_udata);
1351
				dw_at_udata((unsigned long)(p_t->data.t_proc.lang));
1352
			}
1353
			if (attr1 & H_SE) {
1354
				set_attribute(DW_AT_DD_separate, DW_FORM_flag);
1355
				dw_at_flag((di->mor && di->mor->issep ? 1 : 0));
1356
			}
1357
			set_attribute(0, 0);
1358
			out_dwf_label(block_end, 1);
1359
		}
2 7u83 1360
 
7 7u83 1361
		if (!doing_abstract && generic) {
1362
			dw2_out_generic(generic->params);
1363
		}
2 7u83 1364
 
7 7u83 1365
		if (!doing_abstract && !proc_dg_info &&
1366
		    !di->data.n_proc.params) {
1367
			/* must be declaration only */
1368
			dg_param *el = p_t->data.t_proc.params.array;
1369
			int i;
1370
			for (i = 0; i < p_t->data.t_proc.params.len; i++) {
1371
				out_param(el[i]);
1372
			}
1373
			if (p_t->data.t_proc.prps & f_var_callers) {
1374
				IGNORE dw_entry(dwe_opt_par,(long)0);
1375
			}
2 7u83 1376
 
7 7u83 1377
			if (di->mor && di->mor->en_family)
1378
				dw_out_dim(*(di->mor->en_family));
1379
			dw_sibling_end();
1380
			break;	/* to return */
1381
		}
1382
		{
1383
			dg_name param = (dg_name)0;
1384
			dg_param *el = p_t->data.t_proc.params.array;
1385
			int w = 0;
1386
			if (proc_dg_info && proc_dg_info->data.i_prc.p) {
1387
				param = proc_dg_info->data.i_prc.p->data.i_param.args;
1388
			} else if (di->data.n_proc.params) {
1389
				param =
1390
				    di->data.n_proc.params->data.i_param.args;
1391
			}
1392
			while (param) {
1393
				if (param->key == DGN_OBJECT) {
1394
					if (w < p_t->data.t_proc.params.len) {
1395
						param->data.n_obj.p = & (el[w]);
1396
					} else {
1397
						param->data.n_obj.p =
1398
						    (dg_param *)0;
1399
					}
1400
				}
1401
				if (doing_abstract) {
1402
					if (!(param->mor) ||
1403
					    !(param->mor->this_tag)) {
1404
						failer("param inlining error");
1405
					}
1406
					param->mor->inline_ref =
1407
					    param->mor->this_tag;
1408
				}
1409
				dw2_out_name(param, PARAM_NAME);
1410
				param = param->next;
1411
				w++;
1412
			}
1413
		}
1414
		if (p_t->data.t_proc.prps & f_var_callers) {
1415
			IGNORE dw_entry(dwe_opt_par, (long)0);
1416
		}
2 7u83 1417
 
7 7u83 1418
		if (!doing_abstract && di->mor && di->mor->exptns.len) {
1419
			dg_type *et = di->mor->exptns.array;
1420
			int i;
1421
			for (i = 0; i < di->mor->exptns.len; i++) {
1422
				IGNORE dw_entry(dwe_thrown_t, (long)0);
1423
				dw_at_ext_lab(dw2_find_type_label(et[i]));
1424
			}
1425
		}
1426
		if (di->mor && di->mor->en_family) {
1427
			dw_out_dim(*(di->mor->en_family));
1428
		}
1429
		if (proc_dg_info && proc_dg_info->data.i_prc.barrier) {
1430
			dg_info b = proc_dg_info->data.i_prc.barrier;
1431
			IGNORE dw_entry(dwe_barrier, (long)0);
1432
			dw_at_decl(b->data.i_bar.pos);
1433
			dw_at_address(b->data.i_bar.lo_pc);
1434
			dw_at_address(b->data.i_bar.hi_pc);
1435
		}
2 7u83 1436
 
7 7u83 1437
		if (!doing_abstract && extra_diags && proc_dg_info) {
1438
			long atret1 = H_XY, atret2;
1439
			retrec *rets = proc_dg_info->data.i_prc.returns;
1440
			if (rets) {
1441
				atret1 |= H_PC;
1442
				if (res_t) {
1443
					atret1 |= H_LC;
1444
				}
1445
			}
1446
			do {
1447
				atret2 = dw_entry(dwe_return, atret1);
1448
				if (atret2 & ~(H_XY|H_PC|H_LC)) {
1449
					fail_unimplemented();
1450
				}
1451
				if (atret2 & H_XY) {
1452
					dw_at_decl(di->mor->end_pos);
1453
				}
1454
				if (atret2 & H_PC) {
1455
					dw_at_address(rets->lab);
1456
				}
1457
				if (atret2 & H_LC) {
1458
					dw2_locate_result(pt(son(id)));
1459
				}
1460
				if (!rets) {
1461
					break;
1462
				}
1463
				rets = rets->next;
1464
			}
1465
			while (rets);
1466
		}
2 7u83 1467
 
7 7u83 1468
		if (id && (proc_dg_info || doing_abstract)) {
1469
			output_info(son(id), (proc_dg_info ?
1470
					      dgf(son(id))->more :
1471
					      dgf(son(id))));
1472
		}
2 7u83 1473
 
7 7u83 1474
		dw_sibling_end();
1475
		if (doing_abstract) {
1476
			doing_abstract = 0;
1477
			doing_inline = 1;
1478
			attr1 = H_AO;
1479
		} else {
1480
			break;
1481
		}
1482
	} while (proc_dg_info);
2 7u83 1483
 
7 7u83 1484
	doing_abstract = old_ab;
1485
	doing_inline = old_il;
1486
	proc_dg_info = old_di;
1487
	return_type = old_res;
1488
	return;
2 7u83 1489
}
1490
 
1491
 
7 7u83 1492
void
1493
dw2_out_generic(dg_name_list p)
2 7u83 1494
{
7 7u83 1495
	while (p) {
1496
		switch (p->key) {
1497
		case DGN_OBJECT:
1498
			IGNORE dw_entry(dwe_tmpl_val, (long)0);
1499
			dw_at_string(idname_chars(p->idnam));
1500
			dw_at_decl(p->whence);
1501
			dw_at_ext_lab(dw2_find_type_label(p->data.n_obj.typ));
1502
			dw_out_const(son(p->data.n_obj.obtain_val));
1503
			break;
1504
		case DGN_TYPE:
1505
			IGNORE dw_entry(dwe_tmpl_type, (long)0);
1506
			dw_at_string(idname_chars(p->idnam));
1507
			dw_at_decl(p->whence);
1508
			dw_at_ext_lab(dw2_find_type_label(p->data.n_typ.raw));
1509
			break;
1510
		case DGN_PROC:
1511
			IGNORE dw_entry(dwe_tmpl_proc, (long)0);
1512
			dw_at_string(idname_chars(p->idnam));
1513
			dw_at_decl(p->whence);
1514
			dw_at_ext_address(p->mor->refspec);
1515
			break;
1516
		case DGN_MODULE:
1517
			IGNORE dw_entry(dwe_tmpl_mod, (long)0);
1518
			dw_at_string(idname_chars(p->idnam));
1519
			dw_at_decl(p->whence);
1520
			dw_at_ext_address(p->mor->refspec);
1521
			break;
1522
		default:
1523
			break;
1524
		}
1525
		p = p->next;
1526
	}
1527
	return;
2 7u83 1528
}
1529
 
1530
 
7 7u83 1531
void
1532
dw2_out_name(dg_name di, dg_nm_contex contex)
2 7u83 1533
{
7 7u83 1534
	/* in debug_info section */
1535
	dg_tag inl_tag = (di->mor ? di->mor->inline_ref : (dg_tag)0);
1536
	if (di->mor && di->mor->this_tag && !di->mor->this_tag->outref.k) {
1537
		di->mor->this_tag->outref.k = LAB_D;
1538
		di->mor->this_tag->outref.u.l = next_dwarf_label();
1539
	}
2 7u83 1540
 
7 7u83 1541
	/* EXCEPT_NAME, INSTANTN_NAME not done yet */
1542
	if ((contex == LOCAL_NAME || contex == DEAD_NAME) && !doing_abstract) {
1543
		if (!dw2_scope_start) {
1544
			failer("missing scope");
1545
		}
1546
	}
2 7u83 1547
 
7 7u83 1548
	switch (di->key) {
1549
	case DGN_OBJECT: {
1550
		exp x = di->data.n_obj.obtain_val;
1551
		dg_type typ = di->data.n_obj.typ;
1552
		dg_param *ppar = (contex == PARAM_NAME ? di->data.n_obj.p :
1553
				  (dg_param *)0);
1554
		char *nam = idname_chars(di->idnam);
1555
		long attr1 = 0, attr2;
1556
		long loclab = 0, loclabext = 0, infolab = 0;
1557
		abbrev_entry dwe;
1558
		if ((inl_tag && !doing_inline && !doing_abstract) ||
1559
		    (!inl_tag && doing_inline)) {
1560
			failer("inline inconsistency");
1561
		}
2 7u83 1562
 
7 7u83 1563
		if (contex == GLOBAL_NAME && di->idnam.id_key == DG_ID_EXT &&
1564
		    x && find_id(son(x))) {
1565
			infolab = next_dwarf_label();
1566
			exit_section();
1567
			enter_section("debug_pubnames");
1568
			out32();
1569
			out_dwf_labdiff(dw_info_start, infolab);
1570
			d_outnl();
1571
			dw_at_string(nam);
1572
			exit_section();
1573
			enter_section("debug_info");
1574
		}
2 7u83 1575
 
7 7u83 1576
		if (contex == PARAM_NAME || contex == INL_PARAM_NAME) {
1577
			dwe = dwe_param;
1578
		} else if (di->mor && di->mor->isconst) {
1579
			dwe = dwe_constant;
1580
		} else {
1581
			dwe = dwe_variable;
1582
		}
2 7u83 1583
 
7 7u83 1584
		if (doing_inline) {
1585
			attr1 |= H_AO;
1586
		} else {
1587
			if (di->mor && di->mor->refspec) {
1588
				attr1 |= (H_SP | H_XY);
1589
			} else {
1590
				attr1 |= (H_NM | H_XY | H_TP);
1591
				if (contex == GLOBAL_NAME) {
1592
					attr1 |= H_EX;
1593
				}
1594
				if (di->idnam.id_key == DG_ID_ARTFL) {
1595
					attr1 |= H_AT;
1596
				}
1597
			}
1598
			if (di->mor && di->mor->isspec) {
1599
				attr1 |= H_DC;
1600
			}
1601
			if (di->mor && di->mor->acc) {
1602
				attr1 |= H_AC;
1603
			}
1604
			if (contex == PARAM_NAME) {
1605
				attr1 |= H_VP;
2 7u83 1606
#ifdef H_DX
7 7u83 1607
				if (ppar && ppar->p_dflt) {
1608
					if (ppar->p_dflt->span.sp_key ==
1609
					    SP_SPAN ||
1610
					    (ppar->p_dflt->val &&
1611
					     dw_is_const(son(ppar->p_dflt->val)))) {
1612
						attr1 |= H_DF;
1613
					} else {
1614
						attr1 |= H_DX;
1615
					}
1616
				}
2 7u83 1617
#else
7 7u83 1618
				if (ppar && ppar->p_dflt) {
1619
					attr1 |= H_DF;
1620
				}
2 7u83 1621
#endif
7 7u83 1622
			}
1623
			if (di->mor && di->mor->repn) {
1624
				attr1 |= H_RP;
1625
			}
1626
		}
1627
		if (!doing_abstract && !(attr1 & H_DC)) {
1628
			if (!x) {
1629
				failer("obtain_value missing");
1630
			}
1631
			if (contex == LOCAL_NAME || contex == DEAD_NAME) {
1632
				attr1 |= H_SS;
1633
			}
1634
			if (contex != DEAD_NAME && dw_is_const(son(x))) {
1635
				attr1 |= H_CV;
1636
			} else {
1637
				int ll = decide_ll_type(x);
1638
				if (!ll && contex == PARAM_NAME) {
1639
					ll = 1;
1640
				}
1641
				attr1 |= (ll ? H_LL : H_LC);
1642
				if (ll > 1) {
1643
					attr1 |= H_LE;
1644
				}
1645
			}
1646
		}
2 7u83 1647
 
7 7u83 1648
		if (di->mor && di->mor->this_tag) {
1649
			if (doing_abstract) {
1650
				set_abstract_lab(di->mor->this_tag);
1651
			} else {
1652
				set_ext_address(di->mor->this_tag);
1653
			}
1654
		}
1655
		if (infolab) {
1656
			out_dwf_label(infolab, 1);
1657
		}
1658
		attr2 = dw_entry(dwe, attr1);
1659
		if (attr2 & ~(H_AO|H_SP|H_DC|H_NM|H_XY|H_EX|H_AT|H_AC|H_TP|H_VP|
2 7u83 1660
#ifdef H_DX
7 7u83 1661
			      H_SS|H_LC|H_LL|H_LE|H_CV|H_RP|H_DF|H_DX)) {
2 7u83 1662
#else
7 7u83 1663
			      H_SS|H_LC|H_LL|H_LE|H_CV|H_RP|H_DF)) {
2 7u83 1664
#endif
7 7u83 1665
			    fail_unimplemented();
1666
		}
2 7u83 1667
 
7 7u83 1668
		if (attr2 & H_AO) {
1669
			dw_at_abstract_lab(inl_tag);
1670
		}
1671
		if (attr2 & H_SP) {
1672
			dw_at_ext_address(di->mor->refspec);
1673
		}
1674
		if (attr2 & H_DC) {
1675
			dw_at_flag((di->mor && di->mor->isspec ? 1 : 0));
1676
		}
1677
		if (attr2 & H_NM) {
1678
			dw_at_string(nam);
1679
		}
1680
		if (attr2 & H_XY) {
1681
			dw_at_decl(di->whence);
1682
		}
1683
		if (attr2 & H_EX) {
1684
			dw_at_flag((infolab ? 1 : 0));
1685
		}
1686
		if (attr2 & H_AT) {
1687
			dw_at_flag((di->idnam.id_key == DG_ID_ARTFL ? 1 : 0));
1688
		}
1689
		if (attr2 & H_AC) {
1690
			dw_at_data(1, (long)(di->mor ? di->mor->acc : 0));
1691
		}
1692
		if (attr2 & H_TP) {
1693
			dw_at_ext_lab(dw2_find_type_label(typ));
1694
		}
1695
		if (attr2 & H_VP) {
1696
			int vp = 0;
1697
			if (ppar && (ppar->pmode == DG_OUT_MODE ||
1698
				     ppar->pmode == DG_INOUT_MODE)) {
1699
				vp = 1;
1700
			}
1701
			dw_at_flag(vp);
1702
		}
2 7u83 1703
#ifdef H_DX
7 7u83 1704
		if (attr2 & H_DX) {
1705
			dw_at_flag((ppar && ppar->p_dflt &&
1706
				    !(attr2 & H_DF)) ? 1 : 0);
1707
		}
2 7u83 1708
#endif
7 7u83 1709
		if (attr2 & H_DF) {
1710
			dw_out_default(ppar->p_dflt);
1711
		}
1712
		if (attr2 & H_SS) {
1713
			dw_at_distance(dw2_scope_start, local_var_place);
1714
		}
1715
		if (attr2 & H_CV) {
1716
			dw_out_const(son(x));
1717
		}
1718
		if (attr2 & H_LC) {
1719
			if (contex == DEAD_NAME) {
1720
				dw_no_locate();
1721
			} else {
1722
				dw2_locate_exp(son(x), 0, 0);
1723
			}
1724
		}
1725
		if (attr2 & H_LL) {
1726
			dw_at_address(loclab = next_dwarf_label());
1727
		}
1728
		if (attr2 & H_LE) {
1729
			dw_at_address(loclabext = next_dwarf_label());
1730
		}
1731
		if (attr2 & H_RP) {
1732
			dw_out_const(son(di->mor->repn));
1733
		}
2 7u83 1734
 
7 7u83 1735
		if (loclab) {
1736
			long lstart, lend;
2 7u83 1737
#if 0
7 7u83 1738
			retrec * rets = proc_dg_info->data.i_prc.returns;
1739
			long rstart = proc_dg_info->data.i_prc.p->data.i_param.b_start, rend;
2 7u83 1740
#endif
7 7u83 1741
			exit_section();
1742
			enter_section("debug_loc");
1743
			out_dwf_label(loclab, 1);
1744
			if (contex == PARAM_NAME) {
1745
				lstart = proc_dg_info->data.i_prc.prc_start;
1746
				out_loc_range(lstart, lstart, 1);
1747
				dw2_locate_exp(son(x), 0, 3);
1748
				lstart = proc_dg_info->data.i_prc.p->data.i_param.b_start;
1749
				lend = proc_dg_info->data.i_prc.prc_end;
1750
			} else {
1751
				lstart = dw2_scope_start;
1752
				lend = dw2_scope_end;
1753
			}
1754
			out_obj_loclist(lstart, lend, x);
2 7u83 1755
#if 0
7 7u83 1756
			while (rets) {
1757
				if (rets->over) {
1758
					rend = rets->lab;
1759
					if (rend != rstart) {
1760
						out_loc_range(rstart, rend, 0);
1761
						dw2_locate_exp(son(x), 0, 1);
1762
					}
1763
					rstart = rets->over;
1764
				}
1765
				rets = rets->next;
1766
			}
1767
			rend = proc_dg_info->data.i_prc.prc_end;
1768
			if (rend != rstart) {
1769
				out_loc_range(rstart, rend, 0);
1770
				dw2_locate_exp(son(x), 0, 1);
1771
			}
2 7u83 1772
#endif
7 7u83 1773
			out32();
1774
			outs("0, 0");
1775
			outnl_comment("loclist end");
1776
			if (loclabext) {
1777
				out_dwf_label(loclabext, 1);
1778
				out_obj_extloclist(lstart, lend, x);
1779
				out32();
1780
				outs("0, 0");
1781
				outnl_comment("extension end");
1782
			}
1783
			out_obj_shared_set(di);
1784
			exit_section();
1785
			enter_section("debug_info");
1786
		}
1787
		break;
2 7u83 1788
	}
1789
 
7 7u83 1790
	case DGN_PROC:
1791
		dw2_out_proc(di);
1792
		break;
2 7u83 1793
 
7 7u83 1794
	case DGN_MODULE:
1795
	case DGN_NSP: {
1796
		char *nam;
1797
		char *gnam = "";
1798
		long attr1 = 0, attr2;
1799
		abbrev_entry dwe;
1800
		int has_init_code = 0;
1801
		exp id = di->data.n_mod.init;
1802
		dg_instantn *generic = (dg_instantn *)0;
1803
		dg_name mem;
1804
		if (id && name(id) == hold_tag && name(son(id)) == name_tag) {
1805
			id = son(son(id));
1806
			if (son(id) &&
1807
			    (name(son(id)) == apply_tag ||
1808
			     name(son(id)) == apply_general_tag)) {
1809
				dw2_prepare_locate(id);
1810
				if (dgf(son(id))) {
1811
					has_init_code = 1;
1812
				}
1813
			}
1814
		}
1815
		if (di->key == DGN_MODULE) {
1816
			dwe = dwe_module;
1817
		} else {
1818
			dwe = dwe_namespace;
1819
		}
1820
		if (di->idnam.id_key == DG_ID_INST) {
1821
			generic = di->idnam.idd.instance;
1822
			if (generic->nam.id_key == DG_ID_ANON) {
1823
				nam = generic->spec.idd.nam;
1824
			} else {
1825
				nam = generic->nam.idd.nam;
1826
				gnam = generic->spec.idd.nam;
1827
			}
1828
		} else {
1829
			nam = di->idnam.idd.nam;
1830
		}
1831
		if (doing_inline) {
1832
			attr1 |= H_AO;
1833
		} else {
1834
			if (di->mor && di->mor->refspec) {
1835
				attr1 = H_SP | H_XY;
1836
			} else {
1837
				attr1 = H_NM | H_XY;
1838
				switch (di->idnam.id_key) {
1839
				case DG_ID_ARTFL:
1840
					attr1 |= H_AT;
1841
					break;
1842
				case DG_ID_INST:
1843
					if (gnam[0]) {
1844
						attr1 |= H_GN;
1845
					}
1846
					break;
1847
				default:
1848
					break;
1849
				}
1850
			}
1851
			if (di->mor && di->mor->isspec) {
1852
				attr1 |= H_DC;
1853
			}
1854
			if (di->mor && di->mor->issep) {
1855
				attr1 |= H_SE;
1856
			}
1857
		}
1858
		if (!doing_abstract) {
1859
			if (has_init_code) {
1860
				attr1 |= H_PC;
1861
			}
1862
			if (di->mor && di->mor->elabn) {
1863
				attr1 |= H_EL;
1864
			}
1865
		}
2 7u83 1866
 
7 7u83 1867
		if (di->mor && di->mor->this_tag) {
1868
			if (doing_abstract) {
1869
				set_abstract_lab(di->mor->this_tag);
1870
			} else {
1871
				set_ext_address(di->mor->this_tag);
1872
			}
1873
		}
1874
		attr2 = dw_entry(dwe, attr1);
1875
		if (attr2 & ~(H_AO|H_SP|H_DC|H_NM|H_XY|H_AT|H_AC|H_PC|H_EXTN)) {
1876
			fail_unimplemented();
1877
		}
2 7u83 1878
 
7 7u83 1879
		if (attr2 & H_AO) {
1880
			dw_at_abstract_lab(inl_tag);
1881
		}
1882
		if (attr2 & H_SP) {
1883
			dw_at_ext_address(di->mor->refspec);
1884
		}
1885
		if (attr2 & H_DC) {
1886
			dw_at_flag((di->mor && di->mor->isspec ? 1 : 0));
1887
		}
1888
		if (attr2 & H_NM) {
1889
			dw_at_string(nam);
1890
		}
1891
		if (attr2 & H_XY) {
1892
			dw_at_decl(di->whence);
1893
		}
1894
		if (attr2 & H_AT) {
1895
			dw_at_flag((di->idnam.id_key == DG_ID_ARTFL ? 1 : 0));
1896
		}
1897
		if (attr2 & H_AC) {
1898
			dw_at_data(1, (long)(di->mor ? di->mor->acc : 0));
1899
		}
1900
		if (attr2 & H_PC) {
1901
			dg_info pd = dgf(son(id));
1902
			if (pd->key != DGA_PRC) {
1903
				failer("inconsistent proc info");
1904
			}
1905
			dw_at_address(pd->data.i_prc.prc_start);
1906
			dw_at_address(pd->data.i_prc.prc_end);
1907
		}
1908
		if (attr2 & H_EXTN) {
1909
			long block_end = next_dwarf_label();
1910
			attr1 &= ~attr2;
1911
			if (attr1 & ~(H_EL|H_GN|H_SE)) {
1912
				fail_unimplemented();
1913
			}
1914
			out16();
1915
			out_dwf_dist_to_label(block_end);
1916
			d_outnl();
1917
			if (attr1 & H_EL) {
1918
				set_attribute(DW_AT_DD_elaboration,
1919
					      DW_FORM_ref_addr);
1920
				dw_at_ext_address(di->mor->elabn);
1921
			}
1922
			if (attr1 & H_GN) {
1923
				set_attribute(DW_AT_DD_generic_name,
1924
					      DW_FORM_string);
1925
				dw_at_string(gnam);
1926
			}
1927
			if (attr1 & H_SE) {
1928
				set_attribute(DW_AT_DD_separate, DW_FORM_flag);
1929
				dw_at_flag((di->mor && di->mor->issep ? 1 : 0));
1930
			}
1931
			set_attribute(0, 0);
1932
			out_dwf_label(block_end, 1);
1933
		}
1934
 
1935
		if (!doing_abstract && generic) {
1936
			dw2_out_generic(generic->params);
1937
		}
1938
		mem = di->data.n_mod.members;
1939
		while (mem) {
1940
			dw2_out_name(mem, contex);
1941
			mem = mem->next;
1942
		}
1943
		dw_sibling_end();
1944
		break;
2 7u83 1945
	}
7 7u83 1946
 
1947
	case DGN_SUBUNIT: {
1948
		abbrev_entry dwe;
1949
		if (di->data.n_sub.child) {
1950
			dwe = (di->data.n_sub.acc ? dwe_child_acc :
1951
			       dwe_childunit);
1952
		} else {
1953
			dwe = dwe_subunit;
1954
		}
1955
		dw_at_ext_address(di->data.n_sub.parent);
1956
		if (di->data.n_sub.child) {
1957
			if (di->data.n_sub.acc) {
1958
				dw_at_data(1, (long)(di->data.n_sub.acc));
1959
			}
1960
		} else {
1961
			dw_at_flag(di->data.n_sub.split);
1962
		}
1963
		dw2_out_name(di->data.n_sub.sub, contex);
1964
		dw_sibling_end();
1965
		break;
2 7u83 1966
	}
7 7u83 1967
 
1968
	case DGN_IMPORT: {
1969
		long attr1 = 0, attr2;
1970
		char *nam = idname_chars(di->idnam);
1971
		dg_type p_t = di->data.n_imp.i_typ;
1972
		int params = (p_t && p_t->key == DGT_PROC);
1973
		if (nam[0]) {
1974
			attr1 |= H_NM;
1975
		}
1976
		if (di->whence.file) {
1977
			attr1 |= H_XY;
1978
		}
1979
		if (di->mor && di->mor->acc) {
1980
			attr1 |= H_AC;
1981
		}
1982
		if (contex == LOCAL_NAME && !doing_abstract) {
1983
			attr1 |= H_SS;
1984
		}
1985
		attr2 = dw_entry((params ? dwe_import_p : dwe_import), attr1);
1986
		if (attr2 & ~(H_NM|H_XY|H_AC|H_SS)) {
1987
			fail_unimplemented();
1988
		}
1989
		if (attr2 & H_NM) {
1990
			dw_at_string(nam);
1991
		}
1992
		if (attr2 & H_XY) {
1993
			dw_at_decl(di->whence);
1994
		}
1995
		if (attr2 & H_AC) {
1996
			dw_at_data(1, (long)(di->mor ? di->mor->acc : 0));
1997
		}
1998
		dw_at_ext_address(di->data.n_imp.import);
1999
		dw_at_udata((unsigned long)(di->data.n_imp.ik));
2000
		if (attr2 & H_SS) {
2001
			dw_at_distance(dw2_scope_start, local_var_place);
2002
		}
2003
 
2004
		if (params) {
2005
			dg_param *el = p_t->data.t_proc.params.array;
2006
			int i;
2007
			for (i = 0; i < p_t->data.t_proc.params.len; i++) {
2008
				out_param(el[i]);
2009
			}
2010
			if (p_t->data.t_proc.prps & f_var_callers) {
2011
				IGNORE dw_entry(dwe_opt_par, (long)0);
2012
			}
2013
			dw_sibling_end();
2014
		}
2015
		break;
2 7u83 2016
	}
2017
 
7 7u83 2018
	case DGN_TYPE: {
2019
		long attr1 = 0, attr2;
2020
		int ada_derived = 0;
2021
		char * nam = idname_chars(di->idnam);
2022
		if (doing_inline && inl_tag) {
2023
			attr1 |= H_AO;
2024
		} else {
2025
			if (di->mor && di->mor->refspec) {
2026
				attr1 = H_SP;
2027
			}
2028
			if (di->mor && di->mor->isspec) {
2029
				attr1 |= H_DC;
2030
			}
2031
			if (nam[0]) {
2032
				attr1 |= H_NM;
2033
			}
2034
			if (di->whence.file) {
2035
				attr1 |= H_XY;
2036
			}
2037
			if (di->idnam.id_key == DG_ID_ARTFL) {
2038
				attr1 |= H_AT;
2039
			}
2040
			if (di->mor && di->mor->acc) {
2041
				attr1 |= H_AC;
2042
			}
2043
			if (di->data.n_typ.raw) {
2044
				attr1 |= H_TP;
2045
			}
2046
			if (di->mor && di->mor->isnew) {
2047
				attr1 |= H_NW;
2048
			}
2049
			if (di->mor && di->mor->aderiv) {
2050
				attr1 |= H_AD;
2051
				ada_derived = 1;
2052
			}
2053
		}
2054
		if ((attr1 == H_TP ||
2055
		     (!nam[0] && !(di->mor && di->mor->this_tag))) &&
2056
		    !(di->data.n_typ.raw->outref.u.l) &&
2057
		    !di->data.n_typ.constraints) {
2058
			if (di->mor && di->mor->this_tag) {
2059
				di->data.n_typ.raw->outref =
2060
				    di->mor->this_tag->outref;
2061
			} else {
2062
				di->data.n_typ.raw->outref.u.l =
2063
				    next_dwarf_label();
2064
				di->data.n_typ.raw->outref.k = LAB_D;
2065
			}
2066
			dw_out_type(di->data.n_typ.raw);
2067
		} else {
2068
			if (di->mor && di->mor->this_tag) {
2069
				if (doing_abstract) {
2070
					set_abstract_lab(di->mor->this_tag);
2071
				} else if (!(di->mor->this_tag->done)) {
2072
					set_ext_address(di->mor->this_tag);
2073
					di->mor->this_tag->done = 1;
2074
				}
2075
			}
2076
			attr2 = dw_entry((di->data.n_typ.constraints ?
2077
					  dwe_typecon :
2078
					  dwe_typedef), attr1);
2079
			if (attr2 & ~(H_AO|H_SP|H_DC|H_NM|H_XY|H_AT|H_AC|H_TP|
2080
				      H_NW|H_AD)) {
2081
				fail_unimplemented();
2082
			}
2 7u83 2083
 
7 7u83 2084
			if (attr2 & H_AO) {
2085
				dw_at_abstract_lab(inl_tag);
2086
			}
2087
			if (attr2 & H_SP) {
2088
				dw_at_ext_address(di->mor->refspec);
2089
			}
2090
			if (attr2 & H_DC) {
2091
				dw_at_flag((di->mor &&
2092
					    di->mor->isspec ? 1 : 0));
2093
			}
2094
			if (attr2 & H_NM) {
2095
				dw_at_string(nam);
2096
			}
2097
			if (attr2 & H_XY) {
2098
				dw_at_decl(di->whence);
2099
			}
2100
			if (attr2 & H_AT) {
2101
				dw_at_flag((di->idnam.id_key ==
2102
					    DG_ID_ARTFL ? 1 : 0));
2103
			}
2104
			if (attr2 & H_AC) {
2105
				dw_at_data(1, (long)(di->mor ?
2106
						     di->mor->acc : 0));
2107
			}
2108
			if (attr2 & H_TP) {
2109
				dw_at_ext_lab(dw2_find_type_label(di->data.n_typ.raw));
2110
			}
2111
			if (attr2 & H_NW) {
2112
				dw_at_flag((di->mor &&
2113
					    di->mor->isnew ? 1 : ada_derived));
2114
			}
2115
			if (attr2 & H_AD) {
2116
				dw_at_flag(ada_derived);
2117
			}
2118
		}
2119
		if (di->data.n_typ.constraints) {
2120
			dg_constraint c = di->data.n_typ.constraints;
2121
			while (c) {
2122
				attr1 = (c->is_val ? H_CV : H_TP);
2123
				if (c->refmem) {
2124
					attr1 |= H_RM;
2125
				}
2126
				attr2 = dw_entry(dwe_cnstraint, attr1);
2127
				if (attr2 & ~(H_RM|H_CV|H_TP)) {
2128
					fail_unimplemented();
2129
				}
2130
				if (attr2 & H_RM) {
2131
					dw_at_ext_address(c->refmem);
2132
				}
2133
				if (attr2 & H_CV) {
2134
					dw_out_const(son(c->u.val));
2135
				}
2136
				if (attr2 & H_TP) {
2137
					dw_at_ext_lab(dw2_find_type_label(c->u.typ));
2138
				}
2139
				c = c->next;
2140
			}
2141
			dw_sibling_end();
2142
		}
2143
		break;
2144
	}
2 7u83 2145
 
7 7u83 2146
	case DGN_ENTRY: {
2147
		long attr1 = 0, attr2;
2148
		char *nam = idname_chars(di->idnam);
2149
		dg_type p_t = find_proc_type(di->data.n_proc.typ);
2150
		dg_type res_t = p_t->data.t_proc.res_type;
2151
		dg_param *el = p_t->data.t_proc.params.array;
2152
		int i;
2 7u83 2153
 
7 7u83 2154
		attr1 = H_NM | H_XY;
2155
		if (di->mor && di->mor->acc) {
2156
			attr1 |= H_AC;
2157
		}
2158
		if (res_t) {
2159
			attr1 |= H_TP;
2160
		}
2161
		if (di->mor && di->mor->repn) {
2162
			attr1 |= H_RP;
2163
		}
2164
		if (di->mor && di->mor->this_tag) {
2165
			set_ext_address(di->mor->this_tag);
2166
		}
2167
		attr2 = dw_entry(dwe_entry, attr1);
2168
		if (attr2 & ~(H_NM|H_XY|H_AC|H_TP|H_RP)) {
2169
			fail_unimplemented();
2170
		}
2171
		if (attr2 & H_NM) {
2172
			dw_at_string(nam);
2173
		}
2174
		if (attr2 & H_XY) {
2175
			dw_at_decl(di->whence);
2176
		}
2177
		if (attr2 & H_AC) {
2178
			dw_at_data(1, (long)(di->mor ? di->mor->acc : 0));
2179
		}
2180
		if (attr2 & H_TP) {
2181
			dw_at_ext_lab(dw2_find_type_label(res_t));
2182
		}
2183
		if (attr2 & H_RP) {
2184
			dw_out_const(son(di->mor->repn));
2185
		}
2 7u83 2186
 
7 7u83 2187
		for (i = 0; i < p_t->data.t_proc.params.len; i++) {
2188
			out_param(el[i]);
2189
		}
2190
		if (di->mor && di->mor->en_family) {
2191
			dw_out_dim(*(di->mor->en_family));
2192
		}
2193
		dw_sibling_end();
2194
		break;
2 7u83 2195
	}
7 7u83 2196
 
2197
	default:
2198
		failer("unexpected dg_name");
2 7u83 2199
	}
2200
	if (di->mor && di->mor->this_tag) {
7 7u83 2201
		di->mor->this_tag->done = 1;
2 7u83 2202
	}
7 7u83 2203
	return;
2 7u83 2204
}
2205
 
2206
 
7 7u83 2207
static retrec **returns_list;
2 7u83 2208
 
7 7u83 2209
void
2210
dw2_proc_start(exp p, dg_name d)
2 7u83 2211
{
7 7u83 2212
	if (dgf(p)) {
2213
		failer("unexpected diag info for proc");
2214
	}
2215
	proc_dg_info = dgf(p) = new_dg_info(DGA_PRC);
2216
	proc_dg_info->data.i_prc.prc_start = set_dw_text_label();
2217
	proc_dg_info->data.i_prc.prc_end = 0;
2218
	proc_dg_info->data.i_prc.returns = (retrec *)0;
2219
	returns_list = &(proc_dg_info->data.i_prc.returns);
2220
	proc_dg_info->data.i_prc.p = proc_dg_info->data.i_prc.barrier =
2221
	    (dg_info)0;
2222
	if (d) {
2223
		dw2_source_mark(d->whence, 0);
2224
	}
2225
	return;
2 7u83 2226
}
2227
 
2228
 
7 7u83 2229
void
2230
dw2_return_pos(long over)
2 7u83 2231
{
7 7u83 2232
	retrec *rec = (retrec *)xmalloc(sizeof(retrec));
2233
	rec->lab = set_dw_text_label();
2234
	rec->over = over;
2235
	rec->next = (retrec *)0;
2236
	*returns_list = rec;
2237
	returns_list = &(rec->next);
2238
	if (over) {
2239
		set_obj_rets(rec);
2240
	}
2241
	return;
2 7u83 2242
}
2243
 
2244
 
7 7u83 2245
void
2246
dw2_proc_end(exp p)
2 7u83 2247
{
7 7u83 2248
	dgf(p)->data.i_prc.prc_end = set_dw_text_label();
2249
	proc_dg_info = (dg_info)0;
2250
	return;
2 7u83 2251
}
2252
 
2253
 
7 7u83 2254
static void
2255
prepare_detch(detch_info *dl)
2 7u83 2256
{
7 7u83 2257
	while (dl) {
2258
		int reason = dl->why;
2259
		dg_info d = dl->info;
2260
		dg_tag found_tg;
2261
		if (reason >= DGD_MOVD) {
2262
			found_tg = dl->tg;
2263
			while (found_tg->copy) {
2264
				found_tg = found_tg->copy;
2265
			}
2266
			d = found_tg->p.info;
2267
			reason = d->data.i_movd.reason;
2268
			d = d->more;
2269
		}
2270
		if (reason < DGD_MOVD) {
2271
			switch (d->key) {
2272
			case DGA_NAME:
2273
				d->data.i_nam.scope_start = set_dw_text_label();
2274
				break;
2275
			case DGA_SCOPE:
2276
				d->data.i_scope.start = set_dw_text_label();
2277
				d->data.i_scope.end = set_dw_text_label();
2278
				break;
2279
			case DGA_REMVAL:
2280
				d->data.i_remval.lo_pc = set_dw_text_label();
2281
				set_remval_object(d);
2282
				break;
2283
			default:
2284
				break;
2285
			}
2286
		}
2287
		if (dl->sub) {
2288
			prepare_detch(dl->sub);
2289
		}
2290
		dl = dl->next;
2 7u83 2291
	}
7 7u83 2292
	return;
2 7u83 2293
}
2294
 
2295
 
7 7u83 2296
void
2297
dw2_code_info(dg_info d, void(*mcode)(void *), void *args)
2 7u83 2298
{
7 7u83 2299
	if (d == nildiag) {
2300
		(*mcode)(args);
2301
		return;
2302
	}
2303
	switch (d->key) {
2304
	case DGA_PARAMS: {
2305
		obj_list hold_pars;
2306
		hold_pars.obj = d->data.i_param.args;
2307
		hold_pars.islist = 1;
2308
		hold_pars.next = (obj_list *)0;
2309
		local_objects = &hold_pars;
2310
		set_locdata(hold_pars);
2311
		if (proc_dg_info) {
2312
			proc_dg_info->data.i_prc.p = d;
2313
		}
2314
		d->data.i_param.b_start = set_dw_text_label();
2315
		dw2_code_info(d->more, mcode, args);
2316
		close_locdata(hold_pars);
2317
		local_objects = (obj_list *)0;
2318
		break;
2319
	}
2 7u83 2320
 
7 7u83 2321
	case DGA_COMP:
2322
		dw2_code_info(d->more, mcode, args);
2323
		break;
2 7u83 2324
 
7 7u83 2325
	case DGA_SRC:
2326
		if (d->data.i_src.startpos.file) {
2327
			dw2_source_mark(d->data.i_src.startpos,
2328
					d->data.i_src.is_stmt);
2329
		}
2330
		dw2_code_info(d->more, mcode, args);
2331
		if (d->data.i_src.endpos.file) {
2332
			dw2_source_mark(d->data.i_src.endpos, 0);
2333
		}
2334
		break;
2 7u83 2335
 
7 7u83 2336
	case DGA_SCOPE:
2337
	case DGA_EXTRA:
2338
		d->data.i_scope.start = set_dw_text_label();
2339
		dw2_code_info(d->more, mcode, args);
2340
		d->data.i_scope.end = set_dw_text_label();
2341
		break;
2 7u83 2342
 
7 7u83 2343
	case DGA_LAB:
2344
		d->data.i_scope.start = set_dw_text_label();
2345
		dw2_code_info(d->more, mcode, args);
2346
		break;
2 7u83 2347
 
7 7u83 2348
	case DGA_NAME: {
2349
		obj_list hold_obj;
2350
		hold_obj.obj = d->data.i_nam.dnam;
2351
		hold_obj.islist = 0;
2352
		hold_obj.next = local_objects;
2353
		local_objects = &hold_obj;
2354
		set_locdata(hold_obj);
2355
		d->data.i_nam.scope_start = set_dw_text_label();
2356
		dw2_code_info(d->more, mcode, args);
2357
		close_locdata(hold_obj);
2358
		local_objects = hold_obj.next;
2359
		break;
2360
	}
2 7u83 2361
 
7 7u83 2362
	case DGA_WITH:
2363
		d->data.i_with.lo_pc = set_dw_text_label();
2364
		dw2_code_info(d->more, mcode, args);
2365
		d->data.i_with.hi_pc = set_dw_text_label();
2366
		break;
2 7u83 2367
 
7 7u83 2368
	case DGA_CALL: {
2369
		dg_info old = current_dg_info;
2370
		current_dg_info = d;
2371
		dw2_code_info(d->more, mcode, args);
2372
		current_dg_info = old;
2373
		break;
2374
	}
2 7u83 2375
 
7 7u83 2376
	case DGA_INL_CALL: {
2377
		obj_list hold_pars;
2378
		hold_pars.obj = d->data.i_inl.args;
2379
		hold_pars.islist = 1;
2380
		hold_pars.next = local_objects;
2381
		local_objects = &hold_pars;
2382
		set_locdata(hold_pars);
2383
		d->data.i_inl.lo_pc = set_dw_text_label();
2384
		dw2_code_info(d->more, mcode, args);
2385
		d->data.i_inl.hi_pc = set_dw_text_label();
2386
		close_locdata(hold_pars);
2387
		local_objects = hold_pars.next;
2388
		break;
2 7u83 2389
	}
2390
 
7 7u83 2391
	case DGA_INL_RES:
2392
		dw2_code_info(d->more, mcode, args);
2393
		d->data.i_res.brk = set_dw_text_label();
2394
		d->data.i_res.res = find_diag_res(args);
2395
		{
2396
			dg_tag cr = d->data.i_res.call;
2397
			dg_info *dl;
2398
			if (cr->key != DGK_INFO ||
2399
			    cr->p.info->key != DGA_INL_CALL) {
2400
				failer("inline result ref?");
2401
			}
2402
			dl = &(cr->p.info->data.i_inl.resref);
2403
			while (*dl) {
2404
				if ((*dl) ==d) {
2405
					failer("impossible cycle");
2406
					return;
2407
				}
2408
				dl = &((*dl)->data.i_res.next);
2409
			}
2410
			*dl = d;
2411
		}
2412
		break;
2 7u83 2413
 
7 7u83 2414
	case DGA_X_TRY:
2415
		d->data.i_try.lo_pc = set_dw_text_label();
2416
		dw2_code_info(d->more, mcode, args);
2417
		d->data.i_try.hi_pc = set_dw_text_label();
2418
		break;
2 7u83 2419
 
7 7u83 2420
	case DGA_X_CATCH: {
2421
		obj_list hold_obj;
2422
		hold_obj.obj = d->data.i_catch.ex;
2423
		hold_obj.islist = 0;
2424
		hold_obj.next = local_objects;
2425
		local_objects = &hold_obj;
2426
		set_locdata(hold_obj);
2427
		d->data.i_catch.lo_pc = set_dw_text_label();
2428
		dw2_code_info(d->more, mcode, args);
2429
		d->data.i_catch.hi_pc = set_dw_text_label();
2430
		close_locdata(hold_obj);
2431
		local_objects = hold_obj.next;
2432
		break;
2433
	}
2 7u83 2434
 
7 7u83 2435
	case DGA_X_RAISE:
2436
		dw2_code_info(d->more, mcode, args);
2437
		break;
2 7u83 2438
 
7 7u83 2439
	case DGA_BRANCH: {
2440
		int old_db = dw_doing_branch_tests;
2441
		dw_doing_branch_tests = 1;
2442
		d->data.i_brn.brk = set_dw_text_label();
2443
		dw2_code_info(d->more, mcode, args);
2444
		d->data.i_brn.cont = set_dw_text_label();
2445
		dw_doing_branch_tests = old_db;
2446
		break;
2447
	}
2 7u83 2448
 
7 7u83 2449
	case DGA_TEST:
2450
	case DGA_JUMP:
2451
	case DGA_LJ: {
2452
		dg_info old = current_dg_info;
2453
		current_dg_info = d;
2454
		dw2_code_info(d->more, mcode, args);
2455
		current_dg_info = old;
2456
		break;
2457
	}
2 7u83 2458
 
7 7u83 2459
	case DGA_BEG: {
2460
		dg_tag tg = d->data.i_tg;
2461
		if (tg->key != DGK_INFO || tg->p.info->key != DGA_SCOPE)
2462
			failer("statement_part_dg?");
2463
		tg->p.info->data.i_scope.begin_st = set_dw_text_label();
2464
		dw2_code_info(d->more, mcode, args);
2465
		break;
2466
	}
2 7u83 2467
 
7 7u83 2468
	case DGA_DEST:
2469
		d->data.i_dest.brk = set_dw_text_label();
2470
		dw2_code_info(d->more, mcode, args);
2471
		break;
2 7u83 2472
 
7 7u83 2473
	case DGA_RVS: {
2474
		obj_list hold_pars;
2475
		hold_pars.next = local_objects;
2476
		if (d->data.i_rvs.rvs_key == DGR_ACC && d->data.i_rvs.n_code) {
2477
			hold_pars.obj = d->data.i_rvs.u2.p;
2478
			hold_pars.islist = 1;
2479
			local_objects = &hold_pars;
2480
			set_locdata(hold_pars);
2481
		}
2482
		if (d->data.i_rvs.n_code) {
2483
			d->data.i_rvs.lo_pc = set_dw_text_label();
2484
		}
2485
		if (d->data.i_rvs.u.tg) {
2486
			dg_info h;
2487
			if (d->data.i_rvs.u.tg->key != DGK_INFO ||
2488
			    (h = d->data.i_rvs.u.tg->p.info,
2489
			     h->key != DGA_RVS)) {
2490
				failer("incompatible rendezvous sequence");
2491
			}
2492
			d->data.i_rvs.u.iv = h->data.i_rvs.u.iv;
2493
			h->data.i_rvs.u.iv = d;
2494
			h->data.i_rvs.holder = 1;
2495
			d->data.i_rvs.info_e = current_dg_exp;
2496
			d->data.i_rvs.has_iv = 1;
2497
		}
2498
		dw2_code_info(d->more, mcode, args);
2499
		if ((unsigned int)d->data.i_rvs.n_code >= 2) {
2500
			d->data.i_rvs.hi_pc = set_dw_text_label();
2501
		}
2502
		if (d->data.i_rvs.rvs_key == DGR_ACC && d->data.i_rvs.n_code) {
2503
			close_locdata(hold_pars);
2504
		}
2505
		local_objects = hold_pars.next;
2506
		break;
2507
	}
2 7u83 2508
 
7 7u83 2509
	case DGA_BAR:
2510
		d->data.i_bar.lo_pc = set_dw_text_label();
2511
		if (proc_dg_info) {
2512
			proc_dg_info->data.i_prc.barrier = d;
2513
		}
2514
		dw2_code_info(d->more, mcode, args);
2515
		d->data.i_bar.hi_pc = set_dw_text_label();
2516
		break;
2 7u83 2517
 
7 7u83 2518
	case DGA_DETCH:
2519
		if (d->data.i_detch.posn < 0) {
2520
			prepare_detch(d->data.i_detch.dl);
2521
			dw2_code_info(d->more, mcode, args);
2522
		} else {
2523
			dw2_code_info(d->more, mcode, args);
2524
			prepare_detch(d->data.i_detch.dl);
2525
		}
2526
		break;
2 7u83 2527
 
7 7u83 2528
	case DGA_MOVD:
2529
	case DGA_HOIST:
2530
		d->data.i_movd.lo_pc = set_dw_text_label();
2531
		dw2_code_info(d->more, mcode, args);
2532
		d->data.i_movd.hi_pc = set_dw_text_label();
2533
		break;
2 7u83 2534
 
7 7u83 2535
	case DGA_OPTIM:
2536
		d->data.i_optim.lo_pc = set_dw_text_label();
2537
		set_optim_objects(d, 1);
2538
		dw2_code_info(d->more, mcode, args);
2539
		d->data.i_optim.hi_pc = set_dw_text_label();
2540
		set_optim_objects(d, 0);
2541
		break;
2 7u83 2542
 
7 7u83 2543
	default:
2544
		failer("unexpected dg_info");
2 7u83 2545
 
7 7u83 2546
	}
2547
	return;
2 7u83 2548
}