re PR middle-end/33713 (can't find a register in class 'GENERAL_REGS' while reloading 'asm')

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.

From-SVN: r130591
This commit is contained in:
Steven Bosscher 2007-12-03 23:09:23 +00:00 committed by Aldy Hernandez
parent d2dda7fed0
commit 3de5e93a35
11 changed files with 42 additions and 96 deletions

View file

@ -1,3 +1,24 @@
2007-12-03 Steven Bosscher <stevenb.gcc@gmail.com>
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 <jakub@redhat.com>
* omp-low.c (lookup_decl_in_outer_ctx): Allow calling this

View file

@ -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;

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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. */

View file

@ -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);

View file

@ -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.

View file

@ -1,10 +0,0 @@
/* PR 23196 */
/* { dg-options "-fforce-addr" } */
void foo()
{
char c;
c |= 1;
bar(&c);
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 2001 Free Software Foundation.
by Hans-Peter Nilsson <hp@axis.com> */
/* { 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}
};