From: Andrew Pinski <pinskia@gmail.com>
To: James Greenhalgh <james.greenhalgh@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Marcus Shawcroft <marcus.shawcroft@arm.com>,
Richard Earnshaw <richard.earnshaw@arm.com>
Subject: Re: [AArch64] Break -mcpu tie between the compiler and assembler
Date: Wed, 19 Aug 2015 15:50:00 -0000 [thread overview]
Message-ID: <CA+=Sn1=djOY=+c7CWe9KV52vM_HpoQo8HKob4CGKNmuKDAkuTg@mail.gmail.com> (raw)
In-Reply-To: <1439998779-15761-1-git-send-email-james.greenhalgh@arm.com>
On Wed, Aug 19, 2015 at 11:39 PM, James Greenhalgh
<james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch has been sitting in my tree for a while - it comes in handy
> when trying out bootstrap or test with -mcpu values like -mcpu=cortex-a72
> with a system assmebler which trails trunk binutils.
>
> Essentially, we rewrite -mcpu=foo to a -march flag providing the same
> architecture revision and set of optional architecture features. There
> is no reason we should ever need the assembler to see a CPU name, it
> should only be interested in the architecture variant.
>
> While we're there I've long found this function too fragile and hard
> to grok in C. So I've rewritten it in C++ to use std::string rather than
> raw C strings. Making this work with extension strings requires a slight
> refactor to the existing extension printing code to pull it across to
> somewhere common.
>
> Note that this also stops us from having to pick through a big.LITTLE
> target to find and separate the core names - we can just look up the
> architecture of the whole target and use that.
>
> The new function does leak the allocation of a C string to hold the
> result, but looking at gcc.c:getenv_spec_function and
> gcc.c:replace_extension_spec_func this is the usual thing to do.
>
> This has been through an aarch64-none-linux-gnu bootstrap and test run,
> configured with --with-cpu=cortex-a72 , which my system assembler does
> not understand.
>
> Ok?
+ modified string, which seems much worse! */
+ char *output = (char*) xmalloc (sizeof (*output)
+ * (outstr.length () + 1));
+ strcpy (output, outstr.c_str ());
Why not just:
char *output = xstrdup (outstr.c_str ());
Or at least use XNEWVEC instead of xmalloc with a cast?
Thanks,
Andrew Pinski
>
> Thanks,
> James
>
> ---
> 2015-08-19 James Greenhalgh <james.greenhalgh@arm.com>
>
> * common/config/aarch64/aarch64-common.c
> (AARCH64_CPU_NAME_LENGTH): Delete.
> (aarch64_option_extension): New.
> (all_extensions): Likewise.
> (processor_name_to_arch): Likewise.
> (arch_to_arch_name): Likewise.
> (all_cores): New.
> (all_architectures): Likewise.
> (aarch64_get_extension_string_for_isa_flags): Likewise.
> (aarch64_rewrite_selected_cpu): Change to rewrite CPU names to
> architecture names.
> * config/aarch64/aarch64-protos.h
> (aarch64_get_extension_string_for_isa_flags): New.
> * config/aarch64/aarch64.c (aarch64_print_extension): Delete.
> (aarch64_option_print): Get the string to print from
> aarch64_get_extension_string_for_isa_flags.
> (aarch64_declare_function_name): Likewise.
> * config/aarch64/aarch64.h (BIG_LITTLE_SPEC): Rename to...
> (MCPU_TO_MARCH_SPEC): This.
> (ASM_CPU_SPEC): Use it.
> (BIG_LITTLE_SPEC_FUNCTIONS): Rename to...
> (MCPU_TO_MARCH_SPEC_FUNCTIONS): ...This.
> (EXTRA_SPEC_FUNCTIONS): Use it.
>
next prev parent reply other threads:[~2015-08-19 15:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 15:43 James Greenhalgh
2015-08-19 15:48 ` Andrew Pinski
2015-08-19 15:50 ` Andrew Pinski [this message]
2015-08-20 8:16 ` James Greenhalgh
2015-08-20 9:11 ` Marcus Shawcroft
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='CA+=Sn1=djOY=+c7CWe9KV52vM_HpoQo8HKob4CGKNmuKDAkuTg@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=james.greenhalgh@arm.com \
--cc=marcus.shawcroft@arm.com \
--cc=richard.earnshaw@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).