This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mark variables addressable if they are copied using libcall in RTL expander


On Thu, Jun 23, 2011 at 12:16 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jun 23, 2011 at 12:02:35PM -0700, Easwaran Raman wrote:
>> + ? ? ?if (y_expr)
>> + ? ? ? ?mark_addressable (y_expr);
>
> Please watch formatting, a tab should be used instead of 8 spaces.
>
>> + ? ? ?if (x_expr)
>> + ? ? ? ?mark_addressable (x_expr);
>
> Ditto.
>
>> @@ -1084,6 +1084,8 @@ initialize_argument_information (int num_actuals A
>> ? ? ? ? ? ? ? ? && TREE_CODE (base) != SSA_NAME
>> ? ? ? ? ? ? ? ? && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
>> ? ? ? ? ? {
>> + ? ? ? ? ? ? ?mark_addressable (args[i].tree_value);
>> +
>
> Likewise, plus the line is indented too much, each level should be indented
> by 2 chars.
>
> ? ? ? ?Jakub
>

I have attached a new patch that fixes the formatting  issues.

Thanks,
Easwaran
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(revision 175346)
+++ gcc/expr.c	(working copy)
@@ -1181,8 +1181,19 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enu
   else if (may_use_call
 	   && ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (x))
 	   && ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (y)))
-    retval = emit_block_move_via_libcall (x, y, size,
-					  method == BLOCK_OP_TAILCALL);
+    {
+      /* Since x and y are passed to a libcall, mark the corresponding
+	 tree EXPR as addressable.  */
+      tree y_expr = MEM_EXPR (y);
+      tree x_expr = MEM_EXPR (x);
+      if (y_expr)
+	mark_addressable (y_expr);
+      if (x_expr)
+	mark_addressable (x_expr);
+      retval = emit_block_move_via_libcall (x, y, size,
+					    method == BLOCK_OP_TAILCALL);
+    }
+
   else
     emit_block_move_via_loop (x, y, size, align);
 
Index: gcc/calls.c
===================================================================
--- gcc/calls.c	(revision 175346)
+++ gcc/calls.c	(working copy)
@@ -1084,6 +1084,8 @@ initialize_argument_information (int num_actuals A
 		  && TREE_CODE (base) != SSA_NAME
 		  && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
 	    {
+	      mark_addressable (args[i].tree_value);
+
 	      /* We can't use sibcalls if a callee-copied argument is
 		 stored in the current function's frame.  */
 	      if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base))
@@ -3524,7 +3526,12 @@ emit_library_call_value_1 (int retval, rtx orgfun,
 	    }
 
 	  if (MEM_P (val) && !must_copy)
-	    slot = val;
+	    {
+	      tree val_expr = MEM_EXPR (val);
+	      if (val_expr)
+		mark_addressable (val_expr);
+	      slot = val;
+	    }
 	  else
 	    {
 	      slot = assign_temp (lang_hooks.types.type_for_mode (mode, 0),

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]