From: Richard Earnshaw <rearnsha@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Earnshaw <rearnsha@arm.com>, christophe.lyon.oss@gmail.com
Subject: [committed v2 2/3] arm: Don't reconfigure globals in arm_configure_build_target
Date: Thu, 5 Aug 2021 12:57:49 +0100 [thread overview]
Message-ID: <20210805115750.3824520-3-rearnsha@arm.com> (raw)
In-Reply-To: <20210805115750.3824520-1-rearnsha@arm.com>
[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]
arm_configure_build_target is usually used to reconfigure the
arm_active_target structure, which is then used to reconfigure a
number of other global variables describing the current target.
Occasionally, however, we need to use arm_configure_build_target to
construct a temporary target structure and in that case it is wrong to
try to reconfigure the global variables (although probably harmless,
since arm_option_reconfigure_globals() only looks at
arm_active_target). At the very least, however, this is wasted work,
so it is best not to do it unless needed. What's more, several
callers of arm_configure_build target call
arm_option_reconfigure_globals themselves within a few lines, making
the call from within arm_configure_build_target completely redundant.
So this patch moves the responsibility of calling of
arm_configure_build_target to its callers (only two places needed
updating).
gcc:
* config/arm/arm.c (arm_configure_build_target): Don't call
arm_option_reconfigure_globals.
(arm_option_restore): Call arm_option_reconfigure_globals after
reconfiguring the target.
* config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
---
gcc/config/arm/arm-c.c | 1 +
gcc/config/arm/arm.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0002-arm-Don-t-reconfigure-globals-in-arm_configure_bu.patch --]
[-- Type: text/x-patch; name="v2-0002-arm-Don-t-reconfigure-globals-in-arm_configure_bu.patch", Size: 1263 bytes --]
diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index ae2139c4bfa..cc7901bca8d 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -409,6 +409,7 @@ arm_pragma_target_parse (tree args, tree pop_target)
target_option_current_node = cur_tree;
arm_configure_build_target (&arm_active_target,
TREE_TARGET_OPTION (cur_tree), false);
+ arm_option_reconfigure_globals ();
}
/* Update macros if target_node changes. The global state will be restored
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b2dd58d8751..273202ac2fd 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3058,6 +3058,7 @@ arm_option_restore (struct gcc_options */* opts */,
struct cl_target_option *ptr)
{
arm_configure_build_target (&arm_active_target, ptr, false);
+ arm_option_reconfigure_globals ();
}
/* Reset options between modes that the user has specified. */
@@ -3441,7 +3442,6 @@ arm_configure_build_target (struct arm_build_target *target,
target->tune_flags = tune_data->tune_flags;
target->tune = tune_data->tune;
target->tune_core = tune_data->scheduler;
- arm_option_reconfigure_globals ();
}
/* Fix up any incompatible options that the user has specified. */
next prev parent reply other threads:[~2021-08-05 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-05 11:57 [committed v2 0/3] arm: fix problems when targetting extended FPUs [PR101723] Richard Earnshaw
2021-08-05 11:57 ` [committed v2 1/3] arm: ensure the arch_name is always set for the build target Richard Earnshaw
2021-08-05 11:57 ` Richard Earnshaw [this message]
2021-08-05 11:57 ` [committed v2 3/3] arm: reorder assembler architecture directives [PR101723] Richard Earnshaw
2021-08-06 14:08 ` Christophe Lyon
2021-08-06 14:21 ` Christophe Lyon
2021-08-06 14:28 ` Richard Earnshaw
2021-08-06 14:43 ` Christophe Lyon
2021-08-06 14:25 ` Richard Earnshaw
2021-08-09 17:47 ` Christophe Lyon
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=20210805115750.3824520-3-rearnsha@arm.com \
--to=rearnsha@arm.com \
--cc=christophe.lyon.oss@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/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).