summaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-13 12:26:26 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-13 12:26:26 +0000
commit38ea8a260f432bf729a9501ff9f46d7bef4101f3 (patch)
treebe300b9024e7162275964cad1fdb901a5e2ac0f0 /gcc/explow.c
parent09321e8528219e75c0452bce4661b7c543ec235f (diff)
downloadgcc-38ea8a260f432bf729a9501ff9f46d7bef4101f3.tar.gz
PR debug/70628
* rtl.h (convert_memory_address_addr_space_1): New prototype. * explow.c (convert_memory_address_addr_space_1): No longer static, add NO_EMIT argument and don't call convert_modes if true, pass it down recursively, remove break after return. (convert_memory_address_addr_space): Adjust caller. * simplify-rtx.c (simplify_unary_operation_1): Call convert_memory_address_addr_space_1 instead of convert_memory_address, if it returns NULL, don't simplify. * gcc.dg/torture/pr70628.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234933 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index 249318f44b5..48acd36b405 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -259,12 +259,14 @@ break_out_memory_refs (rtx x)
which way). We take advantage of the fact that pointers are not allowed to
overflow by commuting arithmetic operations over conversions so that address
arithmetic insns can be used. IN_CONST is true if this conversion is inside
- a CONST. */
+ a CONST. NO_EMIT is true if no insns should be emitted, and instead
+ it should return NULL if it can't be simplified without emitting insns. */
-static rtx
+rtx
convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
rtx x, addr_space_t as ATTRIBUTE_UNUSED,
- bool in_const ATTRIBUTE_UNUSED)
+ bool in_const ATTRIBUTE_UNUSED,
+ bool no_emit ATTRIBUTE_UNUSED)
{
#ifndef POINTERS_EXTEND_UNSIGNED
gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode);
@@ -310,19 +312,16 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
temp = gen_rtx_LABEL_REF (to_mode, LABEL_REF_LABEL (x));
LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x);
return temp;
- break;
case SYMBOL_REF:
temp = shallow_copy_rtx (x);
PUT_MODE (temp, to_mode);
return temp;
- break;
case CONST:
- return gen_rtx_CONST (to_mode,
- convert_memory_address_addr_space_1
- (to_mode, XEXP (x, 0), as, true));
- break;
+ temp = convert_memory_address_addr_space_1 (to_mode, XEXP (x, 0), as,
+ true, no_emit);
+ return temp ? gen_rtx_CONST (to_mode, temp) : temp;
case PLUS:
case MULT:
@@ -338,18 +337,25 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
&& CONST_INT_P (XEXP (x, 1))
&& ((in_const && POINTERS_EXTEND_UNSIGNED != 0)
|| XEXP (x, 1) == convert_memory_address_addr_space_1
- (to_mode, XEXP (x, 1), as, in_const)
+ (to_mode, XEXP (x, 1), as, in_const,
+ no_emit)
|| POINTERS_EXTEND_UNSIGNED < 0)))
- return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
- convert_memory_address_addr_space_1
- (to_mode, XEXP (x, 0), as, in_const),
- XEXP (x, 1));
+ {
+ temp = convert_memory_address_addr_space_1 (to_mode, XEXP (x, 0),
+ as, in_const, no_emit);
+ return temp ? gen_rtx_fmt_ee (GET_CODE (x), to_mode,
+ temp, XEXP (x, 1))
+ : temp;
+ }
break;
default:
break;
}
+ if (no_emit)
+ return NULL_RTX;
+
return convert_modes (to_mode, from_mode,
x, POINTERS_EXTEND_UNSIGNED);
#endif /* defined(POINTERS_EXTEND_UNSIGNED) */
@@ -364,7 +370,7 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
rtx
convert_memory_address_addr_space (machine_mode to_mode, rtx x, addr_space_t as)
{
- return convert_memory_address_addr_space_1 (to_mode, x, as, false);
+ return convert_memory_address_addr_space_1 (to_mode, x, as, false, false);
}