aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChung-Ju Wu <jasonwucj@gmail.com>2014-09-03 10:19:39 +0000
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>2014-09-03 10:19:39 +0000
commitd40f3c40304c9086d7ff2c5239f58de8bc0c2218 (patch)
tree34b531900948ad949ba6299b368d5f6ea517b9c0
parent650fc46935f19fe1e935fa62891689cb1375d8b6 (diff)
downloadgcc-d40f3c40304c9086d7ff2c5239f58de8bc0c2218.zip
gcc-d40f3c40304c9086d7ff2c5239f58de8bc0c2218.tar.gz
gcc-d40f3c40304c9086d7ff2c5239f58de8bc0c2218.tar.bz2
[NDS32] No need to take padding into consideration in Andes ABI2 because we can...
[NDS32] 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. * config/nds32/nds32.c (nds32_must_pass_in_stack): New implementation for TARGET_MUST_PASS_IN_STACK. From-SVN: r214869
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/nds32/nds32.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2ea7792..cfec7b4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
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.
+
+2014-09-03 Chung-Ju Wu <jasonwucj@gmail.com>
+
* config/nds32/nds32.c (nds32_arg_partial_bytes): New implementation
for TARGET_ARG_PARTIAL_BYTES.
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