Deleted Added
full compact
reload.c (107604) reload.c (107605)
1/* Search an insn for pseudo regs that must be in hard regs and are not.
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 228 unchanged lines hidden (view full) ---

237
238#ifdef HAVE_SECONDARY_RELOADS
239static int push_secondary_reload PARAMS ((int, rtx, int, int, enum reg_class,
240 enum machine_mode, enum reload_type,
241 enum insn_code *));
242#endif
243static enum reg_class find_valid_class PARAMS ((enum machine_mode, int,
244 unsigned int));
1/* Search an insn for pseudo regs that must be in hard regs and are not.
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 228 unchanged lines hidden (view full) ---

237
238#ifdef HAVE_SECONDARY_RELOADS
239static int push_secondary_reload PARAMS ((int, rtx, int, int, enum reg_class,
240 enum machine_mode, enum reload_type,
241 enum insn_code *));
242#endif
243static enum reg_class find_valid_class PARAMS ((enum machine_mode, int,
244 unsigned int));
245static int reload_inner_reg_of_subreg PARAMS ((rtx, enum machine_mode));
245static int reload_inner_reg_of_subreg PARAMS ((rtx, enum machine_mode, int));
246static void push_replacement PARAMS ((rtx *, int, enum machine_mode));
247static void combine_reloads PARAMS ((void));
248static int find_reusable_reload PARAMS ((rtx *, rtx, enum reg_class,
249 enum reload_type, int, int));
250static rtx find_dummy_reload PARAMS ((rtx, rtx, rtx *, rtx *,
251 enum machine_mode, enum machine_mode,
252 enum reg_class, int, int));
253static int hard_reg_set_here_p PARAMS ((unsigned int, unsigned int, rtx));

--- 535 unchanged lines hidden (view full) ---

789 }
790 return n_reloads;
791}
792
793/* Return nonzero if X is a SUBREG which will require reloading of its
794 SUBREG_REG expression. */
795
796static int
246static void push_replacement PARAMS ((rtx *, int, enum machine_mode));
247static void combine_reloads PARAMS ((void));
248static int find_reusable_reload PARAMS ((rtx *, rtx, enum reg_class,
249 enum reload_type, int, int));
250static rtx find_dummy_reload PARAMS ((rtx, rtx, rtx *, rtx *,
251 enum machine_mode, enum machine_mode,
252 enum reg_class, int, int));
253static int hard_reg_set_here_p PARAMS ((unsigned int, unsigned int, rtx));

--- 535 unchanged lines hidden (view full) ---

