if needed.
(expand_builtin_longjmp, expand_builtin_alloca): Likewise.
* except.c (expand_builtin_frob_return_addr): Likewise.
(expand_builtin_eh_return): Likewise.
* stmt.c (expand_computed_goto): Likewise.
* explow.c (memory_address): Likewise.
(allocate_dynamic_stack_space): Clean up predicate testing.
(probe_stack_range): Convert SIZE to Pmode.
* calls.c (rtx_for_function_call): Only call convert_memory_address
if needed.
Pass function call operand as ptr_mode, not Pmode.
* expr.c (expand_assignment): Clean up calls to convert_memory
address by only doing so when needed and making offsets Pmode.
(store_constructor, expand_expr, expand_expr_unaligned): Likewise.
* function.c (assign_parms): Ensure address in MEM for RESULT_DECL
is in Pmode, not ptr_mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46448
138bc75d-0d04-0410-961f-
82ee72b054a4
+Tue Oct 23 13:05:53 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.
+
+ * builtins.c (expand_builtin_setjmp): Only call convert_memory_address
+ if needed.
+ (expand_builtin_longjmp, expand_builtin_alloca): Likewise.
+ * except.c (expand_builtin_frob_return_addr): Likewise.
+ (expand_builtin_eh_return): Likewise.
+ * stmt.c (expand_computed_goto): Likewise.
+ * explow.c (memory_address): Likewise.
+ (allocate_dynamic_stack_space): Clean up predicate testing.
+ (probe_stack_range): Convert SIZE to Pmode.
+ * calls.c (rtx_for_function_call): Only call convert_memory_address
+ if needed.
+ Pass function call operand as ptr_mode, not Pmode.
+ * expr.c (expand_assignment): Clean up calls to convert_memory
+ address by only doing so when needed and making offsets Pmode.
+ (store_constructor, expand_expr, expand_expr_unaligned): Likewise.
+ * function.c (assign_parms): Ensure address in MEM for RESULT_DECL
+ is in Pmode, not ptr_mode.
+
2001-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* darwin-protos.h (constructor_section, destructor_section,
setjmp_alias_set = new_alias_set ();
#ifdef POINTERS_EXTEND_UNSIGNED
- buf_addr = convert_memory_address (Pmode, buf_addr);
+ if (GET_MODE (buf_addr) != Pmode)
+ buf_addr = convert_memory_address (Pmode, buf_addr);
#endif
buf_addr = force_reg (Pmode, force_operand (buf_addr, NULL_RTX));
setjmp_alias_set = new_alias_set ();
#ifdef POINTERS_EXTEND_UNSIGNED
- buf_addr = convert_memory_address (Pmode, buf_addr);
+ if (GET_MODE (buf_addr) != Pmode)
+ buf_addr = convert_memory_address (Pmode, buf_addr);
#endif
+
buf_addr = force_reg (Pmode, buf_addr);
/* We used to store value in static_chain_rtx, but that fails if pointers
result = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
#ifdef POINTERS_EXTEND_UNSIGNED
- result = convert_memory_address (ptr_mode, result);
+ if (GET_MODE (result) != ptr_mode)
+ result = convert_memory_address (ptr_mode, result);
#endif
return result;
{
rtx funaddr;
push_temp_slots ();
- funaddr = funexp =
- expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
+ funaddr = funexp
+ = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
pop_temp_slots (); /* FUNEXP can't be BLKmode. */
/* Check the function is executable. */
if (current_function_check_memory_usage)
{
#ifdef POINTERS_EXTEND_UNSIGNED
- /* It might be OK to convert funexp in place, but there's
- a lot going on between here and when it happens naturally
- that this seems safer. */
- funaddr = convert_memory_address (Pmode, funexp);
+ if (GET_MODE (funexp) != ptr_mode)
+ funaddr = convert_memory_address (ptr_mode, funexp);
#endif
emit_library_call (chkr_check_exec_libfunc, LCT_CONST_MAKE_BLOCK,
- VOIDmode, 1, funaddr, Pmode);
+ VOIDmode, 1, funaddr, ptr_mode);
}
emit_queue ();
}
expand_builtin_frob_return_addr (addr_tree)
tree addr_tree;
{
- rtx addr = expand_expr (addr_tree, NULL_RTX, Pmode, 0);
+ rtx addr = expand_expr (addr_tree, NULL_RTX, ptr_mode, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- addr = convert_memory_address (Pmode, addr);
+ if (GET_MODE (addr) != Pmode)
+ addr = convert_memory_address (Pmode, addr);
#endif
#ifdef RETURN_ADDR_OFFSET
handler = expand_expr (handler_tree, cfun->eh->ehr_handler, VOIDmode, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- stackadj = convert_memory_address (Pmode, stackadj);
- handler = convert_memory_address (Pmode, handler);
+ if (GET_MODE (stackadj) != Pmode)
+ stackadj = convert_memory_address (Pmode, stackadj);
+
+ if (GET_MODE (handler) != Pmode)
+ handler = convert_memory_address (Pmode, handler);
#endif
if (! cfun->eh->ehr_label)
return x;
#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (x) == ptr_mode)
+ if (GET_MODE (x) != Pmode)
x = convert_memory_address (Pmode, x);
#endif
enum machine_mode mode = STACK_SIZE_MODE;
insn_operand_predicate_fn pred;
- pred = insn_data[(int) CODE_FOR_allocate_stack].operand[0].predicate;
- if (pred && ! ((*pred) (target, Pmode)))
-#ifdef POINTERS_EXTEND_UNSIGNED
- target = convert_memory_address (Pmode, target);
-#else
- target = copy_to_mode_reg (Pmode, target);
-#endif
-
+ /* We don't have to check against the predicate for operand 0 since
+ TARGET is known to be a pseudo of the proper mode, which must
+ be valid for the operand. For operand 1, convert to the
+ proper mode and validate. */
if (mode == VOIDmode)
- mode = Pmode;
+ mode = insn_data[(int) CODE_FOR_allocate_stack].operand[1].mode;
pred = insn_data[(int) CODE_FOR_allocate_stack].operand[1].predicate;
if (pred && ! ((*pred) (size, mode)))
HOST_WIDE_INT first;
rtx size;
{
- /* First see if the front end has set up a function for us to call to
+ /* First ensure SIZE is Pmode. */
+ if (GET_MODE (size) != VOIDmode && GET_MODE (size) != Pmode)
+ size = convert_to_mode (Pmode, size, 1);
+
+ /* Next see if the front end has set up a function for us to call to
check the stack. */
if (stack_check_libfunc != 0)
{
abort ();
if (GET_MODE (offset_rtx) != ptr_mode)
- {
+ offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
+
#ifdef POINTERS_EXTEND_UNSIGNED
- offset_rtx = convert_memory_address (ptr_mode, offset_rtx);
-#else
- offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
+ if (GET_MODE (offset_rtx) != Pmode)
+ offset_rtx = convert_memory_address (Pmode, offset_rtx);
#endif
- }
/* A constant address in TO_RTX can have VOIDmode, we must not try
to call force_reg for that case. Avoid that case. */
offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- offset_rtx = convert_memory_address (Pmode, offset_rtx);
+ if (GET_MODE (offset_rtx) != Pmode)
+ offset_rtx = convert_memory_address (Pmode, offset_rtx);
#endif
to_rtx = offset_address (to_rtx, offset_rtx,
offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- offset_rtx = convert_memory_address (ptr_mode, offset_rtx);
+ if (GET_MODE (offset_rtx) != Pmode)
+ offset_rtx = convert_memory_address (Pmode, offset_rtx);
#endif
/* A constant address in OP0 can have VOIDmode, we must not try
offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- offset_rtx = convert_memory_address (ptr_mode, offset_rtx);
+ if (GET_MODE (offset_rtx) != Pmode)
+ offset_rtx = convert_memory_address (Pmode, offset_rtx);
#endif
op0 = offset_address (op0, offset_rtx,
if (parm == function_result_decl)
{
tree result = DECL_RESULT (fndecl);
- rtx x = gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm));
+ rtx addr = DECL_RTL (parm);
+ rtx x;
+#ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (addr) != Pmode)
+ addr = convert_memory_address (Pmode, addr);
+#endif
+
+ x = gen_rtx_MEM (DECL_MODE (result), addr);
set_mem_attributes (x, result, 1);
SET_DECL_RTL (result, x);
}
rtx x = expand_expr (exp, NULL_RTX, VOIDmode, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
- x = convert_memory_address (Pmode, x);
+ if (GET_MODE (x) != Pmode)
+ x = convert_memory_address (Pmode, x);
#endif
emit_queue ();