From 4d25f9eb022d859d0aa6f95cfb3c9fd38ef4a403 Mon Sep 17 00:00:00 2001 From: aldyh Date: Mon, 3 Dec 2007 23:09:23 +0000 Subject: [PATCH] PR33713 * doc/invoke.texi: Remove -fforce-addr documentation. * expr.c (emit_move_insn): Remove use of flag_force_addr. (expand_expr_real_1): Same. (do_tablejump): Same. Call memory_address instead of memory_address_noforce. * expr.h (memory_address_noforce): Remove prototype. * explow.c (memory_address): Remove support for flag_force_addr. (validize_mem): Same. (memory_address_noforce): Remove. * common.opt: Add dummy documentation for -fforce-addr. * combine.c (can_combine_p): Remove -fforce-addr comment. * config/cris/cris.h (OPTIMIZATION_OPTIONS): Remove set of flag_force_addr. * config/m68k/m68k.h (PIC_CASE_VECTOR_ADDRESS): Remove comment relating to memory_address_noforce. * testsuite/gcc.c-torture/compile/20050802-1.c: Remove. * testsuite/gcc.c-torture/compile/20011113-1.c: Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130591 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 ++++++++++++++ gcc/combine.c | 2 +- gcc/common.opt | 6 ++-- gcc/config/cris/cris.h | 5 +--- gcc/config/m68k/m68k.h | 4 +-- gcc/doc/invoke.texi | 7 +---- gcc/explow.c | 37 +++++------------------- gcc/expr.c | 27 +++++------------ gcc/expr.h | 3 -- gcc/testsuite/gcc.c-torture/compile/20050802-1.c | 10 ------- gcc/testsuite/gcc.dg/20011113-1.c | 16 ---------- 11 files changed, 42 insertions(+), 96 deletions(-) delete mode 100644 gcc/testsuite/gcc.c-torture/compile/20050802-1.c delete mode 100644 gcc/testsuite/gcc.dg/20011113-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3994e54..d24aa2a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2007-12-03 Steven Bosscher + + PR33713 + * doc/invoke.texi: Remove -fforce-addr documentation. + * expr.c (emit_move_insn): Remove use of flag_force_addr. + (expand_expr_real_1): Same. + (do_tablejump): Same. + Call memory_address instead of memory_address_noforce. + * expr.h (memory_address_noforce): Remove prototype. + * explow.c (memory_address): Remove support for flag_force_addr. + (validize_mem): Same. + (memory_address_noforce): Remove. + * common.opt: Add dummy documentation for -fforce-addr. + * combine.c (can_combine_p): Remove -fforce-addr comment. + * config/cris/cris.h (OPTIMIZATION_OPTIONS): Remove set of + flag_force_addr. + * config/m68k/m68k.h (PIC_CASE_VECTOR_ADDRESS): Remove comment + relating to memory_address_noforce. + * testsuite/gcc.c-torture/compile/20050802-1.c: Remove. + * testsuite/gcc.c-torture/compile/20011113-1.c: Remove. + 2007-12-03 Jakub Jelinek * omp-low.c (lookup_decl_in_outer_ctx): Allow calling this diff --git a/gcc/combine.c b/gcc/combine.c index cfd0ed1..4e7086f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1694,7 +1694,7 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ, change whether the life span of some REGs crosses calls or not, and it is a pain to update that information. Exception: if source is a constant, moving it later can't hurt. - Accept that special case, because it helps -fforce-addr a lot. */ + Accept that as a special case. */ || (DF_INSN_LUID (insn) < last_call_luid && ! CONSTANT_P (src))) return 0; diff --git a/gcc/common.opt b/gcc/common.opt index 0efce3f..e4916e4 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -482,11 +482,9 @@ ffloat-store Common Report Var(flag_float_store) Optimization Don't allocate floats and doubles in extended-precision registers -; Nonzero for -fforce-addr: load memory address into a register before -; reference to memory. This makes better cse but slower compilation. fforce-addr -Common Report Var(flag_force_addr) Optimization -Copy memory address constants into registers before use +Common +Does nothing. Preserved for backward compatibility. fforward-propagate Common Report Var(flag_forward_propagate) Optimization diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 4e1b964..b2748de 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -305,10 +305,7 @@ extern int target_flags; do \ { \ if ((OPTIMIZE) >= 2 || (SIZE)) \ - { \ - flag_force_addr = 1; \ - flag_omit_frame_pointer = 1; \ - } \ + flag_omit_frame_pointer = 1; \ } \ while (0) diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index d8e1d3a..862f7ca 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -755,9 +755,7 @@ __transfer_from_trampoline () \ } \ while (0) -/* Don't call memory_address_noforce for the address to fetch - the switch offset. This address is ok as it stands, - but memory_address_noforce would alter it. */ +/* This address is OK as it stands. */ #define PIC_CASE_VECTOR_ADDRESS(index) index /* For the 68000, we handle X+REG by loading X into a register R and diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c8a97f4..3376420 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -324,7 +324,7 @@ Objective-C and Objective-C++ Dialects}. -fcse-skip-blocks -fcx-limited-range -fdata-sections -fdce -fdce @gol -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol -fearly-inlining -fexpensive-optimizations -ffast-math @gol --ffinite-math-only -ffloat-store -fforce-addr -fforward-propagate @gol +-ffinite-math-only -ffloat-store -fforward-propagate @gol -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol -fgcse-sm -fif-conversion -fif-conversion2 -finline-functions @gol -finline-functions-called-once -finline-limit=@var{n} @gol @@ -5141,11 +5141,6 @@ function calls and pops them all at once. Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. -@item -fforce-addr -@opindex fforce-addr -Force memory address constants to be copied into registers before -doing arithmetic on them. - @item -fforward-propagate @opindex fforward-propagate Perform a forward propagation pass on RTL. The pass tries to combine two diff --git a/gcc/explow.c b/gcc/explow.c index c669e3f..a5ed65b 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -431,18 +431,21 @@ memory_address (enum machine_mode mode, rtx x) /* At this point, any valid address is accepted. */ if (memory_address_p (mode, x)) - goto win; + goto done; /* If it was valid before but breaking out memory refs invalidated it, use it the old way. */ if (memory_address_p (mode, oldx)) - goto win2; + { + x = oldx; + goto done; + } /* Perform machine-dependent transformations on X in certain cases. This is not necessary since the code below can handle all possible cases, but machine-dependent transformations can make better code. */ - LEGITIMIZE_ADDRESS (x, oldx, mode, win); + LEGITIMIZE_ADDRESS (x, oldx, mode, done); /* PLUS and MULT can appear in special ways as the result of attempts to make an address usable for indexing. @@ -482,17 +485,6 @@ memory_address (enum machine_mode mode, rtx x) the register is a valid address. */ else x = force_reg (Pmode, x); - - goto done; - - win2: - x = oldx; - win: - if (flag_force_addr && ! cse_not_expected && !REG_P (x)) - { - x = force_operand (x, NULL_RTX); - x = force_reg (Pmode, x); - } } done: @@ -515,20 +507,6 @@ memory_address (enum machine_mode mode, rtx x) return x; } -/* Like `memory_address' but pretend `flag_force_addr' is 0. */ - -rtx -memory_address_noforce (enum machine_mode mode, rtx x) -{ - int ambient_force_addr = flag_force_addr; - rtx val; - - flag_force_addr = 0; - val = memory_address (mode, x); - flag_force_addr = ambient_force_addr; - return val; -} - /* Convert a mem ref into one with a valid memory address. Pass through anything else unchanged. */ @@ -538,8 +516,7 @@ validize_mem (rtx ref) if (!MEM_P (ref)) return ref; ref = use_anchored_address (ref); - if (! (flag_force_addr && CONSTANT_ADDRESS_P (XEXP (ref, 0))) - && memory_address_p (GET_MODE (ref), XEXP (ref, 0))) + if (memory_address_p (GET_MODE (ref), XEXP (ref, 0))) return ref; /* Don't alter REF itself, since that is probably a stack slot. */ diff --git a/gcc/expr.c b/gcc/expr.c index 46cca7a..87ed3c2 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3391,16 +3391,12 @@ emit_move_insn (rtx x, rtx y) /* If X or Y are memory references, verify that their addresses are valid for the machine. */ if (MEM_P (x) - && ((! memory_address_p (GET_MODE (x), XEXP (x, 0)) - && ! push_operand (x, GET_MODE (x))) - || (flag_force_addr - && CONSTANT_ADDRESS_P (XEXP (x, 0))))) + && (! memory_address_p (GET_MODE (x), XEXP (x, 0)) + && ! push_operand (x, GET_MODE (x)))) x = validize_mem (x); if (MEM_P (y) - && (! memory_address_p (GET_MODE (y), XEXP (y, 0)) - || (flag_force_addr - && CONSTANT_ADDRESS_P (XEXP (y, 0))))) + && ! memory_address_p (GET_MODE (y), XEXP (y, 0))) y = validize_mem (y); gcc_assert (mode != BLKmode); @@ -7294,9 +7290,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (MEM_P (decl_rtl) && REG_P (XEXP (decl_rtl, 0))) temp = validize_mem (decl_rtl); - /* If DECL_RTL is memory, we are in the normal case and either - the address is not valid or it is not a register and -fforce-addr - is specified, get the address into a register. */ + /* If DECL_RTL is memory, we are in the normal case and the + address is not valid, get the address into a register. */ else if (MEM_P (decl_rtl) && modifier != EXPAND_INITIALIZER) { @@ -7305,8 +7300,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, decl_rtl = use_anchored_address (decl_rtl); if (modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_SUM - && (!memory_address_p (DECL_MODE (exp), XEXP (decl_rtl, 0)) - || (flag_force_addr && !REG_P (XEXP (decl_rtl, 0))))) + && !memory_address_p (DECL_MODE (exp), XEXP (decl_rtl, 0))) temp = replace_equiv_address (decl_rtl, copy_rtx (XEXP (decl_rtl, 0))); } @@ -7428,8 +7422,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_INITIALIZER && modifier != EXPAND_SUM - && (! memory_address_p (mode, XEXP (temp, 0)) - || flag_force_addr)) + && ! memory_address_p (mode, XEXP (temp, 0))) return replace_equiv_address (temp, copy_rtx (XEXP (temp, 0))); return temp; @@ -9970,10 +9963,6 @@ do_tablejump (rtx index, enum machine_mode mode, rtx range, rtx table_label, index = copy_to_mode_reg (Pmode, index); #endif - /* If flag_force_addr were to affect this address - it could interfere with the tricky assumptions made - about addresses that contain label-refs, - which may be valid only very near the tablejump itself. */ /* ??? The only correct use of CASE_VECTOR_MODE is the one inside the GET_MODE_SIZE, because this indicates how large insns are. The other uses should all be Pmode, because they are addresses. This code @@ -9987,7 +9976,7 @@ do_tablejump (rtx index, enum machine_mode mode, rtx range, rtx table_label, index = PIC_CASE_VECTOR_ADDRESS (index); else #endif - index = memory_address_noforce (CASE_VECTOR_MODE, index); + index = memory_address (CASE_VECTOR_MODE, index); temp = gen_reg_rtx (CASE_VECTOR_MODE); vector = gen_const_mem (CASE_VECTOR_MODE, index); convert_move (temp, vector, 0); diff --git a/gcc/expr.h b/gcc/expr.h index f9532ec..8cc5ae3 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -616,9 +616,6 @@ extern rtx eliminate_constant_term (rtx, rtx *); by emitting insns to perform arithmetic if nec. */ extern rtx memory_address (enum machine_mode, rtx); -/* Like `memory_address' but pretend `flag_force_addr' is 0. */ -extern rtx memory_address_noforce (enum machine_mode, rtx); - /* Return a memory reference like MEMREF, but with its mode changed to MODE and its address changed to ADDR. (VOIDmode means don't change the mode. diff --git a/gcc/testsuite/gcc.c-torture/compile/20050802-1.c b/gcc/testsuite/gcc.c-torture/compile/20050802-1.c deleted file mode 100644 index abd0b51..0000000 --- a/gcc/testsuite/gcc.c-torture/compile/20050802-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR 23196 */ -/* { dg-options "-fforce-addr" } */ - -void foo() -{ - char c; - - c |= 1; - bar(&c); -} diff --git a/gcc/testsuite/gcc.dg/20011113-1.c b/gcc/testsuite/gcc.dg/20011113-1.c deleted file mode 100644 index 3f40160..0000000 --- a/gcc/testsuite/gcc.dg/20011113-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - by Hans-Peter Nilsson */ - -/* { dg-do compile } */ -/* { dg-options "-O2 -fforce-addr" } */ - -const char foo[] = "fum"; -const struct fi -{ - const char *const in; - const char *const out; - const int flags; -} fie[] = { - {"nw", " new", 0}, - {"dl", foo, 1} -}; -- 2.7.4