* [PATCH 12/18, nds32] Prepare necessary varargs information in compute_stack_frame().
@ 2014-09-04 6:05 Chung-Ju Wu
0 siblings, 0 replies; only message in thread
From: Chung-Ju Wu @ 2014-09-04 6:05 UTC (permalink / raw)
To: gcc patches; +Cc: Shiva Chen
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
Hi, all,
Committed as Rev. 214862: https://gcc.gnu.org/r214862
gcc/ChangeLog
2014-09-03 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.c (nds32_compute_stack_frame): Prepare necessary
varargs information.
Best regards,
jasonwucj
[-- Attachment #2: 0012-PATCH-12-Prepare-necessary-varargs-information-in-co.patch --]
[-- Type: application/octet-stream, Size: 2923 bytes --]
From 6455a420afd5116c79c72c75c7c735ded1f81f80 Mon Sep 17 00:00:00 2001
From: Chung-Ju Wu <jasonwucj@andestech.com>
Date: Tue, 29 Jul 2014 13:16:38 +0800
Subject: [PATCH 12/18] (PATCH 12) Prepare necessary varargs information in
compute_stack_frame().
---
gcc/config/nds32/nds32.c | 40 ++++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index a94d576..5fbdac8 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -150,16 +150,30 @@ nds32_compute_stack_frame (void)
cfun->machine->naked_p = 0;
/* Get variadic arguments size to prepare pretend arguments and
- push them into stack at prologue.
- Currently, we do not push variadic arguments by ourself.
- We have GCC handle all the works.
- The caller will push all corresponding nameless arguments into stack,
- and the callee is able to retrieve them without problems.
- These variables are still preserved in case one day
- we would like caller passing arguments with registers. */
- cfun->machine->va_args_size = 0;
- cfun->machine->va_args_first_regno = SP_REGNUM;
- cfun->machine->va_args_last_regno = SP_REGNUM;
+ we will push them into stack at prologue by ourself. */
+ cfun->machine->va_args_size = crtl->args.pretend_args_size;
+ if (cfun->machine->va_args_size != 0)
+ {
+ cfun->machine->va_args_first_regno
+ = NDS32_GPR_ARG_FIRST_REGNUM
+ + NDS32_MAX_GPR_REGS_FOR_ARGS
+ - (crtl->args.pretend_args_size / UNITS_PER_WORD);
+ cfun->machine->va_args_last_regno
+ = NDS32_GPR_ARG_FIRST_REGNUM + NDS32_MAX_GPR_REGS_FOR_ARGS - 1;
+ }
+ else
+ {
+ cfun->machine->va_args_first_regno = SP_REGNUM;
+ cfun->machine->va_args_last_regno = SP_REGNUM;
+ }
+
+ /* Important: We need to make sure that varargs area is 8-byte alignment. */
+ block_size = cfun->machine->va_args_size;
+ if (!NDS32_DOUBLE_WORD_ALIGN_P (block_size))
+ {
+ cfun->machine->va_args_area_padding_bytes
+ = NDS32_ROUND_UP_DOUBLE_WORD (block_size) - block_size;
+ }
/* Get local variables, incoming variables, and temporary variables size.
Note that we need to make sure it is 8-byte alignment because
@@ -323,12 +337,10 @@ nds32_compute_stack_frame (void)
}
/* Important: We need to make sure that
- (va_args_size + fp_size + gp_size
- + lp_size + callee_saved_regs_size)
+ (fp_size + gp_size + lp_size + callee_saved_regs_size)
is 8-byte alignment.
If it is not, calculate the padding bytes. */
- block_size = cfun->machine->va_args_size
- + cfun->machine->fp_size
+ block_size = cfun->machine->fp_size
+ cfun->machine->gp_size
+ cfun->machine->lp_size
+ cfun->machine->callee_saved_regs_size;
--
1.9.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-04 6:05 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:05 [PATCH 12/18, nds32] Prepare necessary varargs information in compute_stack_frame() 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).