Hi!

On 8/27/20 1:41 PM, Segher Boessenkool wrote:
Hi!

On Thu, Aug 27, 2020 at 08:21:34AM -0500, Bill Schmidt wrote:
+  /* For ELFv2, r12 and CTR need to hold the function address
+     for an indirect call.  */
+  if (GET_CODE (func_desc) != SYMBOL_REF && DEFAULT_ABI == ABI_ELFv2)
+    {
+      r12 = gen_rtx_REG (Pmode, 12);
+      if (!rtx_equal_p (r12, func_desc))
+       emit_move_insn (r12, func_desc);
These last two lines aren't needed?  A move from r12 to r12 is harmless,
and should be optimised away just fine?


On entry to this function, func_desc has the function address, and the problem is for a sibcall it is generally not in r12.  So I'm forcing it into r12 here.  I guess we could remove the !rtx_equal_p test and generate an unnecessary copy, but I don't see why we should do that.  This is the same thing we do elsewhere (such as rs6000_aix_call).


    /* Create the call.  */
-  call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_desc), tlsarg);
+  call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_addr), tlsarg);
I don't understand this change?  (Maybe I'm not looking well enough.)

Prior to this change, func_desc comes in as a parameter and is never changed.  Now it's either that case, or it's the new case, so this just is the join point of that decision.

Thanks,

Bill


Looks fine otherwise, yes :-)


Segher

Reply via email to