Patchwork use use_reg in several backends

login
register
mail settings
Submitter Nathan Froyd
Date April 5, 2011, 5:55 p.m.
Message ID <20110405175542.GB27880@nightcrawler>
Download mbox | patch
Permalink /patch/89907/
State New
Headers show

Comments

Nathan Froyd - April 5, 2011, 5:55 p.m.
Several places in the compiler could be usefully modified to use use_reg
instead of hand-building EXPR_LISTs.  This patch makes such changes.

Since this patch implements equivalent functionality with an existing
function call, I believe it counts as obvious.

Tested by building cc1 for appropriate targets.  Will commit in a day or
two after giving maintainers a chance for comments.

-Nathan

	* config/alpha/alpha.c (alpha_emit_xfloating_libcall): Call use_reg.
	* config/xtensa/xtensa.c (xtensa_call_tls_desc): Likewise.
	* config/sparc/sparc.c (sparc_legitimize_tls_address): Likewise.
Eric Botcazou - April 5, 2011, 6:06 p.m.
> 	* config/sparc/sparc.c (sparc_legitimize_tls_address): Likewise.

Fine with me, thanks.
Richard Henderson - April 8, 2011, 3:25 p.m.
On 04/05/2011 10:55 AM, Nathan Froyd wrote:
> 	* config/alpha/alpha.c (alpha_emit_xfloating_libcall): Call use_reg.
> 	* config/xtensa/xtensa.c (xtensa_call_tls_desc): Likewise.
> 	* config/sparc/sparc.c (sparc_legitimize_tls_address): Likewise.

Ok.


r~

Patch

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 8aabeb2..d34042e 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -2999,7 +2999,7 @@  alpha_emit_xfloating_libcall (rtx func, rtx target, rtx operands[],
 	}
 
       emit_move_insn (reg, operands[i]);
-      usage = alloc_EXPR_LIST (0, gen_rtx_USE (VOIDmode, reg), usage);
+      use_reg (&usage, reg);
     }
 
   switch (GET_MODE (target))
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 5623cc1..fe70270 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1872,9 +1872,7 @@  xtensa_call_tls_desc (rtx sym, rtx *retp)
   emit_insn (gen_tls_arg (arg, sym));
   emit_move_insn (a10, arg);
   call_insn = emit_call_insn (gen_tls_call (a10, fn, sym, const1_rtx));
-  CALL_INSN_FUNCTION_USAGE (call_insn)
-    = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, a10),
-			 CALL_INSN_FUNCTION_USAGE (call_insn));
+  use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a10);
   insns = get_insns ();
   end_sequence ();

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 1e7ce53..ecb4d25 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -3308,9 +3308,7 @@  sparc_legitimize_tls_address (rtx addr)
 	    insn = emit_call_insn (gen_tgd_call64 (o0, sparc_tls_get_addr (),
 						   addr, const1_rtx));
 	  }
-        CALL_INSN_FUNCTION_USAGE (insn)
-	  = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, o0),
-			       CALL_INSN_FUNCTION_USAGE (insn));
+	use_reg (&CALL_INSN_FUNCTION_USAGE (insn), o0);
 	insn = get_insns ();
 	end_sequence ();
 	emit_libcall_block (insn, ret, o0, addr);
@@ -3338,9 +3336,7 @@  sparc_legitimize_tls_address (rtx addr)
 	    insn = emit_call_insn (gen_tldm_call64 (o0, sparc_tls_get_addr (),
 						    const1_rtx));
 	  }
-        CALL_INSN_FUNCTION_USAGE (insn)
-	  = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, o0),
-			       CALL_INSN_FUNCTION_USAGE (insn));
+	use_reg (&CALL_INSN_FUNCTION_USAGE (insn), o0);
 	insn = get_insns ();
 	end_sequence ();
 	emit_libcall_block (insn, temp3, o0,