Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.c @ 196:5f70abd9453d
*** empty log message ***
author | kono |
---|---|
date | Wed, 07 Apr 2004 21:14:19 +0900 |
parents | c193120ee2a6 |
children | 601301152d9c |
comparison
equal
deleted
inserted
replaced
195:c193120ee2a6 | 196:5f70abd9453d |
---|---|
1556 printf("\tmtctr %s\n",register_name(e2)); | 1556 printf("\tmtctr %s\n",register_name(e2)); |
1557 printf("\tbctr\n"); | 1557 printf("\tbctr\n"); |
1558 } | 1558 } |
1559 | 1559 |
1560 int | 1560 int |
1561 rindirect(int e1) /* *(p +5 ) */ | 1561 code_rindirect(int e1, int offset, int us) |
1562 { | 1562 { |
1563 char *crn; | 1563 char *crn; |
1564 int e2,e3,e4,offset; | 1564 g_expr(e1); |
1565 | |
1566 offset=0; | |
1567 e3 = cadr(e2 = cadr(e1)); | |
1568 if (car(e2)==ADD) { | |
1569 e4=caddr(e2); | |
1570 if (car(e4)==CONST) { | |
1571 offset=cadr(e4); | |
1572 e2=e3; | |
1573 } | |
1574 } | |
1575 g_expr(e2); | |
1576 crn=register_name(creg); | 1565 crn=register_name(creg); |
1577 switch (car(e1)) { | 1566 printf("\tlwz %s,%d(%s)\n",crn,offset,crn); |
1578 #if FLOAT_CODE | 1567 return INT; |
1579 case FRINDIRECT: case DRINDIRECT: | 1568 } |
1580 printf("\t%s %s,%d(%s)\n",fload(car(e1)==DRINDIRECT), | 1569 |
1581 fregister_name(freg),offset,crn); | 1570 int |
1582 regv[creg]=0; regv[freg]=1; | 1571 code_crindirect(int e1, int offset, int us) |
1583 creg = freg; | 1572 { |
1584 return DOUBLE; | 1573 char *crn; |
1585 #endif | 1574 g_expr(e1); |
1586 case CRINDIRECT: | 1575 crn=register_name(creg); |
1576 if (us) { | |
1577 printf("\tlbz %s,%d(%s)\n",crn,offset,crn); | |
1578 return UCHAR; | |
1579 } else { | |
1587 printf("\tlbz %s,%d(%s)\n",crn,offset,crn); | 1580 printf("\tlbz %s,%d(%s)\n",crn,offset,crn); |
1588 printf("\textsb %s,%s\n",crn,crn); | 1581 printf("\textsb %s,%s\n",crn,crn); |
1589 return CHAR; | 1582 return CHAR; |
1590 case CURINDIRECT: | 1583 } |
1591 printf("\tlbz %s,%d(%s)\n",crn,offset,crn); | 1584 } |
1592 return UCHAR; | 1585 |
1593 case SRINDIRECT: | 1586 int |
1587 code_srindirect(int e1, int offset, int us) | |
1588 { | |
1589 char *crn; | |
1590 g_expr(e1); | |
1591 crn=register_name(creg); | |
1592 if (us) { | |
1593 printf("\tlhz %s,%d(%s)\n",crn,offset,crn); | |
1594 return USHORT; | |
1595 } else { | |
1594 printf("\tlhz %s,%d(%s)\n",crn,offset,crn); | 1596 printf("\tlhz %s,%d(%s)\n",crn,offset,crn); |
1595 printf("\textsh %s,%s\n",crn,crn); | 1597 printf("\textsh %s,%s\n",crn,crn); |
1596 return SHORT; | 1598 return SHORT; |
1597 case SURINDIRECT: | 1599 } |
1598 printf("\tlhz %s,%d(%s)\n",crn,offset,crn); | 1600 } |
1599 return USHORT; | 1601 |
1600 case RINDIRECT: | 1602 #if FLOAT_CODE |
1601 printf("\tlwz %s,%d(%s)\n",crn,offset,crn); | 1603 int |
1602 return INT; | 1604 code_drindirect(int e1, int offset, int d) |
1603 } | 1605 { |
1604 error(-1); return INT; | 1606 char *crn; |
1605 } | 1607 g_expr(e1); |
1608 crn=register_name(creg); | |
1609 printf("\t%s %s,%d(%s)\n",fload(d), | |
1610 fregister_name(freg),offset,crn); | |
1611 regv[creg]=0; regv[freg]=1; | |
1612 creg = freg; | |
1613 return DOUBLE; | |
1614 } | |
1615 #endif | |
1616 | |
1617 #if LONGLONG_CODE | |
1618 int | |
1619 code_lrindirect(int e1, int offset, int us) | |
1620 { | |
1621 char *crn; | |
1622 g_expr(e1); | |
1623 crn=register_name(creg); | |
1624 return LONGLONG; | |
1625 } | |
1626 #endif | |
1627 | |
1606 | 1628 |
1607 void | 1629 void |
1608 code_assign_gvar(int e2,int creg,int byte) { | 1630 code_assign_gvar(int e2,int creg,int byte) { |
1609 int r; | 1631 int r; |
1610 char *crn,*rrn; | 1632 char *crn,*rrn; |