Pristine Ack-5.5
[Ack-5.5.git] / mach / z8000 / cg / mach.c
1 /* $Id: mach.c,v 1.6 1994/06/24 13:56:43 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  *
6  */
7
8 /*
9  * machine dependent back end routines for the z8000
10  */
11
12 con_part(sz,w) register sz; word w; {
13
14         while (part_size % sz)
15                 part_size++;
16         if (part_size == TEM_WSIZE)
17                 part_flush();
18         if (sz == 1) {
19                 w &= 0xFF;
20                 if (part_size == 0)
21                         w <<= 8;
22                 part_word |= w;
23         } else {
24                 assert(sz == 2);
25                 part_word = w;
26         }
27         part_size += sz;
28 }
29
30 con_mult(sz) word sz; {
31
32         if (sz != 4)
33                 fatal("bad icon/ucon size");
34         fprintf(codefile,"\t.data4 %s\n", str);
35 }
36
37 con_float() {
38
39 static int been_here;
40         if (argval != 4 && argval != 8)
41                 fatal("bad fcon size");
42         fprintf(codefile,"\t.data4 ");
43         if (argval == 8)
44                 fprintf(codefile,"F_DUM, ");
45         fprintf(codefile,"F_DUM\n");
46         if ( !been_here++)
47         {
48         fprintf(stderr,"Warning : dummy float-constant(s)\n");
49         }
50 }
51
52 /*
53
54 string holstr(n) word n; {
55
56         sprintf(str,hol_off,n,holno);
57         return(mystrcpy(str));
58 }
59 */
60
61 prolog(nlocals) full nlocals; {
62
63         fprintf(codefile,"\tpush\t*RR14, R13\n\tld\tR13, R15\n");
64         if (nlocals == 0)
65                 return;
66         else
67                 fprintf(codefile,"\tsub\tR15, $%d\n",nlocals);
68 }
69
70 mes(type) word type ; {
71         int argt ;
72
73         switch ( (int)type ) {
74         case ms_ext :
75                 for (;;) {
76                         switch ( argt=getarg(
77                             ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
78                         case sp_cend :
79                                 return ;
80                         default:
81                                 strarg(argt) ;
82                                 printf(".define %s\n",argstr) ;
83                                 break ;
84                         }
85                 }
86         default :
87                 while ( getarg(any_ptyp) != sp_cend ) ;
88                 break ;
89         }
90 }
91
92 char    *segname[] = {
93         ".sect .text",        /* SEGTXT */
94         ".sect .data",        /* SEGCON */
95         ".sect .rom",        /* SEGROM */
96         ".sect .bss"          /* SEGBSS */
97 };