aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLulu Cheng <chenglulu@loongson.cn>2025-08-13 11:04:35 +0800
committerLulu Cheng <chenglulu@loongson.cn>2025-08-13 11:19:28 +0800
commitd94178d9b3fb1cb869b90d6f061990eae75c770e (patch)
tree1cb985924d5d596a323afc0a663799a6a5034791
parent8079e96eb767851e8e061a13ecfb21aa1a2362de (diff)
downloadgcc-d94178d9b3fb1cb869b90d6f061990eae75c770e.zip
gcc-d94178d9b3fb1cb869b90d6f061990eae75c770e.tar.gz
gcc-d94178d9b3fb1cb869b90d6f061990eae75c770e.tar.bz2
LoongArch: Define hook TARGET_COMPUTE_PRESSURE_CLASSES[PR120476].
The rtx cost value defined by the target backend affects the calculation of register pressure classes in the IRA, thus affecting scheduling. This may cause program performance degradation. For example, OpenSSL 3.5.1 SHA512 and SPEC CPU 2017 exchange_r. This problem can be avoided by defining a set of register pressure classes in the target backend instead of using the default IRA to automatically calculate them. gcc/ChangeLog: PR target/120476 * config/loongarch/loongarch.cc (loongarch_compute_pressure_classes): New function. (TARGET_COMPUTE_PRESSURE_CLASSES): Define.
-rw-r--r--gcc/config/loongarch/loongarch.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index b169d2f..3b62ed9 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -11182,6 +11182,18 @@ loongarch_bitint_type_info (int n, struct bitint_info *info)
return true;
}
+/* Implement TARGET_COMPUTE_PRESSURE_CLASSES. */
+
+static int
+loongarch_compute_pressure_classes (reg_class *classes)
+{
+ int i = 0;
+ classes[i++] = GENERAL_REGS;
+ classes[i++] = FP_REGS;
+ classes[i++] = FCC_REGS;
+ return i;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -11459,6 +11471,9 @@ loongarch_bitint_type_info (int n, struct bitint_info *info)
#undef TARGET_C_BITINT_TYPE_INFO
#define TARGET_C_BITINT_TYPE_INFO loongarch_bitint_type_info
+#undef TARGET_COMPUTE_PRESSURE_CLASSES
+#define TARGET_COMPUTE_PRESSURE_CLASSES loongarch_compute_pressure_classes
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-loongarch.h"