public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Carlotti <andrew.carlotti@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Sandiford <richard.sandiford@arm.com>
Subject: [PATCH 08/12] aarch64: Decouple feature flag option storage type
Date: Tue, 14 May 2024 15:58:26 +0100	[thread overview]
Message-ID: <d1364919-3404-3ac7-6fd3-420cd70308ec@e124511.cambridge.arm.com> (raw)
In-Reply-To: <0c99ec88-434d-a9de-0e0e-c281cb2dff4d@e124511.cambridge.arm.com>

The awk scripts that process the .opt files are relatively fragile and
only handle a limited set of data types correctly.  The unrecognised
aarch64_feature_flags type is handled as a uint64_t, which happens to be
correct for now.  However, that assumption will change when we extend
the mask to 128 bits.

This patch changes the option members to use uint64_t types, and adds a
"_0" suffix to the names (both for future extensibility, and to allow
the original name to be used for the full aarch64_feature_flags mask
within generator files).

gcc/ChangeLog:

	* common/config/aarch64/aarch64-common.cc
	(aarch64_set_asm_isa_flags): Reorder, and add suffix to names.
	* config/aarch64/aarch64.h
	(aarch64_get_asm_isa_flags): Add "_0" suffix.
	(aarch64_get_isa_flags): Ditto.
	(aarch64_asm_isa_flags): Redefine using renamed uint64_t value.
	(aarch64_isa_flags): Ditto.
	* config/aarch64/aarch64.opt:
	(aarch64_asm_isa_flags): Rename to...
	(aarch64_asm_isa_flags_0): ...this, and change to uint64_t.
	(aarch64_isa_flags): Rename to...
	(aarch64_isa_flags_0): ...this, and change to uint64_t.


diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc
index e08a0fc86590b35a595a305599dfb919f83d6906..2f437b82a24c16d9f808a4367ce2a281a49a77ee 100644
--- a/gcc/common/config/aarch64/aarch64-common.cc
+++ b/gcc/common/config/aarch64/aarch64-common.cc
@@ -66,15 +66,16 @@ static const struct default_options aarch_option_optimization_table[] =
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
-/* Set OPTS->x_aarch64_asm_isa_flags to FLAGS and update
-   OPTS->x_aarch64_isa_flags accordingly.  */
+
+/* Set OPTS->x_aarch64_asm_isa_flags_0 to FLAGS and update
+   OPTS->x_aarch64_isa_flags_0 accordingly.  */
 void
 aarch64_set_asm_isa_flags (gcc_options *opts, aarch64_feature_flags flags)
 {
-  opts->x_aarch64_asm_isa_flags = flags;
-  opts->x_aarch64_isa_flags = flags;
+  opts->x_aarch64_asm_isa_flags_0 = flags;
   if (opts->x_target_flags & MASK_GENERAL_REGS_ONLY)
-    opts->x_aarch64_isa_flags &= ~feature_deps::get_flags_off (AARCH64_FL_FP);
+    flags &= ~feature_deps::get_flags_off (AARCH64_FL_FP);
+  opts->x_aarch64_isa_flags_0 = flags;
 }
 
 /* Implement TARGET_HANDLE_OPTION.
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 49bdc7565cd5ca80fbe2d4abf30aae12841c340f..af256c581aedc04e4194ac0158380fcdb8b65594 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -23,13 +23,18 @@
 #define GCC_AARCH64_H
 
 #define aarch64_get_asm_isa_flags(opts) \
-  (aarch64_feature_flags ((opts)->x_aarch64_asm_isa_flags))
+  (aarch64_feature_flags ((opts)->x_aarch64_asm_isa_flags_0))
 #define aarch64_get_isa_flags(opts) \
-  (aarch64_feature_flags ((opts)->x_aarch64_isa_flags))
+  (aarch64_feature_flags ((opts)->x_aarch64_isa_flags_0))
 
 /* Make these flags read-only so that all uses go via
    aarch64_set_asm_isa_flags.  */
-#ifndef GENERATOR_FILE
+#ifdef GENERATOR_FILE
+#undef aarch64_asm_isa_flags
+#define aarch64_asm_isa_flags (aarch64_feature_flags (aarch64_asm_isa_flags_0))
+#undef aarch64_isa_flags
+#define aarch64_isa_flags (aarch64_feature_flags (aarch64_isa_flags_0))
+#else
 #undef aarch64_asm_isa_flags
 #define aarch64_asm_isa_flags (aarch64_get_asm_isa_flags (&global_options))
 #undef aarch64_isa_flags
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 6356c419399bd324929cd599e5a4b926b0383469..45aab49de27bdfa0fb3f67ec06c7dcf0ac242fb3 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -31,10 +31,10 @@ TargetVariable
 enum aarch64_arch selected_arch = aarch64_no_arch
 
 TargetVariable
-aarch64_feature_flags aarch64_asm_isa_flags = 0
+uint64_t aarch64_asm_isa_flags_0 = 0
 
 TargetVariable
-aarch64_feature_flags aarch64_isa_flags = 0
+uint64_t aarch64_isa_flags_0 = 0
 
 TargetVariable
 unsigned aarch_enable_bti = 2

  parent reply	other threads:[~2024-05-14 14:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 14:54 [PATCH 00/12] aarch64: Extend aarch64_feature_flags to 128 bits Andrew Carlotti
2024-05-14 14:55 ` [PATCH 01/12] aarch64: Remove unused global aarch64_tune_flags Andrew Carlotti
2024-05-14 14:55 ` [PATCH 02/12] aarch64: Move AARCH64_NUM_ISA_MODES definition Andrew Carlotti
2024-05-14 14:56 ` [PATCH 03/12] aarch64: Don't use 0 for aarch64_feature_flags Andrew Carlotti
2024-05-14 14:56 ` [PATCH 04/12] aarch64: Don't compare aarch64_feature_flags to 0 Andrew Carlotti
2024-05-14 14:56 ` [PATCH 05/12] aarch64: Eliminate a temporary variable Andrew Carlotti
2024-05-14 14:57 ` [PATCH 06/12] aarch64: Introduce aarch64_isa_mode type Andrew Carlotti
2024-05-14 14:57 ` [PATCH 07/12] aarch64: Define aarch64_get_{asm_|}isa_flags Andrew Carlotti
2024-05-14 14:58 ` Andrew Carlotti [this message]
2024-05-14 14:58 ` [PATCH 09/12] aarch64: Assign flags to local constexpr variable Andrew Carlotti
2024-05-14 14:59 ` [PATCH 10/12] aarch64: Add aarch64_feature_flags_from_index macro Andrew Carlotti
2024-05-14 14:59 ` [RFC 11/12] Add explicit bool casts to .md condition users Andrew Carlotti
2024-05-14 15:00 ` [PATCH 12/12] aarch64: Extend aarch64_feature_flags to 128 bits Andrew Carlotti
2024-05-17 15:45 ` [PATCH 00/12] " Richard Sandiford
2024-05-20 12:09   ` Andrew Carlotti
2024-05-20 15:53     ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1364919-3404-3ac7-6fd3-420cd70308ec@e124511.cambridge.arm.com \
    --to=andrew.carlotti@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).