789 }
790 return n_reloads;
791}
792
793/* Return nonzero if X is a SUBREG which will require reloading of its
794 SUBREG_REG expression. */
795
796static int
797reload_inner_reg_of_subreg (x, mode)
797reload_inner_reg_of_subreg (x, mode, output)
798 rtx x;
799 enum machine_mode mode;
798 rtx x;
799 enum machine_mode mode;
800 int output;
800{
801 rtx inner;
802
803 /* Only SUBREGs are problematical. */
804 if (GET_CODE (x) != SUBREG)
805 return 0;
806
807 inner = SUBREG_REG (x);

--- 11 unchanged lines hidden (view full) ---

819 /* If INNER is not ok for MODE, then INNER will need reloading. */
820 if (! HARD_REGNO_MODE_OK (subreg_regno (x), mode))
821 return 1;
822
823 /* If the outer part is a word or smaller, INNER larger than a
824 word and the number of regs for INNER is not the same as the
825 number of words in INNER, then INNER will need reloading. */
826 return (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
801{
802 rtx inner;
803
804 /* Only SUBREGs are problematical. */
805 if (GET_CODE (x) != SUBREG)
806 return 0;
807
808 inner = SUBREG_REG (x);

--- 11 unchanged lines hidden (view full) ---

820 /* If INNER is not ok for MODE, then INNER will need reloading. */
821 if (! HARD_REGNO_MODE_OK (subreg_regno (x), mode))
822 return 1;
823
824 /* If the outer part is a word or smaller, INNER larger than a
825 word and the number of regs for INNER is not the same as the
826 number of words in INNER, then INNER will need reloading. */
827 return (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
828 && output
827 && GET_MODE_SIZE (GET_MODE (inner)) > UNITS_PER_WORD
828 && ((GET_MODE_SIZE (GET_MODE (inner)) / UNITS_PER_WORD)
829 != HARD_REGNO_NREGS (REGNO (inner), GET_MODE (inner))));
830}
831
832/* Record one reload that needs to be performed.
833 IN is an rtx saying where the data are to be found before this instruction.
834 OUT says where they must be stored after the instruction.

--- 207 unchanged lines hidden (view full) ---

1042 need one word to store an M2-sized quantity in R.
1043
1044 However, we must reload the inner reg *as well as* the subreg in
1045 that case. */
1046
1047 /* Similar issue for (SUBREG constant ...) if it was not handled by the
1048 code above. This can happen if SUBREG_BYTE != 0. */
1049
829 && GET_MODE_SIZE (GET_MODE (inner)) > UNITS_PER_WORD
830 && ((GET_MODE_SIZE (GET_MODE (inner)) / UNITS_PER_WORD)
831 != HARD_REGNO_NREGS (REGNO (inner), GET_MODE (inner))));
832}
833
834/* Record one reload that needs to be performed.
835 IN is an rtx saying where the data are to be found before this instruction.
836 OUT says where they must be stored after the instruction.

--- 207 unchanged lines hidden (view full) ---

1044 need one word to store an M2-sized quantity in R.
1045
1046 However, we must reload the inner reg *as well as* the subreg in
1047 that case. */
1048
1049 /* Similar issue for (SUBREG constant ...) if it was not handled by the
1050 code above. This can happen if SUBREG_BYTE != 0. */
1051
1050 if (in != 0 && reload_inner_reg_of_subreg (in, inmode))
1052 if (in != 0 && reload_inner_reg_of_subreg (in, inmode, 0))
1051 {
1052 enum reg_class in_class = class;
1053
1054 if (GET_CODE (SUBREG_REG (in)) == REG)
1055 in_class
1056 = find_valid_class (inmode,
1057 subreg_regno_offset (REGNO (SUBREG_REG (in)),
1058 GET_MODE (SUBREG_REG (in)),

--- 80 unchanged lines hidden (view full) ---

1139
1140 /* Similar issue for (SUBREG:M1 (REG:M2 ...) ...) for a hard register R where
1141 either M1 is not valid for R or M2 is wider than a word but we only
1142 need one word to store an M2-sized quantity in R.
1143
1144 However, we must reload the inner reg *as well as* the subreg in
1145 that case. In this case, the inner reg is an in-out reload. */
1146
1053 {
1054 enum reg_class in_class = class;
1055
1056 if (GET_CODE (SUBREG_REG (in)) == REG)
1057 in_class
1058 = find_valid_class (inmode,
1059 subreg_regno_offset (REGNO (SUBREG_REG (in)),
1060 GET_MODE (SUBREG_REG (in)),

--- 80 unchanged lines hidden (view full) ---

1141
1142 /* Similar issue for (SUBREG:M1 (REG:M2 ...) ...) for a hard register R where
1143 either M1 is not valid for R or M2 is wider than a word but we only
1144 need one word to store an M2-sized quantity in R.
1145
1146 However, we must reload the inner reg *as well as* the subreg in
1147 that case. In this case, the inner reg is an in-out reload. */
1148
1147 if (out != 0 && reload_inner_reg_of_subreg (out, outmode))
1149 if (out != 0 && reload_inner_reg_of_subreg (out, outmode, 1))
1148 {
1149 /* This relies on the fact that emit_reload_insns outputs the
1150 instructions for output reloads of type RELOAD_OTHER in reverse
1151 order of the reloads. Thus if the outer reload is also of type
1152 RELOAD_OTHER, we are guaranteed that this inner reload will be
1153 output after the outer reload. */
1154 dont_remove_subreg = 1;
1155 push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),

--- 561 unchanged lines hidden (view full) ---

1717 the output, then we also can't share.
1718 Imagine (set (mem (reg 69)) (plus (reg 69) ...)).
1719 If the same reload reg is used for both reg 69 and the
1720 result to be stored in memory, then that result
1721 will clobber the address of the memory ref. */
1722 && ! (GET_CODE (rld[i].in) == REG
1723 && reg_overlap_mentioned_for_reload_p (rld[i].in,
1724 rld[output_reload].out))))
1150 {
1151 /* This relies on the fact that emit_reload_insns outputs the
1152 instructions for output reloads of type RELOAD_OTHER in reverse
1153 order of the reloads. Thus if the outer reload is also of type
1154 RELOAD_OTHER, we are guaranteed that this inner reload will be
1155 output after the outer reload. */
1156 dont_remove_subreg = 1;
1157 push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),

--- 561 unchanged lines hidden (view full) ---

1719 the output, then we also can't share.
1720 Imagine (set (mem (reg 69)) (plus (reg 69) ...)).
1721 If the same reload reg is used for both reg 69 and the
1722 result to be stored in memory, then that result
1723 will clobber the address of the memory ref. */
1724 && ! (GET_CODE (rld[i].in) == REG
1725 && reg_overlap_mentioned_for_reload_p (rld[i].in,
1726 rld[output_reload].out))))
1725 && ! reload_inner_reg_of_subreg (rld[i].in, rld[i].inmode)
1727 && ! reload_inner_reg_of_subreg (rld[i].in, rld[i].inmode,
1728 rld[i].when_needed != RELOAD_FOR_INPUT)
1726 && (reg_class_size[(int) rld[i].class]
1727 || SMALL_REGISTER_CLASSES)
1728 /* We will allow making things slightly worse by combining an
1729 input and an output, but no worse than that. */
1730 && (rld[i].when_needed == RELOAD_FOR_INPUT
1731 || rld[i].when_needed == RELOAD_FOR_OUTPUT))
1732 {
1733 int j;

--- 2685 unchanged lines hidden (view full) ---

4419
4420 if (subreg_lowpart_p (x)
4421 && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
4422 && reg_equiv_constant[regno] != 0
4423 && (tem = gen_lowpart_common (GET_MODE (x),
4424 reg_equiv_constant[regno])) != 0)
4425 return tem;
4426
1729 && (reg_class_size[(int) rld[i].class]
1730 || SMALL_REGISTER_CLASSES)
1731 /* We will allow making things slightly worse by combining an
1732 input and an output, but no worse than that. */
1733 && (rld[i].when_needed == RELOAD_FOR_INPUT
1734 || rld[i].when_needed == RELOAD_FOR_OUTPUT))
1735 {
1736 int j;

--- 2685 unchanged lines hidden (view full) ---

4422
4423 if (subreg_lowpart_p (x)
4424 && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
4425 && reg_equiv_constant[regno] != 0
4426 && (tem = gen_lowpart_common (GET_MODE (x),
4427 reg_equiv_constant[regno])) != 0)
4428 return tem;
4429
4427 if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD
4428 && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
4429 && reg_equiv_constant[regno] != 0
4430 && (tem = operand_subword (reg_equiv_constant[regno],
4431 SUBREG_BYTE (x) / UNITS_PER_WORD, 0,
4432 GET_MODE (SUBREG_REG (x)))) != 0)
4430 if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
4431 && reg_equiv_constant[regno] != 0)
4433 {
4432 {
4434 /* TEM is now a word sized constant for the bits from X that
4435 we wanted. However, TEM may be the wrong representation.
4436
4437 Use gen_lowpart_common to convert a CONST_INT into a
4438 CONST_DOUBLE and vice versa as needed according to by the mode
4439 of the SUBREG. */
4440 tem = gen_lowpart_common (GET_MODE (x), tem);
4433 tem =
4434 simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
4435 GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
4441 if (!tem)
4442 abort ();
4443 return tem;
4444 }
4445
4446 /* If the SUBREG is wider than a word, the above test will fail.
4447 For example, we might have a SImode SUBREG of a DImode SUBREG_REG
4448 for a 16 bit target, or a DImode SUBREG of a TImode SUBREG_REG for

--- 2548 unchanged lines hidden ---
4436 if (!tem)
4437 abort ();
4438 return tem;
4439 }
4440
4441 /* If the SUBREG is wider than a word, the above test will fail.
4442 For example, we might have a SImode SUBREG of a DImode SUBREG_REG
4443 for a 16 bit target, or a DImode SUBREG of a TImode SUBREG_REG for

--- 2548 unchanged lines hidden ---