OLD | NEW |
1 // Inferno utils/5c/peep.c | 1 // Inferno utils/5c/peep.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/peep.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/peep.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 return 2; | 1150 return 2; |
1151 | 1151 |
1152 if(s != nil) { | 1152 if(s != nil) { |
1153 if(copysub(&p->to, v, s, 1)) | 1153 if(copysub(&p->to, v, s, 1)) |
1154 return 1; | 1154 return 1; |
1155 return 0; | 1155 return 0; |
1156 } | 1156 } |
1157 if(copyau(&p->to, v)) | 1157 if(copyau(&p->to, v)) |
1158 return 4; | 1158 return 4; |
1159 return 3; | 1159 return 3; |
1160 | 1160 » case ADUFFZERO: |
| 1161 » » // R0 is zero, used by DUFFZERO, cannot be substituted. |
| 1162 » » // R1 is ptr to memory, used and set, cannot be substituted. |
| 1163 » » if(v->type == D_REG) { |
| 1164 » » » if(v->reg == REGALLOC_R0) |
| 1165 » » » » return 1; |
| 1166 » » » if(v->reg == REGALLOC_R0+1) |
| 1167 » » » » return 2; |
| 1168 » » } |
| 1169 » » return 0; |
| 1170 » case ADUFFCOPY: |
| 1171 » » // R0 is scratch, set by DUFFCOPY, cannot be substituted. |
| 1172 » » // R1, R2 areptr to src, dst, used and set, cannot be substitute
d. |
| 1173 » » if(v->type == D_REG) { |
| 1174 » » » if(v->reg == REGALLOC_R0) |
| 1175 » » » » return 3; |
| 1176 » » » if(v->reg == REGALLOC_R0+1 || v->reg == REGALLOC_R0+2) |
| 1177 » » » » return 2; |
| 1178 » » } |
| 1179 » » return 0; |
| 1180 » » »······· |
1161 case ATEXT: /* funny */ | 1181 case ATEXT: /* funny */ |
1162 if(v->type == D_REG) | 1182 if(v->type == D_REG) |
1163 if(v->reg == REGARG) | 1183 if(v->reg == REGARG) |
1164 return 3; | 1184 return 3; |
1165 return 0; | 1185 return 0; |
1166 | 1186 |
1167 case APCDATA: | 1187 case APCDATA: |
1168 case AFUNCDATA: | 1188 case AFUNCDATA: |
1169 case AVARDEF: | 1189 case AVARDEF: |
1170 case AVARKILL: | 1190 case AVARKILL: |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 return regtyp(a) && a->reg == REGSP; | 1614 return regtyp(a) && a->reg == REGSP; |
1595 } | 1615 } |
1596 | 1616 |
1597 int | 1617 int |
1598 smallindir(Addr *a, Addr *reg) | 1618 smallindir(Addr *a, Addr *reg) |
1599 { | 1619 { |
1600 return reg->type == D_REG && a->type == D_OREG && | 1620 return reg->type == D_REG && a->type == D_OREG && |
1601 a->reg == reg->reg && | 1621 a->reg == reg->reg && |
1602 0 <= a->offset && a->offset < 4096; | 1622 0 <= a->offset && a->offset < 4096; |
1603 } | 1623 } |
OLD | NEW |