Commit 9d93cc24 by Chung-Ju Wu Committed by Chung-Ju Wu

[NDS32] Define and rename some GPR-specific stuff.

	* config/nds32/nds32.c (nds32_function_arg): Define and rename some
	GPR-specific stuff.
	(nds32_function_arg_advance): Likewise.
	(nds32_init_cumulative_args): Likewise.
	* config/nds32/nds32.h (NDS32_MAX_GPR_REGS_FOR_ARGS): Define.
	(NDS32_FIRST_GPR_REGNUM): Define.
	(NDS32_LAST_GPR_REGNUM): Define.
	(NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG): Define.
	(NDS32_ARG_PASS_IN_REG_P): Use NDS32_MAX_GPR_REGS_FOR_ARGS.
	(FUNCTION_ARG_REGNO_P): Use NDS32_MAX_GPR_REGS_FOR_ARGS.
	(machine_function): Use GRP-specific stuff.

From-SVN: r214859
parent 38a0632e
2014-09-03 Chung-Ju Wu <jasonwucj@gmail.com> 2014-09-03 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.c (nds32_function_arg): Define and rename some
GPR-specific stuff.
(nds32_function_arg_advance): Likewise.
(nds32_init_cumulative_args): Likewise.
* config/nds32/nds32.h (NDS32_MAX_GPR_REGS_FOR_ARGS): Define.
(NDS32_FIRST_GPR_REGNUM): Define.
(NDS32_LAST_GPR_REGNUM): Define.
(NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG): Define.
(NDS32_ARG_PASS_IN_REG_P): Use NDS32_MAX_GPR_REGS_FOR_ARGS.
(FUNCTION_ARG_REGNO_P): Use NDS32_MAX_GPR_REGS_FOR_ARGS.
(machine_function): Use GRP-specific stuff.
2014-09-03 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.c (nds32_expand_prologue): Remove unused variables. * config/nds32/nds32.c (nds32_expand_prologue): Remove unused variables.
(nds32_expand_epilogue): Likewise. (nds32_expand_epilogue): Likewise.
(nds32_expand_prologue_v3push): Likewise. (nds32_expand_prologue_v3push): Likewise.
...@@ -1294,12 +1294,12 @@ nds32_function_arg (cumulative_args_t ca, enum machine_mode mode, ...@@ -1294,12 +1294,12 @@ nds32_function_arg (cumulative_args_t ca, enum machine_mode mode,
return NULL_RTX; return NULL_RTX;
/* If there are still registers available, return it. */ /* If there are still registers available, return it. */
if (NDS32_ARG_PASS_IN_REG_P (cum->reg_offset, mode, type)) if (NDS32_ARG_PASS_IN_REG_P (cum->gpr_offset, mode, type))
{ {
/* Pick up the next available register number. */ /* Pick up the next available register number. */
unsigned int regno; unsigned int regno;
regno = NDS32_AVAILABLE_REGNUM_FOR_ARG (cum->reg_offset, mode, type); regno = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, mode, type);
return gen_rtx_REG (mode, regno); return gen_rtx_REG (mode, regno);
} }
else else
...@@ -1320,8 +1320,8 @@ nds32_function_arg_advance (cumulative_args_t ca, enum machine_mode mode, ...@@ -1320,8 +1320,8 @@ nds32_function_arg_advance (cumulative_args_t ca, enum machine_mode mode,
Only named argument could be advanced. */ Only named argument could be advanced. */
if (named) if (named)
{ {
cum->reg_offset cum->gpr_offset
= NDS32_AVAILABLE_REGNUM_FOR_ARG (cum->reg_offset, mode, type) = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, mode, type)
- NDS32_GPR_ARG_FIRST_REGNUM - NDS32_GPR_ARG_FIRST_REGNUM
+ NDS32_NEED_N_REGS_FOR_ARG (mode, type); + NDS32_NEED_N_REGS_FOR_ARG (mode, type);
} }
...@@ -2656,7 +2656,7 @@ nds32_init_cumulative_args (CUMULATIVE_ARGS *cum, ...@@ -2656,7 +2656,7 @@ nds32_init_cumulative_args (CUMULATIVE_ARGS *cum,
/* Initial available registers /* Initial available registers
(in offset, corresponding to NDS32_GPR_ARG_FIRST_REGNUM) (in offset, corresponding to NDS32_GPR_ARG_FIRST_REGNUM)
for passing arguments. */ for passing arguments. */
cum->reg_offset = 0; cum->gpr_offset = 0;
} }
/* -- Function Entry and Exit. */ /* -- Function Entry and Exit. */
......
...@@ -109,7 +109,7 @@ enum nds32_16bit_address_type ...@@ -109,7 +109,7 @@ enum nds32_16bit_address_type
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* Define maximum numbers of registers for passing arguments. */ /* Define maximum numbers of registers for passing arguments. */
#define NDS32_MAX_REGS_FOR_ARGS 6 #define NDS32_MAX_GPR_REGS_FOR_ARGS 6
/* Define the register number for first argument. */ /* Define the register number for first argument. */
#define NDS32_GPR_ARG_FIRST_REGNUM 0 #define NDS32_GPR_ARG_FIRST_REGNUM 0
...@@ -117,6 +117,10 @@ enum nds32_16bit_address_type ...@@ -117,6 +117,10 @@ enum nds32_16bit_address_type
/* Define the register number for return value. */ /* Define the register number for return value. */
#define NDS32_GPR_RET_FIRST_REGNUM 0 #define NDS32_GPR_RET_FIRST_REGNUM 0
/* Define the first integer register number. */
#define NDS32_FIRST_GPR_REGNUM 0
/* Define the last integer register number. */
#define NDS32_LAST_GPR_REGNUM 31
/* Define double word alignment bits. */ /* Define double word alignment bits. */
#define NDS32_DOUBLE_WORD_ALIGNMENT 64 #define NDS32_DOUBLE_WORD_ALIGNMENT 64
...@@ -154,19 +158,19 @@ enum nds32_16bit_address_type ...@@ -154,19 +158,19 @@ enum nds32_16bit_address_type
b) Otherwise, the register number can be odd or even value. b) Otherwise, the register number can be odd or even value.
2. If it is required ONLY one register, 2. If it is required ONLY one register,
the register number can be odd or even value. */ the register number can be odd or even value. */
#define NDS32_AVAILABLE_REGNUM_FOR_ARG(reg_offset, mode, type) \ #define NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG(reg_offset, mode, type) \
((NDS32_NEED_N_REGS_FOR_ARG (mode, type) > 1) \ ((NDS32_NEED_N_REGS_FOR_ARG (mode, type) > 1) \
? ((NDS32_MODE_TYPE_ALIGN (mode, type) > PARM_BOUNDARY) \ ? ((NDS32_MODE_TYPE_ALIGN (mode, type) > PARM_BOUNDARY) \
? (((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM + 1) & ~1) \ ? (((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM + 1) & ~1) \
: ((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM)) \ : ((reg_offset) + NDS32_GPR_ARG_FIRST_REGNUM)) \
: ((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 /* This macro is to check if there are still available registers
for passing argument. */ for passing argument. */
#define NDS32_ARG_PASS_IN_REG_P(reg_offset, mode, type) \ #define NDS32_ARG_PASS_IN_REG_P(reg_offset, mode, type) \
(((reg_offset) < NDS32_MAX_REGS_FOR_ARGS) \ (((reg_offset) < NDS32_MAX_GPR_REGS_FOR_ARGS) \
&& ((reg_offset) + NDS32_NEED_N_REGS_FOR_ARG (mode, type) \ && ((reg_offset) + NDS32_NEED_N_REGS_FOR_ARG (mode, type) \
<= NDS32_MAX_REGS_FOR_ARGS)) <= NDS32_MAX_GPR_REGS_FOR_ARGS))
/* This macro is to check if the register is required to be saved on stack. /* This macro is to check if the register is required to be saved on stack.
If call_used_regs[regno] == 0, regno is the callee-saved register. If call_used_regs[regno] == 0, regno is the callee-saved register.
...@@ -227,7 +231,7 @@ struct GTY(()) machine_function ...@@ -227,7 +231,7 @@ struct GTY(()) machine_function
/* A C structure that contains the arguments information. */ /* A C structure that contains the arguments information. */
typedef struct typedef struct
{ {
unsigned int reg_offset; unsigned int gpr_offset;
} nds32_cumulative_args; } nds32_cumulative_args;
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
...@@ -710,7 +714,7 @@ enum reg_class ...@@ -710,7 +714,7 @@ enum reg_class
'comparison of unsigned expression >= 0 is always true' warning. */ 'comparison of unsigned expression >= 0 is always true' warning. */
#define FUNCTION_ARG_REGNO_P(regno) \ #define FUNCTION_ARG_REGNO_P(regno) \
(((int) regno - NDS32_GPR_ARG_FIRST_REGNUM >= 0) \ (((int) regno - NDS32_GPR_ARG_FIRST_REGNUM >= 0) \
&& ((int) regno - NDS32_GPR_ARG_FIRST_REGNUM < NDS32_MAX_REGS_FOR_ARGS)) && ((int) regno - NDS32_GPR_ARG_FIRST_REGNUM < NDS32_MAX_GPR_REGS_FOR_ARGS))
#define DEFAULT_PCC_STRUCT_RETURN 0 #define DEFAULT_PCC_STRUCT_RETURN 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment