backport: re PR target/52698 (-maddress-mode=long doesn't work)

Backported from mainline
	2012-03-27  Uros Bizjak  <ubizjak@gmail.com>

	PR target/52698
	* config/i386/i386-protos.h (ix86_legitimize_reload_address):
	New prototype.
	* config/i386/i386.h (LEGITIMIZE_RELOAD_ADDRESS): New define.
	* config/i386/i386.c: Include reload.h.
	(ix86_legitimize_reload_address): New function.

From-SVN: r185972
This commit is contained in:
Uros Bizjak 2012-03-29 21:16:34 +02:00
parent 36940623d0
commit d9b7123a02
4 changed files with 89 additions and 6 deletions

View File

@ -1,3 +1,15 @@
2012-03-29 Uros Bizjak <ubizjak@gmail.com>
Backported from mainline
2012-03-27 Uros Bizjak <ubizjak@gmail.com>
PR target/52698
* config/i386/i386-protos.h (ix86_legitimize_reload_address):
New prototype.
* config/i386/i386.h (LEGITIMIZE_RELOAD_ADDRESS): New define.
* config/i386/i386.c: Include reload.h.
(ix86_legitimize_reload_address): New function.
2012-03-28 Martin Jambor <mjambor@suse.cz>
Backported from mainline
@ -255,7 +267,7 @@
Backported from mainline
2012-03-13 Jakub Jelinek <jakub@redhat.com>
PR c/52577
* c-parser.c (c_parser_postfix_expression)
<case RID_BUILTIN_SHUFFLE>: Call mark_exp_read on argument values.
@ -344,8 +356,8 @@
2012-03-07 Ralf Corsépius <ralf.corsepius@rtems.org>
PR target/51417
* Makefile.in: Let install-gcc-ar depend on installdirs, gcc-ar$(exeext),
gcc-nm$(exeext), gcc-ranlib$(exeext).
* Makefile.in: Let install-gcc-ar depend on installdirs,
gcc-ar$(exeext), gcc-nm$(exeext), gcc-ranlib$(exeext).
Don't double canonicalize if cross-compiling.
2012-03-06 Aldy Hernandez <aldyh@redhat.com>
@ -504,7 +516,7 @@
2012-03-01 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Restore built-in
defines for __UINT24_MAX__, __INT24_MAX__, __INT24_MIN__
defines for __UINT24_MAX__, __INT24_MAX__, __INT24_MIN__
unintentionally removed in r184616.
2012-03-01 Venkataramanan Kumar <venkataramanan.kumar@amd.com>
@ -660,7 +672,7 @@
* config/avr/avr-devices.c (avr_mcu_type): Adjust NULL part
of initializer to changes from r184614.
2012-02-28 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52395

View File

@ -65,7 +65,8 @@ extern bool ix86_expand_strlen (rtx, rtx, rtx, rtx);
extern bool constant_address_p (rtx);
extern bool legitimate_pic_operand_p (rtx);
extern bool legitimate_pic_address_disp_p (rtx);
extern bool ix86_legitimize_reload_address (rtx, enum machine_mode,
int, int, int);
extern void print_reg (rtx, int, FILE*);
extern void ix86_print_operand (FILE *, rtx, int);

View File

@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "common/common-target.h"
#include "langhooks.h"
#include "reload.h"
#include "cgraph.h"
#include "gimple.h"
#include "dwarf2.h"
@ -11923,6 +11924,64 @@ legitimate_pic_address_disp_p (rtx disp)
return false;
}
/* Our implementation of LEGITIMIZE_RELOAD_ADDRESS. Returns a value to
replace the input X, or the original X if no replacement is called for.
The output parameter *WIN is 1 if the calling macro should goto WIN,
0 if it should not. */
bool
ix86_legitimize_reload_address (rtx x,
enum machine_mode mode ATTRIBUTE_UNUSED,
int opnum, int type,
int ind_levels ATTRIBUTE_UNUSED)
{
/* Reload can generate:
(plus:DI (plus:DI (unspec:DI [(const_int 0 [0])] UNSPEC_TP)
(reg:DI 97))
(reg:DI 2 cx))
This RTX is rejected from ix86_legitimate_address_p due to
non-strictness of base register 97. Following this rejection,
reload pushes all three components into separate registers,
creating invalid memory address RTX.
Following code reloads only the invalid part of the
memory address RTX. */
if (GET_CODE (x) == PLUS
&& REG_P (XEXP (x, 1))
&& GET_CODE (XEXP (x, 0)) == PLUS
&& REG_P (XEXP (XEXP (x, 0), 1)))
{
rtx base, index;
bool something_reloaded = false;
base = XEXP (XEXP (x, 0), 1);
if (!REG_OK_FOR_BASE_STRICT_P (base))
{
push_reload (base, NULL_RTX, &XEXP (XEXP (x, 0), 1), NULL,
BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
opnum, (enum reload_type)type);
something_reloaded = true;
}
index = XEXP (x, 1);
if (!REG_OK_FOR_INDEX_STRICT_P (index))
{
push_reload (index, NULL_RTX, &XEXP (x, 1), NULL,
INDEX_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
opnum, (enum reload_type)type);
something_reloaded = true;
}
gcc_assert (something_reloaded);
return true;
}
return false;
}
/* Recognizes RTL expressions that are valid memory addresses for an
instruction. The MODE argument is the machine mode for the MEM
expression that wants to use this address.

View File

@ -1629,6 +1629,17 @@ typedef struct ix86_args {
#define CONSTANT_ADDRESS_P(X) constant_address_p (X)
/* Try a machine-dependent way of reloading an illegitimate address
operand. If we find one, push the reload and jump to WIN. This
macro is used in only one place: `find_reloads_address' in reload.c. */
#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, INDL, WIN) \
do { \
if (ix86_legitimize_reload_address ((X), (MODE), (OPNUM), \
(int)(TYPE), (INDL))) \
goto WIN; \
} while (0)
/* If defined, a C expression to determine the base term of address X.
This macro is used in only one place: `find_base_term' in alias.c.