Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.226
 
1.227
 
MAIN:ragge:20080624193556
 
reader.c
_>12541254         struct interpass *ip2;
 12551255         TWORD t = p->n_left->n_type;
 12561256         NODE *q, *r;
<>1257 -        char *w;
 1258 -        int asg = 0;
  1257+        int cw;
12591258 
 12601259         if (myxasm(ip, p))
 12611260                 return/* handled by target-specific code */
 12621261 
<>1263 -        w = p->n_name;
 1264 -        if (*w == '=')
 1265 -                w++, asg++;
 1266 -        switch (*w) {
  1262+        cw = xasmcode(p->n_name);
  1263+        switch (XASMVAL(cw)) {
12671264         case 'r': /* general reg */
 12681265                 /* set register class */
 12691266                 p->n_label = gclass(p->n_left->n_type);
 12701267                 if (p->n_left->n_op == REG || p->n_left->n_op == TEMP)
 12711268                         break;
<>1272 -                q = mklnode(TEMP, 0, epp->ip_tmpnum++, t);
 1273 -                r = tcopy(q);
 1274 -                if (asg) {
 1275 -                        ip2 = ipnode(mkbinode(ASSIGN, p->n_left, q, t));
 1276 -                        DLIST_INSERT_AFTER(ip, ip2, qelem);
 1277 -                } else {
 1278 -                        ip2 = ipnode(mkbinode(ASSIGN, q, p->n_left, t));
  1269+                q = p->n_left;
  1270+                r = (cw & XASMINOUT ? tcopy(q) : q);
  1271+                p->n_left = mklnode(TEMP, 0, epp->ip_tmpnum++, t);
  1272+                if ((cw & XASMASG) == 0) {
  1273+                        ip2 = ipnode(mkbinode(ASSIGN, tcopy(p->n_left), r, t));
12791274                         DLIST_INSERT_BEFORE(ip, ip2, qelem);
 12801275                 }
<>1281 -                p->n_left = r;
  1276+                if (cw & (XASMASG|XASMINOUT)) {
  1277+                        /* output parameter */
  1278+                        ip2 = ipnode(mkbinode(ASSIGN, q, tcopy(p->n_left), t));
  1279+                        DLIST_INSERT_AFTER(ip, ip2, qelem);
  1280+                }
12821281                 break;
 12831282 
 12841283         case '0': case '1': case '2': case '3': case '4':
 12851284         case '5': case '6': case '7': case '8': case '9':
 12861285                 break;
 12871286 
<> 1287+        case 'n': /* numeric constant */
  1288+                if (p->n_left->n_op != ICON)
  1289+                        uerror("constant required");
  1290+                break;
  1291+
12881292         default:
 12891293                 uerror("unsupported xasm option string '%s'", p->n_name);
 12901294         }
     
 !
13151319                 flist(p, ccheck, 0);
 13161320         }
 13171321 }
<_ 1322+
  1323+/*
  1324+ * Extract codeword from xasm string */
  1325+int
  1326+xasmcode(char *s)
  1327+{
  1328+        int cw = 0;
  1329+
  1330+        while (*s) {
  1331+                switch ((int)*s) {
  1332+                case '=': cw |= XASMASG; break;
  1333+                case '&': cw |= XASMCONSTR; break;
  1334+                case '+': cw |= XASMINOUT; break;
  1335+                default:
  1336+                        if ((*s >= 'a' && *s <= 'z') ||
  1337+                            (*s >= 'A' && *s <= 'Z') ||
  1338+                            (*s >= '0' && *s <= '9')) {
  1339+                                cw |= *s;
  1340+                                break;
  1341+                        }
  1342+                        uerror("bad xasm constraint %c", *s);
  1343+                }
  1344+                s++;
  1345+        }
  1346+        return cw;
  1347+}
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-22 05:57 +0100