From 49d801d3dba0c2ed5038253a447ca2cdff549754 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 14 Nov 2001 14:51:10 +0100 Subject: [PATCH] dbxout.c (dbxout_symbol_location): Update call of alter_subreg. * dbxout.c (dbxout_symbol_location): Update call of alter_subreg. * final.c (walk_alter_subreg): Take pointer; update call of alter_subreg. (final_scan_insn): Update call of alter_subreg. (cleanup_subreg_operands): Likewise. (alter_subreg): Rewrite using simplify_subreg. (output_address, output_operand): Update call of alter_subreg. * output.h (alter_subreg): Update prototype. * sdbout.c (sdbout_symbol): Update call of alter_subreg. * simplify-rtx.c (simplify_subreg): Copy ORIGINAL_REGNO. * Makefile.in (final.o): Add depdendancy on expr.h From-SVN: r47013 --- gcc/ChangeLog | 13 ++++++++ gcc/Makefile.in | 2 +- gcc/dbxout.c | 2 +- gcc/final.c | 79 ++++++++++++++++------------------------------ gcc/output.h | 2 +- gcc/sdbout.c | 2 +- gcc/simplify-rtx.c | 13 +++++++- 7 files changed, 57 insertions(+), 56 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 16f781402e5..d22a17a9257 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +Wed Nov 14 14:17:05 CET 2001 Jan Hubicka + + * dbxout.c (dbxout_symbol_location): Update call of alter_subreg. + * final.c (walk_alter_subreg): Take pointer; update call of alter_subreg. + (final_scan_insn): Update call of alter_subreg. + (cleanup_subreg_operands): Likewise. + (alter_subreg): Rewrite using simplify_subreg. + (output_address, output_operand): Update call of alter_subreg. + * output.h (alter_subreg): Update prototype. + * sdbout.c (sdbout_symbol): Update call of alter_subreg. + * simplify-rtx.c (simplify_subreg): Copy ORIGINAL_REGNO. + * Makefile.in (final.o): Add depdendancy on expr.h + Wed Nov 14 06:37:54 2001 Richard Kenner * c-lang.c (finish_file): Make I unsigned to eliminate warning. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 57ae5a6c170..6231c440c96 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1575,7 +1575,7 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \ $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \ real.h output.h hard-reg-set.h except.h debug.h xcoffout.h \ - toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) + toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) function.h $(BASIC_BLOCK_H) \ $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h flags.h insn-config.h \ $(INSN_ATTR_H) real.h toplev.h output.h reload.h $(TM_P_H) diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 8528abfcaa9..344ebbefeae 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2107,7 +2107,7 @@ dbxout_symbol_location (decl, type, suffix, home) if (REGNO (value) >= FIRST_PSEUDO_REGISTER) return 0; } - home = alter_subreg (home); + home = alter_subreg (&home); } if (GET_CODE (home) == REG) { diff --git a/gcc/final.c b/gcc/final.c index 351fe017c49..733503e9424 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -67,6 +67,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "basic-block.h" #include "target.h" #include "debug.h" +#include "expr.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" /* Needed for external data @@ -242,7 +243,7 @@ static void profile_after_prologue PARAMS ((FILE *)); static void add_bb PARAMS ((FILE *)); static int add_bb_string PARAMS ((const char *, int)); static void notice_source_line PARAMS ((rtx)); -static rtx walk_alter_subreg PARAMS ((rtx)); +static rtx walk_alter_subreg PARAMS ((rtx *)); static void output_asm_name PARAMS ((void)); static tree get_decl_from_op PARAMS ((rtx, int *)); static void output_asm_operand_names PARAMS ((rtx *, int *, int)); @@ -2634,15 +2635,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) && insn != last_ignored_compare) { if (GET_CODE (SET_SRC (set)) == SUBREG) - SET_SRC (set) = alter_subreg (SET_SRC (set)); + SET_SRC (set) = alter_subreg (&SET_SRC (set)); else if (GET_CODE (SET_SRC (set)) == COMPARE) { if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG) XEXP (SET_SRC (set), 0) - = alter_subreg (XEXP (SET_SRC (set), 0)); + = alter_subreg (&XEXP (SET_SRC (set), 0)); if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG) XEXP (SET_SRC (set), 1) - = alter_subreg (XEXP (SET_SRC (set), 1)); + = alter_subreg (&XEXP (SET_SRC (set), 1)); } if ((cc_status.value1 != 0 && rtx_equal_p (SET_SRC (set), cc_status.value1)) @@ -3004,21 +3005,21 @@ cleanup_subreg_operands (insn) for (i = 0; i < recog_data.n_operands; i++) { if (GET_CODE (recog_data.operand[i]) == SUBREG) - recog_data.operand[i] = alter_subreg (recog_data.operand[i]); + recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]); else if (GET_CODE (recog_data.operand[i]) == PLUS || GET_CODE (recog_data.operand[i]) == MULT || GET_CODE (recog_data.operand[i]) == MEM) - recog_data.operand[i] = walk_alter_subreg (recog_data.operand[i]); + recog_data.operand[i] = walk_alter_subreg (recog_data.operand_loc[i]); } for (i = 0; i < recog_data.n_dups; i++) { if (GET_CODE (*recog_data.dup_loc[i]) == SUBREG) - *recog_data.dup_loc[i] = alter_subreg (*recog_data.dup_loc[i]); + *recog_data.dup_loc[i] = alter_subreg (recog_data.dup_loc[i]); else if (GET_CODE (*recog_data.dup_loc[i]) == PLUS || GET_CODE (*recog_data.dup_loc[i]) == MULT || GET_CODE (*recog_data.dup_loc[i]) == MEM) - *recog_data.dup_loc[i] = walk_alter_subreg (*recog_data.dup_loc[i]); + *recog_data.dup_loc[i] = walk_alter_subreg (recog_data.dup_loc[i]); } } @@ -3026,66 +3027,42 @@ cleanup_subreg_operands (insn) based on the thing it is a subreg of. */ rtx -alter_subreg (x) - rtx x; +alter_subreg (xp) + rtx *xp; { + rtx x = *xp; rtx y = SUBREG_REG (x); - if (GET_CODE (y) == SUBREG) - y = alter_subreg (y); - - /* If reload is operating, we may be replacing inside this SUBREG. - Check for that and make a new one if so. */ - if (reload_in_progress && find_replacement (&SUBREG_REG (x)) != 0) - x = copy_rtx (x); - - if (GET_CODE (y) == REG) - { - int regno = subreg_hard_regno (x, 1); - - PUT_CODE (x, REG); - REGNO (x) = regno; - ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y); - /* This field has a different meaning for REGs and SUBREGs. Make sure - to clear it! */ - x->used = 0; - } - else if (GET_CODE (y) == MEM) - { - HOST_WIDE_INT offset = SUBREG_BYTE (x); - - /* Catch these instead of generating incorrect code. */ - if ((offset % GET_MODE_SIZE (GET_MODE (x))) != 0) - abort (); - - PUT_CODE (x, MEM); - MEM_COPY_ATTRIBUTES (x, y); - XEXP (x, 0) = plus_constant (XEXP (y, 0), offset); - } - - return x; + /* simplify_subreg does not remove subreg from volatile references. + We are required to. */ + if (GET_CODE (y) == MEM) + *xp = adjust_address (y, GET_MODE (x), SUBREG_BYTE (x)); + else + *xp = simplify_subreg (GET_MODE (x), y, GET_MODE (y), SUBREG_BYTE (x)); + return *xp; } /* Do alter_subreg on all the SUBREGs contained in X. */ static rtx -walk_alter_subreg (x) - rtx x; +walk_alter_subreg (xp) + rtx *xp; { + rtx x = *xp; switch (GET_CODE (x)) { case PLUS: case MULT: - XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0)); - XEXP (x, 1) = walk_alter_subreg (XEXP (x, 1)); + XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0)); + XEXP (x, 1) = walk_alter_subreg (&XEXP (x, 1)); break; case MEM: - XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0)); + XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0)); break; case SUBREG: - return alter_subreg (x); + return alter_subreg (xp); default: break; @@ -3624,7 +3601,7 @@ output_operand (x, code) int code ATTRIBUTE_UNUSED; { if (x && GET_CODE (x) == SUBREG) - x = alter_subreg (x); + x = alter_subreg (&x); /* If X is a pseudo-register, abort now rather than writing trash to the assembler file. */ @@ -3643,7 +3620,7 @@ void output_address (x) rtx x; { - walk_alter_subreg (x); + walk_alter_subreg (&x); PRINT_OPERAND_ADDRESS (asm_out_file, x); } diff --git a/gcc/output.h b/gcc/output.h index dc2a6983d35..793798809ca 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -77,7 +77,7 @@ extern rtx final_scan_insn PARAMS ((rtx, FILE *, int, int, int)); /* Replace a SUBREG with a REG or a MEM, based on the thing it is a subreg of. */ -extern rtx alter_subreg PARAMS ((rtx)); +extern rtx alter_subreg PARAMS ((rtx *)); /* Report inconsistency between the assembler template and the operands. In an `asm', it's the user's fault; otherwise, the compiler's fault. */ diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 8a6ea31ab79..ab0a0d89849 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -809,7 +809,7 @@ sdbout_symbol (decl, local) if (REGNO (value) >= FIRST_PSEUDO_REGISTER) return; } - regno = REGNO (alter_subreg (DECL_RTL (decl))); + regno = REGNO (alter_subreg (&DECL_RTL (decl))); value = DECL_RTL (decl); } /* Don't output anything if an auto variable diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 9f50ed9459f..0f11556251d 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2587,7 +2587,18 @@ simplify_subreg (outermode, op, innermode, byte) arguments are passed on 32-bit Sparc and should be fixed. */ if (HARD_REGNO_MODE_OK (final_regno, outermode) || ! HARD_REGNO_MODE_OK (REGNO (op), innermode)) - return gen_rtx_REG (outermode, final_regno); + { + rtx x = gen_rtx_REG (outermode, final_regno); + + /* Propagate original regno. We don't have any way to specify + the offset inside orignal regno, so do so only for lowpart. + The information is used only by alias analysis that can not + grog partial register anyway. */ + + if (subreg_lowpart_offset (outermode, innermode) == byte) + ORIGINAL_REGNO (x) = ORIGINAL_REGNO (op); + return x; + } } /* If we have a SUBREG of a register that we are replacing and we are -- 2.30.2