Patchwork [middle-end,i386] : Trivial: use copy_addr_to_reg some more.

login
register
mail settings
Submitter Uros Bizjak
Date March 19, 2012, 8:36 p.m.
Message ID <CAFULd4aAx_OX1TFZ3wb-2MzwuuqBN6tEv1pLj0CQAwyL27k8Wg@mail.gmail.com>
Download mbox | patch
Permalink /patch/147622/
State New
Headers show

Comments

Uros Bizjak - March 19, 2012, 8:36 p.m.
Hello!

This patch just substitutes "copy_to_mode_reg (Pmode, ...)" with
copy_addr_to_reg function where appropriate.

2012-03-19  Uros Bizjak  <ubizjak@gmail.com>

	* builtins.c (expand_builtin_cexpi): Use copy_addr_to_reg instead of
	copy_to_mode_reg (Pmode, ...).
	(expand_builtin_frame_address): Ditto.
	* expr.c (emit_block_move_via_libcall): Ditto.
	(set_storage_via_libcall): Ditto.

	* config/i386/i386.c (ix86_expand_movmem): Ditto.
	(ix86_expand_setmem): Ditto.
	(ix86_trampoline_init): DItto.
	* config/i386/i386.md (cmpstrnsi): Ditto.
	(allocate_stack): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN as obvious.

Uros.

Patch

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 185539)
+++ config/i386/i386.md	(working copy)
@@ -16073,8 +16073,8 @@ 
   if (!REG_P (out))
     out = gen_reg_rtx (SImode);
 
-  addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-  addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
+  addr1 = copy_addr_to_reg (XEXP (operands[1], 0));
+  addr2 = copy_addr_to_reg (XEXP (operands[2], 0));
   if (addr1 != XEXP (operands[1], 0))
     operands[1] = replace_equiv_address_nv (operands[1], addr1);
   if (addr2 != XEXP (operands[2], 0))
@@ -16737,7 +16737,7 @@ 
     }
   else
     {
-      x = copy_to_mode_reg (Pmode, operands[1]);
+      x = copy_addr_to_reg (operands[1]);
       if (TARGET_64BIT)
         emit_insn (gen_allocate_stack_worker_probe_di (x, x));
       else
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 185539)
+++ config/i386/i386.c	(working copy)
@@ -22101,8 +22101,8 @@  ix86_expand_movmem (rtx dst, rtx src, rtx count_ex
   gcc_assert (alg != no_stringop);
   if (!count)
     count_exp = copy_to_mode_reg (GET_MODE (count_exp), count_exp);
-  destreg = copy_to_mode_reg (Pmode, XEXP (dst, 0));
-  srcreg = copy_to_mode_reg (Pmode, XEXP (src, 0));
+  destreg = copy_addr_to_reg (XEXP (dst, 0));
+  srcreg = copy_addr_to_reg (XEXP (src, 0));
   switch (alg)
     {
     case libcall:
@@ -22490,7 +22490,7 @@  ix86_expand_setmem (rtx dst, rtx count_exp, rtx va
   gcc_assert (alg != no_stringop);
   if (!count)
     count_exp = copy_to_mode_reg (counter_mode (count_exp), count_exp);
-  destreg = copy_to_mode_reg (Pmode, XEXP (dst, 0));
+  destreg = copy_addr_to_reg (XEXP (dst, 0));
   switch (alg)
     {
     case libcall:
@@ -24368,7 +24368,7 @@  ix86_trampoline_init (rtx m_tramp, tree fndecl, rt
       if (ptr_mode == SImode
 	  || x86_64_zext_immediate_operand (fnaddr, VOIDmode))
 	{
-	  fnaddr = copy_to_mode_reg (Pmode, fnaddr);
+	  fnaddr = copy_addr_to_reg (fnaddr);
 
 	  mem = adjust_address (m_tramp, HImode, offset);
 	  emit_move_insn (mem, gen_int_mode (0xbb41, HImode));
Index: builtins.c
===================================================================
--- builtins.c	(revision 185539)
+++ builtins.c	(working copy)
@@ -2613,8 +2613,8 @@  expand_builtin_cexpi (tree exp, rtx target)
 
       op1 = assign_temp (TREE_TYPE (arg), 0, 1, 1);
       op2 = assign_temp (TREE_TYPE (arg), 0, 1, 1);
-      op1a = copy_to_mode_reg (Pmode, XEXP (op1, 0));
-      op2a = copy_to_mode_reg (Pmode, XEXP (op2, 0));
+      op1a = copy_addr_to_reg (XEXP (op1, 0));
+      op2a = copy_addr_to_reg (XEXP (op2, 0));
       top1 = make_tree (build_pointer_type (TREE_TYPE (arg)), op1a);
       top2 = make_tree (build_pointer_type (TREE_TYPE (arg)), op2a);
 
@@ -4580,7 +4580,7 @@  expand_builtin_frame_address (tree fndecl, tree ex
 
       if (!REG_P (tem)
 	  && ! CONSTANT_P (tem))
-	tem = copy_to_mode_reg (Pmode, tem);
+	tem = copy_addr_to_reg (tem);
       return tem;
     }
 }
Index: expr.c
===================================================================
--- expr.c	(revision 185539)
+++ expr.c	(working copy)
@@ -1343,8 +1343,8 @@  emit_block_move_via_libcall (rtx dst, rtx src, rtx
      pseudos.  We can then place those new pseudos into a VAR_DECL and
      use them later.  */
 
-  dst_addr = copy_to_mode_reg (Pmode, XEXP (dst, 0));
-  src_addr = copy_to_mode_reg (Pmode, XEXP (src, 0));
+  dst_addr = copy_addr_to_reg (XEXP (dst, 0));
+  src_addr = copy_addr_to_reg (XEXP (src, 0));
 
   dst_addr = convert_memory_address (ptr_mode, dst_addr);
   src_addr = convert_memory_address (ptr_mode, src_addr);
@@ -2719,7 +2719,7 @@  set_storage_via_libcall (rtx object, rtx size, rtx
   /* Emit code to copy OBJECT and SIZE into new pseudos.  We can then
      place those into new pseudos into a VAR_DECL and use them later.  */
 
-  object = copy_to_mode_reg (Pmode, XEXP (object, 0));
+  object = copy_addr_to_reg (XEXP (object, 0));
 
   size_mode = TYPE_MODE (sizetype);
   size = convert_to_mode (size_mode, size, 1);