#include "string.h"
#include "target.h"
-#define SORT_NEEDED
-
extern char *reg_names[];
#define freg_names (®_names[4 * 8])
return 0;
}
-#ifdef SORT_NEEDED
static int opcodes_sorted = 0;
extern void qsort ();
-#endif
-/* Print one instruction from MEMADDR on STREAM. */
+/* Print one instruction from MEMADDR on STREAM.
+
+ We suffix the instruction with a comment that gives the absolute
+ address involved, as well as its symbolic form, if the instruction
+ is preceded by a findable `sethi' and it either adds an immediate
+ displacement to that register, or it is an `add' or `or' instruction
+ on that register. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
register unsigned int i;
-#ifdef SORT_NEEDED
if (!opcodes_sorted)
{
static int compare_opcodes ();
sizeof (sparc_opcodes[0]), compare_opcodes);
opcodes_sorted = 1;
}
-#endif
read_memory (memaddr, &insn, sizeof (insn));
field of the opcode table. */
int found_plus = 0;
- /* Do we have an 'or' instruction where rs1 is the same
+ /* Do we have an `add' or `or' instruction where rs1 is the same
as rsd, and which has the i bit set? */
- if (opcode->match == 0x80102000
+ if ((opcode->match == 0x80102000 || opcode->match == 0x80002000)
+ /* (or) (add) */
&& insn.rs1 == insn.rd)
imm_added_to_rs1 = 1;
return sizeof (insn);
}
-#ifdef SORT_NEEDED
/* Compare opcodes A and B. */
static int
better have the same opcode. This is a sanity check on the table. */
i = strcmp (op0->name, op1->name);
if (i)
- {
- /* *** FIXME - There must be a better way to deal with this! */
- /* We prefer names used in the earliest architecture */
- if (op0->architecture != op1->architecture)
- return op0->architecture - op1->architecture;
-
if (op0->flags & F_ALIAS) /* If they're both aliases, be arbitrary. */
- return i;
+ return i;
else
- fprintf (stderr,
- "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n",
- op0->name, op1->name);
- }
+ fprintf (stderr,
+ "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n",
+ op0->name, op1->name);
/* Fewer arguments are preferred. */
{
written, so just say there are equal. */
return 0;
}
-#endif