Commit 8a498f99 by Chung-Ju Wu Committed by Chung-Ju Wu

Refine formatting and comments.

gcc/
	* config/nds32/nds32.c: Refine formatting and comments.
	* config/nds32/nds32.h: Likewise.
	* config/nds32/nds32.md: Likewise.
	* config/nds32/nds32-cost.c: Likewise.
	* config/nds32/nds32-isr.c: Likewise.
	* config/nds32/nds32-md-auxiliary.c: Likewise.
	* config/nds32/nds32-multiple.md: Likewise.
	* config/nds32/nds32-predicates.c: Likewise.

From-SVN: r252874
parent ebc6a85e
2017-09-16 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.c: Refine formatting and comments.
* config/nds32/nds32.h: Likewise.
* config/nds32/nds32.md: Likewise.
* config/nds32/nds32-cost.c: Likewise.
* config/nds32/nds32-isr.c: Likewise.
* config/nds32/nds32-md-auxiliary.c: Likewise.
* config/nds32/nds32-multiple.md: Likewise.
* config/nds32/nds32-predicates.c: Likewise.
2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com> 2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>
......
...@@ -99,7 +99,7 @@ size_cost: ...@@ -99,7 +99,7 @@ size_cost:
{ {
case SET: case SET:
/* For 'SET' rtx, we need to return false /* For 'SET' rtx, we need to return false
so that it can recursively calculate costs. */ so that it can recursively calculate costs. */
return false; return false;
case USE: case USE:
...@@ -109,7 +109,7 @@ size_cost: ...@@ -109,7 +109,7 @@ size_cost:
case CONST_INT: case CONST_INT:
/* All instructions involving constant operation /* All instructions involving constant operation
need to be considered for cost evaluation. */ need to be considered for cost evaluation. */
if (outer_code == SET) if (outer_code == SET)
{ {
/* (set X imm5s), use movi55, 2-byte cost. /* (set X imm5s), use movi55, 2-byte cost.
...@@ -202,17 +202,17 @@ size_cost: ...@@ -202,17 +202,17 @@ size_cost:
case POST_INC: case POST_INC:
case POST_DEC: case POST_DEC:
/* We encourage that rtx contains /* We encourage that rtx contains
POST_MODIFY/POST_INC/POST_DEC behavior. */ POST_MODIFY/POST_INC/POST_DEC behavior. */
return 0; return 0;
case SYMBOL_REF: case SYMBOL_REF:
/* We can have gp-relative load/store for symbol_ref. /* We can have gp-relative load/store for symbol_ref.
Have it 4-byte cost. */ Have it 4-byte cost. */
return COSTS_N_INSNS (1); return COSTS_N_INSNS (1);
case CONST: case CONST:
/* It is supposed to be the pattern (const (plus symbol_ref const_int)). /* It is supposed to be the pattern (const (plus symbol_ref const_int)).
Have it 4-byte cost. */ Have it 4-byte cost. */
return COSTS_N_INSNS (1); return COSTS_N_INSNS (1);
case REG: case REG:
...@@ -221,14 +221,14 @@ size_cost: ...@@ -221,14 +221,14 @@ size_cost:
case PLUS: case PLUS:
/* We do not need to check if the address is a legitimate address, /* We do not need to check if the address is a legitimate address,
because this hook is never called with an invalid address. because this hook is never called with an invalid address.
But we better check the range of But we better check the range of
const_int value for cost, if it exists. */ const_int value for cost, if it exists. */
plus0 = XEXP (address, 0); plus0 = XEXP (address, 0);
plus1 = XEXP (address, 1); plus1 = XEXP (address, 1);
if (REG_P (plus0) && CONST_INT_P (plus1)) if (REG_P (plus0) && CONST_INT_P (plus1))
{ {
/* If it is possible to be lwi333/swi333 form, /* If it is possible to be lwi333/swi333 form,
make it 2-byte cost. */ make it 2-byte cost. */
if (satisfies_constraint_Iu05 (plus1)) if (satisfies_constraint_Iu05 (plus1))
......
...@@ -171,20 +171,20 @@ nds32_emit_isr_vector_section (int vector_id) ...@@ -171,20 +171,20 @@ nds32_emit_isr_vector_section (int vector_id)
if (nds32_isr_vector_size == 4) if (nds32_isr_vector_size == 4)
{ {
/* This block is for 4-byte vector size. /* This block is for 4-byte vector size.
Hardware $VID support is necessary and only one instruction Hardware $VID support is necessary and only one instruction
is needed in vector section. */ is needed in vector section. */
fprintf (asm_out_file, "\tj\t%s ! jump to first level handler\n", fprintf (asm_out_file, "\tj\t%s ! jump to first level handler\n",
first_level_handler_name); first_level_handler_name);
} }
else else
{ {
/* This block is for 16-byte vector size. /* This block is for 16-byte vector size.
There is NO hardware $VID so that we need several instructions There is NO hardware $VID so that we need several instructions
such as pushing GPRs and preparing software vid at vector section. such as pushing GPRs and preparing software vid at vector section.
For pushing GPRs, there are four variations for For pushing GPRs, there are four variations for
16-byte vector content and we have to handle each combination. 16-byte vector content and we have to handle each combination.
For preparing software vid, note that the vid need to For preparing software vid, note that the vid need to
be substracted vector_number_offset. */ be substracted vector_number_offset. */
if (TARGET_REDUCED_REGS) if (TARGET_REDUCED_REGS)
{ {
if (nds32_isr_vectors[vector_id].save_reg == NDS32_SAVE_ALL) if (nds32_isr_vectors[vector_id].save_reg == NDS32_SAVE_ALL)
...@@ -449,12 +449,12 @@ nds32_construct_isr_vectors_information (tree func_attrs, ...@@ -449,12 +449,12 @@ nds32_construct_isr_vectors_information (tree func_attrs,
nds32_isr_vectors[0].category = NDS32_ISR_RESET; nds32_isr_vectors[0].category = NDS32_ISR_RESET;
/* Prepare id_list and identify id value so that /* Prepare id_list and identify id value so that
we can set total number of vectors. */ we can set total number of vectors. */
id_list = TREE_VALUE (reset); id_list = TREE_VALUE (reset);
id = TREE_VALUE (id_list); id = TREE_VALUE (id_list);
/* The total vectors = interrupt + exception numbers + reset. /* The total vectors = interrupt + exception numbers + reset.
There are 8 exception and 1 reset in nds32 architecture. */ There are 8 exception and 1 reset in nds32 architecture. */
nds32_isr_vectors[0].total_n_vectors = TREE_INT_CST_LOW (id) + 8 + 1; nds32_isr_vectors[0].total_n_vectors = TREE_INT_CST_LOW (id) + 8 + 1;
strcpy (nds32_isr_vectors[0].func_name, func_name); strcpy (nds32_isr_vectors[0].func_name, func_name);
......
...@@ -453,33 +453,33 @@ nds32_output_32bit_load_s (rtx *operands, int byte) ...@@ -453,33 +453,33 @@ nds32_output_32bit_load_s (rtx *operands, int byte)
{ {
case REG: case REG:
/* (mem (reg X)) /* (mem (reg X))
=> access location by using register, => access location by using register,
use "lbsi / lhsi" */ use "lbsi / lhsi" */
snprintf (pattern, sizeof (pattern), "l%csi\t%%0, %%1", size); snprintf (pattern, sizeof (pattern), "l%csi\t%%0, %%1", size);
break; break;
case SYMBOL_REF: case SYMBOL_REF:
case CONST: case CONST:
/* (mem (symbol_ref X)) /* (mem (symbol_ref X))
(mem (const (...))) (mem (const (...)))
=> access global variables, => access global variables,
use "lbsi.gp / lhsi.gp" */ use "lbsi.gp / lhsi.gp" */
operands[1] = XEXP (operands[1], 0); operands[1] = XEXP (operands[1], 0);
snprintf (pattern, sizeof (pattern), "l%csi.gp\t%%0, [ + %%1]", size); snprintf (pattern, sizeof (pattern), "l%csi.gp\t%%0, [ + %%1]", size);
break; break;
case POST_INC: case POST_INC:
/* (mem (post_inc reg)) /* (mem (post_inc reg))
=> access location by using register which will be post increment, => access location by using register which will be post increment,
use "lbsi.bi / lhsi.bi" */ use "lbsi.bi / lhsi.bi" */
snprintf (pattern, sizeof (pattern), snprintf (pattern, sizeof (pattern),
"l%csi.bi\t%%0, %%1, %d", size, byte); "l%csi.bi\t%%0, %%1, %d", size, byte);
break; break;
case POST_DEC: case POST_DEC:
/* (mem (post_dec reg)) /* (mem (post_dec reg))
=> access location by using register which will be post decrement, => access location by using register which will be post decrement,
use "lbsi.bi / lhsi.bi" */ use "lbsi.bi / lhsi.bi" */
snprintf (pattern, sizeof (pattern), snprintf (pattern, sizeof (pattern),
"l%csi.bi\t%%0, %%1, -%d", size, byte); "l%csi.bi\t%%0, %%1, -%d", size, byte);
break; break;
...@@ -585,8 +585,8 @@ nds32_output_stack_push (rtx par_rtx) ...@@ -585,8 +585,8 @@ nds32_output_stack_push (rtx par_rtx)
&& (cfun->machine->va_args_size == 0)) && (cfun->machine->va_args_size == 0))
{ {
/* For stack v3push: /* For stack v3push:
operands[0]: Re operands[0]: Re
operands[1]: imm8u */ operands[1]: imm8u */
/* This variable is to check if 'push25 Re,imm8u' is available. */ /* This variable is to check if 'push25 Re,imm8u' is available. */
int sp_adjust; int sp_adjust;
...@@ -595,7 +595,7 @@ nds32_output_stack_push (rtx par_rtx) ...@@ -595,7 +595,7 @@ nds32_output_stack_push (rtx par_rtx)
operands[0] = gen_rtx_REG (SImode, re_callee_saved); operands[0] = gen_rtx_REG (SImode, re_callee_saved);
/* Check if we can generate 'push25 Re,imm8u', /* Check if we can generate 'push25 Re,imm8u',
otherwise, generate 'push25 Re,0'. */ otherwise, generate 'push25 Re,0'. */
sp_adjust = cfun->machine->local_size sp_adjust = cfun->machine->local_size
+ cfun->machine->out_args_size + cfun->machine->out_args_size
+ cfun->machine->callee_saved_area_gpr_padding_bytes; + cfun->machine->callee_saved_area_gpr_padding_bytes;
...@@ -611,12 +611,12 @@ nds32_output_stack_push (rtx par_rtx) ...@@ -611,12 +611,12 @@ nds32_output_stack_push (rtx par_rtx)
else else
{ {
/* For normal stack push multiple: /* For normal stack push multiple:
operands[0]: Rb operands[0]: Rb
operands[1]: Re operands[1]: Re
operands[2]: En4 */ operands[2]: En4 */
/* This variable is used to check if we only need to generate En4 field. /* This variable is used to check if we only need to generate En4 field.
As long as Rb==Re=SP_REGNUM, we set this variable to 1. */ As long as Rb==Re=SP_REGNUM, we set this variable to 1. */
int push_en4_only_p = 0; int push_en4_only_p = 0;
/* Set operands[0] and operands[1]. */ /* Set operands[0] and operands[1]. */
...@@ -678,8 +678,8 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED) ...@@ -678,8 +678,8 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED)
&& (cfun->machine->va_args_size == 0)) && (cfun->machine->va_args_size == 0))
{ {
/* For stack v3pop: /* For stack v3pop:
operands[0]: Re operands[0]: Re
operands[1]: imm8u */ operands[1]: imm8u */
/* This variable is to check if 'pop25 Re,imm8u' is available. */ /* This variable is to check if 'pop25 Re,imm8u' is available. */
int sp_adjust; int sp_adjust;
...@@ -688,12 +688,12 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED) ...@@ -688,12 +688,12 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED)
operands[0] = gen_rtx_REG (SImode, re_callee_saved); operands[0] = gen_rtx_REG (SImode, re_callee_saved);
/* Check if we can generate 'pop25 Re,imm8u', /* Check if we can generate 'pop25 Re,imm8u',
otherwise, generate 'pop25 Re,0'. otherwise, generate 'pop25 Re,0'.
We have to consider alloca issue as well. We have to consider alloca issue as well.
If the function does call alloca(), the stack pointer is not fixed. If the function does call alloca(), the stack pointer is not fixed.
In that case, we cannot use 'pop25 Re,imm8u' directly. In that case, we cannot use 'pop25 Re,imm8u' directly.
We have to caculate stack pointer from frame pointer We have to caculate stack pointer from frame pointer
and then use 'pop25 Re,0'. */ and then use 'pop25 Re,0'. */
sp_adjust = cfun->machine->local_size sp_adjust = cfun->machine->local_size
+ cfun->machine->out_args_size + cfun->machine->out_args_size
+ cfun->machine->callee_saved_area_gpr_padding_bytes; + cfun->machine->callee_saved_area_gpr_padding_bytes;
...@@ -710,12 +710,12 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED) ...@@ -710,12 +710,12 @@ nds32_output_stack_pop (rtx par_rtx ATTRIBUTE_UNUSED)
else else
{ {
/* For normal stack pop multiple: /* For normal stack pop multiple:
operands[0]: Rb operands[0]: Rb
operands[1]: Re operands[1]: Re
operands[2]: En4 */ operands[2]: En4 */
/* This variable is used to check if we only need to generate En4 field. /* This variable is used to check if we only need to generate En4 field.
As long as Rb==Re=SP_REGNUM, we set this variable to 1. */ As long as Rb==Re=SP_REGNUM, we set this variable to 1. */
int pop_en4_only_p = 0; int pop_en4_only_p = 0;
/* Set operands[0] and operands[1]. */ /* Set operands[0] and operands[1]. */
......
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
otherwise we have to FAIL this rtx generation: otherwise we have to FAIL this rtx generation:
1. The number of consecutive registers must be integer. 1. The number of consecutive registers must be integer.
2. Maximum 4 or 8 registers for lmw.bi instruction 2. Maximum 4 or 8 registers for lmw.bi instruction
(based on this nds32-multiple.md design). (based on this nds32-multiple.md design).
3. Minimum 2 registers for lmw.bi instruction 3. Minimum 2 registers for lmw.bi instruction
(based on this nds32-multiple.md design). (based on this nds32-multiple.md design).
4. operands[0] must be register for sure. 4. operands[0] must be register for sure.
5. operands[1] must be memory for sure. 5. operands[1] must be memory for sure.
6. Do not cross $r15 register because it is not allocatable. */ 6. Do not cross $r15 register because it is not allocatable. */
...@@ -231,9 +231,9 @@ ...@@ -231,9 +231,9 @@
otherwise we have to FAIL this rtx generation: otherwise we have to FAIL this rtx generation:
1. The number of consecutive registers must be integer. 1. The number of consecutive registers must be integer.
2. Maximum 4 or 8 registers for smw.bi instruction 2. Maximum 4 or 8 registers for smw.bi instruction
(based on this nds32-multiple.md design). (based on this nds32-multiple.md design).
3. Minimum 2 registers for smw.bi instruction 3. Minimum 2 registers for smw.bi instruction
(based on this nds32-multiple.md design). (based on this nds32-multiple.md design).
4. operands[0] must be memory for sure. 4. operands[0] must be memory for sure.
5. operands[1] must be register for sure. 5. operands[1] must be register for sure.
6. Do not cross $r15 register because it is not allocatable. */ 6. Do not cross $r15 register because it is not allocatable. */
......
...@@ -175,47 +175,47 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p) ...@@ -175,47 +175,47 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p)
{ {
elt = XVECEXP (op, 0, index); elt = XVECEXP (op, 0, index);
if (GET_CODE (elt) != SET) if (GET_CODE (elt) != SET)
return false; return false;
} }
/* For push operation, the parallel rtx looks like: /* For push operation, the parallel rtx looks like:
(parallel [(set (mem (plus (reg:SI SP_REGNUM) (const_int -32))) (parallel [(set (mem (plus (reg:SI SP_REGNUM) (const_int -32)))
(reg:SI Rb)) (reg:SI Rb))
(set (mem (plus (reg:SI SP_REGNUM) (const_int -28))) (set (mem (plus (reg:SI SP_REGNUM) (const_int -28)))
(reg:SI Rb+1)) (reg:SI Rb+1))
... ...
(set (mem (plus (reg:SI SP_REGNUM) (const_int -16))) (set (mem (plus (reg:SI SP_REGNUM) (const_int -16)))
(reg:SI Re)) (reg:SI Re))
(set (mem (plus (reg:SI SP_REGNUM) (const_int -12))) (set (mem (plus (reg:SI SP_REGNUM) (const_int -12)))
(reg:SI FP_REGNUM)) (reg:SI FP_REGNUM))
(set (mem (plus (reg:SI SP_REGNUM) (const_int -8))) (set (mem (plus (reg:SI SP_REGNUM) (const_int -8)))
(reg:SI GP_REGNUM)) (reg:SI GP_REGNUM))
(set (mem (plus (reg:SI SP_REGNUM) (const_int -4))) (set (mem (plus (reg:SI SP_REGNUM) (const_int -4)))
(reg:SI LP_REGNUM)) (reg:SI LP_REGNUM))
(set (reg:SI SP_REGNUM) (set (reg:SI SP_REGNUM)
(plus (reg:SI SP_REGNUM) (const_int -32)))]) (plus (reg:SI SP_REGNUM) (const_int -32)))])
For pop operation, the parallel rtx looks like: For pop operation, the parallel rtx looks like:
(parallel [(set (reg:SI Rb) (parallel [(set (reg:SI Rb)
(mem (reg:SI SP_REGNUM))) (mem (reg:SI SP_REGNUM)))
(set (reg:SI Rb+1) (set (reg:SI Rb+1)
(mem (plus (reg:SI SP_REGNUM) (const_int 4)))) (mem (plus (reg:SI SP_REGNUM) (const_int 4))))
... ...
(set (reg:SI Re) (set (reg:SI Re)
(mem (plus (reg:SI SP_REGNUM) (const_int 16)))) (mem (plus (reg:SI SP_REGNUM) (const_int 16))))
(set (reg:SI FP_REGNUM) (set (reg:SI FP_REGNUM)
(mem (plus (reg:SI SP_REGNUM) (const_int 20)))) (mem (plus (reg:SI SP_REGNUM) (const_int 20))))
(set (reg:SI GP_REGNUM) (set (reg:SI GP_REGNUM)
(mem (plus (reg:SI SP_REGNUM) (const_int 24)))) (mem (plus (reg:SI SP_REGNUM) (const_int 24))))
(set (reg:SI LP_REGNUM) (set (reg:SI LP_REGNUM)
(mem (plus (reg:SI SP_REGNUM) (const_int 28)))) (mem (plus (reg:SI SP_REGNUM) (const_int 28))))
(set (reg:SI SP_REGNUM) (set (reg:SI SP_REGNUM)
(plus (reg:SI SP_REGNUM) (const_int 32)))]) */ (plus (reg:SI SP_REGNUM) (const_int 32)))]) */
/* 1. Consecutive registers push/pop operations. /* 1. Consecutive registers push/pop operations.
We need to calculate how many registers should be consecutive. We need to calculate how many registers should be consecutive.
The $sp adjustment rtx, $fp push rtx, $gp push rtx, The $sp adjustment rtx, $fp push rtx, $gp push rtx,
and $lp push rtx are excluded. */ and $lp push rtx are excluded. */
/* Detect whether we have $fp, $gp, or $lp in the parallel rtx. */ /* Detect whether we have $fp, $gp, or $lp in the parallel rtx. */
save_fp = reg_mentioned_p (gen_rtx_REG (SImode, FP_REGNUM), op); save_fp = reg_mentioned_p (gen_rtx_REG (SImode, FP_REGNUM), op);
...@@ -239,19 +239,19 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p) ...@@ -239,19 +239,19 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p)
first_regno = REGNO (elt_reg); first_regno = REGNO (elt_reg);
/* The 'push' operation is a kind of store operation. /* The 'push' operation is a kind of store operation.
The 'pop' operation is a kind of load operation. The 'pop' operation is a kind of load operation.
Pass corresponding false/true as second argument (bool load_p). Pass corresponding false/true as second argument (bool load_p).
The par_index is supposed to start with index 0. */ The par_index is supposed to start with index 0. */
if (!nds32_consecutive_registers_load_store_p (op, if (!nds32_consecutive_registers_load_store_p (op,
!push_p ? true : false, !push_p ? true : false,
0, 0,
first_regno, first_regno,
rest_count)) rest_count))
return false; return false;
} }
/* 2. Valid $fp/$gp/$lp push/pop operations. /* 2. Valid $fp/$gp/$lp push/pop operations.
Remember to set start index for checking them. */ Remember to set start index for checking them. */
/* The rest_count is the start index for checking $fp/$gp/$lp. */ /* The rest_count is the start index for checking $fp/$gp/$lp. */
index = rest_count; index = rest_count;
...@@ -270,9 +270,9 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p) ...@@ -270,9 +270,9 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p)
index++; index++;
if (GET_CODE (elt_mem) != MEM if (GET_CODE (elt_mem) != MEM
|| GET_CODE (elt_reg) != REG || GET_CODE (elt_reg) != REG
|| REGNO (elt_reg) != FP_REGNUM) || REGNO (elt_reg) != FP_REGNUM)
return false; return false;
} }
if (save_gp) if (save_gp)
{ {
...@@ -282,9 +282,9 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p) ...@@ -282,9 +282,9 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p)
index++; index++;
if (GET_CODE (elt_mem) != MEM if (GET_CODE (elt_mem) != MEM
|| GET_CODE (elt_reg) != REG || GET_CODE (elt_reg) != REG
|| REGNO (elt_reg) != GP_REGNUM) || REGNO (elt_reg) != GP_REGNUM)
return false; return false;
} }
if (save_lp) if (save_lp)
{ {
...@@ -294,16 +294,16 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p) ...@@ -294,16 +294,16 @@ nds32_valid_stack_push_pop_p (rtx op, bool push_p)
index++; index++;
if (GET_CODE (elt_mem) != MEM if (GET_CODE (elt_mem) != MEM
|| GET_CODE (elt_reg) != REG || GET_CODE (elt_reg) != REG
|| REGNO (elt_reg) != LP_REGNUM) || REGNO (elt_reg) != LP_REGNUM)
return false; return false;
} }
/* 3. The last element must be stack adjustment rtx. /* 3. The last element must be stack adjustment rtx.
Its form of rtx should be: Its form of rtx should be:
(set (reg:SI SP_REGNUM) (set (reg:SI SP_REGNUM)
(plus (reg:SI SP_REGNUM) (const_int X))) (plus (reg:SI SP_REGNUM) (const_int X)))
The X could be positive or negative value. */ The X could be positive or negative value. */
/* Pick up the last element. */ /* Pick up the last element. */
elt = XVECEXP (op, 0, total_count - 1); elt = XVECEXP (op, 0, total_count - 1);
......
...@@ -159,18 +159,18 @@ enum nds32_16bit_address_type ...@@ -159,18 +159,18 @@ enum nds32_16bit_address_type
/* This macro is used to return the register number for passing argument. /* This macro is used to return the register number for passing argument.
We need to obey the following rules: We need to obey the following rules:
1. If it is required MORE THAN one register, 1. If it is required MORE THAN one register,
we need to further check if it really needs to be we need to further check if it really needs to be
aligned on double words. aligned on double words.
a) If double word alignment is necessary, a) If double word alignment is necessary,
the register number must be even value. the register number must be even value.
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_GPR_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
...@@ -761,13 +761,13 @@ enum reg_class ...@@ -761,13 +761,13 @@ enum reg_class
The trampoline code for nds32 target must contains following parts: The trampoline code for nds32 target must contains following parts:
1. instructions (4 * 4 = 16 bytes): 1. instructions (4 * 4 = 16 bytes):
get $pc first get $pc first
load chain_value to static chain register via $pc load chain_value to static chain register via $pc
load nested function address to $r15 via $pc load nested function address to $r15 via $pc
jump to desired nested function via $r15 jump to desired nested function via $r15
2. data (4 * 2 = 8 bytes): 2. data (4 * 2 = 8 bytes):
chain_value chain_value
nested function address nested function address
Please check nds32.c implementation for more information. */ Please check nds32.c implementation for more information. */
#define TRAMPOLINE_SIZE 24 #define TRAMPOLINE_SIZE 24
...@@ -906,10 +906,10 @@ enum reg_class ...@@ -906,10 +906,10 @@ enum reg_class
do \ do \
{ \ { \
/* Because our jump table is in text section, \ /* Because our jump table is in text section, \
we need to make sure 2-byte alignment after \ we need to make sure 2-byte alignment after \
the jump table for instructions fetch. */ \ the jump table for instructions fetch. */ \
if (GET_MODE (PATTERN (table)) == QImode) \ if (GET_MODE (PATTERN (table)) == QImode) \
ASM_OUTPUT_ALIGN (stream, 1); \ ASM_OUTPUT_ALIGN (stream, 1); \
asm_fprintf (stream, "\t! Jump Table End\n"); \ asm_fprintf (stream, "\t! Jump Table End\n"); \
} while (0) } while (0)
......
...@@ -269,12 +269,12 @@ ...@@ -269,12 +269,12 @@
{ {
case 0: case 0:
/* addi Rt4,Rt4,-x ==> subi45 Rt4,x /* addi Rt4,Rt4,-x ==> subi45 Rt4,x
where 0 <= x <= 31 */ where 0 <= x <= 31 */
operands[2] = gen_int_mode (-INTVAL (operands[2]), SImode); operands[2] = gen_int_mode (-INTVAL (operands[2]), SImode);
return "subi45\t%0, %2"; return "subi45\t%0, %2";
case 1: case 1:
/* addi Rt3,Ra3,-x ==> subi333 Rt3,Ra3,x /* addi Rt3,Ra3,-x ==> subi333 Rt3,Ra3,x
where 0 <= x <= 7 */ where 0 <= x <= 7 */
operands[2] = gen_int_mode (-INTVAL (operands[2]), SImode); operands[2] = gen_int_mode (-INTVAL (operands[2]), SImode);
return "subi333\t%0, %1, %2"; return "subi333\t%0, %1, %2";
case 2: case 2:
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
;; and needs to ensure it is exact_log2 value. ;; and needs to ensure it is exact_log2 value.
(define_insn "*add_slli" (define_insn "*add_slli"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" " r") (plus:SI (mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "immediate_operand" " i")) (match_operand:SI 2 "immediate_operand" " i"))
(match_operand:SI 3 "register_operand" " r")))] (match_operand:SI 3 "register_operand" " r")))]
"TARGET_ISA_V3 "TARGET_ISA_V3
...@@ -415,9 +415,9 @@ ...@@ -415,9 +415,9 @@
(define_insn "*maddr32_0" (define_insn "*maddr32_0"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (match_operand:SI 3 "register_operand" " 0") (plus:SI (match_operand:SI 3 "register_operand" " 0")
(mult:SI (match_operand:SI 1 "register_operand" " r") (mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))))] (match_operand:SI 2 "register_operand" " r"))))]
"" ""
"maddr32\t%0, %1, %2" "maddr32\t%0, %1, %2"
[(set_attr "type" "alu") [(set_attr "type" "alu")
...@@ -425,9 +425,9 @@ ...@@ -425,9 +425,9 @@
(define_insn "*maddr32_1" (define_insn "*maddr32_1"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" " r") (plus:SI (mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r")) (match_operand:SI 2 "register_operand" " r"))
(match_operand:SI 3 "register_operand" " 0")))] (match_operand:SI 3 "register_operand" " 0")))]
"" ""
"maddr32\t%0, %1, %2" "maddr32\t%0, %1, %2"
[(set_attr "type" "alu") [(set_attr "type" "alu")
...@@ -435,9 +435,9 @@ ...@@ -435,9 +435,9 @@
(define_insn "*msubr32" (define_insn "*msubr32"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(minus:SI (match_operand:SI 3 "register_operand" " 0") (minus:SI (match_operand:SI 3 "register_operand" " 0")
(mult:SI (match_operand:SI 1 "register_operand" " r") (mult:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))))] (match_operand:SI 2 "register_operand" " r"))))]
"" ""
"msubr32\t%0, %1, %2" "msubr32\t%0, %1, %2"
[(set_attr "type" "alu") [(set_attr "type" "alu")
...@@ -448,10 +448,10 @@ ...@@ -448,10 +448,10 @@
(define_insn "divmodsi4" (define_insn "divmodsi4"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(div:SI (match_operand:SI 1 "register_operand" " r") (div:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))) (match_operand:SI 2 "register_operand" " r")))
(set (match_operand:SI 3 "register_operand" "=r") (set (match_operand:SI 3 "register_operand" "=r")
(mod:SI (match_dup 1) (match_dup 2)))] (mod:SI (match_dup 1) (match_dup 2)))]
"" ""
"divsr\t%0, %3, %1, %2" "divsr\t%0, %3, %1, %2"
[(set_attr "type" "alu") [(set_attr "type" "alu")
...@@ -459,10 +459,10 @@ ...@@ -459,10 +459,10 @@
(define_insn "udivmodsi4" (define_insn "udivmodsi4"
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(udiv:SI (match_operand:SI 1 "register_operand" " r") (udiv:SI (match_operand:SI 1 "register_operand" " r")
(match_operand:SI 2 "register_operand" " r"))) (match_operand:SI 2 "register_operand" " r")))
(set (match_operand:SI 3 "register_operand" "=r") (set (match_operand:SI 3 "register_operand" "=r")
(umod:SI (match_dup 1) (match_dup 2)))] (umod:SI (match_dup 1) (match_dup 2)))]
"" ""
"divr\t%0, %3, %1, %2" "divr\t%0, %3, %1, %2"
[(set_attr "type" "alu") [(set_attr "type" "alu")
...@@ -2275,8 +2275,8 @@ create_template: ...@@ -2275,8 +2275,8 @@ create_template:
add_tmp = gen_int_mode (-INTVAL (operands[1]), SImode); add_tmp = gen_int_mode (-INTVAL (operands[1]), SImode);
/* If the integer value is not in the range of imm15s, /* If the integer value is not in the range of imm15s,
we need to force register first because our addsi3 pattern we need to force register first because our addsi3 pattern
only accept nds32_rimm15s_operand predicate. */ only accept nds32_rimm15s_operand predicate. */
add_tmp = force_reg (SImode, add_tmp); add_tmp = force_reg (SImode, add_tmp);
emit_insn (gen_addsi3 (reg, operands[0], add_tmp)); emit_insn (gen_addsi3 (reg, operands[0], add_tmp));
......
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