Changeset 792
- Timestamp:
- 12/08/10 01:08:41 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/backend/el.h (modified) (1 diff)
- branches/dmd-1.x/src/backend/gloop.c (modified) (1 diff)
- branches/dmd-1.x/src/backend/gother.c (modified) (1 diff)
- trunk/src/backend/el.h (modified) (1 diff)
- trunk/src/backend/gloop.c (modified) (1 diff)
- trunk/src/backend/gother.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/backend/el.h
r728 r792 80 80 tym_t Ety_; // data type (TYxxxx) 81 81 #define Ety _EU._EO.Ety_ 82 82 unsigned Eexp_; // index into expnod[] 83 83 #define Eexp _EU._EO.Eexp_ 84 84 85 85 // These flags are all temporary markers, used once and then 86 86 // thrown away. 87 87 unsigned char Nflags_; // NFLxxx 88 88 #define Nflags _EU._EO.Nflags_ 89 89 #define NFLli 1 // loop invariant 90 90 #define NFLnogoal 2 // evaluate elem for side effects only 91 91 #define NFLassign 8 // unambiguous assignment elem 92 92 #define NFLaecp 0x10 // AE or CP or VBE expression 93 93 #define NFLdelcse 0x40 // this is not the generating CSE 94 94 #if !TX86 95 95 #define NFLfcall 0x20 // flag that there has been a function call on RHS 96 96 // of an assignment of this LHS value hence do not 97 97 // propagate this assignment into a paramter list 98 98 // (see glocal.c) 99 99 #endif 100 #define NFLtouns 0x80 // relational operator was changed from signed to unsigned 100 101 #if MARS 101 102 unsigned char Ejty_; // original Jupiter/Mars type 102 103 #define Ejty _EU._EO.Ejty_ 103 104 #endif 104 105 }_EO; 105 106 106 107 // CODGEN 107 108 struct 108 109 { 109 110 // Ety2: Must be in same position as Ety! 110 111 tym_t Ety2_; // data type (TYxxxx) 111 112 #define Ety2 _EU._EC.Ety2_ 112 113 unsigned char Ecomsub_; // number of remaining references to 113 114 // this common subexp (used to determine 114 115 // first, intermediate, and last references 115 116 // to a CSE) 116 117 #define Ecomsub _EU._EC.Ecomsub_ 117 118 118 119 #if TARGET_POWERPC 119 120 unsigned char Gflags; branches/dmd-1.x/src/backend/gloop.c
r768 r792 3166 3166 c1 & ~0x7FFFL) 3167 3167 ) 3168 3168 continue; 3169 3169 3170 3170 if (sz == LONGSIZE && 3171 3171 ((ref->E2->Eoper == OPconst && 3172 3172 c1 * el_tolong(ref->E2) & ~0x7FFFFFFFL) || 3173 3173 c1 & ~0x7FFFFFFFL) 3174 3174 ) 3175 3175 continue; 3176 3176 #if LONGLONG && __INTSIZE >= 4 3177 3177 if (sz == LLONGSIZE && 3178 3178 ((ref->E2->Eoper == OPconst && 3179 3179 c1 * el_tolong(ref->E2) & ~0x7FFFFFFFFFFFFFFFLL) || 3180 3180 c1 & ~0x7FFFFFFFFFFFFFFFLL) 3181 3181 ) 3182 3182 continue; 3183 3183 #endif 3184 3184 } 3185 3185 3186 /* If loop started out with a signed conditional that was 3187 * replaced with an unsigned one, don't do it if c2 3188 * is less than 0. 3189 */ 3190 if (ref->Nflags & NFLtouns && fl->c2->Eoper == OPconst) 3191 { 3192 targ_llong c2 = el_tolong(fl->c2); 3193 if (c2 < 0) 3194 continue; 3195 } 3196 3186 3197 elem *refE2 = el_copytree(ref->E2); 3187 3198 int refEoper = ref->Eoper; 3188 3199 3189 3200 /* if c1 < 0 and relop is < <= > >= 3190 3201 then adjust relop as if both sides were multiplied 3191 3202 by -1 3192 3203 */ 3193 3204 if (!tyuns(ty) && 3194 3205 (tyintegral(ty) && el_tolong(fl->c1) < 0 || 3195 3206 #if TARGET_68K && __POWERPC 3196 3207 tyfloating(ty) && Xlt(el_toldouble(fl->c1),Xzero()) )) 3197 3208 #else 3198 3209 tyfloating(ty) && el_toldouble(fl->c1) < 0.0)) 3199 3210 #endif 3200 3211 refEoper = swaprel(refEoper); 3201 3212 3202 3213 /* Replace (X relop e) with (X relop (short)e) 3203 3214 if T is 1 word but e is 2 3204 3215 */ 3205 3216 if (tysize(flty) == SHORTSIZE && branches/dmd-1.x/src/backend/gother.c
r609 r792 788 788 // initial,increment,final); 789 789 790 790 /* Determine if we can make the relational an unsigned */ 791 791 if (initial >= 0) 792 792 { if (final >= initial) 793 793 { if (increment > 0 && ((final - initial) % increment) == 0) 794 794 goto makeuns; 795 795 } 796 796 else if (final >= 0) 797 797 { /* 0 <= final < initial */ 798 798 if (increment < 0 && ((final - initial) % increment) == 0 && 799 799 !(final + increment < 0 && 800 800 (relatop == OPge || relatop == OPlt) 801 801 ) 802 802 ) 803 803 { 804 804 makeuns: 805 805 if (!tyuns(rel->pelem->E2->Ety)) 806 806 { 807 807 rel->pelem->E2->Ety = touns(rel->pelem->E2->Ety); 808 rel->pelem->Nflags |= NFLtouns; 808 809 #ifdef DEBUG 809 810 if (debugc) 810 811 { WReqn(rel->pelem); 811 812 dbg_printf(" made unsigned, initial = %ld, increment = %ld,\ 812 813 final = %ld\n",initial,increment,final); 813 814 } 814 815 #endif 815 816 changes++; 816 817 } 817 818 #if 0 818 819 // Eliminate loop if it is empty 819 820 if (relatop == OPlt && 820 821 rb->BC == BCiftrue && 821 822 list_block(rb->Bsucc) == rb && 822 823 rb->Belem->Eoper == OPcomma && 823 824 rb->Belem->E1 == rdinc && 824 825 rb->Belem->E2 == rel->pelem 825 826 ) 826 827 { 827 828 rel->pelem->Eoper = OPeq; trunk/src/backend/el.h
r728 r792 80 80 tym_t Ety_; // data type (TYxxxx) 81 81 #define Ety _EU._EO.Ety_ 82 82 unsigned Eexp_; // index into expnod[] 83 83 #define Eexp _EU._EO.Eexp_ 84 84 85 85 // These flags are all temporary markers, used once and then 86 86 // thrown away. 87 87 unsigned char Nflags_; // NFLxxx 88 88 #define Nflags _EU._EO.Nflags_ 89 89 #define NFLli 1 // loop invariant 90 90 #define NFLnogoal 2 // evaluate elem for side effects only 91 91 #define NFLassign 8 // unambiguous assignment elem 92 92 #define NFLaecp 0x10 // AE or CP or VBE expression 93 93 #define NFLdelcse 0x40 // this is not the generating CSE 94 94 #if !TX86 95 95 #define NFLfcall 0x20 // flag that there has been a function call on RHS 96 96 // of an assignment of this LHS value hence do not 97 97 // propagate this assignment into a paramter list 98 98 // (see glocal.c) 99 99 #endif 100 #define NFLtouns 0x80 // relational operator was changed from signed to unsigned 100 101 #if MARS 101 102 unsigned char Ejty_; // original Jupiter/Mars type 102 103 #define Ejty _EU._EO.Ejty_ 103 104 #endif 104 105 }_EO; 105 106 106 107 // CODGEN 107 108 struct 108 109 { 109 110 // Ety2: Must be in same position as Ety! 110 111 tym_t Ety2_; // data type (TYxxxx) 111 112 #define Ety2 _EU._EC.Ety2_ 112 113 unsigned char Ecomsub_; // number of remaining references to 113 114 // this common subexp (used to determine 114 115 // first, intermediate, and last references 115 116 // to a CSE) 116 117 #define Ecomsub _EU._EC.Ecomsub_ 117 118 118 119 #if TARGET_POWERPC 119 120 unsigned char Gflags; trunk/src/backend/gloop.c
r768 r792 3166 3166 c1 & ~0x7FFFL) 3167 3167 ) 3168 3168 continue; 3169 3169 3170 3170 if (sz == LONGSIZE && 3171 3171 ((ref->E2->Eoper == OPconst && 3172 3172 c1 * el_tolong(ref->E2) & ~0x7FFFFFFFL) || 3173 3173 c1 & ~0x7FFFFFFFL) 3174 3174 ) 3175 3175 continue; 3176 3176 #if LONGLONG && __INTSIZE >= 4 3177 3177 if (sz == LLONGSIZE && 3178 3178 ((ref->E2->Eoper == OPconst && 3179 3179 c1 * el_tolong(ref->E2) & ~0x7FFFFFFFFFFFFFFFLL) || 3180 3180 c1 & ~0x7FFFFFFFFFFFFFFFLL) 3181 3181 ) 3182 3182 continue; 3183 3183 #endif 3184 3184 } 3185 3185 3186 /* If loop started out with a signed conditional that was 3187 * replaced with an unsigned one, don't do it if c2 3188 * is less than 0. 3189 */ 3190 if (ref->Nflags & NFLtouns && fl->c2->Eoper == OPconst) 3191 { 3192 targ_llong c2 = el_tolong(fl->c2); 3193 if (c2 < 0) 3194 continue; 3195 } 3196 3186 3197 elem *refE2 = el_copytree(ref->E2); 3187 3198 int refEoper = ref->Eoper; 3188 3199 3189 3200 /* if c1 < 0 and relop is < <= > >= 3190 3201 then adjust relop as if both sides were multiplied 3191 3202 by -1 3192 3203 */ 3193 3204 if (!tyuns(ty) && 3194 3205 (tyintegral(ty) && el_tolong(fl->c1) < 0 || 3195 3206 #if TARGET_68K && __POWERPC 3196 3207 tyfloating(ty) && Xlt(el_toldouble(fl->c1),Xzero()) )) 3197 3208 #else 3198 3209 tyfloating(ty) && el_toldouble(fl->c1) < 0.0)) 3199 3210 #endif 3200 3211 refEoper = swaprel(refEoper); 3201 3212 3202 3213 /* Replace (X relop e) with (X relop (short)e) 3203 3214 if T is 1 word but e is 2 3204 3215 */ 3205 3216 if (tysize(flty) == SHORTSIZE && trunk/src/backend/gother.c
r609 r792 788 788 // initial,increment,final); 789 789 790 790 /* Determine if we can make the relational an unsigned */ 791 791 if (initial >= 0) 792 792 { if (final >= initial) 793 793 { if (increment > 0 && ((final - initial) % increment) == 0) 794 794 goto makeuns; 795 795 } 796 796 else if (final >= 0) 797 797 { /* 0 <= final < initial */ 798 798 if (increment < 0 && ((final - initial) % increment) == 0 && 799 799 !(final + increment < 0 && 800 800 (relatop == OPge || relatop == OPlt) 801 801 ) 802 802 ) 803 803 { 804 804 makeuns: 805 805 if (!tyuns(rel->pelem->E2->Ety)) 806 806 { 807 807 rel->pelem->E2->Ety = touns(rel->pelem->E2->Ety); 808 rel->pelem->Nflags |= NFLtouns; 808 809 #ifdef DEBUG 809 810 if (debugc) 810 811 { WReqn(rel->pelem); 811 812 dbg_printf(" made unsigned, initial = %ld, increment = %ld,\ 812 813 final = %ld\n",initial,increment,final); 813 814 } 814 815 #endif 815 816 changes++; 816 817 } 817 818 #if 0 818 819 // Eliminate loop if it is empty 819 820 if (relatop == OPlt && 820 821 rb->BC == BCiftrue && 821 822 list_block(rb->Bsucc) == rb && 822 823 rb->Belem->Eoper == OPcomma && 823 824 rb->Belem->E1 == rdinc && 824 825 rb->Belem->E2 == rel->pelem 825 826 ) 826 827 { 827 828 rel->pelem->Eoper = OPeq;
