From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126276 invoked by alias); 5 Mar 2016 21:24:19 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 126064 invoked by uid 89); 5 Mar 2016 21:24:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=strcasecmp, !strcasecmp, chosen, 347 X-HELO: mail-wm0-f44.google.com Received: from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 05 Mar 2016 21:24:12 +0000 Received: by mail-wm0-f44.google.com with SMTP id l68so29622193wml.1 for ; Sat, 05 Mar 2016 13:24:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=k1+qw4mRHgrH7Tgwopx1qWncv+l8PRfa+vpgtQa0+tc=; b=NrTS6INLZp9e0pFmdK0uSA/iry6j4Z7PlHVsCfRddZgwpuJhjPEs8mOpxskM8fGCye 2UZ0oG22DMpWtZJyMEpA507bpVSmY5CD3XaDgGhC2SKEqcNMZUwk/gED4e/1ABYtkusy XZdlsRHfN4Ci7VdcysLrNhzYeqX+L2S+iUKASQyVeoKoZUmYsT05KydI6vZVLqBtqzgv hrRQNtCSsqVZEspnrudcVRsqggQCLYCCcbxTByZ1inYtU5Y3skbXL84Nptb5fXJnLJ2U qI02nE8iioJAL3/uGkYjnrzLk5Ap7EmiNS2jZu54/IMl470c1GFTsfho+dGn7d3nnmRs aYAA== X-Gm-Message-State: AD7BkJJZLWL2xRcffaLJX6Pw9peT4OfSQnhwYXnMCXgTW4BN9Wa7hsdKKmS95ugd3EO+Sg== X-Received: by 10.194.223.104 with SMTP id qt8mr15137392wjc.11.1457213049552; Sat, 05 Mar 2016 13:24:09 -0800 (PST) Received: from localhost (host86-138-94-184.range86-138.btcentralplus.com. [86.138.94.184]) by smtp.gmail.com with ESMTPSA id av3sm9819740wjc.44.2016.03.05.13.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Mar 2016 13:24:08 -0800 (PST) Date: Sat, 05 Mar 2016 21:24:00 -0000 From: Andrew Burgess To: binutils@sourceware.org Cc: noamca@mellanox.com, Claudiu.Zissulescu@synopsys.com, Cupertino.Miranda@synopsys.com Subject: Re: [PATCHv2 1/2] arc/gas: default mach is arc700, initialised in md_begin Message-ID: <20160305212352.GH9275@embecosm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00092.txt.bz2 After a little further testing on this branch it turns out I introduced a bug in the content I moved from md_parse_option to arc_select_cpu. After a little thought, I realised that the whole allocating of a temporary string was unneeded, and we can instead just use strcasecmp (which is already being used in tc-arc.c). Here's a new version of the patch, basically the same except that arc_select_cpu is now a little simpler. Thanks, Andrew --- This commit restructures the selection of the default cpu/mach so that the choice is made from md_begin (if the user has not provided a command line choice). This will reduce the amount of change needed in a later patch. At the request of Synopsys, the default architecture changes to ARC700 from this commit, previously the default was a non-existent super-architecture that contained all instructions from all arc variants. There's some clean up associated with removing the default merged architecture, and a small test fix now that the default is ARC700. binutils/ChangeLog: * testsuite/binutils-all/objdump.exp (cpus_expected): Add ARC700 to the architecture list. gas/ChangeLog: * config/tc-arc.c (arc_target): Delay initialisation until arc_select_cpu. (arc_target_name): Likewise. (arc_features): Likewise. (arc_mach_type): Likewise. (cpu_types): Remove "all" entry. (arc_select_cpu): New function, most of the content is from... (md_parse_option): ... here. Call new arc_select_cpu. (md_begin): Call arc_select_cpu if needed, default is now arc700. include/ChangeLog: * opcode/arc.h (ARC_OPCODE_BASE): Delete. opcodes/ChangeLog: * arc-opc.c (BASE): Delete. --- binutils/ChangeLog | 5 ++ binutils/testsuite/binutils-all/objdump.exp | 2 +- gas/ChangeLog | 12 +++++ gas/config/tc-arc.c | 80 ++++++++++++++--------------- include/ChangeLog | 4 ++ include/opcode/arc.h | 5 -- opcodes/ChangeLog | 4 ++ opcodes/arc-opc.c | 3 -- 8 files changed, 64 insertions(+), 51 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 56c8adc..b4750ef 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2016-03-01 Andrew Burgess + + * testsuite/binutils-all/objdump.exp (cpus_expected): Add ARC700 + to the architecture list. + 2016-02-26 H.J. Lu PR ld/19645 diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 22c4686..3573037 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -34,7 +34,7 @@ send_user "Version [binutil_version $OBJDUMP]" set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] set cpus_expected [list] -lappend cpus_expected aarch64 alpha arc ARCv2 arm cris +lappend cpus_expected aarch64 alpha arc ARC700 ARCv2 arm cris lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 iamcu ip2022 lappend cpus_expected m16c m32c m32r m68hc11 m68hc12 m68k m88k MCore mep c5 h1 MicroBlaze lappend cpus_expected mips mn10200 mn10300 ms1 msp MSP430 nds32 n1h_v3 ns32k diff --git a/gas/ChangeLog b/gas/ChangeLog index 4a075bb..141f8c8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +2016-03-01 Andrew Burgess + + * config/tc-arc.c (arc_target): Delay initialisation until + arc_select_cpu. + (arc_target_name): Likewise. + (arc_features): Likewise. + (arc_mach_type): Likewise. + (cpu_types): Remove "all" entry. + (arc_select_cpu): New function, most of the content is from... + (md_parse_option): ... here. Call new arc_select_cpu. + (md_begin): Call arc_select_cpu if needed, default is now arc700. + 2016-02-29 Cupertino Miranda Claudiu Zissulescu diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index e509fec..b11dd64 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -311,12 +311,12 @@ static void assemble_insn const struct arc_flags *, int, struct arc_insn *); /* The cpu for which we are generating code. */ -static unsigned arc_target = ARC_OPCODE_BASE; -static const char *arc_target_name = ""; -static unsigned arc_features = 0x00; +static unsigned arc_target; +static const char *arc_target_name; +static unsigned arc_features; /* The default architecture. */ -static int arc_mach_type = bfd_mach_arc_arcv2; +static int arc_mach_type; /* Non-zero if the cpu type has been explicitly specified. */ static int mach_type_specified_p = 0; @@ -346,8 +346,6 @@ static const struct cpu_type EF_ARC_CPU_ARCV2EM, ARC_CD}, { "archs", ARC_OPCODE_ARCv2HS, bfd_mach_arc_arcv2, EF_ARC_CPU_ARCV2HS, ARC_CD}, - { "all", ARC_OPCODE_BASE, bfd_mach_arc_arcv2, - 0x00, 0x00 }, { 0, 0, 0, 0, 0 } }; @@ -569,6 +567,35 @@ md_number_to_chars_midend (char *buf, valueT val, int n) } } +/* Select an appropriate entry from CPU_TYPES based on ARG and initialise + the relevant static global variables. */ + +static void +arc_select_cpu (const char *arg) +{ + int cpu_flags = EF_ARC_CPU_GENERIC; + int i; + + for (i = 0; cpu_types[i].name; ++i) + { + if (!strcasecmp (cpu_types[i].name, arg)) + { + arc_target = cpu_types[i].flags; + arc_target_name = cpu_types[i].name; + arc_features = cpu_types[i].features; + arc_mach_type = cpu_types[i].mach; + cpu_flags = cpu_types[i].eflags; + break; + } + } + + if (!cpu_types[i].name) + as_fatal (_("unknown architecture: %s\n"), arg); + + if (cpu_flags != EF_ARC_CPU_GENERIC) + arc_eflag = (arc_eflag & ~EF_ARC_MACH_MSK) | cpu_flags; +} + /* Here ends all the ARCompact extension instruction assembling stuff. */ @@ -2088,6 +2115,9 @@ md_begin (void) { unsigned int i; + if (!mach_type_specified_p) + arc_select_cpu ("arc700"); + /* The endianness can be chosen "at the factory". */ target_big_endian = byte_order == BIG_ENDIAN; @@ -2874,8 +2904,6 @@ arc_parse_name (const char *name, int md_parse_option (int c, char *arg ATTRIBUTE_UNUSED) { - int cpu_flags = EF_ARC_CPU_GENERIC; - switch (c) { case OPTION_ARC600: @@ -2893,37 +2921,8 @@ md_parse_option (int c, char *arg ATTRIBUTE_UNUSED) case OPTION_MCPU: { - int i; - char *s = alloca (strlen (arg) + 1); - - { - char *t = s; - char *arg1 = arg; - - do - *t = TOLOWER (*arg1++); - while (*t++); - } - - for (i = 0; cpu_types[i].name; ++i) - { - if (!strcmp (cpu_types[i].name, s)) - { - arc_target = cpu_types[i].flags; - arc_target_name = cpu_types[i].name; - arc_features = cpu_types[i].features; - arc_mach_type = cpu_types[i].mach; - cpu_flags = cpu_types[i].eflags; - - mach_type_specified_p = 1; - break; - } - } - - if (!cpu_types[i].name) - { - as_fatal (_("unknown architecture: %s\n"), arg); - } + arc_select_cpu (arg); + mach_type_specified_p = 1; break; } @@ -2977,9 +2976,6 @@ md_parse_option (int c, char *arg ATTRIBUTE_UNUSED) return 0; } - if (cpu_flags != EF_ARC_CPU_GENERIC) - arc_eflag = (arc_eflag & ~EF_ARC_MACH_MSK) | cpu_flags; - return 1; } diff --git a/include/ChangeLog b/include/ChangeLog index 97bba8b..dcefe91 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2016-03-01 Andrew Burgess + + * opcode/arc.h (ARC_OPCODE_BASE): Delete. + 2016-02-26 H.J. Lu PR ld/19645 diff --git a/include/opcode/arc.h b/include/opcode/arc.h index 6f5bc98..d33b878 100644 --- a/include/opcode/arc.h +++ b/include/opcode/arc.h @@ -171,11 +171,6 @@ extern const unsigned arc_num_opcodes; #define ARC_XMAC 0x1000 #define ARC_CRC 0x1000 -/* Base architecture -- all cpus. */ -#define ARC_OPCODE_BASE \ - (ARC_OPCODE_ARC600 | ARC_OPCODE_ARC700 \ - | ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS) - /* A macro to check for short instructions. */ #define ARC_SHORT(mask) \ (((mask) & 0xFFFF0000) ? 0 : 1) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0a78719..fe466f3 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2016-03-01 Andrew Burgess + + * arc-opc.c (BASE): Delete. + 2016-03-01 Nick Clifton PR target/19747 diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c index 9a674d5..a4fdaff 100644 --- a/opcodes/arc-opc.c +++ b/opcodes/arc-opc.c @@ -642,9 +642,6 @@ extract_g_s (unsigned insn ATTRIBUTE_UNUSED, defines. */ #include "arc-fxi.h" -/* Abbreviations for instruction subsets. */ -#define BASE ARC_OPCODE_BASE - /* The flag operands table. The format of the table is -- 2.5.1