summaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-18 20:43:13 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-18 20:43:13 +0000
commit85d654ddd4b94ecbd2d2f291a6b6404fcde249ec (patch)
treedc06eda173c4ba3b692dac9d2c7c0e70f0eeba75 /gcc/explow.c
parent282368caa60b41902b386d6890cc601ee18a9e29 (diff)
downloadgcc-85d654ddd4b94ecbd2d2f291a6b6404fcde249ec.tar.gz
PR target/11184
* builtins.c (expand_builtin_apply): Use convert_memory_address before returning the value. * alias.c (find_base_value): Simplify use of convert_memory_address. (find_base_term): Likewise. * builtins.c (expand_builtin_stejmp_setup): Likewise. (expand_builtin_longjmp): Likewise. (expand_builtin_prefetch): Likewise. (get_memory_rtx): Likewise. (expand_builtin_return): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_va_arg): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_alloca): Likewise. * calls.c (expand_call): Likewise. * except.c (expand_builtin_extract_return_addr): Likewise. (expand_builtin_eh_return): Likewise. * explow.c (convert_memory_address): Define even when POINTER_EXTEND_UNSIGNED is not defined. Do nothing if the address is already in the right mode. * explow.c (memory_address): Simplify use of convert_memory_address. (probe_stack_range): Likewise. * expmed.c (make_tree): Likewise. * expr.c (emit_block_move_in_libcall): Likewise. (expand_assignment): Likewise. (expand_expr): Likewise. * function.c (assign_parms): Likewise. (expand_function_end): Likewise. * integrate.c (copy_rtx_and_substitute): Likewise. * stmt.c (expand_computed_goto): Likewise. PR target/11184 * gcc.dg/builtin-apply1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index e9ca57b7803..56f9a3ff04a 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -303,8 +303,6 @@ break_out_memory_refs (rtx x)
return x;
}
-#ifdef POINTERS_EXTEND_UNSIGNED
-
/* Given X, a memory address in ptr_mode, convert it to an address
in Pmode, or vice versa (TO_MODE says which way). We take advantage of
the fact that pointers are not allowed to overflow by commuting arithmetic
@@ -312,12 +310,22 @@ break_out_memory_refs (rtx x)
used. */
rtx
-convert_memory_address (enum machine_mode to_mode, rtx x)
+convert_memory_address (enum machine_mode to_mode ATTRIBUTE_UNUSED,
+ rtx x)
{
- enum machine_mode from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
+#ifndef POINTERS_EXTEND_UNSIGNED
+ return x;
+#else /* defined(POINTERS_EXTEND_UNSIGNED) */
+ enum machine_mode from_mode;
rtx temp;
enum rtx_code code;
+ /* If X already has the right mode, just return it. */
+ if (GET_MODE (x) == to_mode)
+ return x;
+
+ from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
+
/* Here we handle some special cases. If none of them apply, fall through
to the default case. */
switch (GET_CODE (x))
@@ -381,8 +389,8 @@ convert_memory_address (enum machine_mode to_mode, rtx x)
return convert_modes (to_mode, from_mode,
x, POINTERS_EXTEND_UNSIGNED);
+#endif /* defined(POINTERS_EXTEND_UNSIGNED) */
}
-#endif
/* Given a memory address or facsimile X, construct a new address,
currently equivalent, that is stable: future stores won't change it.
@@ -434,10 +442,7 @@ memory_address (enum machine_mode mode, rtx x)
if (GET_CODE (x) == ADDRESSOF)
return x;
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (x) != Pmode)
- x = convert_memory_address (Pmode, x);
-#endif
+ x = convert_memory_address (Pmode, x);
/* By passing constant addresses thru registers
we get a chance to cse them. */
@@ -1419,11 +1424,7 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
stack_pointer_rtx,
plus_constant (size, first)));
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (addr) != ptr_mode)
- addr = convert_memory_address (ptr_mode, addr);
-#endif
-
+ addr = convert_memory_address (ptr_mode, addr);
emit_library_call (stack_check_libfunc, LCT_NORMAL, VOIDmode, 1, addr,
ptr_mode);
}