Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20070726095557

Diff

Diff from 1.50 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/i386/local.c

Annotated File View

ragge
1.50
1 /*      $Id: local.c,v 1.50 2007/07/26 09:55:57 ragge Exp $     */
ragge
1.1
2 /*
3  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29
ragge
1.48
30 #include "pass1.h"
ragge
1.1
31
32 /*      this file contains code which is dependent on the target machine */
33
ragge
1.48
34 /* clocal() is called to do local transformations on
35  * an expression tree preparitory to its being
36  * written out in intermediate code.
37  *
38  * the major essential job is rewriting the
39  * automatic variables and arguments in terms of
40  * REG and OREG nodes
41  * conversion ops which are not necessary are also clobbered here
42  * in addition, any special features (such as rewriting
43  * exclusive or) are easily handled here as well
44  */
ragge
1.1
45 NODE *
46 clocal(NODE *p)
47 {
48
49         register struct symtab *q;
ragge
1.2
50         register NODE *r, *l;
ragge
1.1
51         register int o;
ragge
1.40
52         register int m;
ragge
1.19
53         TWORD t;
ragge
1.1
54
ragge
1.24
55 //printf("in:\n");
56 //fwalk(p, eprint, 0);
ragge
1.1
57         switcho = p->n_op ){
58
59         case NAME:
60                 if ((q = p->n_sp) == NULL)
61                         return p/* Nothing to care about */
62
63                 switch (q->sclass) {
64
65                 case PARAM:
66                 case AUTO:
67                         /* fake up a structure reference */
68                         r = block(REGNILNILPTR+STRTY00);
69                         r->n_lval = 0;
70                         r->n_rval = FPREG;
71                         p = stref(block(STREFrp000));
72                         break;
73
74                 case STATIC:
75                         if (q->slevel == 0)
76                                 break;
77                         p->n_lval = 0;
78                         p->n_sp = q;
79                         break;
80
81                 case REGISTER:
82                         p->n_op = REG;
83                         p->n_lval = 0;
84                         p->n_rval = q->soffset;
85                         break;
86
87                         }
88                 break;
89
ragge
1.39
90         case STCALL:
ragge
1.37
91         case CALL:
92                 /* Fix function call arguments. On x86, just add funarg */
93                 for (r = p->n_rightr->n_op == CMr = r->n_left) {
ragge
1.38
94                         if (r->n_right->n_op != STARG &&
95                             r->n_right->n_op != FUNARG)
ragge
1.37
96                                 r->n_right = block(FUNARGr->n_rightNIL
97                                     r->n_right->n_typer->n_right->n_df,
98                                     r->n_right->n_sue);
99                 }
ragge
1.38
100                 if (r->n_op != STARG && r->n_op != FUNARG) {
ragge
1.37
101                         l = talloc();
102                         *l = *r;
103                         r->n_op = FUNARGr->n_left = lr->n_type = l->n_type;
104                 }
ragge
1.10
105                 break;
ragge
1.37
106                 
ragge
1.8
107         case CBRANCH:
108                 l = p->n_left;
109
110                 /*
111                  * Remove unneccessary conversion ops.
112                  */
ragge
1.10
113                 if (clogop(l->n_op) && l->n_left->n_op == SCONV) {
ragge
1.12
114                         if (coptype(l->n_op) != BITYPE)
115                                 break;
ragge
1.8
116                         if (l->n_right->n_op == ICON) {
117                                 r = l->n_left->n_left;
ragge
1.24
118                                 if (r->n_type >= FLOAT && r->n_type <= LDOUBLE)
119                                         break;
ragge
1.18
120                                 /* Type must be correct */
ragge
1.19
121                                 t = r->n_type;
ragge
1.8
122                                 nfree(l->n_left);
123                                 l->n_left = r;
ragge
1.19
124                                 l->n_type = t;
125                                 l->n_right->n_type = t;
ragge
1.17
126                         }
ragge
1.8
127                 }
128                 break;
129
ragge
1.1
130         case PCONV:
ragge
1.40
131                 /* Remove redundant PCONV's. Be careful */
ragge
1.1
132                 l = p->n_left;
ragge
1.40
133                 if (l->n_op == ICON) {
134                         l->n_lval = (unsigned)l->n_lval;
135                         goto delp;
136                 }
137                 if (l->n_type < INT || l->n_type == LONGLONG || 
138                     l->n_type == ULONGLONG) {
139                         /* float etc? */
140                         p->n_left = block(SCONVlNIL,
141                             UNSIGNED0MKSUE(UNSIGNED));
142                         break;
143                 }
144                 /* if left is SCONV, cannot remove */
145                 if (l->n_op == SCONV)
ragge
1.1
146                         break;
ragge
1.40
147                 /* if conversion to another pointer type, just remove */
148                 if (p->n_type > BTMASK && l->n_type > BTMASK)
149                         goto delp;
150                 break;
151
152         delp:   l->n_type = p->n_type;
ragge
1.1
153                 l->n_qual = p->n_qual;
154                 l->n_df = p->n_df;
155                 l->n_sue = p->n_sue;
156                 nfree(p);
157                 p = l;
158                 break;
ragge
1.40
159                 
ragge
1.1
160         case SCONV:
161                 l = p->n_left;
ragge
1.4
162
ragge
1.25
163                 if (p->n_type == l->n_type) {
164                         nfree(p);
165                         return l;
166                 }
167
ragge
1.4
168                 if ((p->n_type & TMASK) == 0 && (l->n_type & TMASK) == 0 &&
pj
1.30
169                     btdims[p->n_type].suesize == btdims[l->n_type].suesize) {
ragge
1.4
170                         if (p->n_type != FLOAT && p->n_type != DOUBLE &&
ragge
1.15
171                             l->n_type != FLOAT && l->n_type != DOUBLE &&
172                             l->n_type != LDOUBLE && p->n_type != LDOUBLE) {
ragge
1.41
173                                 if (l->n_op == NAME || l->n_op == UMUL ||
174                                     l->n_op == TEMP) {
ragge
1.15
175                                         l->n_type = p->n_type;
176                                         nfree(p);
177                                         return l;
178                                 }
ragge
1.4
179                         }
ragge
1.6
180                 }
181
ragge
1.42
182                 if (DEUNSIGN(p->n_type) == INT && DEUNSIGN(l->n_type) == INT &&
183                     coptype(l->n_op) == BITYPE) {
184                         l->n_type = p->n_type;
185                         nfree(p);
186                         return l;
187                 }
188
ragge
1.3
189                 o = l->n_op;
ragge
1.4
190                 m = p->n_type;
ragge
1.1
191
192                 if (o == ICON) {
193                         CONSZ val = l->n_lval;
194
ragge
1.29
195                         if (!ISPTR(m)) /* Pointers don't need to be conv'd */
196                             switch (m) {
ragge
1.1
197                         case CHAR:
198                                 l->n_lval = (char)val;
199                                 break;
200                         case UCHAR:
201                                 l->n_lval = val & 0377;
202                                 break;
ragge
1.15
203                         case SHORT:
ragge
1.1
204                                 l->n_lval = (short)val;
205                                 break;
ragge
1.15
206                         case USHORT:
ragge
1.1
207                                 l->n_lval = val & 0177777;
208                                 break;
ragge
1.15
209                         case ULONG:
ragge
1.1
210                         case UNSIGNED:
211                                 l->n_lval = val & 0xffffffff;
212                                 break;
213                         case ENUMTY:
214                         case MOETY:
ragge
1.15
215                         case LONG:
ragge
1.1
216                         case INT:
217                                 l->n_lval = (int)val;
218                                 break;
219                         case LONGLONG:
220                                 l->n_lval = (long long)val;
ragge
1.15
221                                 break;
ragge
1.1
222                         case ULONGLONG:
223                                 l->n_lval = val;
224                                 break;
225                         case VOID:
226                                 break;
ragge
1.14
227                         case LDOUBLE:
ragge
1.1
228                         case DOUBLE:
229                         case FLOAT:
230                                 l->n_op = FCON;
231                                 l->n_dcon = val;
232                                 break;
233                         default:
234                                 cerror("unknown type %d"m);
235                         }
236                         l->n_type = m;
ragge
1.44
237                         l->n_sue = MKSUE(m);
ragge
1.1
238                         nfree(p);
239                         return l;
240                 }
ragge
1.17
241                 if (DEUNSIGN(p->n_type) == SHORT &&
242                     DEUNSIGN(l->n_type) == SHORT) {
243                         nfree(p);
244                         p = l;
245                 }
ragge
1.36
246                 if ((p->n_type == CHAR || p->n_type == UCHAR ||
247                     p->n_type == SHORT || p->n_type == USHORT) &&
248                     (l->n_type == FLOAT || l->n_type == DOUBLE ||
249                     l->n_type == LDOUBLE)) {
250                         p = block(SCONVpNILp->n_typep->n_dfp->n_sue);
251                         p->n_left->n_type = INT;
252                         return p;
253                 }
ragge
1.1
254                 break;
255
ragge
1.15
256         case MOD:
257         case DIV:
258                 if (o == DIV && p->n_type != CHAR && p->n_type != SHORT)
259                         break;
ragge
1.16
260                 if (o == MOD && p->n_type != CHAR && p->n_type != SHORT)
ragge
1.15
261                         break;
262                 /* make it an int division by inserting conversions */
263                 p->n_left = block(SCONVp->n_leftNILINT0MKSUE(INT));
264                 p->n_right = block(SCONVp->n_rightNILINT0MKSUE(INT));
265                 p = block(SCONVpNILp->n_type0MKSUE(p->n_type));
266                 p->n_left->n_type = INT;
267                 break;
268
ragge
1.1
269         case PMCONV:
270         case PVCONV:
271                 ifp->n_right->n_op != ICON ) cerror"bad conversion"0);
272                 nfree(p);
273                 return(buildtree(o==PMCONV?MUL:DIVp->n_leftp->n_right));
274
ragge
1.31
275         case FORCE:
ragge
1.32
276                 /* put return value in return reg */
277                 p->n_op = ASSIGN;
278                 p->n_right = p->n_left;
279                 p->n_left = block(REGNILNILp->n_type0MKSUE(INT));
ragge
1.35
280                 p->n_left->n_rval = RETREG(p->n_type);
ragge
1.31
281                 break;
ragge
1.39
282
283         case LS:
284         case RS:
285                 /* shift count must be in a char
286                  * unless longlong, where it must be int */
287                 if (p->n_right->n_op == ICON)
288                         break/* do not do anything */
289                 if (p->n_type == LONGLONG || p->n_type == ULONGLONG) {
290                         if (p->n_right->n_type != INT)
291                                 p->n_right = block(SCONVp->n_rightNIL,
292                                     INT0MKSUE(INT));
293                         break;
294                 }
295                 if (p->n_right->n_type == CHAR || p->n_right->n_type == UCHAR)
296                         break;
297                 p->n_right = block(SCONVp->n_rightNIL,
298                     CHAR0MKSUE(CHAR));
299                 break;
ragge
1.1
300         }
ragge
1.24
301 //printf("ut:\n");
302 //fwalk(p, eprint, 0);
ragge
1.1
303
304         return(p);
305 }
306
307 void
308 myp2tree(NODE *p)
309 {
310 }
311
312 /*ARGSUSED*/
313 int
314 andable(NODE *p)
315 {
316         return(1);  /* all names can have & taken on them */
317 }
318
319 /*
320  * at the end of the arguments of a ftn, set the automatic offset
321  */
322 void
323 cendarg()
324 {
325         autooff = AUTOINIT;
326 }
327
328 /*
ragge
1.36
329  * Return 1 if a variable of type type is OK to put in register.
330  */
331 int
332 cisreg(TWORD t)
333 {
334         if (t == FLOAT || t == DOUBLE || t == LDOUBLE)
335                 return 0/* not yet */
336         return 1;
337 }
338
339 /*
ragge
1.1
340  * return a node, for structure references, which is suitable for
341  * being added to a pointer of type t, in order to be off bits offset
342  * into a structure
343  * t, d, and s are the type, dimension offset, and sizeoffset
344  * For pdp10, return the type-specific index number which calculation
345  * is based on its size. For example, short a[3] would return 3.
346  * Be careful about only handling first-level pointers, the following
347  * indirections must be fullword.
348  */
349 NODE *
350 offcon(OFFSZ offTWORD tunion dimfun *dstruct suedef *sue)
351 {
352         register NODE *p;
353
354         if (xdebug)
355                 printf("offcon: OFFSZ %lld type %x dim %p siz %d\n",
356                     offtdsue->suesize);
357
358         p = bcon(0);
359         p->n_lval = off/SZCHAR/* Default */
360         return(p);
361 }
362
363 /*
364  * Allocate off bits on the stack.  p is a tree that when evaluated
ragge
1.45
365  * is the multiply count for off, t is a storeable node where to write
ragge
1.1
366  * the allocated address.
367  */
368 void
369 spalloc(NODE *tNODE *pOFFSZ off)
370 {
371         NODE *sp;
372
ragge
1.45
373         p = buildtree(MULpbcon(off/SZCHAR)); /* XXX word alignment? */
374
375         /* sub the size from sp */
376         sp = block(REGNILNILp->n_type00);
377         sp->n_lval = 0;
378         sp->n_rval = STKREG;
379         ecomp(buildtree(MINUSEQspp));
ragge
1.1
380
381         /* save the address of sp */
382         sp = block(REGNILNILPTR+INTt->n_dft->n_sue);
383         sp->n_lval = 0;
384         sp->n_rval = STKREG;
385         t->n_type = sp->n_type;
386         ecomp(buildtree(ASSIGNtsp)); /* Emit! */
387
388 }
389
ragge
1.49
390 #if 0
ragge
1.48
391 /*
392  * Print out an integer constant of size size.
393  * can only be sizes <= SZINT.
394  */
ragge
1.47
395 void
396 indata(CONSZ valint size)
397 {
398         switch (size) {
399         case SZCHAR:
400                 printf("\t.byte %d\n", (int)val & 0xff);
401                 break;
402         case SZSHORT:
403                 printf("\t.word %d\n", (int)val & 0xffff);
404                 break;
405         case SZINT:
406                 printf("\t.long %d\n", (int)val & 0xffffffff);
407                 break;
408         default:
409                 cerror("indata");
410         }
411 }
ragge
1.49
412 #endif
ragge
1.47
413
ragge
1.1
414 /*
ragge
1.48
415  * Print out a string of characters.
416  * Assume that the assembler understands C-style escape
417  * sequences.  Location is already set.
418  */
419 void
420 instring(char *str)
421 {
422         char *s;
423
424         /* be kind to assemblers and avoid long strings */
425         printf("\t.ascii \"");
426         for (s = str; *s != 0s++) {
427                 if (*s == '\\')
428                         (void)esccon(&s);
429                 if (s - str > 64) {
430                         fwrite(str1s - strstdout);
431                         printf("\"\n\t.ascii \"");
432                         str = s;
433                 }
434         }
435         fwrite(str1s - strstdout);
436         printf("\\0\"\n");
437 }
438
ragge
1.49
439 static int inbitsinval;
440
441 /*
442  * set fsz bits in sequence to zero.
443  */
444 void
445 zbits(OFFSZ offint fsz)
446 {
447         int m;
448
449         if (idebug)
450                 printf("zbits off %lld, fsz %d\n"offfsz);
451         if ((m = (inbits % SZCHAR))) {
452                 m = SZCHAR - m;
453                 if (fsz < m) {
454                         inbits += m;
455                         return;
456                 } else {
457                         fsz -= m;
458                         printf("\t.byte %d\n"inval);
459                         inval = inbits = 0;
460                 }
461         }
462         if (fsz >= SZCHAR) {
463                 printf("\t.zero %d\n"fsz/SZCHAR);
464                 fsz -= (fsz/SZCHAR);
465         }
466         if (fsz) {
467                 inval = 0;
468                 inbits = fsz;
469         }
470 }
471
472 /*
473  * Initialize a bitfield.
474  */
475 void
476 infld(CONSZ offint fszCONSZ val)
477 {
478         if (idebug)
479                 printf("infld off %lld, fsz %d, val %lld\n"offfszval);
480         val &= (1 << fsz)-1;
481         while (fsz + inbits >= SZCHAR) {
482                 inval |= (val << inbits);
483                 printf("\t.byte %d\n"inval & 255);
484                 fsz -= (SZCHAR - inbits);
485                 val >>= (SZCHAR - inbits);
486                 inval = inbits = 0;
487         }
488         inval = val;
489         inbits = fsz;
490 }
491
ragge
1.48
492 /*
ragge
1.46
493  * print out a constant node, may be associated with a label.
494  * Do not free the node after use.
ragge
1.49
495  * off is bit offset from the beginning of the aggregate
496  * fsz is the number of bits this is referring to
ragge
1.21
497  */
498 void
ragge
1.49
499 ninval(CONSZ offint fszNODE *p)
ragge
1.21
500 {
ragge
1.46
501         union { float fdouble dlong double lint i[3]; } u;
ragge
1.24
502         struct symtab *q;
ragge
1.23
503         TWORD t;
ragge
1.46
504         int i;
ragge
1.23
505
506         t = p->n_type;
507         if (t > BTMASK)
508                 t = INT/* pointer */
509
ragge
1.46
510         if (p->n_op != ICON && p->n_op != FCON)
ragge
1.40
511                 cerror("ninval: init node not constant");
512
ragge
1.49
513         if (p->n_op == ICON && p->n_sp != NULL && DEUNSIGN(t) != INT)
ragge
1.46
514                 uerror("element not constant");
515
ragge
1.23
516         switch (t) {
ragge
1.21
517         case LONGLONG:
518         case ULONGLONG:
ragge
1.46
519                 i = (p->n_lval >> 32);
520                 p->n_lval &= 0xffffffff;
521                 p->n_op = INT;
ragge
1.49
522                 ninval(off32p);
ragge
1.46
523                 p->n_lval = i;
ragge
1.49
524                 ninval(off+3232p);
ragge
1.21
525                 break;
526         case INT:
527         case UNSIGNED:
528                 printf("\t.long 0x%x", (int)p->n_lval);
ragge
1.24
529                 if ((q = p->n_sp) != NULL) {
530                         if ((q->sclass == STATIC && q->slevel > 0) ||
531                             q->sclass == ILABEL) {
532                                 printf("+" LABFMTq->soffset);
ragge
1.21
533                         } else
ragge
1.24
534                                 printf("+%s"exname(q->sname));
ragge
1.21
535                 }
536                 printf("\n");
537                 break;
ragge
1.46
538         case SHORT:
539         case USHORT:
540                 printf("\t.short 0x%x\n", (int)p->n_lval & 0xffff);
541                 break;
542         case CHAR:
543         case UCHAR:
ragge
1.50
544                 printf("\t.byte %d\n", (int)p->n_lval & 0xff);
ragge
1.46
545                 break;
546         case LDOUBLE:
547                 u.i[2] = 0;
548                 u.l = (long double)p->n_dcon;
549                 printf("\t.long\t0x%x,0x%x,0x%x\n"u.i[0], u.i[1], u.i[2]);
550                 break;
551         case DOUBLE:
552                 u.d = (double)p->n_dcon;
553                 printf("\t.long\t0x%x,0x%x\n"u.i[0], u.i[1]);
554                 break;
555         case FLOAT:
556                 u.f = (float)p->n_dcon;
557                 printf("\t.long\t0x%x\n"u.i[0]);
558                 break;
ragge
1.21
559         default:
560                 cerror("ninval");
561         }
562 }
563
ragge
1.46
564 #if 0
ragge
1.21
565 /*
ragge
1.17
566  * print out an integer.
ragge
1.1
567  */
568 void
ragge
1.17
569 inval(CONSZ word)
ragge
1.1
570 {
ragge
1.17
571         word &= 0xffffffff;
572         printf("        .long 0x%llx\n"word);
ragge
1.1
573 }
574
ragge
1.17
575 /* output code to initialize a floating point value */
ragge
1.1
576 /* the proper alignment has been obtained */
577 void
ragge
1.17
578 finval(NODE *p)
ragge
1.1
579 {
ragge
1.43
580         union { float fdouble dlong double lint i[3]; } u;
581
ragge
1.17
582         switch (p->n_type) {
583         case LDOUBLE:
ragge
1.43
584                 u.i[2] = 0;
585                 u.l = (long double)p->n_dcon;
586                 printf("\t.long\t0x%x,0x%x,0x%x\n"u.i[0], u.i[1], u.i[2]);
ragge
1.14
587                 break;
ragge
1.17
588         case DOUBLE:
ragge
1.43
589                 u.d = (double)p->n_dcon;
590                 printf("\t.long\t0x%x,0x%x\n"u.i[0], u.i[1]);
ragge
1.14
591                 break;
ragge
1.17
592         case FLOAT:
ragge
1.43
593                 u.f = (float)p->n_dcon;
594                 printf("\t.long\t0x%x\n"u.i[0]);
ragge
1.14
595                 break;
596         }
ragge
1.1
597 }
ragge
1.46
598 #endif
ragge
1.1
599
600 /* make a name look like an external name in the local machine */
601 char *
602 exname(char *p)
603 {
604         if (p == NULL)
605                 return "";
606         return p;
607 }
608
609 /*
610  * map types which are not defined on the local machine
611  */
ragge
1.15
612 TWORD
ragge
1.1
613 ctype(TWORD type)
614 {
615         switch (BTYPE(type)) {
616         case LONG:
617                 MODTYPE(type,INT);
618                 break;
619
620         case ULONG:
621                 MODTYPE(type,UNSIGNED);
ragge
1.13
622
ragge
1.1
623         }
624         return (type);
625 }
626
627 /* curid is a variable which is defined but
628  * is not initialized (and not a function );
ragge
1.17
629  * This routine returns the storage class for an uninitialized declaration
ragge
1.1
630  */
631 int
632 noinit()
633 {
634         return(EXTERN);
635 }
636
pj
1.30
637 void
638 calldec(NODE *pNODE *q
639 {
640 }
641
642 void
643 extdec(struct symtab *q)
644 {
645 }
646
ragge
1.1
647 /* make a common declaration for id, if reasonable */
648 void
649 commdec(struct symtab *q)
650 {
651         int off;
652
653         off = tsize(q->stypeq->sdfq->ssue);
ragge
1.8
654         off = (off+(SZCHAR-1))/SZCHAR;
ragge
1.7
655 #ifdef GCC_COMPAT
656         printf("        .comm %s,0%o\n"gcc_findname(q), off);
657 #else
ragge
1.1
658         printf("        .comm %s,0%o\n"exname(q->sname), off);
ragge
1.7
659 #endif
ragge
1.1
660 }
661
662 /* make a local common declaration for id, if reasonable */
663 void
664 lcommdec(struct symtab *q)
665 {
666         int off;
667
668         off = tsize(q->stypeq->sdfq->ssue);
ragge
1.8
669         off = (off+(SZCHAR-1))/SZCHAR;
ragge
1.1
670         if (q->slevel == 0)
ragge
1.7
671 #ifdef GCC_COMPAT
672                 printf("        .lcomm %s,0%o\n"gcc_findname(q), off);
673 #else
ragge
1.1
674                 printf("        .lcomm %s,0%o\n"exname(q->sname), off);
ragge
1.7
675 #endif
ragge
1.1
676         else
677                 printf("        .lcomm " LABFMT ",0%o\n"q->soffsetoff);
678 }
ragge
1.22
679
680 /*
681  * print a (non-prog) label.
682  */
683 void
684 deflab1(int label)
685 {
686         printf(LABFMT ":\n"label);
687 }
688
ragge
1.28
689 static char *loctbl[] = { "text""data""section .rodata""section .rodata" };
ragge
1.27
690
ragge
1.23
691 void
692 setloc1(int locc)
693 {
694         if (locc == lastloc)
695                 return;
696         lastloc = locc;
ragge
1.27
697         printf("        .%s\n"loctbl[locc]);
ragge
1.23
698 }
ragge
1.48
699
ragge
1.49
700 #if 0
ragge
1.48
701 int
702 ftoint(NODE *pCONSZ **c)
703 {
704         static CONSZ cc[3];
705         union { float fdouble dlong double lint i[3]; } u;
706         int n;
707
708         switch (p->n_type) {
709         case LDOUBLE:
710                 u.i[2] = 0;
711                 u.l = (long double)p->n_dcon;
712                 n = SZLDOUBLE;
713                 break;
714         case DOUBLE:
715                 u.d = (double)p->n_dcon;
716                 n = SZDOUBLE;
717                 break;
718         case FLOAT:
719                 u.f = (float)p->n_dcon;
720                 n = SZFLOAT;
721                 break;
722         }
723         cc[0] = u.i[0];
724         cc[1] = u.i[1];
725         cc[2] = u.i[2];
726         *c = cc;
727         return n;
728 }
ragge
1.49
729 #endif
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-18 23:46 +0200