aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJin Ma <jinma@linux.alibaba.com>2023-08-09 13:52:06 -0600
committerJeff Law <jlaw@ventanamicro.com>2023-08-09 13:52:06 -0600
commitf088b768d01ae42385697584a2bcac141685dce2 (patch)
tree2090f029c326561f6bda1485b0a18833e49d8013 /gcc
parenta16dc729fda9fabd6472d50cce45791cb3b6ada8 (diff)
downloadgcc-f088b768d01ae42385697584a2bcac141685dce2.zip
gcc-f088b768d01ae42385697584a2bcac141685dce2.tar.gz
gcc-f088b768d01ae42385697584a2bcac141685dce2.tar.bz2
RISC-V: Handle no_insn in TARGET_SCHED_VARIABLE_ISSUE.
Reference: https://github.com/gcc-mirror/gcc/commit/d0bc0cb66bcb0e6a5a5a31a9e900e8ccc98e34e5 RISC-V should also be implemented to handle no_insn patterns for pipelining. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_sched_variable_issue): New function. (TARGET_SCHED_VARIABLE_ISSUE): New macro. Co-authored-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/riscv/riscv.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 7f2041a..dfb519a 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -6698,6 +6698,31 @@ riscv_issue_rate (void)
return tune_param->issue_rate;
}
+/* Implement TARGET_SCHED_VARIABLE_ISSUE. */
+static int
+riscv_sched_variable_issue (FILE *, int, rtx_insn *insn, int more)
+{
+ if (DEBUG_INSN_P (insn))
+ return more;
+
+ rtx_code code = GET_CODE (PATTERN (insn));
+ if (code == USE || code == CLOBBER)
+ return more;
+
+ /* GHOST insns are used for blockage and similar cases which
+ effectively end a cycle. */
+ if (get_attr_type (insn) == TYPE_GHOST)
+ return 0;
+
+#if 0
+ /* If we ever encounter an insn with an unknown type, trip
+ an assert so we can find and fix this problem. */
+ gcc_assert (get_attr_type (insn) != TYPE_UNKNOWN);
+#endif
+
+ return more - 1;
+}
+
/* Auxiliary function to emit RISC-V ELF attribute. */
static void
riscv_emit_attribute ()
@@ -8420,6 +8445,9 @@ riscv_frame_pointer_required (void)
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE riscv_issue_rate
+#undef TARGET_SCHED_VARIABLE_ISSUE
+#define TARGET_SCHED_VARIABLE_ISSUE riscv_sched_variable_issue
+
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL riscv_function_ok_for_sibcall