public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@redhat.com>
To: binutils@sources.redhat.com
Subject: Rework MIPS nop-insertion code, add -mfix-vr4130 [2/11]
Date: Tue, 08 Mar 2005 14:42:00 -0000	[thread overview]
Message-ID: <wvn1xaqdwrs.fsf@talisman.cambridge.redhat.com> (raw)
In-Reply-To: <wvn6502dwyp.fsf@talisman.cambridge.redhat.com> (Richard Sandiford's message of "Tue, 08 Mar 2005 14:38:22 +0000")

gas used to store the entire contents of the append_insn reloc_type[]
argument in prev_insn_reloc_type.  It turns out that element 0 was only
used used to detect MIPS16 absolute jumps and elements 1 and 2 weren't
used at all.

Now that we're using a structure to record the insn history, we might as
well use a bitfield to record the mips16 condition.  Doing this makes the
code simpler and shaves three ints off the size of mips_cl_insn.

Tested on mips64{,el}-linux-gnu and mipsisa64{,el}-elf.  OK to install?

Richard


	* config/tc-mips.c (mips_cl_insn): Replace reloc_type array with
	a single mips16_absolute_jump_p bit.
	(append_insn): Adjust accordingly.

diff -urpN gas.2/config/tc-mips.c gas/config/tc-mips.c
--- gas.2/config/tc-mips.c	2005-03-08 09:07:40.562917062 +0000
+++ gas/config/tc-mips.c	2005-03-08 10:04:27.514029340 +0000
@@ -146,9 +146,6 @@ struct mips_cl_insn
   /* The relocs associated with the instruction, if any.  */
   fixS *fixp[3];
 
-  /* The reloc types associated with the instruction.  */
-  bfd_reloc_code_real_type reloc_type[3];
-
   /* True if this entry describes a real instruction.  */
   unsigned int valid_p : 1;
 
@@ -161,6 +158,9 @@ struct mips_cl_insn
 
   /* True for extended mips16 instructions.  */
   unsigned int extended_p : 1;
+
+  /* True for mips16 instructions that jump to an absolute address.  */
+  unsigned int mips16_absolute_jump_p : 1;
 };
 
 /* The ABI to use.  */
@@ -2076,8 +2076,7 @@ append_insn (struct mips_cl_insn *ip, ex
 					 mips16_small, mips16_ext,
 					 (prev_pinfo
 					  & INSN_UNCOND_BRANCH_DELAY),
-					 (*history[0].reloc_type
-					  == BFD_RELOC_MIPS16_JMP)),
+					 history[0].mips16_absolute_jump_p),
 		    make_expr_symbol (address_expr), 0, NULL);
     }
   else if (mips_opts.mips16
@@ -2714,9 +2713,7 @@ append_insn (struct mips_cl_insn *ip, ex
 	  history[0].fixp[0] = NULL;
 	  history[0].fixp[1] = NULL;
 	  history[0].fixp[2] = NULL;
-	  history[0].reloc_type[0] = BFD_RELOC_UNUSED;
-	  history[0].reloc_type[1] = BFD_RELOC_UNUSED;
-	  history[0].reloc_type[2] = BFD_RELOC_UNUSED;
+	  history[0].mips16_absolute_jump_p = 0;
 	  history[0].extended_p = 0;
 	}
       else if (pinfo & INSN_COND_BRANCH_LIKELY)
@@ -2735,9 +2732,7 @@ append_insn (struct mips_cl_insn *ip, ex
 	  history[0].fixp[0] = NULL;
 	  history[0].fixp[1] = NULL;
 	  history[0].fixp[2] = NULL;
-	  history[0].reloc_type[0] = BFD_RELOC_UNUSED;
-	  history[0].reloc_type[1] = BFD_RELOC_UNUSED;
-	  history[0].reloc_type[2] = BFD_RELOC_UNUSED;
+	  history[0].mips16_absolute_jump_p = 0;
 	  history[0].extended_p = 0;
 	  history[0].delay_slot_p = 1;
 	}
@@ -2766,9 +2761,8 @@ append_insn (struct mips_cl_insn *ip, ex
 	  history[0].fixp[0] = fixp[0];
 	  history[0].fixp[1] = fixp[1];
 	  history[0].fixp[2] = fixp[2];
-	  history[0].reloc_type[0] = reloc_type[0];
-	  history[0].reloc_type[1] = reloc_type[1];
-	  history[0].reloc_type[2] = reloc_type[2];
+	  history[0].mips16_absolute_jump_p = (reloc_type[0]
+					       == BFD_RELOC_MIPS16_JMP);
 	  if (mips_opts.mips16)
 	    history[0].extended_p = (ip->use_extend
 				     || *reloc_type > BFD_RELOC_UNUSED);
@@ -2793,9 +2787,8 @@ append_insn (struct mips_cl_insn *ip, ex
       history[0].use_extend = ip->use_extend;
       history[0].extend = ip->extend;
       history[0].insn_opcode = ip->insn_opcode;
-      history[0].reloc_type[0] = reloc_type[0];
-      history[0].reloc_type[1] = reloc_type[1];
-      history[0].reloc_type[2] = reloc_type[2];
+      history[0].mips16_absolute_jump_p = (reloc_type[0]
+					   == BFD_RELOC_MIPS16_JMP);
       history[1].noreorder_p = history[0].noreorder_p;
       history[0].noreorder_p = 1;
     }
@@ -2824,9 +2817,7 @@ mips_no_prev_insn (int preserve)
   history[0].delay_slot_p = 0;
   history[0].noreorder_p = 0;
   history[0].extended_p = 0;
-  history[0].reloc_type[0] = BFD_RELOC_UNUSED;
-  history[0].reloc_type[1] = BFD_RELOC_UNUSED;
-  history[0].reloc_type[2] = BFD_RELOC_UNUSED;
+  history[0].mips16_absolute_jump_p = 0;
   history[1].noreorder_p = 0;
   mips_clear_insn_labels ();
 }

  reply	other threads:[~2005-03-08 14:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-08 14:39 Rework MIPS nop-insertion code, add -mfix-vr4130 [1/11] Richard Sandiford
2005-03-08 14:42 ` Richard Sandiford [this message]
2005-03-08 14:46   ` Rework MIPS nop-insertion code, add -mfix-vr4130 [3/11] Richard Sandiford
2005-03-08 14:50     ` Rework MIPS nop-insertion code, add -mfix-vr4130 [4/11] Richard Sandiford
2005-03-08 14:56       ` Rework MIPS nop-insertion code, add -mfix-vr4130 [5/11] Richard Sandiford
2005-03-08 15:00         ` Rework MIPS nop-insertion code, add -mfix-vr4130 [6/11] Richard Sandiford
2005-03-08 15:05           ` Rework MIPS nop-insertion code, add -mfix-vr4130 [7/11] Richard Sandiford
2005-03-08 15:06             ` Rework MIPS nop-insertion code, add -mfix-vr4130 [8/11] Richard Sandiford
2005-03-08 15:10               ` Rework MIPS nop-insertion code, add -mfix-vr4130 [9/11] Richard Sandiford
2005-03-08 15:12                 ` Rework MIPS nop-insertion code, add -mfix-vr4130 [10/11] Richard Sandiford
2005-03-08 15:16                   ` Rework MIPS nop-insertion code, add -mfix-vr4130 [11/11] Richard Sandiford
2005-03-08 19:45                     ` Eric Christopher
2005-03-08 19:43                   ` Rework MIPS nop-insertion code, add -mfix-vr4130 [10/11] Eric Christopher
2005-03-08 19:42                 ` Rework MIPS nop-insertion code, add -mfix-vr4130 [9/11] Eric Christopher
2005-03-08 19:19               ` Rework MIPS nop-insertion code, add -mfix-vr4130 [8/11] Eric Christopher
2005-03-08 19:18             ` Rework MIPS nop-insertion code, add -mfix-vr4130 [7/11] Eric Christopher
2005-03-09  9:55               ` Richard Sandiford
2005-03-08 19:12           ` Rework MIPS nop-insertion code, add -mfix-vr4130 [6/11] Eric Christopher
2005-03-08 19:12         ` Rework MIPS nop-insertion code, add -mfix-vr4130 [5/11] Eric Christopher
2005-03-08 19:09       ` Rework MIPS nop-insertion code, add -mfix-vr4130 [4/11] Eric Christopher
2005-03-08 19:08     ` Rework MIPS nop-insertion code, add -mfix-vr4130 [3/11] Eric Christopher
2005-03-08 19:07   ` Rework MIPS nop-insertion code, add -mfix-vr4130 [2/11] Eric Christopher
2005-03-08 19:06 ` Rework MIPS nop-insertion code, add -mfix-vr4130 [1/11] Eric Christopher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wvn1xaqdwrs.fsf@talisman.cambridge.redhat.com \
    --to=rsandifo@redhat.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).