public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 18/18, nds32] No need to take padding into consideration in Andes ABI2 because we can pass arguments in registers for variadic function.
@ 2014-09-04  6:22 Chung-Ju Wu
  0 siblings, 0 replies; only message in thread
From: Chung-Ju Wu @ 2014-09-04  6:22 UTC (permalink / raw)
  To: gcc patches; +Cc: Shiva Chen

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

Hi, all,

Committed as Rev. 214869: https://gcc.gnu.org/r214869


gcc/ChangeLog

2014-09-03  Chung-Ju Wu  <jasonwucj@gmail.com>

        * config/nds32/nds32.c (nds32_must_pass_in_stack): New implementation
        for TARGET_MUST_PASS_IN_STACK.


Best regards,
jasonwucj

[-- Attachment #2: 0018-PATCH-18-No-need-to-take-padding-into-consideration-.patch --]
[-- Type: application/octet-stream, Size: 1850 bytes --]

From 51f9f905f7d47e9c1e55dd22f1531605a4ba095d Mon Sep 17 00:00:00 2001
From: Chung-Ju Wu <jasonwucj@andestech.com>
Date: Tue, 29 Jul 2014 16:46:30 +0800
Subject: [PATCH 18/18] (PATCH 18) No need to take padding into consideration
 in Andes ABI2 because we can pass arguments in registers for variadic
 function.

  -- By default GCC uses must_pass_in_stack_var_size_or_pad for TARGET_MUST_PASS_IN_STACK.
     For Andes ABI2, the data layout in memory will be incorrect when calling variadic function
     under big-endian configuration.
---
 gcc/config/nds32/nds32.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index fdd4fd4..062e803 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -1352,6 +1352,19 @@ nds32_function_arg (cumulative_args_t ca, enum machine_mode mode,
   return NULL_RTX;
 }
 
+static bool
+nds32_must_pass_in_stack (enum machine_mode mode, const_tree type)
+{
+  /* Return true if a type must be passed in memory.
+     If it is NOT using hard float abi, small aggregates can be
+     passed in a register even we are calling a variadic function.
+     So there is no need to take padding into consideration.  */
+  if (TARGET_HARD_FLOAT)
+    return must_pass_in_stack_var_size_or_pad (mode, type);
+  else
+    return must_pass_in_stack_var_size (mode, type);
+}
+
 static int
 nds32_arg_partial_bytes (cumulative_args_t ca, enum machine_mode mode,
 			 tree type, bool named ATTRIBUTE_UNUSED)
@@ -3498,6 +3511,9 @@ nds32_target_alignment (rtx label)
 #undef TARGET_FUNCTION_ARG
 #define TARGET_FUNCTION_ARG nds32_function_arg
 
+#undef TARGET_MUST_PASS_IN_STACK
+#define TARGET_MUST_PASS_IN_STACK nds32_must_pass_in_stack
+
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES nds32_arg_partial_bytes
 
-- 
1.9.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-04  6:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04  6:22 [PATCH 18/18, nds32] No need to take padding into consideration in Andes ABI2 because we can pass arguments in registers for variadic function Chung-Ju Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).