GCC with patches for OS216
Revision | 495bf6087a2fe026ed0155b32a43407d7b3f7900 (tree) |
---|---|
Zeit | 1998-04-20 10:22:13 |
Autor | Richard Henderson <rth@cygn...> |
Commiter | Jeff Law |
reload1.c (eliminate_regs): Delete LOAD_EXTENDED_OP code that boiled down to && ! 0.
Various alpha fixes from the mainline sources.
Co-Authored-By: J"orn Rennecke <amylaar@cygnus.co.uk>
Co-Authored-By: Jim Wilson <wilson@cygnus.com>
From-SVN: r19336
@@ -1,3 +1,29 @@ | ||
1 | +Mon Apr 20 02:17:37 1998 Richard Henderson <rth@cygnus.com> | |
2 | + Jim Wilson <wilson@cygnus.com> | |
3 | + J"orn Rennecke <amylaar@cygnus.co.uk> | |
4 | + | |
5 | + * reload1.c (eliminate_regs): Delete LOAD_EXTENDED_OP code that | |
6 | + boiled down to && ! 0. | |
7 | + | |
8 | + * reload.c (find_reloads): Always force (subreg (mem)) to be | |
9 | + reloaded if WORD_REGISTER_OPERATIONS. | |
10 | + | |
11 | + * reload.c (find_reloads_toplev): Handle arbitrary non-paradoxical | |
12 | + SUBREGs of CONST_INTs. | |
13 | + | |
14 | + * reload.c (push_reload): If WORD_REGISTER_OPERATIONS, reload the | |
15 | + SUBREG_REG if the word count is unchanged, also in the input reload | |
16 | + case. Disable non-applicable sanity checks. | |
17 | + | |
18 | + * reload.c (push_reload): In WORD_REGISTER_OPERATIONS code, add test | |
19 | + to require the SUBREG mode to be smaller than the SUBREG_REG mode. | |
20 | + * reload1.c (eliminate_regs): Likewise. | |
21 | + | |
22 | + * reload.c (push_reload): If WORD_REGISTER_OPERATIONS, reload the | |
23 | + SUBREG_REG if the word count is unchanged. | |
24 | + * reload1.c (eliminate_regs) [case SET]: If W_R_O, preserve | |
25 | + subregs of identical word size for push_reload. | |
26 | + | |
1 | 27 | Mon Apr 20 00:58:48 1998 H.J. Lu (hjl@gnu.org) |
2 | 28 | |
3 | 29 | * reg-stack.c (subst_asm_stack_regs): Change to return the last |
@@ -890,6 +890,13 @@ push_reload (in, out, inloc, outloc, class, | ||
890 | 890 | && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (in))) |
891 | 891 | && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (in))) != NIL) |
892 | 892 | #endif |
893 | +#ifdef WORD_REGISTER_OPERATIONS | |
894 | + || ((GET_MODE_SIZE (inmode) | |
895 | + < GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))) | |
896 | + && ((GET_MODE_SIZE (inmode) - 1) / UNITS_PER_WORD == | |
897 | + ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))) - 1) | |
898 | + / UNITS_PER_WORD))) | |
899 | +#endif | |
893 | 900 | )) |
894 | 901 | || (GET_CODE (SUBREG_REG (in)) == REG |
895 | 902 | && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER |
@@ -927,7 +934,7 @@ push_reload (in, out, inloc, outloc, class, | ||
927 | 934 | in_subreg_loc = inloc; |
928 | 935 | inloc = &SUBREG_REG (in); |
929 | 936 | in = *inloc; |
930 | -#ifndef LOAD_EXTEND_OP | |
937 | +#if ! defined (LOAD_EXTEND_OP) && ! defined (WORD_REGISTER_OPERATIONS) | |
931 | 938 | if (GET_CODE (in) == MEM) |
932 | 939 | /* This is supposed to happen only for paradoxical subregs made by |
933 | 940 | combine.c. (SUBREG (MEM)) isn't supposed to occur other ways. */ |
@@ -989,7 +996,15 @@ push_reload (in, out, inloc, outloc, class, | ||
989 | 996 | && REGNO (SUBREG_REG (out)) >= FIRST_PSEUDO_REGISTER) |
990 | 997 | || GET_CODE (SUBREG_REG (out)) == MEM) |
991 | 998 | && ((GET_MODE_SIZE (outmode) |
992 | - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))))) | |
999 | + > GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))) | |
1000 | +#ifdef WORD_REGISTER_OPERATIONS | |
1001 | + || ((GET_MODE_SIZE (outmode) | |
1002 | + < GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))) | |
1003 | + && ((GET_MODE_SIZE (outmode) - 1) / UNITS_PER_WORD == | |
1004 | + ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (out))) - 1) | |
1005 | + / UNITS_PER_WORD))) | |
1006 | +#endif | |
1007 | + )) | |
993 | 1008 | || (GET_CODE (SUBREG_REG (out)) == REG |
994 | 1009 | && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER |
995 | 1010 | && ((GET_MODE_SIZE (outmode) <= UNITS_PER_WORD |
@@ -1023,7 +1038,7 @@ push_reload (in, out, inloc, outloc, class, | ||
1023 | 1038 | out_subreg_loc = outloc; |
1024 | 1039 | outloc = &SUBREG_REG (out); |
1025 | 1040 | out = *outloc; |
1026 | -#ifndef LOAD_EXTEND_OP | |
1041 | +#if ! defined (LOAD_EXTEND_OP) && ! defined (WORD_REGISTER_OPERATIONS) | |
1027 | 1042 | if (GET_CODE (out) == MEM |
1028 | 1043 | && GET_MODE_SIZE (GET_MODE (out)) > GET_MODE_SIZE (outmode)) |
1029 | 1044 | abort (); |
@@ -2757,10 +2772,20 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) | ||
2757 | 2772 | register access. If the data is, in fact, in memory we |
2758 | 2773 | must always load using the size assumed to be in the |
2759 | 2774 | register and let the insn do the different-sized |
2760 | - accesses. */ | |
2775 | + accesses. | |
2776 | + | |
2777 | + This is doubly true if WORD_REGISTER_OPERATIONS. In | |
2778 | + this case eliminate_regs has left non-paradoxical | |
2779 | + subregs for push_reloads to see. Make sure it does | |
2780 | + by forcing the reload. | |
2781 | + | |
2782 | + ??? When is it right at this stage to have a subreg | |
2783 | + of a mem that is _not_ to be handled specialy? IMO | |
2784 | + those should have been reduced to just a mem. */ | |
2761 | 2785 | || ((GET_CODE (operand) == MEM |
2762 | 2786 | || (GET_CODE (operand)== REG |
2763 | 2787 | && REGNO (operand) >= FIRST_PSEUDO_REGISTER)) |
2788 | +#ifndef WORD_REGISTER_OPERATIONS | |
2764 | 2789 | && (((GET_MODE_BITSIZE (GET_MODE (operand)) |
2765 | 2790 | < BIGGEST_ALIGNMENT) |
2766 | 2791 | && (GET_MODE_SIZE (operand_mode[i]) |
@@ -2775,7 +2800,9 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) | ||
2775 | 2800 | && INTEGRAL_MODE_P (GET_MODE (operand)) |
2776 | 2801 | && LOAD_EXTEND_OP (GET_MODE (operand)) != NIL) |
2777 | 2802 | #endif |
2778 | - )) | |
2803 | + ) | |
2804 | +#endif | |
2805 | + ) | |
2779 | 2806 | /* Subreg of a hard reg which can't handle the subreg's mode |
2780 | 2807 | or which would handle that mode in the wrong number of |
2781 | 2808 | registers for subregging to work. */ |
@@ -4162,6 +4189,29 @@ find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest) | ||
4162 | 4189 | GET_MODE (SUBREG_REG (x)))) != 0) |
4163 | 4190 | return tem; |
4164 | 4191 | |
4192 | + /* If the SUBREG is wider than a word, the above test will fail. | |
4193 | + For example, we might have a SImode SUBREG of a DImode SUBREG_REG | |
4194 | + for a 16 bit target, or a DImode SUBREG of a TImode SUBREG_REG for | |
4195 | + a 32 bit target. We still can - and have to - handle this | |
4196 | + for non-paradoxical subregs of CONST_INTs. */ | |
4197 | + if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 | |
4198 | + && reg_equiv_constant[regno] != 0 | |
4199 | + && GET_CODE (reg_equiv_constant[regno]) == CONST_INT | |
4200 | + && (GET_MODE_SIZE (GET_MODE (x)) | |
4201 | + < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))) | |
4202 | + { | |
4203 | + int shift = SUBREG_WORD (x) * BITS_PER_WORD; | |
4204 | + if (WORDS_BIG_ENDIAN) | |
4205 | + shift = (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) | |
4206 | + - GET_MODE_BITSIZE (GET_MODE (x)) | |
4207 | + - shift); | |
4208 | + /* Here we use the knowledge that CONST_INTs have a | |
4209 | + HOST_WIDE_INT field. */ | |
4210 | + if (shift >= HOST_BITS_PER_WIDE_INT) | |
4211 | + shift = HOST_BITS_PER_WIDE_INT - 1; | |
4212 | + return GEN_INT (INTVAL (reg_equiv_constant[regno]) >> shift); | |
4213 | + } | |
4214 | + | |
4165 | 4215 | if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 |
4166 | 4216 | && reg_equiv_constant[regno] != 0 |
4167 | 4217 | && GET_MODE (reg_equiv_constant[regno]) == VOIDmode) |
@@ -3108,30 +3108,21 @@ eliminate_regs (x, mem_mode, insn, storing) | ||
3108 | 3108 | int x_size = GET_MODE_SIZE (GET_MODE (x)); |
3109 | 3109 | int new_size = GET_MODE_SIZE (GET_MODE (new)); |
3110 | 3110 | |
3111 | - /* When asked to spill a partial word subreg, we need to go | |
3112 | - ahead and spill the whole thing against the possibility | |
3113 | - that we reload the whole reg and find garbage at the top. */ | |
3114 | - if (storing | |
3115 | - && GET_CODE (new) == MEM | |
3116 | - && x_size < new_size | |
3117 | - && ((x_size + UNITS_PER_WORD-1) / UNITS_PER_WORD | |
3118 | - == (new_size + UNITS_PER_WORD-1) / UNITS_PER_WORD)) | |
3119 | - return new; | |
3120 | - else if (GET_CODE (new) == MEM | |
3121 | - && x_size <= new_size | |
3122 | -#ifdef LOAD_EXTEND_OP | |
3123 | - /* On these machines we will be reloading what is | |
3124 | - inside the SUBREG if it originally was a pseudo and | |
3125 | - the inner and outer modes are both a word or | |
3126 | - smaller. So leave the SUBREG then. */ | |
3127 | - && ! (GET_CODE (SUBREG_REG (x)) == REG | |
3128 | - && x_size <= UNITS_PER_WORD | |
3129 | - && new_size <= UNITS_PER_WORD | |
3130 | - && x_size > new_size | |
3131 | - && INTEGRAL_MODE_P (GET_MODE (new)) | |
3132 | - && LOAD_EXTEND_OP (GET_MODE (new)) != NIL) | |
3111 | + if (GET_CODE (new) == MEM | |
3112 | + && ((x_size < new_size | |
3113 | +#ifdef WORD_REGISTER_OPERATIONS | |
3114 | + /* On these machines, combine can create rtl of the form | |
3115 | + (set (subreg:m1 (reg:m2 R) 0) ...) | |
3116 | + where m1 < m2, and expects something interesting to | |
3117 | + happen to the entire word. Moreover, it will use the | |
3118 | + (reg:m2 R) later, expecting all bits to be preserved. | |
3119 | + So if the number of words is the same, preserve the | |
3120 | + subreg so that push_reloads can see it. */ | |
3121 | + && ! ((x_size-1)/UNITS_PER_WORD == (new_size-1)/UNITS_PER_WORD) | |
3133 | 3122 | #endif |
3134 | - ) | |
3123 | + ) | |
3124 | + || (x_size == new_size)) | |
3125 | + ) | |
3135 | 3126 | { |
3136 | 3127 | int offset = SUBREG_WORD (x) * UNITS_PER_WORD; |
3137 | 3128 | enum machine_mode mode = GET_MODE (x); |
@@ -3271,12 +3262,6 @@ eliminate_regs (x, mem_mode, insn, storing) | ||
3271 | 3262 | && GET_CODE (insn) != INSN_LIST) |
3272 | 3263 | emit_insn_after (gen_rtx (CLOBBER, VOIDmode, SET_DEST (x)), insn); |
3273 | 3264 | |
3274 | - /* If SET_DEST was a partial-word subreg, NEW0 may have been widened | |
3275 | - to spill the entire register (see SUBREG case above). If the | |
3276 | - widths of SET_DEST and NEW0 no longer match, adjust NEW1. */ | |
3277 | - if (GET_MODE (SET_DEST (x)) != GET_MODE (new0)) | |
3278 | - new1 = gen_rtx (SUBREG, GET_MODE (new0), new1, 0); | |
3279 | - | |
3280 | 3265 | if (new0 != SET_DEST (x) || new1 != SET_SRC (x)) |
3281 | 3266 | return gen_rtx (SET, VOIDmode, new0, new1); |
3282 | 3267 | } |