[PATCH 8/9] MIPS/opcodes: Correct branch instruction classification

Maciej W. Rozycki macro@codesourcery.com
Fri Jul 2 16:15:00 GMT 2010


Hi,

 This is a fix for standard MIPS branch instruction type determination.  
As it is an incorrect data structure (!) is used to check opcode flags 
against, and then JALR is incorrectly classified as an unconditional 
branch rather than a jump to a subroutine.

 The most likely beneficiary of this change is GDB, although I do not 
remember off the head if this change showed up as a progression anywhere.  

2010-07-02  Maciej W. Rozycki  <macro@codesourcery.com>

	opcodes/
	* mips-dis.c (print_insn_mips): Correct branch instruction type
	determination.

 OK to commit?

  Maciej

binutils-254625.diff
Index: binutils-fsf-trunk-quilt/opcodes/mips-dis.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/opcodes/mips-dis.c	2010-06-30 14:49:48.000000000 +0100
+++ binutils-fsf-trunk-quilt/opcodes/mips-dis.c	2010-06-30 15:00:20.000000000 +0100
@@ -1404,7 +1404,8 @@
 	      /* Figure out instruction type and branch delay information.  */
 	      if ((op->pinfo & INSN_UNCOND_BRANCH_DELAY) != 0)
 	        {
-		  if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
+		  if ((op->pinfo & (INSN_WRITE_GPR_31
+				    | INSN_WRITE_GPR_D)) != 0)
 		    info->insn_type = dis_jsr;
 		  else
 		    info->insn_type = dis_branch;
@@ -1413,7 +1414,7 @@
 	      else if ((op->pinfo & (INSN_COND_BRANCH_DELAY
 				     | INSN_COND_BRANCH_LIKELY)) != 0)
 		{
-		  if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
+		  if ((op->pinfo & INSN_WRITE_GPR_31) != 0)
 		    info->insn_type = dis_condjsr;
 		  else
 		    info->insn_type = dis_condbranch;



More information about the Binutils mailing list