subreg-byte-branch
Andrew Macleod
amacleod@cygnus.com
Fri Nov 17 12:53:00 GMT 2000
OK, other things are now out of the way, and Im back to getting the
subreg-byte-branch code up to snuff. This patch will remove the 2
big ugly macros in rtl.h and replace them with functions.
I am now proceeding on to testing on other architectures and
then we'll see how far off we are from the current source tree.
I have not applied this patch to the branch yet, but presuming
there are no complaints, I will do so the beginning of next week.
I am not aware of anything else that needs to be done to the branch,
(other than specific architecture bugs that were missed that will
hopefully pop up with testing). If anyone else knows of
anything, please let me know.
Andrew
* rtl.h (SUBREG_REGNO_OFFSET, SUBREG_REGNO): Remove macros.
(subreg_regno_offset, subreg_regno): Define prototypes.
* rtlanal.c (refers_to_regno_p, reg_overlap_mentioned_p): Use
subreg_regno function.
(subreg_regno_offset): New function replaces SUBREG_REGNO_OFFSET macro.
(subreg_regno): New function to replace SUBREG_REGNO macro.
* alias.c (nonlocal_reference_p): Use subreg_regno function.
* caller-save.c (add_stored_regs): Use subreg_regno_offset function.
* emit-rtl.c (subreg_hard_regno, gen_lowpart_common, gen_highpart,
operand_subword): Use new subreg_regno_* functions.
* flow.c (mark_set_1): Use subreg_regno_offset function.
* function.c (purge_single_hard_subreg_set): Use subreg_regno_offset
function.
* global.c (set_preference): Use subreg_regno_offset function.
* integrate.c (mark_stores): Use subreg_regno_offset function.
* jump.c (rtx_renumbered_equal_p, true_regnum): Use subreg_regno_offset
function.
* local-alloc.c (combine_regs): Use subreg_regno_offset function.
* recog.c (constrain_operands): Use subreg_regno_offset function.
* reg-stack.c (get_true_reg): Use subreg_regno_offset function.
* reload.c (reload_inner_reg_of_subreg, push_reload, find_dummy_reload,
operands_match_p, find_reloads, find_reloads_toplev,
find_reloads_address_1, find_replacement, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Use new subreg_regno_* functions.
* reload1.c (forget_old_reloads_1, choose_reload_regs,
reload_combine_note_store, move2add_note_store): Use new subreg_regno_*
functions.
* resource.c (update_live_status, mark_referenced_resources): Use
subreg_regno function.
* tm.texi (SUBREG_REGNO_OFFSET): Document macro.
* config/a29k/a29k.c (gpc_reg_operand): Use subreg_regno function.
* config/d30v/d30v.c (d30v_split_double,
d30v_print_operand_memory_reference): Use subreg_regno_offset function.
* config/mips/mips.c (mips_move_1word, mips_move_2words,
mips_secondary_reload_class): Use subreg_regno_offset function.
* config/mn10200/mn10200.c (print_operand): Use subreg_regno function.
* config/mn10300/mn10300.c (print_operand): Use subreg_regno function.
* config/pyr/pyr.c (subreg_overlap_mentioned_p, consecutive_operands):
Use subreg_regno_offset function.
* config/sh/sh.c (output_movedouble, regs_used,
machine_dependent_reorg): Use new subreg_regno_* functions.
* config/sh/sh.md: Use subreg_regno function.
* config/v850/v850.c (print_operand, output_move_double): Use
subreg_regno function.
Index: gcc/alias.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/alias.c,v
retrieving revision 1.101.2.1
diff -c -p -r1.101.2.1 alias.c
*** alias.c 2000/09/24 22:21:30 1.101.2.1
--- alias.c 2000/11/17 20:43:01
*************** nonlocal_reference_p (x)
*** 1763,1769 ****
{
/* Global registers are not local. */
if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
! && global_regs[SUBREG_REGNO (x)])
return 1;
return 0;
}
--- 1763,1769 ----
{
/* Global registers are not local. */
if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
! && global_regs[subreg_regno (x)])
return 1;
return 0;
}
Index: gcc/caller-save.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/caller-save.c,v
retrieving revision 1.32.2.1
diff -c -p -r1.32.2.1 caller-save.c
*** caller-save.c 2000/09/24 22:21:30 1.32.2.1
--- caller-save.c 2000/11/17 20:43:01
*************** add_stored_regs (reg, setter, data)
*** 485,491 ****
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
{
! offset = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (reg)),
GET_MODE (SUBREG_REG (reg)),
SUBREG_BYTE (reg),
GET_MODE (reg));
--- 485,491 ----
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
{
! offset = subreg_regno_offset (REGNO (SUBREG_REG (reg)),
GET_MODE (SUBREG_REG (reg)),
SUBREG_BYTE (reg),
GET_MODE (reg));
Index: gcc/emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.147.2.3
diff -c -p -r1.147.2.3 emit-rtl.c
*** emit-rtl.c 2000/11/03 20:27:22 1.147.2.3
--- emit-rtl.c 2000/11/17 20:43:04
*************** subreg_hard_regno (x, check_mode)
*** 734,740 ****
if ((byte_offset % GET_MODE_SIZE (mode)) != 0)
abort ();
! final_regno = SUBREG_REGNO (x);
/* Punt if what we end up with is not a valid regno in
the SUBREG's mode, or we went past the end of the inner
--- 734,740 ----
if ((byte_offset % GET_MODE_SIZE (mode)) != 0)
abort ();
! final_regno = subreg_regno (x);
/* Punt if what we end up with is not a valid regno in
the SUBREG's mode, or we went past the end of the inner
*************** gen_lowpart_common (mode, x)
*** 830,836 ****
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (x) +
! SUBREG_REGNO_OFFSET (REGNO (x), GET_MODE (x), offset, mode);
/* If the final regno is not valid for MODE, punt. */
/* ??? We do allow it if the current REG is not valid for
--- 830,836 ----
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (x) +
! subreg_regno_offset (REGNO (x), GET_MODE (x), offset, mode);
/* If the final regno is not valid for MODE, punt. */
/* ??? We do allow it if the current REG is not valid for
*************** gen_highpart (mode, x)
*** 1266,1272 ****
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (x) +
! SUBREG_REGNO_OFFSET (REGNO (x), GET_MODE (x), offset, mode);
/* integrate.c can't handle parts of a return value register.
??? Then integrate.c should be fixed!
--- 1266,1272 ----
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (x) +
! subreg_regno_offset (REGNO (x), GET_MODE (x), offset, mode);
/* integrate.c can't handle parts of a return value register.
??? Then integrate.c should be fixed!
*************** operand_subword (op, offset, validate_ad
*** 1606,1612 ****
if (REGNO (op) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (op) +
! SUBREG_REGNO_OFFSET (REGNO (op), GET_MODE (op),
offset * UNITS_PER_WORD,
word_mode);
--- 1606,1612 ----
if (REGNO (op) < FIRST_PSEUDO_REGISTER)
{
int final_regno = REGNO (op) +
! subreg_regno_offset (REGNO (op), GET_MODE (op),
offset * UNITS_PER_WORD,
word_mode);
Index: gcc/flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.340.2.1
diff -c -p -r1.340.2.1 flow.c
*** flow.c 2000/09/24 22:21:32 1.340.2.1
--- flow.c 2000/11/17 20:43:08
*************** mark_set_1 (pbi, code, reg, cond, insn,
*** 4439,4445 ****
regno_last = regno_first = REGNO (SUBREG_REG (reg));
if (regno_first < FIRST_PSEUDO_REGISTER)
{
! regno_first += SUBREG_REGNO_OFFSET (regno_first, inner_mode,
SUBREG_BYTE (reg),
outer_mode);
regno_last = (regno_first
--- 4439,4445 ----
regno_last = regno_first = REGNO (SUBREG_REG (reg));
if (regno_first < FIRST_PSEUDO_REGISTER)
{
! regno_first += subreg_regno_offset (regno_first, inner_mode,
SUBREG_BYTE (reg),
outer_mode);
regno_last = (regno_first
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.220.2.3
diff -c -p -r1.220.2.3 function.c
*** function.c 2000/10/03 01:08:35 1.220.2.3
--- function.c 2000/11/17 20:43:10
*************** purge_single_hard_subreg_set (pattern)
*** 3414,3420 ****
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG
&& REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER)
{
! offset = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (reg)),
GET_MODE (SUBREG_REG (reg)),
SUBREG_BYTE (reg),
GET_MODE (reg));
--- 3414,3420 ----
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG
&& REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER)
{
! offset = subreg_regno_offset (REGNO (SUBREG_REG (reg)),
GET_MODE (SUBREG_REG (reg)),
SUBREG_BYTE (reg),
GET_MODE (reg));
Index: gcc/global.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/global.c,v
retrieving revision 1.63.2.1
diff -c -p -r1.63.2.1 global.c
*** global.c 2000/09/24 22:21:33 1.63.2.1
--- global.c 2000/11/17 20:43:10
*************** set_preference (dest, src)
*** 1596,1602 ****
src_regno = REGNO (SUBREG_REG (src));
if (REGNO (SUBREG_REG (src)) < FIRST_PSEUDO_REGISTER)
! offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (src)),
GET_MODE (SUBREG_REG (src)),
SUBREG_BYTE (src),
GET_MODE (src));
--- 1596,1602 ----
src_regno = REGNO (SUBREG_REG (src));
if (REGNO (SUBREG_REG (src)) < FIRST_PSEUDO_REGISTER)
! offset += subreg_regno_offset (REGNO (SUBREG_REG (src)),
GET_MODE (SUBREG_REG (src)),
SUBREG_BYTE (src),
GET_MODE (src));
*************** set_preference (dest, src)
*** 1614,1620 ****
dest_regno = REGNO (SUBREG_REG (dest));
if (REGNO (SUBREG_REG (dest)) < FIRST_PSEUDO_REGISTER)
! offset -= SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (dest)),
GET_MODE (SUBREG_REG (dest)),
SUBREG_BYTE (dest),
GET_MODE (dest));
--- 1614,1620 ----
dest_regno = REGNO (SUBREG_REG (dest));
if (REGNO (SUBREG_REG (dest)) < FIRST_PSEUDO_REGISTER)
! offset -= subreg_regno_offset (REGNO (SUBREG_REG (dest)),
GET_MODE (SUBREG_REG (dest)),
SUBREG_BYTE (dest),
GET_MODE (dest));
Index: gcc/integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.116.2.1
diff -c -p -r1.116.2.1 integrate.c
*** integrate.c 2000/09/24 22:21:33 1.116.2.1
--- integrate.c 2000/11/17 20:43:11
*************** mark_stores (dest, x, data)
*** 2628,2634 ****
{
regno = REGNO (SUBREG_REG (dest));
if (regno < FIRST_PSEUDO_REGISTER)
! regno += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (dest)),
GET_MODE (SUBREG_REG (dest)),
SUBREG_BYTE (dest),
GET_MODE (dest));
--- 2628,2634 ----
{
regno = REGNO (SUBREG_REG (dest));
if (regno < FIRST_PSEUDO_REGISTER)
! regno += subreg_regno_offset (REGNO (SUBREG_REG (dest)),
GET_MODE (SUBREG_REG (dest)),
SUBREG_BYTE (dest),
GET_MODE (dest));
Index: gcc/jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.136.2.1
diff -c -p -r1.136.2.1 jump.c
*** jump.c 2000/09/24 22:21:33 1.136.2.1
--- jump.c 2000/11/17 20:43:12
*************** rtx_renumbered_equal_p (x, y)
*** 3532,3538 ****
if (reg_renumber[reg_x] >= 0)
{
! reg_x = SUBREG_REGNO_OFFSET (reg_renumber[reg_x],
GET_MODE (SUBREG_REG (x)),
byte_x,
GET_MODE (x));
--- 3532,3538 ----
if (reg_renumber[reg_x] >= 0)
{
! reg_x = subreg_regno_offset (reg_renumber[reg_x],
GET_MODE (SUBREG_REG (x)),
byte_x,
GET_MODE (x));
*************** rtx_renumbered_equal_p (x, y)
*** 3553,3559 ****
if (reg_renumber[reg_y] >= 0)
{
! reg_y = SUBREG_REGNO_OFFSET (reg_renumber[reg_y],
GET_MODE (SUBREG_REG (y)),
byte_y,
GET_MODE (y));
--- 3553,3559 ----
if (reg_renumber[reg_y] >= 0)
{
! reg_y = subreg_regno_offset (reg_renumber[reg_y],
GET_MODE (SUBREG_REG (y)),
byte_y,
GET_MODE (y));
*************** true_regnum (x)
*** 3698,3704 ****
{
int base = true_regnum (SUBREG_REG (x));
if (base >= 0 && base < FIRST_PSEUDO_REGISTER)
! return base + SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x), GET_MODE (x));
}
--- 3698,3704 ----
{
int base = true_regnum (SUBREG_REG (x));
if (base >= 0 && base < FIRST_PSEUDO_REGISTER)
! return base + subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x), GET_MODE (x));
}
Index: gcc/local-alloc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/local-alloc.c,v
retrieving revision 1.70.2.1
diff -c -p -r1.70.2.1 local-alloc.c
*** local-alloc.c 2000/09/24 22:21:33 1.70.2.1
--- local-alloc.c 2000/11/17 20:43:12
*************** combine_regs (usedreg, setreg, may_save_
*** 1603,1609 ****
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (usedreg))) > UNITS_PER_WORD)
may_save_copy = 0;
if (REGNO (SUBREG_REG (usedreg)) < FIRST_PSEUDO_REGISTER)
! offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (usedreg)),
GET_MODE (SUBREG_REG (usedreg)),
SUBREG_BYTE (usedreg),
GET_MODE (usedreg));
--- 1603,1609 ----
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (usedreg))) > UNITS_PER_WORD)
may_save_copy = 0;
if (REGNO (SUBREG_REG (usedreg)) < FIRST_PSEUDO_REGISTER)
! offset += subreg_regno_offset (REGNO (SUBREG_REG (usedreg)),
GET_MODE (SUBREG_REG (usedreg)),
SUBREG_BYTE (usedreg),
GET_MODE (usedreg));
*************** combine_regs (usedreg, setreg, may_save_
*** 1627,1633 ****
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (setreg))) > UNITS_PER_WORD)
may_save_copy = 0;
if (REGNO (SUBREG_REG (setreg)) < FIRST_PSEUDO_REGISTER)
! offset -= SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (setreg)),
GET_MODE (SUBREG_REG (setreg)),
SUBREG_BYTE (setreg),
GET_MODE (setreg));
--- 1627,1633 ----
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (setreg))) > UNITS_PER_WORD)
may_save_copy = 0;
if (REGNO (SUBREG_REG (setreg)) < FIRST_PSEUDO_REGISTER)
! offset -= subreg_regno_offset (REGNO (SUBREG_REG (setreg)),
GET_MODE (SUBREG_REG (setreg)),
SUBREG_BYTE (setreg),
GET_MODE (setreg));
Index: gcc/recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.76.2.2
diff -c -p -r1.76.2.2 recog.c
*** recog.c 2000/09/30 13:32:25 1.76.2.2
--- recog.c 2000/11/17 20:43:13
*************** constrain_operands (strict)
*** 2347,2353 ****
{
if (GET_CODE (SUBREG_REG (op)) == REG
&& REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER)
! offset = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op)),
GET_MODE (SUBREG_REG (op)),
SUBREG_BYTE (op),
GET_MODE (op));
--- 2347,2353 ----
{
if (GET_CODE (SUBREG_REG (op)) == REG
&& REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER)
! offset = subreg_regno_offset (REGNO (SUBREG_REG (op)),
GET_MODE (SUBREG_REG (op)),
SUBREG_BYTE (op),
GET_MODE (op));
Index: gcc/reg-stack.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reg-stack.c,v
retrieving revision 1.62.2.1
diff -c -p -r1.62.2.1 reg-stack.c
*** reg-stack.c 2000/09/24 22:21:34 1.62.2.1
--- reg-stack.c 2000/11/17 20:43:13
*************** get_true_reg (pat)
*** 561,567 ****
rtx subreg;
if (FP_REG_P (subreg = SUBREG_REG (*pat)))
{
! int regno_off = SUBREG_REGNO_OFFSET (REGNO (subreg),
GET_MODE (subreg),
SUBREG_BYTE (*pat),
GET_MODE (*pat));
--- 561,567 ----
rtx subreg;
if (FP_REG_P (subreg = SUBREG_REG (*pat)))
{
! int regno_off = subreg_regno_offset (REGNO (subreg),
GET_MODE (subreg),
SUBREG_BYTE (*pat),
GET_MODE (*pat));
Index: gcc/reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.130.2.3
diff -c -p -r1.130.2.3 reload.c
*** reload.c 2000/10/03 01:08:36 1.130.2.3
--- reload.c 2000/11/17 20:43:15
*************** reload_inner_reg_of_subreg (x, mode)
*** 791,797 ****
return 0;
/* If INNER is not ok for MODE, then INNER will need reloading. */
! if (! HARD_REGNO_MODE_OK (SUBREG_REGNO (x), mode))
return 1;
/* If the outer part is a word or smaller, INNER larger than a
--- 791,797 ----
return 0;
/* If INNER is not ok for MODE, then INNER will need reloading. */
! if (! HARD_REGNO_MODE_OK (subreg_regno (x), mode))
return 1;
/* If the outer part is a word or smaller, INNER larger than a
*************** push_reload (in, out, inloc, outloc, cla
*** 985,991 ****
/ UNITS_PER_WORD)
!= HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)))))
! || ! HARD_REGNO_MODE_OK (SUBREG_REGNO (in), inmode)))
#ifdef SECONDARY_INPUT_RELOAD_CLASS
|| (SECONDARY_INPUT_RELOAD_CLASS (class, inmode, in) != NO_REGS
&& (SECONDARY_INPUT_RELOAD_CLASS (class,
--- 985,991 ----
/ UNITS_PER_WORD)
!= HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)))))
! || ! HARD_REGNO_MODE_OK (subreg_regno (in), inmode)))
#ifdef SECONDARY_INPUT_RELOAD_CLASS
|| (SECONDARY_INPUT_RELOAD_CLASS (class, inmode, in) != NO_REGS
&& (SECONDARY_INPUT_RELOAD_CLASS (class,
*************** push_reload (in, out, inloc, outloc, cla
*** 1036,1042 ****
output before the outer reload. */
push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_PTR,
find_valid_class (inmode,
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)),
SUBREG_BYTE (in),
GET_MODE (in))),
--- 1036,1042 ----
output before the outer reload. */
push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_PTR,
find_valid_class (inmode,
! subreg_regno_offset (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)),
SUBREG_BYTE (in),
GET_MODE (in))),
*************** push_reload (in, out, inloc, outloc, cla
*** 1081,1087 ****
/ UNITS_PER_WORD)
!= HARD_REGNO_NREGS (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)))))
! || ! HARD_REGNO_MODE_OK (SUBREG_REGNO (out), outmode)))
#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
|| (SECONDARY_OUTPUT_RELOAD_CLASS (class, outmode, out) != NO_REGS
&& (SECONDARY_OUTPUT_RELOAD_CLASS (class,
--- 1081,1087 ----
/ UNITS_PER_WORD)
!= HARD_REGNO_NREGS (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)))))
! || ! HARD_REGNO_MODE_OK (subreg_regno (out), outmode)))
#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
|| (SECONDARY_OUTPUT_RELOAD_CLASS (class, outmode, out) != NO_REGS
&& (SECONDARY_OUTPUT_RELOAD_CLASS (class,
*************** push_reload (in, out, inloc, outloc, cla
*** 1129,1135 ****
push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),
&SUBREG_REG (out),
find_valid_class (outmode,
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)),
SUBREG_BYTE (out),
GET_MODE (out))),
--- 1129,1135 ----
push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),
&SUBREG_REG (out),
find_valid_class (outmode,
! subreg_regno_offset (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)),
SUBREG_BYTE (out),
GET_MODE (out))),
*************** push_reload (in, out, inloc, outloc, cla
*** 1149,1162 ****
if (in != 0 && GET_CODE (in) == SUBREG && GET_CODE (SUBREG_REG (in)) == REG
&& REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
&& ! dont_remove_subreg)
! in = gen_rtx_REG (GET_MODE (in), SUBREG_REGNO (in));
/* Similarly for OUT. */
if (out != 0 && GET_CODE (out) == SUBREG
&& GET_CODE (SUBREG_REG (out)) == REG
&& REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
&& ! dont_remove_subreg)
! out = gen_rtx_REG (GET_MODE (out), SUBREG_REGNO (out));
/* Narrow down the class of register wanted if that is
desirable on this machine for efficiency. */
--- 1149,1162 ----
if (in != 0 && GET_CODE (in) == SUBREG && GET_CODE (SUBREG_REG (in)) == REG
&& REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
&& ! dont_remove_subreg)
! in = gen_rtx_REG (GET_MODE (in), subreg_regno (in));
/* Similarly for OUT. */
if (out != 0 && GET_CODE (out) == SUBREG
&& GET_CODE (SUBREG_REG (out)) == REG
&& REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
&& ! dont_remove_subreg)
! out = gen_rtx_REG (GET_MODE (out), subreg_regno (out));
/* Narrow down the class of register wanted if that is
desirable on this machine for efficiency. */
*************** find_dummy_reload (real_in, real_out, in
*** 1815,1821 ****
{
if (GET_CODE (SUBREG_REG (out)) == REG
&& REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER)
! out_offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)),
SUBREG_BYTE (out),
GET_MODE (out));
--- 1815,1821 ----
{
if (GET_CODE (SUBREG_REG (out)) == REG
&& REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER)
! out_offset += subreg_regno_offset (REGNO (SUBREG_REG (out)),
GET_MODE (SUBREG_REG (out)),
SUBREG_BYTE (out),
GET_MODE (out));
*************** find_dummy_reload (real_in, real_out, in
*** 1825,1831 ****
{
if (GET_CODE (SUBREG_REG (in)) == REG
&& REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER)
! in_offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)),
SUBREG_BYTE (in),
GET_MODE (in));
--- 1825,1831 ----
{
if (GET_CODE (SUBREG_REG (in)) == REG
&& REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER)
! in_offset += subreg_regno_offset (REGNO (SUBREG_REG (in)),
GET_MODE (SUBREG_REG (in)),
SUBREG_BYTE (in),
GET_MODE (in));
*************** operands_match_p (x, y)
*** 2045,2051 ****
i = REGNO (SUBREG_REG (x));
if (i >= FIRST_PSEUDO_REGISTER)
goto slow;
! i += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
--- 2045,2051 ----
i = REGNO (SUBREG_REG (x));
if (i >= FIRST_PSEUDO_REGISTER)
goto slow;
! i += subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
*************** operands_match_p (x, y)
*** 2058,2064 ****
j = REGNO (SUBREG_REG (y));
if (j >= FIRST_PSEUDO_REGISTER)
goto slow;
! j += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (y)),
GET_MODE (SUBREG_REG (y)),
SUBREG_BYTE (y),
GET_MODE (y));
--- 2058,2064 ----
j = REGNO (SUBREG_REG (y));
if (j >= FIRST_PSEUDO_REGISTER)
goto slow;
! j += subreg_regno_offset (REGNO (SUBREG_REG (y)),
GET_MODE (SUBREG_REG (y)),
SUBREG_BYTE (y),
GET_MODE (y));
*************** find_reloads (insn, replace, ind_levels,
*** 2796,2802 ****
if (GET_CODE (SUBREG_REG (operand)) == REG
&& REGNO (SUBREG_REG (operand)) < FIRST_PSEUDO_REGISTER)
{
! offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (operand)),
GET_MODE (SUBREG_REG (operand)),
SUBREG_BYTE (operand),
GET_MODE (operand));
--- 2796,2802 ----
if (GET_CODE (SUBREG_REG (operand)) == REG
&& REGNO (SUBREG_REG (operand)) < FIRST_PSEUDO_REGISTER)
{
! offset += subreg_regno_offset (REGNO (SUBREG_REG (operand)),
GET_MODE (SUBREG_REG (operand)),
SUBREG_BYTE (operand),
GET_MODE (operand));
*************** find_reloads_toplev (x, opnum, type, ind
*** 4405,4411 ****
if (is_set_dest)
push_reload (NULL_RTX, SUBREG_REG (x), NULL_PTR, &SUBREG_REG (x),
find_valid_class (subreg_mode,
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x))),
--- 4405,4411 ----
if (is_set_dest)
push_reload (NULL_RTX, SUBREG_REG (x), NULL_PTR, &SUBREG_REG (x),
find_valid_class (subreg_mode,
! subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x))),
*************** find_reloads_toplev (x, opnum, type, ind
*** 4413,4419 ****
else
push_reload (SUBREG_REG (x), NULL_RTX, &SUBREG_REG (x), NULL_PTR,
find_valid_class (subreg_mode,
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x))),
--- 4413,4419 ----
else
push_reload (SUBREG_REG (x), NULL_RTX, &SUBREG_REG (x), NULL_PTR,
find_valid_class (subreg_mode,
! subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x))),
*************** find_reloads_address_1 (mode, x, context
*** 5073,5079 ****
if (code0 == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER)
op0 = gen_rtx_REG (word_mode,
(REGNO (op0) +
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (orig_op0)),
GET_MODE (SUBREG_REG (orig_op0)),
SUBREG_BYTE (orig_op0),
GET_MODE (orig_op0))));
--- 5073,5079 ----
if (code0 == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER)
op0 = gen_rtx_REG (word_mode,
(REGNO (op0) +
! subreg_regno_offset (REGNO (SUBREG_REG (orig_op0)),
GET_MODE (SUBREG_REG (orig_op0)),
SUBREG_BYTE (orig_op0),
GET_MODE (orig_op0))));
*************** find_reloads_address_1 (mode, x, context
*** 5088,5094 ****
??? op0 SUBREGs we use word_mode? */
op1 = gen_rtx_REG (GET_MODE (op1),
(REGNO (op1) +
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (orig_op1)),
GET_MODE (SUBREG_REG (orig_op1)),
SUBREG_BYTE (orig_op1),
GET_MODE (orig_op1))));
--- 5088,5094 ----
??? op0 SUBREGs we use word_mode? */
op1 = gen_rtx_REG (GET_MODE (op1),
(REGNO (op1) +
! subreg_regno_offset (REGNO (SUBREG_REG (orig_op1)),
GET_MODE (SUBREG_REG (orig_op1)),
SUBREG_BYTE (orig_op1),
GET_MODE (orig_op1))));
*************** find_reloads_address_1 (mode, x, context
*** 5501,5507 ****
needless copies if SUBREG_REG is multi-word. */
if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! int regno = SUBREG_REGNO (x);
if (! (context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
--- 5501,5507 ----
needless copies if SUBREG_REG is multi-word. */
if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! int regno = subreg_regno (x);
if (! (context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
*************** find_replacement (loc)
*** 5839,5845 ****
if (GET_CODE (reloadreg) == REG)
return gen_rtx_REG (GET_MODE (*loc),
(REGNO (reloadreg) +
! SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (*loc)),
GET_MODE (SUBREG_REG (*loc)),
SUBREG_BYTE (*loc),
GET_MODE (*loc))));
--- 5839,5845 ----
if (GET_CODE (reloadreg) == REG)
return gen_rtx_REG (GET_MODE (*loc),
(REGNO (reloadreg) +
! subreg_regno_offset (REGNO (SUBREG_REG (*loc)),
GET_MODE (SUBREG_REG (*loc)),
SUBREG_BYTE (*loc),
GET_MODE (*loc))));
*************** refers_to_regno_for_reload_p (regno, end
*** 5932,5938 ****
if (GET_CODE (SUBREG_REG (x)) == REG
&& REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! unsigned int inner_regno = SUBREG_REGNO (x);
unsigned int inner_endregno
= inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
--- 5932,5938 ----
if (GET_CODE (SUBREG_REG (x)) == REG
&& REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! unsigned int inner_regno = subreg_regno (x);
unsigned int inner_endregno
= inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
*************** reg_overlap_mentioned_for_reload_p (x, i
*** 6027,6033 ****
{
regno = REGNO (SUBREG_REG (x));
if (regno < FIRST_PSEUDO_REGISTER)
! regno += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
--- 6027,6033 ----
{
regno = REGNO (SUBREG_REG (x));
if (regno < FIRST_PSEUDO_REGISTER)
! regno += subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
Index: gcc/reload1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload1.c,v
retrieving revision 1.229.2.1
diff -c -p -r1.229.2.1 reload1.c
*** reload1.c 2000/09/24 22:21:34 1.229.2.1
--- reload1.c 2000/11/17 20:43:18
*************** forget_old_reloads_1 (x, ignored, data)
*** 3985,3994 ****
int offset = 0;
/* note_stores does give us subregs of hard regs,
! SUBREG_REGNO_OFFSET will abort if it is not a hard reg. */
while (GET_CODE (x) == SUBREG)
{
! offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
--- 3985,3994 ----
int offset = 0;
/* note_stores does give us subregs of hard regs,
! subreg_regno_offset will abort if it is not a hard reg. */
while (GET_CODE (x) == SUBREG)
{
! offset += subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
*************** choose_reload_regs (chain)
*** 5273,5279 ****
byte = SUBREG_BYTE (rld[r].in_reg);
regno = REGNO (SUBREG_REG (rld[r].in_reg));
if (regno < FIRST_PSEUDO_REGISTER)
! regno = SUBREG_REGNO (rld[r].in_reg);
mode = GET_MODE (rld[r].in_reg);
}
#ifdef AUTO_INC_DEC
--- 5273,5279 ----
byte = SUBREG_BYTE (rld[r].in_reg);
regno = REGNO (SUBREG_REG (rld[r].in_reg));
if (regno < FIRST_PSEUDO_REGISTER)
! regno = subreg_regno (rld[r].in_reg);
mode = GET_MODE (rld[r].in_reg);
}
#ifdef AUTO_INC_DEC
*************** choose_reload_regs (chain)
*** 5294,5300 ****
that can invalidate an inherited reload of part of a pseudoreg. */
else if (GET_CODE (rld[r].in) == SUBREG
&& GET_CODE (SUBREG_REG (rld[r].in)) == REG)
! regno = SUBREG_REGNO (rld[r].in);
#endif
if (regno >= 0 && reg_last_reload_reg[regno] != 0)
--- 5294,5300 ----
that can invalidate an inherited reload of part of a pseudoreg. */
else if (GET_CODE (rld[r].in) == SUBREG
&& GET_CODE (SUBREG_REG (rld[r].in)) == REG)
! regno = subreg_regno (rld[r].in);
#endif
if (regno >= 0 && reg_last_reload_reg[regno] != 0)
*************** choose_reload_regs (chain)
*** 5304,5310 ****
enum machine_mode need_mode;
i = REGNO (last_reg);
! i += SUBREG_REGNO_OFFSET (i, GET_MODE (last_reg), byte, mode);
last_class = REGNO_REG_CLASS (i);
if (byte == 0)
--- 5304,5310 ----
enum machine_mode need_mode;
i = REGNO (last_reg);
! i += subreg_regno_offset (i, GET_MODE (last_reg), byte, mode);
last_class = REGNO_REG_CLASS (i);
if (byte == 0)
*************** choose_reload_regs (chain)
*** 5478,5484 ****
Make a new REG since this might be used in an
address and not all machines support SUBREGs
there. */
! regno = SUBREG_REGNO (equiv);
equiv = gen_rtx_REG (rld[r].mode, regno);
}
else
--- 5478,5484 ----
Make a new REG since this might be used in an
address and not all machines support SUBREGs
there. */
! regno = subreg_regno (equiv);
equiv = gen_rtx_REG (rld[r].mode, regno);
}
else
*************** reload_combine_note_store (dst, set, dat
*** 8630,8636 ****
if (GET_CODE (dst) == SUBREG)
{
! regno = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
--- 8630,8636 ----
if (GET_CODE (dst) == SUBREG)
{
! regno = subreg_regno_offset (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
*************** move2add_note_store (dst, set, data)
*** 9017,9023 ****
if (GET_CODE (dst) == SUBREG)
{
! regno = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
--- 9017,9023 ----
if (GET_CODE (dst) == SUBREG)
{
! regno = subreg_regno_offset (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
Index: gcc/resource.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/resource.c,v
retrieving revision 1.34.2.1
diff -c -p -r1.34.2.1 resource.c
*** resource.c 2000/09/24 22:21:35 1.34.2.1
--- resource.c 2000/11/17 20:43:18
*************** update_live_status (dest, x, data)
*** 99,105 ****
return;
if (GET_CODE (dest) == SUBREG)
! first_regno = SUBREG_REGNO (dest);
else
first_regno = REGNO (dest);
--- 99,105 ----
return;
if (GET_CODE (dest) == SUBREG)
! first_regno = subreg_regno (dest);
else
first_regno = REGNO (dest);
*************** mark_referenced_resources (x, res, inclu
*** 208,214 ****
mark_referenced_resources (SUBREG_REG (x), res, 0);
else
{
! unsigned int regno = SUBREG_REGNO (x);
unsigned int last_regno
= regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
--- 208,214 ----
mark_referenced_resources (SUBREG_REG (x), res, 0);
else
{
! unsigned int regno = subreg_regno (x);
unsigned int last_regno
= regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
*************** mark_set_resources (x, res, in_dest, mar
*** 756,762 ****
mark_set_resources (SUBREG_REG (x), res, in_dest, mark_type);
else
{
! unsigned int regno = SUBREG_REGNO (x);
unsigned int last_regno
= regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
--- 756,762 ----
mark_set_resources (SUBREG_REG (x), res, in_dest, mark_type);
else
{
! unsigned int regno = subreg_regno (x);
unsigned int last_regno
= regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
Index: gcc/rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.225.2.1
diff -c -p -r1.225.2.1 rtl.h
*** rtl.h 2000/09/24 22:21:35 1.225.2.1
--- rtl.h 2000/11/17 20:43:19
*************** extern const char * const note_insn_name
*** 781,813 ****
#define SUBREG_BYTE(RTX) XCUINT(RTX, 1, SUBREG)
#define SUBREG_WORD(RTX) ((RTX)->fld[1].subreg_word_no_longer_exists_dummy)
! /* Given XREGNO, a REGNO of an inner hard SUBREG_REG (or what will become
! one), XMODE the mode of that reg, OFFSET the byte offset, and YMODE
! the mode of a top level SUBREG (or what may become one) return regno
! offset which would be used. */
! #define SUBREG_REGNO_OFFSET(XREGNO,XMODE,OFFSET,YMODE) \
! (XREGNO >= FIRST_PSEUDO_REGISTER ? \
! (abort (), 0) : \
! (((OFFSET) == 0 \
! || (HARD_REGNO_NREGS (XREGNO, XMODE) == \
! HARD_REGNO_NREGS (XREGNO, YMODE))) ? \
! 0 : \
! ((GET_MODE_SIZE (YMODE) > GET_MODE_SIZE (XMODE)) ? \
! (abort (), 0) : \
! (((OFFSET / GET_MODE_SIZE (YMODE)) / \
! ((GET_MODE_SIZE (XMODE) / GET_MODE_SIZE (YMODE)) / \
! (HARD_REGNO_NREGS (XREGNO, XMODE) / \
! HARD_REGNO_NREGS (XREGNO, YMODE)))) * \
! HARD_REGNO_NREGS (XREGNO, YMODE)))))
!
! /* Given X, a SUBREG, with an inner SUBREG_REG which is
! a hard REG, give the final regno it refers to. */
! #define SUBREG_REGNO(X) \
! (REGNO (SUBREG_REG (X)) \
! + (SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (X)), \
! GET_MODE (SUBREG_REG (X)), \
! SUBREG_BYTE (X), \
! GET_MODE (X))))
/* 1 if the REG contained in SUBREG_REG is already known to be
sign- or zero-extended from the mode of the SUBREG to the mode of
--- 781,792 ----
#define SUBREG_BYTE(RTX) XCUINT(RTX, 1, SUBREG)
#define SUBREG_WORD(RTX) ((RTX)->fld[1].subreg_word_no_longer_exists_dummy)
! /* in rtlanal.c */
! extern unsigned int subreg_regno_offset PARAMS ((unsigned int,
! enum machine_mode,
! unsigned int,
! enum machine_mode));
! extern unsigned int subreg_regno PARAMS ((rtx));
/* 1 if the REG contained in SUBREG_REG is already known to be
sign- or zero-extended from the mode of the SUBREG to the mode of
Index: gcc/rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.69.2.1
diff -c -p -r1.69.2.1 rtlanal.c
*** rtlanal.c 2000/09/24 22:21:35 1.69.2.1
--- rtlanal.c 2000/11/17 20:43:20
*************** refers_to_regno_p (regno, endregno, x, l
*** 1022,1028 ****
if (GET_CODE (SUBREG_REG (x)) == REG
&& REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! unsigned int inner_regno = SUBREG_REGNO (x);
unsigned int inner_endregno
= inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
--- 1022,1028 ----
if (GET_CODE (SUBREG_REG (x)) == REG
&& REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
! unsigned int inner_regno = subreg_regno (x);
unsigned int inner_endregno
= inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
*************** reg_overlap_mentioned_p (x, in)
*** 1109,1115 ****
case SUBREG:
regno = REGNO (SUBREG_REG (x));
if (regno < FIRST_PSEUDO_REGISTER)
! regno = SUBREG_REGNO (x);
goto do_reg;
case REG:
--- 1109,1115 ----
case SUBREG:
regno = REGNO (SUBREG_REG (x));
if (regno < FIRST_PSEUDO_REGISTER)
! regno = subreg_regno (x);
goto do_reg;
case REG:
*************** loc_mentioned_in_p (loc, in)
*** 2506,2509 ****
--- 2506,2571 ----
return 1;
}
return 0;
+ }
+
+ /* This function returns the regno offset of a subreg expression.
+ xregno - A regno of an inner hard subreg_reg (or what will become one).
+ xmode - The mode of xregno.
+ offset - The byte offset.
+ ymode - The mode of a top level SUBREG (or what may become one).
+ RETURN - The regno offset which would be used.
+ This function can be overridden by defining SUBREG_REGNO_OFFSET,
+ taking the same parameters. */
+ unsigned int
+ subreg_regno_offset (xregno, xmode, offset, ymode)
+ unsigned int xregno;
+ enum machine_mode xmode;
+ unsigned int offset;
+ enum machine_mode ymode;
+ {
+ unsigned ret;
+ int nregs_xmode, nregs_ymode;
+ int mode_multiple, nregs_multiple;
+ int y_offset;
+
+ /* Check for an override, and use it instead. */
+ #ifdef SUBREG_REGNO_OFFSET
+ ret = SUBREG_REGNO_OFFSET (xregno, xmode, offset, ymode)
+ #else
+ if (xregno >= FIRST_PSEUDO_REGISTER)
+ abort ();
+
+ nregs_xmode = HARD_REGNO_NREGS (xregno, xmode);
+ nregs_ymode = HARD_REGNO_NREGS (xregno, ymode);
+ if (offset == 0 || nregs_xmode == nregs_ymode)
+ return 0;
+
+ /* size of ymode must not be greater than the size of xmode. */
+ mode_multiple = GET_MODE_SIZE (xmode) / GET_MODE_SIZE (ymode);
+ if (mode_multiple == 0)
+ abort ();
+
+ y_offset = offset / GET_MODE_SIZE (ymode);
+ nregs_multiple = nregs_xmode / nregs_ymode;
+ ret = (y_offset / (mode_multiple / nregs_multiple)) * nregs_ymode;
+ #endif
+
+ return ret;
+ }
+
+ /* Return the final regno that a subreg expression refers to. */
+ unsigned int
+ subreg_regno (x)
+ rtx x;
+ {
+ unsigned int ret;
+ rtx subreg = SUBREG_REG (x);
+ int regno = REGNO (subreg);
+
+ ret = regno + subreg_regno_offset (regno,
+ GET_MODE (subreg),
+ SUBREG_BYTE (x),
+ GET_MODE (x));
+ return ret;
+
}
Index: gcc/tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.145.2.1
diff -c -p -r1.145.2.1 tm.texi
*** tm.texi 2000/09/24 22:21:36 1.145.2.1
--- tm.texi 2000/11/17 20:43:24
*************** allocation.
*** 1675,1680 ****
--- 1675,1693 ----
Define this macro if the compiler should avoid copies to/from @code{CCmode}
registers. You should only define this macro if support for copying to/from
@code{CCmode} is incomplete.
+
+ @findex SUBREG_REGNO_OFFSET
+ @item SUBREG_REGNO_OFFSET
+ Define this macro if the compiler needs to handle subregs in a non-standard
+ way. The macro returns the correct regno offset for mode @code{YMODE} given
+ a subreg of type @code{XMODE}.
+ This macro takes 4 parameters:
+ @code{XREGNO} - A regno of an inner hard subreg_reg (or what will become one).
+ @code{XMODE} - The mode of xregno.
+ @code{OFFSET} - The byte offset.
+ @code{YMODE} - The mode of a top level SUBREG (or what may become one).
+ The default function can be found in rtlanal.c, function
+ @code{subreg_regno_offset}. Normally this does not need to be defined.
@end table
@node Leaf Functions
Index: gcc/config/a29k/a29k.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/a29k/a29k.c,v
retrieving revision 1.11.6.1
diff -c -p -r1.11.6.1 a29k.c
*** a29k.c 2000/09/24 22:21:36 1.11.6.1
--- a29k.c 2000/11/17 20:43:24
*************** gpc_reg_operand (op, mode)
*** 264,270 ****
else if (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG)
{
if (regno < FIRST_PSEUDO_REGISTER)
! regno = SUBREG_REGNO (op);
else
regno = REGNO (SUBREG_REG (op));
}
--- 264,270 ----
else if (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG)
{
if (regno < FIRST_PSEUDO_REGISTER)
! regno = subreg_regno (op);
else
regno = REGNO (SUBREG_REG (op));
}
Index: gcc/config/d30v/d30v.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/d30v/d30v.c,v
retrieving revision 1.3.2.1
diff -c -p -r1.3.2.1 d30v.c
*** d30v.c 2000/09/24 22:21:37 1.3.2.1
--- d30v.c 2000/11/17 20:43:25
*************** d30v_split_double (value, p_high, p_low)
*** 2674,2680 ****
case SUBREG:
if (GET_CODE (SUBREG_REG (value)) != REG)
abort ();
! offset = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (value)),
GET_MODE (SUBREG_REG (value)),
SUBREG_BYTE (value),
GET_MODE (value));
--- 2674,2680 ----
case SUBREG:
if (GET_CODE (SUBREG_REG (value)) != REG)
abort ();
! offset = subreg_regno_offset (REGNO (SUBREG_REG (value)),
GET_MODE (SUBREG_REG (value)),
SUBREG_BYTE (value),
GET_MODE (value));
*************** d30v_print_operand_memory_reference (str
*** 2803,2809 ****
if (GET_CODE (x0) == SUBREG)
{
! offset0 = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x0)),
GET_MODE (SUBREG_REG (x0)),
SUBREG_BYTE (x0),
GET_MODE (x0));
--- 2803,2809 ----
if (GET_CODE (x0) == SUBREG)
{
! offset0 = subreg_regno_offset (REGNO (SUBREG_REG (x0)),
GET_MODE (SUBREG_REG (x0)),
SUBREG_BYTE (x0),
GET_MODE (x0));
*************** d30v_print_operand_memory_reference (str
*** 2839,2845 ****
switch (GET_CODE (x1))
{
case SUBREG:
! offset1 = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x1)),
GET_MODE (SUBREG_REG (x1)),
SUBREG_BYTE (x1),
GET_MODE (x1));
--- 2839,2845 ----
switch (GET_CODE (x1))
{
case SUBREG:
! offset1 = subreg_regno_offset (REGNO (SUBREG_REG (x1)),
GET_MODE (SUBREG_REG (x1)),
SUBREG_BYTE (x1),
GET_MODE (x1));
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.100.2.1
diff -c -p -r1.100.2.1 mips.c
*** mips.c 2000/09/24 22:21:38 1.100.2.1
--- mips.c 2000/11/17 20:43:28
*************** mips_move_1word (operands, insn, unsigne
*** 1842,1848 ****
while (code0 == SUBREG)
{
! subreg_offset0 += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
--- 1842,1848 ----
while (code0 == SUBREG)
{
! subreg_offset0 += subreg_regno_offset (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
*************** mips_move_1word (operands, insn, unsigne
*** 1852,1858 ****
while (code1 == SUBREG)
{
! subreg_offset1 += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
--- 1852,1858 ----
while (code1 == SUBREG)
{
! subreg_offset1 += subreg_regno_offset (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
*************** mips_move_2words (operands, insn)
*** 2240,2246 ****
while (code0 == SUBREG)
{
! subreg_offset0 += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
--- 2240,2246 ----
while (code0 == SUBREG)
{
! subreg_offset0 += subreg_regno_offset (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
*************** mips_move_2words (operands, insn)
*** 2256,2262 ****
while (code1 == SUBREG)
{
! subreg_offset1 += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
--- 2256,2262 ----
while (code1 == SUBREG)
{
! subreg_offset1 += subreg_regno_offset (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
*************** mips_secondary_reload_class (class, mode
*** 7924,7930 ****
{
while (GET_CODE (x) == SUBREG)
{
! off += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
--- 7924,7930 ----
{
while (GET_CODE (x) == SUBREG)
{
! off += subreg_regno_offset (REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x),
GET_MODE (x));
Index: gcc/config/mn10200/mn10200.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10200/mn10200.c,v
retrieving revision 1.15.6.1
diff -c -p -r1.15.6.1 mn10200.c
*** mn10200.c 2000/09/24 22:21:42 1.15.6.1
--- mn10200.c 2000/11/17 20:43:29
*************** print_operand (file, x, code)
*** 163,169 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x)]);
break;
case CONST_DOUBLE:
--- 163,169 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x)]);
break;
case CONST_DOUBLE:
*************** print_operand (file, x, code)
*** 222,228 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x) + 1]);
break;
case CONST_DOUBLE:
--- 222,228 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x) + 1]);
break;
case CONST_DOUBLE:
*************** print_operand (file, x, code)
*** 321,327 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x)]);
break;
case CONST_INT:
--- 321,327 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x)]);
break;
case CONST_INT:
Index: gcc/config/mn10300/mn10300.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.c,v
retrieving revision 1.29.2.1
diff -c -p -r1.29.2.1 mn10300.c
*** mn10300.c 2000/09/24 22:21:43 1.29.2.1
--- mn10300.c 2000/11/17 20:43:29
*************** print_operand (file, x, code)
*** 144,150 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x)]);
break;
case CONST_DOUBLE:
--- 144,150 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x)]);
break;
case CONST_DOUBLE:
*************** print_operand (file, x, code)
*** 204,210 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x) + 1]);
break;
case CONST_DOUBLE:
--- 204,210 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x) + 1]);
break;
case CONST_DOUBLE:
*************** print_operand (file, x, code)
*** 288,294 ****
break;
case SUBREG:
! fprintf (file, "%s", reg_names[SUBREG_REGNO (x)]);
break;
/* This will only be single precision.... */
--- 288,294 ----
break;
case SUBREG:
! fprintf (file, "%s", reg_names[subreg_regno (x)]);
break;
/* This will only be single precision.... */
Index: gcc/config/pyr/pyr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/pyr/Attic/pyr.c,v
retrieving revision 1.6.10.1
diff -c -p -r1.6.10.1 pyr.c
*** pyr.c 2000/09/24 22:21:47 1.6.10.1
--- pyr.c 2000/11/17 20:43:30
*************** int
*** 404,410 ****
subreg_overlap_mentioned_p (subreg, x)
rtx subreg, x;
{
! int regno = SUBREG_REGNO (subreg);
int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (subreg));
return refers_to_regno_p (regno, endregno, x, 0);
}
--- 404,410 ----
subreg_overlap_mentioned_p (subreg, x)
rtx subreg, x;
{
! int regno = subreg_regno (subreg);
int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (subreg));
return refers_to_regno_p (regno, endregno, x, 0);
}
*************** consecutive_operands (op0, op1)
*** 431,437 ****
{
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0))) <= UNITS_PER_WORD)
return 0;
! regno_off0 = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
--- 431,437 ----
{
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0))) <= UNITS_PER_WORD)
return 0;
! regno_off0 = subreg_regno_offset (REGNO (SUBREG_REG (op0)),
GET_MODE (SUBREG_REG (op0)),
SUBREG_BYTE (op0),
GET_MODE (op0));
*************** consecutive_operands (op0, op1)
*** 444,450 ****
{
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op1))) <= UNITS_PER_WORD)
return 0;
! regno_off1 = SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
--- 444,450 ----
{
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op1))) <= UNITS_PER_WORD)
return 0;
! regno_off1 = subreg_regno_offset (REGNO (SUBREG_REG (op1)),
GET_MODE (SUBREG_REG (op1)),
SUBREG_BYTE (op1),
GET_MODE (op1));
Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.c,v
retrieving revision 1.67.2.1
diff -c -p -r1.67.2.1 sh.c
*** sh.c 2000/09/24 22:21:48 1.67.2.1
--- sh.c 2000/11/17 20:43:32
*************** output_movedouble (insn, operands, mode)
*** 664,670 ****
if (GET_CODE (inside) == REG)
ptrreg = REGNO (inside);
else if (GET_CODE (inside) == SUBREG)
! ptrreg = SUBREG_REGNO (inside);
else if (GET_CODE (inside) == PLUS)
{
ptrreg = REGNO (XEXP (inside, 0));
--- 664,670 ----
if (GET_CODE (inside) == REG)
ptrreg = REGNO (inside);
else if (GET_CODE (inside) == SUBREG)
! ptrreg = subreg_regno (inside);
else if (GET_CODE (inside) == PLUS)
{
ptrreg = REGNO (XEXP (inside, 0));
*************** regs_used (x, is_dest)
*** 2492,2498 ****
if (REGNO (y) < 16)
return (((1 << HARD_REGNO_NREGS (0, GET_MODE (x))) - 1)
<< (REGNO (y) +
! SUBREG_REGNO_OFFSET (REGNO (y),
GET_MODE (y),
SUBREG_BYTE (x),
GET_MOD (x)) + is_dest));
--- 2492,2498 ----
if (REGNO (y) < 16)
return (((1 << HARD_REGNO_NREGS (0, GET_MODE (x))) - 1)
<< (REGNO (y) +
! subreg_regno_offset (REGNO (y),
GET_MODE (y),
SUBREG_BYTE (x),
GET_MOD (x)) + is_dest));
*************** machine_dependent_reorg (first)
*** 3229,3235 ****
mode = HImode;
while (GET_CODE (dst) == SUBREG)
{
! offset += SUBREG_REGNO_OFFSET (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
--- 3229,3235 ----
mode = HImode;
while (GET_CODE (dst) == SUBREG)
{
! offset += subreg_regno_offset (REGNO (SUBREG_REG (dst)),
GET_MODE (SUBREG_REG (dst)),
SUBREG_BYTE (dst),
GET_MODE (dst));
Index: gcc/config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.md,v
retrieving revision 1.51.2.1
diff -c -p -r1.51.2.1 sh.md
*** sh.md 2000/09/24 22:21:48 1.51.2.1
--- sh.md 2000/11/17 20:43:34
***************
*** 2472,2478 ****
if (GET_CODE (operands[0]) == REG)
regno = REGNO (operands[0]);
else if (GET_CODE (operands[0]) == SUBREG)
! regno = SUBREG_REGNO (operands[0]);
else if (GET_CODE (operands[0]) == MEM)
regno = -1;
--- 2472,2478 ----
if (GET_CODE (operands[0]) == REG)
regno = REGNO (operands[0]);
else if (GET_CODE (operands[0]) == SUBREG)
! regno = subreg_regno (operands[0]);
else if (GET_CODE (operands[0]) == MEM)
regno = -1;
***************
*** 2857,2863 ****
if (GET_CODE (operands[0]) == REG)
regno = REGNO (operands[0]);
else if (GET_CODE (operands[0]) == SUBREG)
! regno = SUBREG_REGNO (operands[0]);
else if (GET_CODE (operands[0]) == MEM)
regno = -1;
--- 2857,2863 ----
if (GET_CODE (operands[0]) == REG)
regno = REGNO (operands[0]);
else if (GET_CODE (operands[0]) == SUBREG)
! regno = subreg_regno (operands[0]);
else if (GET_CODE (operands[0]) == MEM)
regno = -1;
Index: gcc/config/v850/v850.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/v850/v850.c,v
retrieving revision 1.31.2.1
diff -c -p -r1.31.2.1 v850.c
*** v850.c 2000/09/24 22:21:49 1.31.2.1
--- v850.c 2000/11/17 20:43:34
*************** print_operand (file, x, code)
*** 535,541 ****
fputs (reg_names[REGNO (x)], file);
break;
case SUBREG:
! fputs (reg_names[SUBREG_REGNO (x)], file);
break;
case CONST_INT:
case SYMBOL_REF:
--- 535,541 ----
fputs (reg_names[REGNO (x)], file);
break;
case SUBREG:
! fputs (reg_names[subreg_regno (x)], file);
break;
case CONST_INT:
case SYMBOL_REF:
*************** output_move_double (operands)
*** 817,823 ****
if (GET_CODE (inside) == REG)
ptrreg = REGNO (inside);
else if (GET_CODE (inside) == SUBREG)
! ptrreg = SUBREG_REGNO (inside);
else if (GET_CODE (inside) == PLUS)
ptrreg = REGNO (XEXP (inside, 0));
else if (GET_CODE (inside) == LO_SUM)
--- 817,823 ----
if (GET_CODE (inside) == REG)
ptrreg = REGNO (inside);
else if (GET_CODE (inside) == SUBREG)
! ptrreg = subreg_regno (inside);
else if (GET_CODE (inside) == PLUS)
ptrreg = REGNO (XEXP (inside, 0));
else if (GET_CODE (inside) == LO_SUM)
More information about the Gcc-patches
mailing list