`shorten_branches' and length of `asm' without operands

Denis Chertykov denisc@overta.ru
Tue Dec 14 12:57:00 GMT 1999


While I'm playing with my port (Atmel AVR) I have founded a strange thing
in final.c shorten_branches () 

shorten_branches don't calculate insn length if insn is a `asm'
without operands.

Is this a bug ?
Or I must calculate `asm' insn length inside ADJUST_INSN_LENGTH ?

As I understand `get_attr_length' calculates `asm' insn length properly.


Patch for correct final.c:

*** final.c	1999/12/11 17:20:42	1.1
--- final.c	1999/12/11 17:21:59
***************
*** 1271,1277 ****
  				 * GET_MODE_SIZE (GET_MODE (body)));
  	  /* Alignment is handled by ADDR_VEC_ALIGN.  */
  	}
!       else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
        else if (GET_CODE (body) == SEQUENCE)
  	{
--- 1271,1277 ----
  				 * GET_MODE_SIZE (GET_MODE (body)));
  	  /* Alignment is handled by ADDR_VEC_ALIGN.  */
  	}
!       else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
        else if (GET_CODE (body) == SEQUENCE)
  	{
***************
*** 1291,1297 ****
  	      int inner_uid = INSN_UID (inner_insn);
  	      int inner_length;
  
! 	      if (asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0)
  		inner_length = (asm_insn_count (PATTERN (inner_insn))
  				* insn_default_length (inner_insn));
  	      else
--- 1291,1298 ----
  	      int inner_uid = INSN_UID (inner_insn);
  	      int inner_length;
  
! 	      if (GET_CODE (PATTERN (XVECEXP (body, 0, i))) == ASM_INPUT
! 		  || asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0)
  		inner_length = (asm_insn_count (PATTERN (inner_insn))
  				* insn_default_length (inner_insn));
  	      else


Denis.
PS: I don't have a GCC COPYING ASSIGNMENT



More information about the Gcc mailing list