[NDS32] Refine ADJUST_INSN_LENGTH implementation.
gcc/ * config/nds32/nds32.c (nds32_adjust_insn_length): Refine. * config/nds32/nds32.h (ADJUST_INSN_LENGTH): Change the location in file. From-SVN: r259187
This commit is contained in:
parent
f467067339
commit
a58762287e
3 changed files with 38 additions and 35 deletions
|
@ -1,3 +1,9 @@
|
|||
2018-04-06 Chung-Ju Wu <jasonwucj@gmail.com>
|
||||
|
||||
* config/nds32/nds32.c (nds32_adjust_insn_length): Refine.
|
||||
* config/nds32/nds32.h (ADJUST_INSN_LENGTH): Change the location in
|
||||
file.
|
||||
|
||||
2018-04-06 Chung-Ju Wu <jasonwucj@gmail.com>
|
||||
Kito Cheng <kito.cheng@gmail.com>
|
||||
|
||||
|
|
|
@ -1328,6 +1328,35 @@ nds32_register_passes (void)
|
|||
/* PART 3: Implement target hook stuff definitions. */
|
||||
|
||||
|
||||
/* Computing the Length of an Insn.
|
||||
Modifies the length assigned to instruction INSN.
|
||||
LEN is the initially computed length of the insn. */
|
||||
int
|
||||
nds32_adjust_insn_length (rtx_insn *insn, int length)
|
||||
{
|
||||
int adjust_value = 0;
|
||||
switch (recog_memoized (insn))
|
||||
{
|
||||
case CODE_FOR_call_internal:
|
||||
case CODE_FOR_call_value_internal:
|
||||
{
|
||||
/* We need insert a nop after a noretun function call
|
||||
to prevent software breakpoint corrupt the next function. */
|
||||
if (find_reg_note (insn, REG_NORETURN, NULL_RTX))
|
||||
{
|
||||
if (TARGET_16_BIT)
|
||||
adjust_value += 2;
|
||||
else
|
||||
adjust_value += 4;
|
||||
}
|
||||
}
|
||||
return length + adjust_value;
|
||||
|
||||
default:
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
/* Register Usage. */
|
||||
|
||||
static void
|
||||
|
@ -4364,37 +4393,6 @@ nds32_ls_333_p (rtx rt, rtx ra, rtx imm, machine_mode mode)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Computing the Length of an Insn.
|
||||
Modifies the length assigned to instruction INSN.
|
||||
LEN is the initially computed length of the insn. */
|
||||
int
|
||||
nds32_adjust_insn_length (rtx_insn *insn, int length)
|
||||
{
|
||||
rtx src, dst;
|
||||
|
||||
switch (recog_memoized (insn))
|
||||
{
|
||||
case CODE_FOR_move_df:
|
||||
case CODE_FOR_move_di:
|
||||
/* Adjust length of movd44 to 2. */
|
||||
src = XEXP (PATTERN (insn), 1);
|
||||
dst = XEXP (PATTERN (insn), 0);
|
||||
|
||||
if (REG_P (src)
|
||||
&& REG_P (dst)
|
||||
&& (REGNO (src) % 2) == 0
|
||||
&& (REGNO (dst) % 2) == 0)
|
||||
length = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
bool
|
||||
nds32_split_double_word_load_store_p(rtx *operands, bool load_p)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
/* The following are auxiliary macros or structure declarations
|
||||
that are used all over the nds32.c and nds32.h. */
|
||||
|
||||
#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
|
||||
(LENGTH = nds32_adjust_insn_length (INSN, LENGTH))
|
||||
|
||||
/* Use SYMBOL_FLAG_MACH_DEP to define our own symbol_ref flag.
|
||||
It is used in nds32_encode_section_info() to store flag in symbol_ref
|
||||
in case the symbol should be placed in .rodata section.
|
||||
|
@ -41,10 +44,6 @@ enum nds32_expand_result_type
|
|||
EXPAND_CREATE_TEMPLATE
|
||||
};
|
||||
|
||||
/* Computing the Length of an Insn. */
|
||||
#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
|
||||
(LENGTH = nds32_adjust_insn_length (INSN, LENGTH))
|
||||
|
||||
/* Check instruction LS-37-FP-implied form.
|
||||
Note: actually its immediate range is imm9u
|
||||
since it is used for lwi37/swi37 instructions. */
|
||||
|
|
Loading…
Add table
Reference in a new issue