LEFT | RIGHT |
1 // Derived from Inferno utils/6c/peep.c | 1 // Derived from Inferno utils/6c/peep.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/peep.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 566 } |
567 for(r=uniqp(r0); r!=nil; r=uniqp(r)) { | 567 for(r=uniqp(r0); r!=nil; r=uniqp(r)) { |
568 if(debug['P'] && debug['v']) | 568 if(debug['P'] && debug['v']) |
569 print("\t? %P\n", r->prog); | 569 print("\t? %P\n", r->prog); |
570 if(uniqs(r) == nil) { | 570 if(uniqs(r) == nil) { |
571 if(debug['P'] && debug['v']) | 571 if(debug['P'] && debug['v']) |
572 print("\tno unique successor\n"); | 572 print("\tno unique successor\n"); |
573 break; | 573 break; |
574 } | 574 } |
575 p = r->prog; | 575 p = r->prog; |
| 576 if(p->as == AVARDEF) |
| 577 continue; |
576 proginfo(&info, p); | 578 proginfo(&info, p); |
577 if(p->as == AVARDEF) | |
578 info.flags = 0; | |
579 if(info.flags & Call) { | 579 if(info.flags & Call) { |
580 if(debug['P'] && debug['v']) | 580 if(debug['P'] && debug['v']) |
581 print("\tfound %P; return 0\n", p); | 581 print("\tfound %P; return 0\n", p); |
582 return 0; | 582 return 0; |
583 } | 583 } |
584 | 584 |
585 if(info.reguse | info.regset) { | 585 if(info.reguse | info.regset) { |
586 if(debug['P'] && debug['v']) | 586 if(debug['P'] && debug['v']) |
587 print("\tfound %P; return 0\n", p); | 587 print("\tfound %P; return 0\n", p); |
588 return 0; | 588 return 0; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 if(copyau(&p->to, v)) | 783 if(copyau(&p->to, v)) |
784 return 4; | 784 return 4; |
785 return 3; | 785 return 3; |
786 | 786 |
787 case ATEXT: | 787 case ATEXT: |
788 if(REGARG >= 0 && v->type == (uchar)REGARG) | 788 if(REGARG >= 0 && v->type == (uchar)REGARG) |
789 return 3; | 789 return 3; |
790 return 0; | 790 return 0; |
791 } | 791 } |
792 | 792 |
| 793 if(p->as == AVARDEF) |
| 794 return 0; |
793 proginfo(&info, p); | 795 proginfo(&info, p); |
794 if(p->as == AVARDEF) | |
795 info.flags = 0; | |
796 | 796 |
797 if((info.reguse|info.regset) & RtoB(v->type)) | 797 if((info.reguse|info.regset) & RtoB(v->type)) |
798 return 2; | 798 return 2; |
799 ················ | 799 ················ |
800 if(info.flags & LeftAddr) | 800 if(info.flags & LeftAddr) |
801 if(copyas(&p->from, v)) | 801 if(copyas(&p->from, v)) |
802 return 2; | 802 return 2; |
803 | 803 |
804 if((info.flags & (RightRead|RightWrite)) == (RightRead|RightWrite)) | 804 if((info.flags & (RightRead|RightWrite)) == (RightRead|RightWrite)) |
805 if(copyas(&p->to, v)) | 805 if(copyas(&p->to, v)) |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 a->type == D_INDIR + reg->type && | 976 a->type == D_INDIR + reg->type && |
977 a->index == D_NONE && | 977 a->index == D_NONE && |
978 0 <= a->offset && a->offset < 4096; | 978 0 <= a->offset && a->offset < 4096; |
979 } | 979 } |
980 | 980 |
981 int | 981 int |
982 stackaddr(Addr *a) | 982 stackaddr(Addr *a) |
983 { | 983 { |
984 return regtyp(a) && a->type == D_SP; | 984 return regtyp(a) && a->type == D_SP; |
985 } | 985 } |
LEFT | RIGHT |