This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[AArch64] Make gentune.sh also generate "generic_sched" attribute
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: marcus dot shawcroft at arm dot com, richard dot earnshaw at arm dot com
- Date: Thu, 25 Sep 2014 14:37:51 +0100
- Subject: [AArch64] Make gentune.sh also generate "generic_sched" attribute
- Authentication-results: sourceware.org; auth=none
Hi,
This patch fixes an annoying gotcha when adding new cores or piepline
models in builds for AArch64. The "generic_sched" attribute also needs
updating in addition to aarch64-tune.md.
I see no good reason for this, we can generate that attribute in
gentune.sh quite easily.
For testing, I built an aarch64-none-elf toolchain with no issues.
OK?
Thanks,
James
---
2014-09-25 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.md (generic_sched): Don't define here.
* config/aarch64/gentune.sh: Also generate "generic_sched" attribute.
* config/aarch64/aarch64-tune.md: Regenerate.
diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md
index b7e40e0b5d13842ba5db02b41c9d17a2e626d916..38c4b30addc87d80fa374148e4a1752a297e9932 100644
--- a/gcc/config/aarch64/aarch64-tune.md
+++ b/gcc/config/aarch64/aarch64-tune.md
@@ -3,3 +3,11 @@
(define_attr "tune"
"cortexa53,cortexa15,cortexa57cortexa53"
(const (symbol_ref "((enum attr_tune) aarch64_tune)")))
+;; True if the generic scheduling description should be used.
+(define_attr "generic_sched" "yes,no"
+ (const (if_then_else
+ (eq_attr "tune"
+ "cortexa15,cortexa53"
+ )
+ (const_string "no")
+ (const_string "yes"))))
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 74b554ec4df78a963de6572c0175d0304d2bdf15..71bd131a5a32c2692c217f7189def6d77e02ecd6 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -181,14 +181,6 @@ (define_attr "enabled" "no,yes"
;; Processor types.
(include "aarch64-tune.md")
-;; True if the generic scheduling description should be used.
-
-(define_attr "generic_sched" "yes,no"
- (const (if_then_else
- (eq_attr "tune" "cortexa53,cortexa15")
- (const_string "no")
- (const_string "yes"))))
-
;; Scheduling
(include "../arm/cortex-a53.md")
(include "../arm/cortex-a15.md")
diff --git a/gcc/config/aarch64/gentune.sh b/gcc/config/aarch64/gentune.sh
index c0f2e79..7a8a976 100644
--- a/gcc/config/aarch64/gentune.sh
+++ b/gcc/config/aarch64/gentune.sh
@@ -19,8 +19,11 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Generate aarch64-tune.md, a file containing the tune attribute from the list of
-# CPUs in aarch64-cores.def
+# Generate aarch64-tune.md, a file containing the tune attribute and the
+# generic_sched attribute from the list of CPUs in aarch64-cores.def
+#
+# The two attributes require different awk patterns as the tune attribute
+# is sensitive to the ordering of the values it uses.
echo ";; -*- buffer-read-only: t -*-"
echo ";; Generated automatically by gentune.sh from aarch64-cores.def"
@@ -30,3 +33,15 @@ allcores=`awk -F'[(, ]+' '/^AARCH64_CORE/ { cores = cores$3"," } END { print co
echo "(define_attr \"tune\""
echo " \"$allcores\"" | sed -e 's/,"$/"/'
echo " (const (symbol_ref \"((enum attr_tune) aarch64_tune)\")))"
+
+allcores=`awk -F'[(, ]+' '/^AARCH64_CORE/ { if ($4 != "genericv8") print $4 }' $1 \
+ | sort -u | tr '\n' ','`
+
+echo ";; True if the generic scheduling description should be used."
+echo "(define_attr \"generic_sched\" \"yes,no\""
+echo " (const (if_then_else"
+echo " (eq_attr \"tune\""
+echo " \"$allcores\"" | sed -e 's/,"$/"/'
+echo " )"
+echo " (const_string \"no\")"
+echo " (const_string \"yes\"))))"