+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>
/* PART 3: Implement target hook stuff definitions. */
\f
+/* 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
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)
{
/* 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.
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. */