LEFT | RIGHT |
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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 case ADUFFZERO: | 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. |
1161 if(v->type == D_REG) { | 1163 if(v->type == D_REG) { |
1162 if(v->reg == REGALLOC_R0) | 1164 if(v->reg == REGALLOC_R0) |
1163 return 1; | 1165 return 1; |
1164 if(v->reg == REGALLOC_R0+1) | 1166 if(v->reg == REGALLOC_R0+1) |
1165 return 2; | 1167 return 2; |
1166 } | 1168 } |
1167 return 0; | 1169 return 0; |
1168 case ADUFFCOPY: | 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. |
1169 if(v->type == D_REG) { | 1173 if(v->type == D_REG) { |
1170 if(v->reg == REGALLOC_R0) | 1174 if(v->reg == REGALLOC_R0) |
1171 return 3; | 1175 return 3; |
1172 if(v->reg == REGALLOC_R0+1 || v->reg == REGALLOC_R0+2) | 1176 if(v->reg == REGALLOC_R0+1 || v->reg == REGALLOC_R0+2) |
1173 return 2; | 1177 return 2; |
1174 } | 1178 } |
1175 return 0; | 1179 return 0; |
1176 ························ | 1180 ························ |
1177 case ATEXT: /* funny */ | 1181 case ATEXT: /* funny */ |
1178 if(v->type == D_REG) | 1182 if(v->type == D_REG) |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 return regtyp(a) && a->reg == REGSP; | 1614 return regtyp(a) && a->reg == REGSP; |
1611 } | 1615 } |
1612 | 1616 |
1613 int | 1617 int |
1614 smallindir(Addr *a, Addr *reg) | 1618 smallindir(Addr *a, Addr *reg) |
1615 { | 1619 { |
1616 return reg->type == D_REG && a->type == D_OREG && | 1620 return reg->type == D_REG && a->type == D_OREG && |
1617 a->reg == reg->reg && | 1621 a->reg == reg->reg && |
1618 0 <= a->offset && a->offset < 4096; | 1622 0 <= a->offset && a->offset < 4096; |
1619 } | 1623 } |
LEFT | RIGHT |