From 344b78b848693ada74b0ce238153c86fdf02ee09 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 30 Sep 2002 21:35:17 +0200 Subject: [PATCH] reload.c (push_reload): Handle subregs and secondary memory. * reload.c (push_reload): Handle subregs and secondary memory. * reload1.c (gen_reload): Likewise. * jump.c (reg_or_subregno): New function. * rtl.h (reg_or_subregno): Declare * unroll.c (find_splittable_givs): Handle subregs. From-SVN: r57663 --- gcc/ChangeLog | 9 +++++++++ gcc/jump.c | 12 ++++++++++++ gcc/reload.c | 13 +++++++------ gcc/reload1.c | 10 ++++++---- gcc/rtl.h | 1 + gcc/unroll.c | 4 ++-- 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7413d67..ef6c2ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +Mon Sep 30 21:33:23 CEST 2002 Jan Hubicka + + * reload.c (push_reload): Handle subregs and secondary memory. + * reload1.c (gen_reload): Likewise. + + * jump.c (reg_or_subregno): New function. + * rtl.h (reg_or_subregno): Declare + * unroll.c (find_splittable_givs): Handle subregs. + 2002-09-30 Mark Mitchell * store-layout.c (finish_record_layout): Add free_p parameter. diff --git a/gcc/jump.c b/gcc/jump.c index 5fef7b7..3b75110 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -2410,3 +2410,15 @@ true_regnum (x) } return -1; } + +/* Return regno of the register REG and handle subregs too. */ +unsigned int +reg_or_subregno (reg) + rtx reg; +{ + if (REG_P (reg)) + return REGNO (reg); + if (GET_CODE (reg) == SUBREG) + return REGNO (SUBREG_REG (reg)); + abort (); +} diff --git a/gcc/reload.c b/gcc/reload.c index ba5d075..2b42722 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -1285,9 +1285,9 @@ push_reload (in, out, inloc, outloc, class, #ifdef SECONDARY_MEMORY_NEEDED /* If a memory location is needed for the copy, make one. */ - if (in != 0 && GET_CODE (in) == REG - && REGNO (in) < FIRST_PSEUDO_REGISTER - && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)), + if (in != 0 && (GET_CODE (in) == REG || GET_CODE (in) == SUBREG) + && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER + && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)), class, inmode)) get_secondary_mem (in, inmode, opnum, type); #endif @@ -1315,9 +1315,10 @@ push_reload (in, out, inloc, outloc, class, n_reloads++; #ifdef SECONDARY_MEMORY_NEEDED - if (out != 0 && GET_CODE (out) == REG - && REGNO (out) < FIRST_PSEUDO_REGISTER - && SECONDARY_MEMORY_NEEDED (class, REGNO_REG_CLASS (REGNO (out)), + if (out != 0 && (GET_CODE (out) == REG || GET_CODE (out) == SUBREG) + && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER + && SECONDARY_MEMORY_NEEDED (class, + REGNO_REG_CLASS (reg_or_subregno (out)), outmode)) get_secondary_mem (out, outmode, opnum, type); #endif diff --git a/gcc/reload1.c b/gcc/reload1.c index 726a4bf..ea703f1 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -7532,10 +7532,12 @@ gen_reload (out, in, opnum, type) #ifdef SECONDARY_MEMORY_NEEDED /* If we need a memory location to do the move, do it that way. */ - else if (GET_CODE (in) == REG && REGNO (in) < FIRST_PSEUDO_REGISTER - && GET_CODE (out) == REG && REGNO (out) < FIRST_PSEUDO_REGISTER - && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)), - REGNO_REG_CLASS (REGNO (out)), + else if ((GET_CODE (in) == REG || GET_CODE (in) == SUBREG) + && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER + && (GET_CODE (out) == REG || GET_CODE (out) == SUBREG) + && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER + && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)), + REGNO_REG_CLASS (reg_or_subregno (out)), GET_MODE (out))) { /* Get the memory to use and rewrite both registers to its mode. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index e2afd90..d4147c2 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1943,6 +1943,7 @@ extern int invert_jump_1 PARAMS ((rtx, rtx)); extern int invert_jump PARAMS ((rtx, rtx, int)); extern int rtx_renumbered_equal_p PARAMS ((rtx, rtx)); extern int true_regnum PARAMS ((rtx)); +extern unsigned int reg_or_subregno PARAMS ((rtx)); extern int redirect_jump_1 PARAMS ((rtx, rtx)); extern int redirect_jump PARAMS ((rtx, rtx, int)); extern void rebuild_jump_labels PARAMS ((rtx)); diff --git a/gcc/unroll.c b/gcc/unroll.c index 126b5868..a1b0287 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -2822,7 +2822,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number) value = tem; } - splittable_regs[REGNO (v->new_reg)] = value; + splittable_regs[reg_or_subregno (v->new_reg)] = value; } else continue; @@ -2856,7 +2856,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number) if (! v->ignore) count = REG_IV_CLASS (ivs, REGNO (v->src_reg))->biv_count; - splittable_regs_updates[REGNO (v->new_reg)] = count; + splittable_regs_updates[reg_or_subregno (v->new_reg)] = count; } result++; -- 2.7.4