This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[AArch64] Let aliased instructions be their preferred form.


Hello,

Although the AArch64 backend supports aliased instructions, the aliasing
forms are always preferred over the real instruction. This makes it
awkward to handle instructions which have aliases but which are their
own preferred form.

This patch includes the instruction being aliased in the list of
alternatives which is searched when considering which form to use.

Tested for aarch64-none-linux-gnu with cross-compiled check-binutils and
check-gas.

Ok for trunk?
Matthew

opcodes/
2015-11-24  Matthew Wahab  <matthew.wahab@arm.com>

	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-dis.c: Weaken assert.
	* aarch64-gen.c: Include the instruction in the list of its
	possible aliases.
>From b3f4e361e7994e3b9818552cd9c57937d683c5f8 Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
Date: Thu, 3 Sep 2015 20:47:00 +0100
Subject: [PATCH] [Aarch64] Allow an aliased instruction to be its preferred
 form.

Change-Id: Ie4c2b22c551c6a0ca02a60496fddc97504bc4c1c
---
 opcodes/aarch64-dis.c | 2 +-
 opcodes/aarch64-gen.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 93766c6..d744c25 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -1866,7 +1866,7 @@ determine_disassembling_preference (struct aarch64_inst *inst)
   for (; alias; alias = aarch64_find_next_alias_opcode (alias))
     {
       DEBUG_TRACE ("try %s", alias->name);
-      assert (alias_opcode_p (alias));
+      assert (alias_opcode_p (alias) || opcode_has_alias (opcode));
 
       /* An alias can be a pseudo opcode which will never be used in the
 	 disassembly, e.g. BIC logical immediate is such a pseudo opcode
diff --git a/opcodes/aarch64-gen.c b/opcodes/aarch64-gen.c
index bc1e58a..155ec85 100644
--- a/opcodes/aarch64-gen.c
+++ b/opcodes/aarch64-gen.c
@@ -693,12 +693,14 @@ find_alias_opcode (const aarch64_opcode *opcode)
   /* Assume maximum of 8 disassemble preference candidates.  */
   const int max_num_aliases = 8;
   const aarch64_opcode *ent;
-  const aarch64_opcode *preferred[max_num_aliases];
+  const aarch64_opcode *preferred[max_num_aliases + 1];
   opcode_node head, **next;
 
   assert (opcode_has_alias (opcode));
 
   i = 0;
+  if (opcode->name != NULL)
+    preferred[i++] = opcode;
   ent = aarch64_opcode_table;
   while (ent->name != NULL)
     {
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]