diff options
author | Chung-Ju Wu <jasonwucj@gmail.com> | 2013-12-20 09:02:58 +0000 |
---|---|---|
committer | Chung-Ju Wu <jasonwucj@gcc.gnu.org> | 2013-12-20 09:02:58 +0000 |
commit | 634bdae96bb7ff880eeaaf35e6a91e38607a5783 (patch) | |
tree | 40049a2907c89ce3b58e3f10402616ae6903e54a /gcc | |
parent | 7920b6d673b95b5c243b37526618d2f436737dfc (diff) | |
download | gcc-634bdae96bb7ff880eeaaf35e6a91e38607a5783.zip gcc-634bdae96bb7ff880eeaaf35e6a91e38607a5783.tar.gz gcc-634bdae96bb7ff880eeaaf35e6a91e38607a5783.tar.bz2 |
nds32.h (NDS32_MODE_TYPE_ALIGN): New macro.
2013-12-20 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.h (NDS32_MODE_TYPE_ALIGN): New macro.
(NDS32_AVAILABLE_REGNUM_FOR_ARG): Use more accurate alignment checking
to determine available register number.
* config/nds32/nds32.c (nds32_needs_double_word_align): Use new
macro NDS32_MODE_TYPE_ALIGN.
(nds32_function_arg): Refine code layout.
From-SVN: r206142
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/nds32/nds32.c | 12 | ||||
-rw-r--r-- | gcc/config/nds32/nds32.h | 19 |
3 files changed, 30 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1adb68f..2301ccb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-12-20 Chung-Ju Wu <jasonwucj@gmail.com> + + * config/nds32/nds32.h (NDS32_MODE_TYPE_ALIGN): New macro. + (NDS32_AVAILABLE_REGNUM_FOR_ARG): Use more accurate alignment checking + to determine available register number. + * config/nds32/nds32.c (nds32_needs_double_word_align): Use new + macro NDS32_MODE_TYPE_ALIGN. + (nds32_function_arg): Refine code layout. + 2013-12-19 Jeff Law <law@redhat.com> * doc/invoke.texi: (dump-rtl-ree): Fix typo and clarify ree diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 124b1af..e7d1dc0 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -1438,8 +1438,8 @@ nds32_needs_double_word_align (enum machine_mode mode, const_tree type) { unsigned int align; - /* When 'type' is nonnull, there is no need to look at 'mode'. */ - align = (type ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode)); + /* Pick up the alignment according to the mode or type. */ + align = NDS32_MODE_TYPE_ALIGN (mode, type); return (align > PARM_BOUNDARY); } @@ -1853,10 +1853,10 @@ nds32_function_arg (cumulative_args_t ca, enum machine_mode mode, if (NDS32_ARG_PASS_IN_REG_P (cum->reg_offset, mode, type)) { /* Pick up the next available register number. */ - return gen_rtx_REG (mode, - NDS32_AVAILABLE_REGNUM_FOR_ARG (cum->reg_offset, - mode, - type)); + unsigned int regno; + + regno = NDS32_AVAILABLE_REGNUM_FOR_ARG (cum->reg_offset, mode, type); + return gen_rtx_REG (mode, regno); } else { diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h index 74f126c..1e798e4 100644 --- a/gcc/config/nds32/nds32.h +++ b/gcc/config/nds32/nds32.h @@ -126,6 +126,11 @@ enum nds32_16bit_address_type #define NDS32_SINGLE_WORD_ALIGN_P(value) (((value) & 0x03) == 0) #define NDS32_DOUBLE_WORD_ALIGN_P(value) (((value) & 0x07) == 0) +/* Get alignment according to mode or type information. + When 'type' is nonnull, there is no need to look at 'mode'. */ +#define NDS32_MODE_TYPE_ALIGN(mode, type) \ + (type ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode)) + /* Round X up to the nearest double word. */ #define NDS32_ROUND_UP_DOUBLE_WORD(value) (((value) + 7) & ~7) @@ -142,12 +147,18 @@ enum nds32_16bit_address_type /* This macro is used to return the register number for passing argument. We need to obey the following rules: 1. If it is required MORE THAN one register, - make sure the register number is a even value. + we need to further check if it really needs to be + aligned on double words. + a) If double word alignment is necessary, + the register number must be even value. + b) Otherwise, the register number can be odd or even value. 2. If it is required ONLY one register, the register number can be odd or even value. */ -#define NDS32_AVAILABLE_REGNUM_FOR_ARG(reg_offset, mode, type) \ - ((NDS32_NEED_N_REGS_FOR_ARG (mode, type) > 1) \ - ? (((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM + 1) & ~1) \ +#define NDS32_AVAILABLE_REGNUM_FOR_ARG(reg_offset, mode, type) \ + ((NDS32_NEED_N_REGS_FOR_ARG (mode, type) > 1) \ + ? ((NDS32_MODE_TYPE_ALIGN (mode, type) > PARM_BOUNDARY) \ + ? (((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM + 1) & ~1) \ + : ((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM)) \ : ((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM)) /* This macro is to check if there are still available registers |