This is the mail archive of the binutils@sources.redhat.com 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]

[RFA:] Delete JREG and #if 0:d code in gas/config/tc-sh.c


At first this code (or rather, the comment at JREG) scared me, because it
looked like an ABI-clash bug.  Register r14 is used by GCC (as
frame-pointer), and not at all free for this kind of use when relaxing.  
I'd like to delete this code so it won't scare others.

Ok to commit?

	* config/tc-sh.c (JREG): Remove.
	(md_convert_frag): Remove #if 0:d code using JREG.

Index: tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.23
diff -p -c -r1.23 tc-sh.c
*** tc-sh.c	2000/09/26 07:09:18	1.23
--- tc-sh.c	2000/10/15 21:38:04
*************** const char FLT_CHARS[] = "rRsSfFdDxXpP";
*** 123,129 ****
  
  #define C(a,b) ENCODE_RELAX(a,b)
  
- #define JREG 14			/* Register used as a temp when relaxing */
  #define ENCODE_RELAX(what,length) (((what) << 4) + (length))
  #define GET_WHAT(x) ((x>>4))
  
--- 123,128 ----
*************** md_convert_frag (headers, seg, fragP)
*** 2417,2463 ****
  		(unsigned long) fragP->fr_address,
  		S_GET_NAME (fragP->fr_symbol));
  
- #if 0
-       /* This code works, but generates poor code and the compiler
- 	 should never produce a sequence that requires it to be used.  */
- 
-       /* A jump wont fit in 12 bits, make code which looks like
- 	 bra foo
- 	 mov.w @(0, PC), r14
- 	 .long disp
- 	 foo: bra @r14
- 	 */
-       int t = buffer[0] & 0x10;
- 
-       buffer[highbyte     ] = 0xa0;	/* branch over move and disp */
-       buffer[lowbyte      ] = 3;
-       buffer[highbyte +  2] = 0xd0 | JREG;	/* Build mov insn */
-       buffer[lowbyte  +  2] = 0x00;
- 
-       buffer[highbyte +  4] = 0;	/* space for 32 bit jump disp */
-       buffer[lowbyte  +  4] = 0;
-       buffer[highbyte +  6] = 0;
-       buffer[lowbyte  +  6] = 0;
- 
-       buffer[highbyte +  8] = 0x40 | JREG;	/* Build jmp @JREG */
-       buffer[lowbyte  +  8] = t ? 0xb : 0x2b;
- 
-       buffer[highbyte + 10] = 0x20; /* build nop */
-       buffer[lowbyte  + 10] = 0x0b;
- 
-       /* Make reloc for the long disp.  */
-       fix_new (fragP,
- 	       fragP->fr_fix + 4,
- 	       4,
- 	       fragP->fr_symbol,
- 	       fragP->fr_offset,
- 	       0,
- 	       BFD_RELOC_32);
-       fragP->fr_fix += UNCOND32_LENGTH;
-       fragP->fr_var = 0;
-       donerelax = 1;
- #endif
- 
        break;
  
      case C (COND_JUMP, COND12):
--- 2416,2421 ----
*************** md_convert_frag (headers, seg, fragP)
*** 2540,2588 ****
  	as_bad (_("at 0x%lx, displacement to undefined symbol %s overflows 8-bit field "),
  		(unsigned long) fragP->fr_address,
  		S_GET_NAME (fragP->fr_symbol));
- 
- #if 0
-       /* This code works, but generates poor code, and the compiler
- 	 should never produce a sequence that requires it to be used.  */
- 
-       /* A bcond won't fit and it won't go into a 12 bit
- 	 displacement either, the code sequence looks like:
- 	 b!cond foop
- 	 mov.w @(n, PC), r14
- 	 jmp  @r14
- 	 nop
- 	 .long where
- 	 foop:
- 	 */
- 
-       buffer[0] ^= 0x2;		/* Toggle T/F bit */
- #define JREG 14
-       buffer[1] = 5;		/* branch over mov, jump, nop and ptr */
-       buffer[2] = 0xd0 | JREG;	/* Build mov insn */
-       buffer[3] = 0x2;
-       buffer[4] = 0x40 | JREG;	/* Build jmp @JREG */
-       buffer[5] = 0x0b;
-       buffer[6] = 0x20;		/* build nop */
-       buffer[7] = 0x0b;
-       buffer[8] = 0;		/* space for 32 bit jump disp */
-       buffer[9] = 0;
-       buffer[10] = 0;
-       buffer[11] = 0;
-       buffer[12] = 0;
-       buffer[13] = 0;
-       /* Make reloc for the long disp */
-       fix_new (fragP,
- 	       fragP->fr_fix + 8,
- 	       4,
- 	       fragP->fr_symbol,
- 	       fragP->fr_offset,
- 	       0,
- 	       BFD_RELOC_32);
-       fragP->fr_fix += COND32_LENGTH;
-       fragP->fr_var = 0;
-       donerelax = 1;
- #endif
- 
        break;
  
      default:
--- 2498,2503 ----

brgds, H-P


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