aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorSheldon Lobo <sheldon.lobo@oracle.com>2017-02-23 07:49:37 -0800
committerJose E. Marchesi <jose.marchesi@oracle.com>2017-02-23 07:53:16 -0800
commit1e9d41d49f7f0b9e7381e8bf8ce848f8a33b8fde (patch)
treec8858a8766718c47ed5e890c67434e499bb04278 /gas
parent8eaf53202ea60191162d5f1069cd08ebd9f38f6c (diff)
downloadfsf-binutils-gdb-1e9d41d49f7f0b9e7381e8bf8ce848f8a33b8fde.zip
fsf-binutils-gdb-1e9d41d49f7f0b9e7381e8bf8ce848f8a33b8fde.tar.gz
fsf-binutils-gdb-1e9d41d49f7f0b9e7381e8bf8ce848f8a33b8fde.tar.bz2
opcodes,gas: associate SPARC ASIs with an architecture level.
With this change an architecture level bump due to assembly ASIs will show up as a warning/error depending on options passed to gas. Tested with sparc64-linux-gnu, and it does not introduce any regressions. gas/ChangeLog: Add support for associating SPARC ASIs with an architecture level. * config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs. opcodes/ChangeLog: Add support for associating SPARC ASIs with an architecture level. * include/opcode/sparc.h (sparc_asi): New sparc_asi struct. * opcodes/sparc-opc.c (asi_table): Updated asi_table and encoding/ decoding of SPARC ASIs.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-sparc.c53
2 files changed, 51 insertions, 7 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index bf3e038..415237c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-23 Sheldon Lobo <sheldon.lobo@oracle.com>
+
+ Add support for associating SPARC ASIs with an architecture level.
+ * config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs.
+
2017-02-23 Jan Beulich <jbeulich@suse.com>
* testsuite/gas/all/err-sizeof.s: Don't use sums or differences
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index b1651f9..030e10d 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -36,6 +36,7 @@
#define U0x80000000 ((((unsigned long) 1 << 16) << 15))
static int sparc_ip (char *, const struct sparc_opcode **);
+static int parse_sparc_asi (char **, const sparc_asi **);
static int parse_keyword_arg (int (*) (const char *), char **, int *);
static int parse_const_expr_arg (char **, int *);
static int get_expression (char *);
@@ -1764,6 +1765,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
int comma = 0;
int v9_arg_p;
int special_case = SPECIAL_CASE_NONE;
+ const sparc_asi *sasi = NULL;
s = str;
if (ISLOWER (*s))
@@ -2969,11 +2971,12 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
/* Parse an asi. */
if (*s == '#')
{
- if (! parse_keyword_arg (sparc_encode_asi, &s, &asi))
+ if (! parse_sparc_asi (&s, &sasi))
{
error_message = _(": invalid ASI name");
goto error;
}
+ asi = sasi->value;
}
else
{
@@ -3147,8 +3150,18 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
else
{
/* We have a match. Now see if the architecture is OK. */
+ /* String to use in case of architecture warning. */
+ const char *msg_str = str;
int needed_arch_mask = insn->architecture;
- bfd_uint64_t hwcaps
+
+ /* Include the ASI architecture needed as well */
+ if (sasi && needed_arch_mask > sasi->architecture)
+ {
+ needed_arch_mask = sasi->architecture;
+ msg_str = sasi->name;
+ }
+
+ bfd_uint64_t hwcaps
= (((bfd_uint64_t) insn->hwcaps2) << 32) | insn->hwcaps;
#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
@@ -3183,7 +3196,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
as_warn (_("architecture bumped from \"%s\" to \"%s\" on \"%s\""),
sparc_opcode_archs[current_architecture].name,
sparc_opcode_archs[needed_architecture].name,
- str);
+ msg_str);
warn_after_architecture = needed_architecture;
}
current_architecture = needed_architecture;
@@ -3247,6 +3260,35 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
return special_case;
}
+static char *
+skip_over_keyword (char *q)
+{
+ for (q = q + (*q == '#' || *q == '%');
+ ISALNUM (*q) || *q == '_';
+ ++q)
+ continue;
+ return q;
+}
+
+static int
+parse_sparc_asi (char **input_pointer_p, const sparc_asi **value_p)
+{
+ const sparc_asi *value;
+ char c, *p, *q;
+
+ p = *input_pointer_p;
+ q = skip_over_keyword(p);
+ c = *q;
+ *q = 0;
+ value = sparc_encode_asi (p);
+ *q = c;
+ if (value == NULL)
+ return 0;
+ *value_p = value;
+ *input_pointer_p = q;
+ return 1;
+}
+
/* Parse an argument that can be expressed as a keyword.
(eg: #StoreStore or %ccfr).
The result is a boolean indicating success.
@@ -3261,10 +3303,7 @@ parse_keyword_arg (int (*lookup_fn) (const char *),
char c, *p, *q;
p = *input_pointerP;
- for (q = p + (*p == '#' || *p == '%');
- ISALNUM (*q) || *q == '_';
- ++q)
- continue;
+ q = skip_over_keyword(p);
c = *q;
*q = 0;
value = (*lookup_fn) (p);