Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.11
 
1.12
 
MAIN:ragge:20110627115025
 
code.c
_>8686                 printf(LABFMT ":\n", sp->soffset);
 8787 }
 8888 
<> 89+static int strtemp;
8990 
<>90 -
9191 void
<>92 -efcode(){
  92+efcode()
  93+{
  94+        TWORD t;
  95+        NODE *p, *q;
  96+
9397         /* code for the end of a function */
 9498         if (cftnsp->stype != STRTY+FTN && cftnsp->stype != UNIONTY+FTN)
 9599                 return;
<>96 -        cerror("efcode");
97100 
<>98 -#ifdef notyet
 99 -        if( strftn ){  /* copy output (in R2) to caller */
 100 -                register NODE *l, *r;
 101 -                register struct symtab *p;
 102 -                register TWORD t;
 103 -                register int j;
 104 -                int i;
  101+        t = PTR+BTYPE(cftnsp->stype);
  102+        /* Create struct assignment */
  103+        q = tempnode(strtemp, t, 0, cftnsp->sap);
  104+        q = buildtree(UMUL, q, NIL);
  105+        p = block(REG, NIL, NIL, t, 0, cftnsp->sap);
  106+        regno(p) = R0;
  107+        p = buildtree(UMUL, p, NIL);
  108+        p = buildtree(ASSIGN, q, p);
  109+        ecomp(p);
105110 
<>106 -                p = &stab[curftn];
 107 -                t = p->stype;
 108 -                t = DECREF(t);
  111+        /* put hidden arg in r0 on return */
  112+        q = tempnode(strtemp, INT, 0, 0);
  113+        p = block(REG, NIL, NIL, INT, 0, 0);
  114+        regno(p) = R0;
  115+        ecomp(buildtree(ASSIGN, p, q));
  116+}
109117 
<>110 -                deflab( retlab );
 111 -
 112 -                i = getlab();   /* label for return area */
 113 -                printf("        .data\n" );
 114 -                printf("        .align  2\n" );
 115 -                deflab1(i);
 116 -                printf("\t.space  %d\n", tsize(t, p->dimoff, p->sizoff)/SZCHAR);
 117 -                printf("        .text\n" );
 118 -                psline();
 119 -                printf("        movab   " LABFMT ",r1\n", i);
 120 -
 121 -                reached = 1;
 122 -                l = block( REG, NIL, NIL, PTR|t, p->dimoff, p->sizoff );
 123 -                l->rval = 1/* R1 */
 124 -                l->lval = 0/* no offset */
 125 -                r = block( REG, NIL, NIL, PTR|t, p->dimoff, p->sizoff );
 126 -                r->rval = 0/* R0 */
 127 -                r->lval = 0;
 128 -                l = buildtree( UNARY MUL, l, NIL );
 129 -                r = buildtree( UNARY MUL, r, NIL );
 130 -                l = buildtree( ASSIGN, l, r );
 131 -                l->op = FREE;
 132 -                ecomp( l->left );
 133 -                printf( "       movab   " LABFMT ",r0\n", i );
 134 -                /* turn off strftn flag, so return sequence will be generated */
 135 -                strftn = 0;
 136 -                }
 137 -        branch( retlab );
 138 -        printf( "       .set    .R%d,0x%x\n", ftnno, ent_mask[reg_use] );
 139 -        reg_use = 11;
 140 -        p2bend();
 141 -        fdefflag = 0;
 142 -#endif
 143 -        }
 144 -
145118 void
<>146 -bfcode(struct symtab **a, int n)
  119+bfcode(struct symtab **sp, int n)
147120 {
<> 121+        struct symtab *sp2;
  122+        NODE *p, *q;
148123         int i;
 149124 
<>150 -        if (cftnsp->stype != STRTY+FTN && cftnsp->stype != UNIONTY+FTN)
  125+        if (cftnsp->stype == STRTY+FTN || cftnsp->stype == UNIONTY+FTN) {
  126+                /* Move return address into temporary */
  127+                p = tempnode(0, INT, 0, 0);
  128+                strtemp = regno(p);
  129+                q = block(REG, 0, 0, INT, 0, 0);
  130+                regno(q) = R1;
  131+                ecomp(buildtree(ASSIGN, p, q));
  132+        }
  133+        if (xtemps == 0)
151134                 return;
<>152 -        /* Function returns struct, adjust arg offset */
 153 -        for (i = 0; i < n; i++)
 154 -                a[i]->soffset += SZPOINT(INT);
  135+
  136+        /* put arguments in temporaries */
  137+        for (i = 0; i < n; i++) {
  138+                if (sp[i]->stype == STRTY || sp[i]->stype == UNIONTY ||
  139+                    cisreg(sp[i]->stype) == 0)
  140+                        continue;
  141+                if (cqual(sp[i]->stype, sp[i]->squal) & VOL)
  142+                        continue;
  143+                sp2 = sp[i];
  144+                p = tempnode(0, sp[i]->stype, sp[i]->sdf, sp[i]->sap);
  145+                p = buildtree(ASSIGN, p, nametree(sp2));
  146+                sp[i]->soffset = regno(p->n_left);
  147+                sp[i]->sflags |= STNODE;
  148+                ecomp(p);
  149+        }
  150+
155151 }
 156152 
 157153 void
     
 !
180176 #endif
 181177 
 182178 void
<>183 -defnam( p ) register struct symtab *p; {
 184 -        /* define the current location as the name p->sname */
 185 -        char *n;
 186 -
 187 -        n = p->soname ? p->soname : exname(p->sname);
 188 -        if( p->sclass == EXTDEF ){
 189 -                printf( "       .globl  %s\n", n );
 190 -                }
 191 -        printf( "%s:\n", n );
 192 -
 193 -        }
 194 -
 195 -void
 196 -bycode( t, i ){
 197 -        /* put byte i+1 in a string */
 198 -
 199 -        i &= 07;
 200 -        if( t < 0 ){ /* end of the string */
 201 -                if( i != 0 ) printf( "\n" );
 202 -                }
 203 -
 204 -        else { /* stash byte t into string */
 205 -                if( i == 0 ) printf( "  .byte   " );
 206 -                else printf( "," );
 207 -                printf( "0x%x", t );
 208 -                if( i == 07 ) printf( "\n" );
 209 -                }
 210 -        }
 211 -
 212 -void
213179 fldty( p ) struct symtab *p; { /* fix up type of field p */
 214180         ;
 215181         }
     
 !
343309 NODE *
 344310 funcode(NODE *p)
 345311 {
<> 312+        NODE *r, *l;
  313+
  314+        /* Fix function call arguments. On vax, just add funarg */
  315+        for (r = p->n_right; r->n_op == CM; r = r->n_left) {
  316+                if (r->n_right->n_op != STARG)
  317+                        r->n_right = block(FUNARG, r->n_right, NIL,
  318+                            r->n_right->n_type, r->n_right->n_df,
  319+                            r->n_right->n_ap);
  320+        }
  321+        if (r->n_op != STARG) {
  322+                l = talloc();
  323+                *l = *r;
  324+                r->n_op = FUNARG; r->n_left = l; r->n_type = l->n_type;
  325+        }
<_346326         return p;
 347327 }
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-10-31 14:38 +0100