aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChung-Ju Wu <jasonwucj@gmail.com>2018-04-06 18:36:28 +0000
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>2018-04-06 18:36:28 +0000
commita58762287e1a75e29df3d6e80e7b22e3ff03a320 (patch)
tree286cd9ae620e38054bba7ba340b62b254e539fa0
parentf46706733954c2868af5e91687931538600b2a92 (diff)
downloadgcc-a58762287e1a75e29df3d6e80e7b22e3ff03a320.zip
gcc-a58762287e1a75e29df3d6e80e7b22e3ff03a320.tar.gz
gcc-a58762287e1a75e29df3d6e80e7b22e3ff03a320.tar.bz2
[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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/nds32/nds32.c60
-rw-r--r--gcc/config/nds32/nds32.h7
3 files changed, 38 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a261a45..f92cd60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,10 @@
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>
* config/nds32/nds32-md-auxiliary.c (nds32_output_return,
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 1070b47..030fb2e 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -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)
{
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index c1d389c..934fe03 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -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. */