]> gcc.gnu.org Git - gcc.git/commitdiff
function.c (expand_function_end): Properly handle DECL_RESULT and copy when ptr_mode...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Tue, 2 Jan 2001 02:31:22 +0000 (02:31 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Tue, 2 Jan 2001 02:31:22 +0000 (21:31 -0500)
* function.c (expand_function_end): Properly handle DECL_RESULT
and copy when ptr_mode != Pmode.
* expmed.c (make_tree): Convert X from Pmode to ptr_mode, if needed.

From-SVN: r38607

gcc/ChangeLog
gcc/expmed.c
gcc/function.c

index 5fa3e72da3696ba14767c7ccdf7208903369de1d..1c9c7bad54c36805d23170cb315d3188fac4320c 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jan  1 21:28:29 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * function.c (expand_function_end): Properly handle DECL_RESULT
+       and copy when ptr_mode != Pmode.
+       * expmed.c (make_tree): Convert X from Pmode to ptr_mode, if needed.
+
 2001-01-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * c-common.c (c_common_nodes_and_builtins): Set prototype
index 6d6e6f5d5023d90112dbc36c0e0464fb674af276..0661e105a381ff0a86c9d95f1d7b75fc432f5681 100644 (file)
@@ -1,7 +1,7 @@
 /* Medium-level subroutines: convert bit-field store and extract
    and shifts, multiplies and divides to rtl instructions.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -4066,6 +4066,14 @@ make_tree (type, x)
    default:
       t = make_node (RTL_EXPR);
       TREE_TYPE (t) = type;
+
+#ifdef POINTERS_EXTEND_UNSIGNED
+      /* If TYPE is a POINTER_TYPE, X might be Pmode with TYPE_MODE being
+        ptr_mode.  So convert.  */
+      if (POINTER_TYPE_P (type) && GET_MODE (x) != TYPE_MODE (type))
+       x = convert_memory_address (TYPE_MODE (type), x);
+#endif
+
       RTL_EXPR_RTL (t) = x;
       /* There are no insns to be output
         when this rtl_expr is used.  */
index 586ef7ea92e481dfc1678d842fee772b54f3d26d..bbd7ecc3e978aa6283ce878be2def9b7a3296045 100644 (file)
@@ -1,6 +1,6 @@
 /* Expands front end tree to back end RTL for GNU C-Compiler
    Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000 Free Software Foundation, Inc.
+   1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -6825,8 +6825,8 @@ expand_function_end (filename, line, end_bindings)
   if (current_function_returns_struct
       || current_function_returns_pcc_struct)
     {
-      rtx value_address =
-       XEXP (DECL_RTL (DECL_RESULT (current_function_decl)), 0);
+      rtx value_address
+       XEXP (DECL_RTL (DECL_RESULT (current_function_decl)), 0);
       tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
 #ifdef FUNCTION_OUTGOING_VALUE
       rtx outgoing
@@ -6834,15 +6834,25 @@ expand_function_end (filename, line, end_bindings)
                                   current_function_decl);
 #else
       rtx outgoing
-       = FUNCTION_VALUE (build_pointer_type (type),
-                         current_function_decl);
+       = FUNCTION_VALUE (build_pointer_type (type), current_function_decl);
 #endif
 
       /* Mark this as a function return value so integrate will delete the
         assignment and USE below when inlining this function.  */
       REG_FUNCTION_VALUE_P (outgoing) = 1;
 
+#ifdef POINTERS_EXTEND_UNSIGNED
+      /* The address may be ptr_mode and OUTGOING may be Pmode.  */
+      if (GET_MODE (outgoing) != GET_MODE (value_address))
+       value_address = convert_memory_address (GET_MODE (outgoing),
+                                               value_address);
+#endif
+
       emit_move_insn (outgoing, value_address);
+
+      /* Show return register used to hold result (in this case the address
+        of the result.  */
+      current_function_return_rtx = outgoing;
     }
 
   /* ??? This should no longer be necessary since stupid is no longer with
This page took 0.110289 seconds and 5 git commands to generate.