Mixed 32/64 pointer support in builtins.c
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Sun Oct 28 12:51:00 GMT 2001
It wasn't done in builtins.c. Tested on Alpha/OpenVMS, one of the few
systems that supports these things.
Sun Oct 28 15:45:16 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* builtins.c (get_memory_rtx): Handle POINTERS_EXTEND_UNSIGNED case.
(expand_builtin_apply, expand_builtin_return): Likewise.
(expand_builtin_va_arg, expand_builtin_va_copy): Likewise.
*** builtins.c 2001/10/23 22:59:14 1.124
--- builtins.c 2001/10/28 20:22:45
*************** get_memory_rtx (exp)
*** 723,731 ****
tree exp;
{
! rtx mem = gen_rtx_MEM (BLKmode,
! memory_address (BLKmode,
! expand_expr (exp, NULL_RTX,
! ptr_mode, EXPAND_SUM)));
set_mem_attributes (mem, exp, 0);
--- 723,735 ----
tree exp;
{
! rtx addr = expand_expr (exp, NULL_RTX, ptr_mode, EXPAND_SUM);
! rtx mem;
+ #ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (addr) != Pmode)
+ addr = convert_memory_address (Pmode, addr);
+ #endif
+
+ mem = gen_rtx_MEM (BLKmode, memory_address (BLKmode, addr));
set_mem_attributes (mem, exp, 0);
*************** expand_builtin_apply (function, argument
*** 1049,1052 ****
--- 1053,1061 ----
rtx call_fusage = 0;
+ #ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (arguments) != Pmode)
+ arguments = convert_memory_address (Pmode, arguments);
+ #endif
+
/* Create a block where the return registers can be saved. */
result = assign_stack_local (BLKmode, apply_result_size (), -1);
*************** expand_builtin_apply (function, argument
*** 1054,1059 ****
/* Fetch the arg pointer from the ARGUMENTS block. */
incoming_args = gen_reg_rtx (Pmode);
! emit_move_insn (incoming_args,
! gen_rtx_MEM (Pmode, arguments));
#ifndef STACK_GROWS_DOWNWARD
incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
--- 1063,1067 ----
/* Fetch the arg pointer from the ARGUMENTS block. */
incoming_args = gen_reg_rtx (Pmode);
! emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments));
#ifndef STACK_GROWS_DOWNWARD
incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
*************** expand_builtin_return (result)
*** 1219,1222 ****
--- 1227,1235 ----
rtx call_fusage = 0;
+ #ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (result) != Pmode)
+ result = convert_memory_address (Pmode, result);
+ #endif
+
apply_result_size ();
result = gen_rtx_MEM (BLKmode, result);
*************** expand_builtin_va_arg (valist, type)
*** 2960,2963 ****
--- 2973,2981 ----
}
+ #ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (addr) != Pmode)
+ addr = convert_memory_address (Pmode, addr);
+ #endif
+
result = gen_rtx_MEM (TYPE_MODE (type), addr);
set_mem_alias_set (result, get_varargs_alias_set ());
*************** expand_builtin_va_copy (arglist)
*** 3018,3021 ****
--- 3036,3047 ----
size = expand_expr (TYPE_SIZE_UNIT (va_list_type_node), NULL_RTX,
VOIDmode, EXPAND_NORMAL);
+
+ #ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (dstb) != Pmode)
+ dstb = convert_memory_address (Pmode, dstb);
+
+ if (GET_MODE (srcb) != Pmode)
+ srcb = convert_memory_address (Pmode, srcb);
+ #endif
/* "Dereference" to BLKmode memories. */
More information about the Gcc-patches
mailing list