[3/4] lm32: Compute pretend_size in setup_incoming_varargs even if no_rtl

Message ID 20250113202607.3288177-4-keithp@keithp.com
State Committed
Commit 423e9a8ad59e6972cd6f25238cd328080fed11cc
Headers
Series lm32: varargs patches |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed

Commit Message

Keith Packard Jan. 13, 2025, 8:08 p.m. UTC
  Adjust the conditionals so that pretend_size is always computed, even
if no_rtl is set.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 gcc/config/lm32/lm32.cc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/config/lm32/lm32.cc b/gcc/config/lm32/lm32.cc
index dfec28608a0..b677953bb4c 100644
--- a/gcc/config/lm32/lm32.cc
+++ b/gcc/config/lm32/lm32.cc
@@ -705,16 +705,18 @@  lm32_setup_incoming_varargs (cumulative_args_t cum_v,
 	((size + UNITS_PER_WORD - 1) / UNITS_PER_WORD);
     }
 
-  if ((first_anon_arg < (LM32_FIRST_ARG_REG + LM32_NUM_ARG_REGS)) && !no_rtl)
+  if (FUNCTION_ARG_REGNO_P (first_anon_arg))
     {
-      int first_reg_offset = first_anon_arg;
       int size = LM32_FIRST_ARG_REG + LM32_NUM_ARG_REGS - first_anon_arg;
-      rtx regblock;
 
-      regblock = gen_rtx_MEM (BLKmode,
-			      plus_constant (Pmode, arg_pointer_rtx,
-					     FIRST_PARM_OFFSET (0)));
-      move_block_from_reg (first_reg_offset, regblock, size);
+      if (!no_rtl)
+	{
+	  rtx regblock
+	    = gen_rtx_MEM (BLKmode,
+			   plus_constant (Pmode, arg_pointer_rtx,
+					  FIRST_PARM_OFFSET (0)));
+	  move_block_from_reg (first_anon_arg, regblock, size);
+	}
 
       *pretend_size = size * UNITS_PER_WORD;
     }