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]
Other format: [Raw text]

Fix Compile Time Warnings: cgen & opcodes


Hi Guys,

  Here is a large patch to take care of the compile time warnings
  about comparing and passing signed and unsigned pointers in cgen
  generated files in the opcodes directory.  It also includes a few
  other, similar fixes for other files in opcodes so that entire
  directory should now be compile time warning free.

Cheers
  Nick

cpu/ChangeLog
2005-02-23  Nick Clifton  <nickc@redhat.com>

	* frv.opc: Fixed compile time warnings about differing signed'ness
	of pointers passed to functions.
	* m32r.opc: Likewise.

cgen/ChangeLog
2005-02-23  Nick Clifton  <nickc@redhat.com>

	* opcodes.scm (gen-parse-number): Add a cast to the desired
	pointer signed'ness in order to prevent compile time warnings.
	* cpu/ip2k.opc: Fixed compile time warnings about differing
	signed'ness of pointers passed to functions.
	* cpu/iq2000.opc: Likewise.
	* cpu/m32r.opc: Likewise.
	* cpu/openrisc.opc: Likewise.
	* cpu/xstormy16.opc: Likewise.

opcodes/ChangeLog
2005-02-23  Nick Clifton  <nickc@redhat.com>

	* cgen-dis.in: Use bfd_byte for buffers that are passed to
	read_memory.
	
	* ia64-opc.c (locate_opcode_ent): Initialise opval array.
	
	* fr30-asm.c: Regenerate.
	* fr30-dis.c: Regenerate.
	* frv-asm.c: Regenerate.
	* frv-dis.c: Regenerate.
	* ip2k-asm.c: Regenerate.
	* ip2k-dis.c: Regenerate.
	* iq2000-asm.c: Regenerate.
	* iq2000-dis.c: Regenerate.
	* m32r-asm.c: Regenerate.
	* m32r-dis.c: Regenerate.
	* openrisc-asm.c: Regenerate.
	* openrisc-dis.c: Regenerate.
	* xstormy16-asm.c: Regenerate.
	* xstormy16-dis.c: Regenerate.

Index: cpu/frv.opc
===================================================================
RCS file: /cvs/src/src/cpu/frv.opc,v
retrieving revision 1.9
diff -c -3 -p -r1.9 frv.opc
*** cpu/frv.opc	25 Jan 2005 20:22:28 -0000	1.9
--- cpu/frv.opc	23 Feb 2005 15:57:42 -0000
*************** spr_valid (regno)
*** 948,954 ****
  static const char * parse_ulo16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_uslo16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_uhi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static long parse_register_number
--- 948,954 ----
  static const char * parse_ulo16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_uslo16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, signed long *));
  static const char * parse_uhi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static long parse_register_number
*************** static const char * parse_u12
*** 964,974 ****
  static const char * parse_even_register
    PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *));
  static const char * parse_A0
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_A1
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_A
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *, long));
  
  inline static const char *
  parse_symbolic_address (CGEN_CPU_DESC cd,
--- 964,974 ----
  static const char * parse_even_register
    PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *));
  static const char * parse_A0
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_A1
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_A
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *, long));
  
  inline static const char *
  parse_symbolic_address (CGEN_CPU_DESC cd,
*************** static const char *
*** 997,1003 ****
  parse_ldd_annotation (CGEN_CPU_DESC cd,
  		      const char **strp,
  		      int opindex,
! 		      long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 997,1003 ----
  parse_ldd_annotation (CGEN_CPU_DESC cd,
  		      const char **strp,
  		      int opindex,
! 		      unsigned long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** static const char *
*** 1036,1042 ****
  parse_call_annotation (CGEN_CPU_DESC cd,
  		       const char **strp,
  		       int opindex,
! 		       long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 1036,1042 ----
  parse_call_annotation (CGEN_CPU_DESC cd,
  		       const char **strp,
  		       int opindex,
! 		       unsigned long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** static const char *
*** 1075,1081 ****
  parse_ld_annotation (CGEN_CPU_DESC cd,
  		     const char **strp,
  		     int opindex,
! 		     long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 1075,1081 ----
  parse_ld_annotation (CGEN_CPU_DESC cd,
  		     const char **strp,
  		     int opindex,
! 		     unsigned long *valuep)
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** parse_ulo16 (cd, strp, opindex, valuep)
*** 1234,1240 ****
  	  return errmsg;
  	}
      }
!   return cgen_parse_signed_integer (cd, strp, opindex, valuep);
  }
  
  static const char *
--- 1234,1240 ----
  	  return errmsg;
  	}
      }
!   return cgen_parse_unsigned_integer (cd, strp, opindex, valuep);
  }
  
  static const char *
*************** parse_uslo16 (cd, strp, opindex, valuep)
*** 1242,1248 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 1242,1248 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      signed long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** parse_uslo16 (cd, strp, opindex, valuep)
*** 1361,1367 ****
  	  return errmsg;
  	}
      }
!   return cgen_parse_unsigned_integer (cd, strp, opindex, valuep);
  }
  
  static const char *
--- 1361,1367 ----
  	  return errmsg;
  	}
      }
!   return cgen_parse_signed_integer (cd, strp, opindex, valuep);
  }
  
  static const char *
*************** parse_A (cd, strp, opindex, valuep, A)
*** 1820,1826 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
       long A;
  {
    const char *errmsg;
--- 1820,1826 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
       long A;
  {
    const char *errmsg;
*************** parse_A0 (cd, strp, opindex, valuep)
*** 1843,1849 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    return parse_A (cd, strp, opindex, valuep, 0);
  }
--- 1843,1849 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    return parse_A (cd, strp, opindex, valuep, 0);
  }
*************** parse_A1 (cd, strp, opindex, valuep)
*** 1853,1859 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    return parse_A (cd, strp, opindex, valuep, 1);
  }
--- 1853,1859 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    return parse_A (cd, strp, opindex, valuep, 1);
  }
Index: cpu/m32r.opc
===================================================================
RCS file: /cvs/src/src/cpu/m32r.opc,v
retrieving revision 1.3
diff -c -3 -p -r1.3 m32r.opc
*** cpu/m32r.opc	30 Mar 2004 09:29:18 -0000	1.3
--- cpu/m32r.opc	23 Feb 2005 15:57:42 -0000
*************** m32r_cgen_dis_hash (buf, value)
*** 88,94 ****
  
  /* -- asm.c */
  static const char * parse_hash
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_hi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_slo16
--- 89,95 ----
  
  /* -- asm.c */
  static const char * parse_hash
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_hi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_slo16
*************** parse_hash (cd, strp, opindex, valuep)
*** 103,109 ****
       CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
       const char **strp;
       int opindex ATTRIBUTE_UNUSED;
!      unsigned long *valuep ATTRIBUTE_UNUSED;
  {
    if (**strp == '#')
      ++*strp;
--- 104,110 ----
       CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
       const char **strp;
       int opindex ATTRIBUTE_UNUSED;
!      long *valuep ATTRIBUTE_UNUSED;
  {
    if (**strp == '#')
      ++*strp;
Index: cgen/opcodes.scm
===================================================================
RCS file: /cvs/src/src/cgen/opcodes.scm,v
retrieving revision 1.9
diff -c -3 -p -r1.9 opcodes.scm
*** cgen/opcodes.scm	27 Jan 2005 20:31:12 -0000	1.9
--- cgen/opcodes.scm	23 Feb 2005 15:57:45 -0000
***************
*** 334,341 ****
  		      (obj:name mode)))))
     " (cd, strp, "
     op-enum
!    ", &" result-var-name
!    ");\n"
     )
  )
  
--- 334,348 ----
  		      (obj:name mode)))))
     " (cd, strp, "
     op-enum
!    ", "
!    ; This is to pacify gcc 4.x which will complain about
!    ; incorrect signed-ness of pointers passed to functions.
!    (case (obj:name mode)
! 	 ((QI HI SI INT) "(long *)")
! 	 ((BI UQI UHI USI UINT) "(unsigned long *)")
!    )
!    " (& " result-var-name
!    "));\n"
     )
  )
  
Index: cgen/cpu/ip2k.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/ip2k.opc,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ip2k.opc
*** cgen/cpu/ip2k.opc	15 Feb 2005 12:52:01 -0000	1.3
--- cgen/cpu/ip2k.opc	23 Feb 2005 15:57:45 -0000
*************** ip2k_cgen_insn_supported (cd, insn)
*** 73,85 ****
  /* -- asm.c */
  
  #define PARSE_FUNC_DECL(name) \
! static const char *name PARAMS ((CGEN_CPU_DESC, const char **, int, long *))
! 
! PARSE_FUNC_DECL (parse_fr);
! PARSE_FUNC_DECL (parse_addr16);
! PARSE_FUNC_DECL (parse_addr16_cjp);
  PARSE_FUNC_DECL (parse_lit8);
! PARSE_FUNC_DECL (parse_bit3);
  
  
  static const char *
--- 73,87 ----
  /* -- asm.c */
  
  #define PARSE_FUNC_DECL(name) \
!   static const char *name (CGEN_CPU_DESC, const char **, int, long *)
! #define PARSE_UFUNC_DECL(name) \
!   static const char *name (CGEN_CPU_DESC, const char **, int, unsigned long *)
! 
! PARSE_UFUNC_DECL (parse_fr);
! PARSE_UFUNC_DECL (parse_addr16);
! PARSE_UFUNC_DECL (parse_addr16_cjp);
  PARSE_FUNC_DECL (parse_lit8);
! PARSE_UFUNC_DECL (parse_bit3);
  
  
  static const char *
*************** parse_fr (cd, strp, opindex, valuep)
*** 87,93 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    const char *old_strp;
--- 89,95 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    const char *old_strp;
*************** parse_fr (cd, strp, opindex, valuep)
*** 100,146 ****
    old_strp = *strp;
    afteroffset = NULL; 
  
! 
!   /* Check here to see if you're about to try parsing a w as the first arg */
!   /* and return an error if you are.                                       */
!   if ( (strncmp(*strp,"w",1)==0) || (strncmp(*strp,"W",1)==0) )
      {
        (*strp)++;
  
!       if ( (strncmp(*strp,",",1)==0) || ISSPACE(**strp) )
  	{
! 	  /* We've been passed a w.  Return with an error message so that  */
! 	  /* cgen will try the next parsing option.                        */
  	  errmsg = _("W keyword invalid in FR operand slot.");
  	  return errmsg;
  	}
        *strp = old_strp;
      }
  
- 
    /* Attempt parse as register keyword. */
-   /* old_strp = *strp; */
- 
    errmsg = cgen_parse_keyword (cd, strp, & ip2k_cgen_opval_register_names,
! 			       valuep);
!   if ( *strp != NULL )
!     if (errmsg == NULL)
!       return errmsg;
  
!   /* Attempt to parse for "(IP)" */
!   afteroffset = strstr(*strp,"(IP)");
  
!   if ( afteroffset == NULL)
!     {
!       /* Make sure it's not in lower case */
!       afteroffset = strstr(*strp,"(ip)");
!     }
  
!   if ( afteroffset != NULL )
      {
!       if ( afteroffset != *strp )
  	{
! 	  /* Invalid offset present.*/
  	  errmsg = _("offset(IP) is not a valid form");
  	  return errmsg;
  	}
--- 102,142 ----
    old_strp = *strp;
    afteroffset = NULL; 
  
!   /* Check here to see if you're about to try parsing a w as the first arg
!      and return an error if you are.  */
!   if ((strncmp (*strp, "w", 1) == 0) || (strncmp (*strp, "W", 1) == 0))
      {
        (*strp)++;
  
!       if ((strncmp (*strp, ",", 1) == 0) || ISSPACE (**strp))
  	{
! 	  /* We've been passed a w.  Return with an error message so that
! 	     cgen will try the next parsing option.  */
  	  errmsg = _("W keyword invalid in FR operand slot.");
  	  return errmsg;
  	}
        *strp = old_strp;
      }
  
    /* Attempt parse as register keyword. */
    errmsg = cgen_parse_keyword (cd, strp, & ip2k_cgen_opval_register_names,
! 			       (long *) valuep);
!   if (*strp != NULL
!       && errmsg == NULL)
!     return errmsg;
  
!   /* Attempt to parse for "(IP)".  */
!   afteroffset = strstr (*strp, "(IP)");
  
!   if (afteroffset == NULL)
!     /* Make sure it's not in lower case.  */
!     afteroffset = strstr (*strp, "(ip)");
  
!   if (afteroffset != NULL)
      {
!       if (afteroffset != *strp)
  	{
! 	  /* Invalid offset present.  */
  	  errmsg = _("offset(IP) is not a valid form");
  	  return errmsg;
  	}
*************** parse_fr (cd, strp, opindex, valuep)
*** 153,199 ****
  	}
      }
  
!   /* Attempt to parse for DP. ex: mov w, offset(DP)  */
!   /*                              mov offset(DP),w   */
  
!   /* Try parsing it as an address and see what comes back */
  
!   afteroffset = strstr(*strp,"(DP)");
! 
!   if ( afteroffset == NULL)
!     {
!       /* Maybe it's in lower case */
!       afteroffset = strstr(*strp,"(dp)");
!     }
  
!   if ( afteroffset != NULL )
      {
!       if ( afteroffset == *strp )
  	{
! 	  /* No offset present. Use 0 by default. */
  	  tempvalue = 0;
  	  errmsg = NULL;
  	}
        else
! 	{
! 	  errmsg = cgen_parse_address (cd, strp, opindex,
! 				       BFD_RELOC_IP2K_FR_OFFSET,
! 				       & result_type, & tempvalue);
! 	}
  
        if (errmsg == NULL)
  	{
  	  if (tempvalue <= 127)
  	    {
! 	      /* Value is ok.  Fix up the first 2 bits and return */       
  	      *valuep = 0x0100 | tempvalue;
! 	      *strp += 4; /* skip over the (DP) in *strp */
  	      return errmsg;
  	    }
  	  else
  	    {
  	      /* Found something there in front of (DP) but it's out
! 		 of range. */
  	      errmsg = _("(DP) offset out of range.");
  	      return errmsg;
  	    }
--- 149,190 ----
  	}
      }
  
!   /* Attempt to parse for DP. ex: mov w, offset(DP)
!                                   mov offset(DP),w   */
  
!   /* Try parsing it as an address and see what comes back.  */
!   afteroffset = strstr (*strp, "(DP)");
  
!   if (afteroffset == NULL)
!     /* Maybe it's in lower case.  */
!     afteroffset = strstr (*strp, "(dp)");
  
!   if (afteroffset != NULL)
      {
!       if (afteroffset == *strp)
  	{
! 	  /* No offset present. Use 0 by default.  */
  	  tempvalue = 0;
  	  errmsg = NULL;
  	}
        else
! 	errmsg = cgen_parse_address (cd, strp, opindex,
! 				     BFD_RELOC_IP2K_FR_OFFSET,
! 				     & result_type, & tempvalue);
  
        if (errmsg == NULL)
  	{
  	  if (tempvalue <= 127)
  	    {
! 	      /* Value is ok.  Fix up the first 2 bits and return.  */
  	      *valuep = 0x0100 | tempvalue;
! 	      *strp += 4; /* skip over the (DP) in *strp.  */
  	      return errmsg;
  	    }
  	  else
  	    {
  	      /* Found something there in front of (DP) but it's out
! 		 of range.  */
  	      errmsg = _("(DP) offset out of range.");
  	      return errmsg;
  	    }
*************** parse_fr (cd, strp, opindex, valuep)
*** 201,254 ****
      }
  
  
!   /* Attempt to parse for SP. ex: mov w, offset(SP)  */
!   /*                              mov offset(SP), w  */
! 
! 
!   afteroffset = strstr(*strp,"(SP)");
  
    if (afteroffset == NULL)
!     {
!       /* Maybe it's in lower case. */
!       afteroffset = strstr(*strp, "(sp)");
!     }
  
!   if ( afteroffset != NULL )
      {
!       if ( afteroffset ==  *strp )
  	{
! 	  /* No offset present. Use 0 by default. */
  	  tempvalue = 0;
  	  errmsg = NULL;
  	}
        else
! 	{
! 	  errmsg = cgen_parse_address (cd, strp, opindex,
! 				       BFD_RELOC_IP2K_FR_OFFSET,
! 				       & result_type, & tempvalue);
! 	}
        if (errmsg == NULL)
  	{
  	  if (tempvalue <= 127)
  	    {
! 	      /* Value is ok.  Fix up the first 2 bits and return */
  	      *valuep = 0x0180 | tempvalue;
! 	      *strp += 4; /* skip over the (SP) in *strp */
  	      return errmsg;
  	    }
  	  else
  	    {
  	      /* Found something there in front of (SP) but it's out
! 		 of range. */
  	      errmsg = _("(SP) offset out of range.");
  	      return errmsg;
  	    }
-         
  	}
      }
  
! 
!   /* Attempt to parse as an address. */
    *strp = old_strp;
    errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IP2K_FR9,
  			       & result_type, & value);
--- 192,238 ----
      }
  
  
!   /* Attempt to parse for SP. ex: mov w, offset(SP)
!                                   mov offset(SP), w.  */
!   afteroffset = strstr (*strp, "(SP)");
  
    if (afteroffset == NULL)
!     /* Maybe it's in lower case.  */
!     afteroffset = strstr (*strp, "(sp)");
  
!   if (afteroffset != NULL)
      {
!       if (afteroffset == *strp)
  	{
! 	  /* No offset present. Use 0 by default.  */
  	  tempvalue = 0;
  	  errmsg = NULL;
  	}
        else
! 	errmsg = cgen_parse_address (cd, strp, opindex,
! 				     BFD_RELOC_IP2K_FR_OFFSET,
! 				     & result_type, & tempvalue);
! 
        if (errmsg == NULL)
  	{
  	  if (tempvalue <= 127)
  	    {
! 	      /* Value is ok.  Fix up the first 2 bits and return.  */
  	      *valuep = 0x0180 | tempvalue;
! 	      *strp += 4; /* skip over the (SP) in *strp.  */
  	      return errmsg;
  	    }
  	  else
  	    {
  	      /* Found something there in front of (SP) but it's out
! 		 of range.  */
  	      errmsg = _("(SP) offset out of range.");
  	      return errmsg;
  	    }
  	}
      }
  
!   /* Attempt to parse as an address.  */
    *strp = old_strp;
    errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IP2K_FR9,
  			       & result_type, & value);
*************** parse_fr (cd, strp, opindex, valuep)
*** 256,269 ****
      {
        *valuep = value;
  
!       /* if a parenthesis is found, warn about invalid form */
! 
        if (**strp == '(')
! 	{
! 	  errmsg = _("illegal use of parentheses");
!         }
        /* if a numeric value is specified, ensure that it is between
! 	 1 and 255 */
        else if (result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	{
  	  if (value < 0x1 || value > 0xff)
--- 240,251 ----
      {
        *valuep = value;
  
!       /* if a parenthesis is found, warn about invalid form.  */
        if (**strp == '(')
! 	errmsg = _("illegal use of parentheses");
! 
        /* if a numeric value is specified, ensure that it is between
! 	 1 and 255.  */
        else if (result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	{
  	  if (value < 0x1 || value > 0xff)
*************** parse_addr16 (cd, strp, opindex, valuep)
*** 278,293 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
    bfd_reloc_code_real_type code = BFD_RELOC_NONE;
    bfd_vma value;
  
!   if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16H )
      code = BFD_RELOC_IP2K_HI8DATA;
!   else if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16L )
      code = BFD_RELOC_IP2K_LO8DATA;
    else
      {
--- 260,275 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
    bfd_reloc_code_real_type code = BFD_RELOC_NONE;
    bfd_vma value;
  
!   if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16H)
      code = BFD_RELOC_IP2K_HI8DATA;
!   else if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16L)
      code = BFD_RELOC_IP2K_LO8DATA;
    else
      {
*************** parse_addr16 (cd, strp, opindex, valuep)
*** 301,310 ****
    if (errmsg == NULL)
      {
        /* We either have a relocation or a number now. */
!       if ( result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER )
  	{
  	  /* We got a number back. */
! 	  if ( code == BFD_RELOC_IP2K_HI8DATA )
              value >>= 8;
  	  else    /* code = BFD_RELOC_IP2K_LOW8DATA */
  	    value &= 0x00FF;
--- 283,292 ----
    if (errmsg == NULL)
      {
        /* We either have a relocation or a number now. */
!       if (result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	{
  	  /* We got a number back. */
! 	  if (code == BFD_RELOC_IP2K_HI8DATA)
              value >>= 8;
  	  else    /* code = BFD_RELOC_IP2K_LOW8DATA */
  	    value &= 0x00FF;
*************** parse_addr16_cjp (cd, strp, opindex, val
*** 321,355 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
    bfd_reloc_code_real_type code = BFD_RELOC_NONE;
    bfd_vma value;
   
!   if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16CJP )
      code = BFD_RELOC_IP2K_ADDR16CJP;
!   else if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16P )
      code = BFD_RELOC_IP2K_PAGE3;
  
    errmsg = cgen_parse_address (cd, strp, opindex, code,
  			       & result_type, & value);
    if (errmsg == NULL)
      {
!       if ( result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER )
  	{
! 	  if ( (value & 0x1) == 0)  /* If the address is even .... */
  	    {
! 	      if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16CJP )
                  *valuep = (value >> 1) & 0x1FFF;  /* Should mask be 1FFF? */
! 	      else if ( opindex == (CGEN_OPERAND_TYPE)IP2K_OPERAND_ADDR16P )
                  *valuep = (value >> 14) & 0x7;
  	    }
            else
   	    errmsg = _("Byte address required. - must be even.");
  	}
!       else if ( result_type == CGEN_PARSE_OPERAND_RESULT_QUEUED )
  	{
  	  /* This will happen for things like (s2-s1) where s2 and s1
  	     are labels.  */
--- 303,337 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
    bfd_reloc_code_real_type code = BFD_RELOC_NONE;
    bfd_vma value;
   
!   if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16CJP)
      code = BFD_RELOC_IP2K_ADDR16CJP;
!   else if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16P)
      code = BFD_RELOC_IP2K_PAGE3;
  
    errmsg = cgen_parse_address (cd, strp, opindex, code,
  			       & result_type, & value);
    if (errmsg == NULL)
      {
!       if (result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	{
! 	  if ((value & 0x1) == 0)  /* If the address is even .... */
  	    {
! 	      if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16CJP)
                  *valuep = (value >> 1) & 0x1FFF;  /* Should mask be 1FFF? */
! 	      else if (opindex == (CGEN_OPERAND_TYPE) IP2K_OPERAND_ADDR16P)
                  *valuep = (value >> 14) & 0x7;
  	    }
            else
   	    errmsg = _("Byte address required. - must be even.");
  	}
!       else if (result_type == CGEN_PARSE_OPERAND_RESULT_QUEUED)
  	{
  	  /* This will happen for things like (s2-s1) where s2 and s1
  	     are labels.  */
*************** parse_bit3 (cd, strp, opindex, valuep)
*** 436,442 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    char mode = 0;
--- 418,424 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    char mode = 0;
*************** parse_bit3 (cd, strp, opindex, valuep)
*** 459,471 ****
        mode = 2;
      }
  
!   errmsg = cgen_parse_signed_integer (cd, strp, opindex, valuep);
    if (errmsg)
      return errmsg;
  
    if (mode)
      {
!       value = (unsigned long) *valuep;
        if (value == 0)
  	{
  	  errmsg = _("Attempt to find bit index of 0");
--- 441,453 ----
        mode = 2;
      }
  
!   errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, valuep);
    if (errmsg)
      return errmsg;
  
    if (mode)
      {
!       value = * valuep;
        if (value == 0)
  	{
  	  errmsg = _("Attempt to find bit index of 0");
Index: cgen/cpu/iq2000.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/iq2000.opc,v
retrieving revision 1.3
diff -c -3 -p -r1.3 iq2000.opc
*** cgen/cpu/iq2000.opc	11 Feb 2005 16:09:29 -0000	1.3
--- cgen/cpu/iq2000.opc	23 Feb 2005 15:57:45 -0000
*************** extern int iq2000_cgen_insn_supported (C
*** 40,50 ****
  
  static int iq2000_cgen_isa_register PARAMS ((const char **));
  static const char * parse_jtargq10 PARAMS ((CGEN_CPU_DESC, const char **, int, int, enum cgen_parse_operand_result *, bfd_vma *));
! static const char * parse_mimm PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_imm  PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_hi16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
! static const char * parse_lo16 PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
! static const char * parse_mlo16 PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  
  /* Special check to ensure that instruction exists for given machine */
  int
--- 40,50 ----
  
  static int iq2000_cgen_isa_register PARAMS ((const char **));
  static const char * parse_jtargq10 PARAMS ((CGEN_CPU_DESC, const char **, int, int, enum cgen_parse_operand_result *, bfd_vma *));
! static const char * parse_mimm PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_imm  PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_hi16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
! static const char * parse_lo16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
! static const char * parse_mlo16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  
  /* Special check to ensure that instruction exists for given machine */
  int
*************** parse_mimm (cd, strp, opindex, valuep)
*** 93,103 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
  
!   /* Verify this isn't a register */
    if (iq2000_cgen_isa_register (strp))
      errmsg = _("immediate value cannot be register");
    else
--- 93,103 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
  
!   /* Verify this isn't a register.  */
    if (iq2000_cgen_isa_register (strp))
      errmsg = _("immediate value cannot be register");
    else
*************** parse_mimm (cd, strp, opindex, valuep)
*** 108,113 ****
--- 108,114 ----
        if (errmsg == NULL)
  	{
  	  long x = (-value) & 0xFFFF0000;
+ 
  	  if (x != 0 && x != (long) 0xFFFF0000)
  	    errmsg = _("immediate value out of range");
  	  else
*************** parse_lo16 (cd, strp, opindex, valuep)
*** 248,254 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    if (strncasecmp (*strp, "%lo(", 4) == 0)
      {
--- 249,255 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    if (strncasecmp (*strp, "%lo(", 4) == 0)
      {
*************** parse_mlo16 (cd, strp, opindex, valuep)
*** 281,287 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    if (strncasecmp (*strp, "%lo(", 4) == 0)
      {
--- 282,288 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    if (strncasecmp (*strp, "%lo(", 4) == 0)
      {
Index: cgen/cpu/m32r.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/m32r.opc,v
retrieving revision 1.6
diff -c -3 -p -r1.6 m32r.opc
*** cgen/cpu/m32r.opc	30 Mar 2004 09:29:16 -0000	1.6
--- cgen/cpu/m32r.opc	23 Feb 2005 15:57:45 -0000
*************** m32r_cgen_dis_hash (buf, value)
*** 65,71 ****
  
  /* -- asm.c */
  static const char * parse_hash
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_hi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_slo16
--- 65,71 ----
  
  /* -- asm.c */
  static const char * parse_hash
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_hi16
    PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_slo16
*************** parse_hash (cd, strp, opindex, valuep)
*** 80,86 ****
       CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
       const char **strp;
       int opindex ATTRIBUTE_UNUSED;
!      unsigned long *valuep ATTRIBUTE_UNUSED;
  {
    if (**strp == '#')
      ++*strp;
--- 80,86 ----
       CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
       const char **strp;
       int opindex ATTRIBUTE_UNUSED;
!      long *valuep ATTRIBUTE_UNUSED;
  {
    if (**strp == '#')
      ++*strp;
*************** my_print_insn (cd, pc, info)
*** 266,277 ****
       bfd_vma pc;
       disassemble_info *info;
  {
!   char buffer[CGEN_MAX_INSN_SIZE];
!   char *buf = buffer;
    int status;
    int buflen = (pc & 3) == 0 ? 4 : 2;
    int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
!   char *x;
  
    /* Read the base part of the insn.  */
  
--- 266,277 ----
       bfd_vma pc;
       disassemble_info *info;
  {
!   bfd_byte buffer[CGEN_MAX_INSN_SIZE];
!   bfd_byte *buf = buffer;
    int status;
    int buflen = (pc & 3) == 0 ? 4 : 2;
    int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
!   bfd_byte *x;
  
    /* Read the base part of the insn.  */
  
Index: cgen/cpu/openrisc.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/openrisc.opc,v
retrieving revision 1.3
diff -c -3 -p -r1.3 openrisc.opc
*** cgen/cpu/openrisc.opc	4 Dec 2003 08:33:25 -0000	1.3
--- cgen/cpu/openrisc.opc	23 Feb 2005 15:57:45 -0000
*************** extern long openrisc_sign_extend_16bit P
*** 36,44 ****
  #define CGEN_VERBOSE_ASSEMBLER_ERRORS
  
  static const char * parse_hi16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  static const char * parse_lo16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
  
  long
  openrisc_sign_extend_16bit (value)
--- 36,44 ----
  #define CGEN_VERBOSE_ASSEMBLER_ERRORS
  
  static const char * parse_hi16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  static const char * parse_lo16
!   PARAMS ((CGEN_CPU_DESC, const char **, int, long *));
  
  long
  openrisc_sign_extend_16bit (value)
*************** parse_hi16 (cd, strp, opindex, valuep)
*** 54,60 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 54,60 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** parse_hi16 (cd, strp, opindex, valuep)
*** 68,80 ****
        bfd_vma value;
  
        *strp += 3;
! #if 0
!       errmsg = cgen_parse_signed_integer (cd, strp, opindex, valuep);
!       if (errmsg != NULL)
!         fprintf (stderr, "parse_hi: %s\n", errmsg);
!       if (errmsg != NULL)
! #endif
!         errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
                                       &result_type, &value);
        if (**strp != ')')
          return _("missing `)'");
--- 68,74 ----
        bfd_vma value;
  
        *strp += 3;
!       errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
                                       &result_type, &value);
        if (**strp != ')')
          return _("missing `)'");
*************** parse_hi16 (cd, strp, opindex, valuep)
*** 90,101 ****
--- 84,97 ----
        if (**strp == '-')
  	{
  	  long value;
+ 
  	  errmsg = cgen_parse_signed_integer (cd, strp, opindex, &value);
  	  ret = value;
  	}
        else
  	{
  	  unsigned long value;
+ 
  	  errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value);
  	  ret = value;
  	}
*************** parse_lo16 (cd, strp, opindex, valuep)
*** 112,118 ****
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      unsigned long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
--- 108,114 ----
       CGEN_CPU_DESC cd;
       const char **strp;
       int opindex;
!      long *valuep;
  {
    const char *errmsg;
    enum cgen_parse_operand_result result_type;
*************** parse_lo16 (cd, strp, opindex, valuep)
*** 126,140 ****
        bfd_vma value;
  
        *strp += 3;
! #if 0 
!       errmsg = cgen_parse_signed_integer (cd, strp, opindex, valuep);
!       if (errmsg != NULL)
!         fprintf (stderr, "parse_lo: %s\n", errmsg);
! 
!       if (errmsg != NULL)
! #endif
!         errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
!                                      &result_type, &value);
        if (**strp != ')')
          return _("missing `)'");
  
--- 122,129 ----
        bfd_vma value;
  
        *strp += 3;
!       errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
! 				   &result_type, &value);
        if (**strp != ')')
          return _("missing `)'");
  
*************** parse_lo16 (cd, strp, opindex, valuep)
*** 146,157 ****
--- 135,148 ----
        if (**strp == '-')
  	{
  	  long value;
+ 
  	  errmsg = cgen_parse_signed_integer (cd, strp, opindex, &value);
  	  ret = value;
  	}
        else
  	{
  	  unsigned long value;
+ 
  	  errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value);
  	  ret = value;
  	}
Index: cgen/cpu/xstormy16.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/xstormy16.opc,v
retrieving revision 1.4
diff -c -3 -p -r1.4 xstormy16.opc
*** cgen/cpu/xstormy16.opc	17 Dec 2002 04:48:25 -0000	1.4
--- cgen/cpu/xstormy16.opc	23 Feb 2005 15:57:45 -0000
*************** parse_mem8 (cd, strp, opindex, valuep)
*** 65,71 ****
  	return _("Bad register name");
      }
    else if (cgen_parse_keyword (cd, strp, & xstormy16_cgen_opval_gr_names, 
! 			       valuep) == NULL)
      return _("Label conflicts with register name");
    else if (strncasecmp (*strp, "rx,", 3) == 0
  	   || strncasecmp (*strp, "rxl,", 3) == 0
--- 65,71 ----
  	return _("Bad register name");
      }
    else if (cgen_parse_keyword (cd, strp, & xstormy16_cgen_opval_gr_names, 
! 			       (long *) valuep) == NULL)
      return _("Label conflicts with register name");
    else if (strncasecmp (*strp, "rx,", 3) == 0
  	   || strncasecmp (*strp, "rxl,", 3) == 0
Index: opcodes/cgen-dis.in
===================================================================
RCS file: /cvs/src/src/opcodes/cgen-dis.in,v
retrieving revision 1.18
diff -c -3 -p -r1.18 cgen-dis.in
*** opcodes/cgen-dis.in	15 Feb 2005 12:52:02 -0000	1.18
--- opcodes/cgen-dis.in	23 Feb 2005 15:57:45 -0000
*************** static void print_keyword
*** 49,59 ****
  static void print_insn_normal
    (CGEN_CPU_DESC, void *, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int);
  static int print_insn
!   (CGEN_CPU_DESC, bfd_vma,  disassemble_info *, char *, unsigned);
  static int default_print_insn
    (CGEN_CPU_DESC, bfd_vma, disassemble_info *) ATTRIBUTE_UNUSED;
  static int read_insn
!   (CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, CGEN_EXTRACT_INFO *,
     unsigned long *);
  
  /* -- disassembler routines inserted here */
--- 49,59 ----
  static void print_insn_normal
    (CGEN_CPU_DESC, void *, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int);
  static int print_insn
!   (CGEN_CPU_DESC, bfd_vma,  disassemble_info *, bfd_byte *, unsigned);
  static int default_print_insn
    (CGEN_CPU_DESC, bfd_vma, disassemble_info *) ATTRIBUTE_UNUSED;
  static int read_insn
!   (CGEN_CPU_DESC, bfd_vma, disassemble_info *, bfd_byte *, int, CGEN_EXTRACT_INFO *,
     unsigned long *);
  
  /* -- disassembler routines inserted here */
*************** static int
*** 177,183 ****
  read_insn (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   bfd_vma pc,
  	   disassemble_info *info,
! 	   char *buf,
  	   int buflen,
  	   CGEN_EXTRACT_INFO *ex_info,
  	   unsigned long *insn_value)
--- 177,183 ----
  read_insn (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   bfd_vma pc,
  	   disassemble_info *info,
! 	   bfd_byte *buf,
  	   int buflen,
  	   CGEN_EXTRACT_INFO *ex_info,
  	   unsigned long *insn_value)
*************** static int
*** 207,213 ****
  print_insn (CGEN_CPU_DESC cd,
  	    bfd_vma pc,
  	    disassemble_info *info,
! 	    char *buf,
  	    unsigned int buflen)
  {
    CGEN_INSN_INT insn_value;
--- 207,213 ----
  print_insn (CGEN_CPU_DESC cd,
  	    bfd_vma pc,
  	    disassemble_info *info,
! 	    bfd_byte *buf,
  	    unsigned int buflen)
  {
    CGEN_INSN_INT insn_value;
*************** print_insn (CGEN_CPU_DESC cd,
*** 231,237 ****
    /* The instructions are stored in hash lists.
       Pick the first one and keep trying until we find the right one.  */
  
!   insn_list = CGEN_DIS_LOOKUP_INSN (cd, buf, insn_value);
    while (insn_list != NULL)
      {
        const CGEN_INSN *insn = insn_list->insn;
--- 231,237 ----
    /* The instructions are stored in hash lists.
       Pick the first one and keep trying until we find the right one.  */
  
!   insn_list = CGEN_DIS_LOOKUP_INSN (cd, (char *) buf, insn_value);
    while (insn_list != NULL)
      {
        const CGEN_INSN *insn = insn_list->insn;
*************** print_insn (CGEN_CPU_DESC cd,
*** 315,321 ****
  static int
  default_print_insn (CGEN_CPU_DESC cd, bfd_vma pc, disassemble_info *info)
  {
!   char buf[CGEN_MAX_INSN_SIZE];
    int buflen;
    int status;
  
--- 315,321 ----
  static int
  default_print_insn (CGEN_CPU_DESC cd, bfd_vma pc, disassemble_info *info)
  {
!   bfd_byte buf[CGEN_MAX_INSN_SIZE];
    int buflen;
    int status;
  
Index: opcodes/ia64-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ia64-opc.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 ia64-opc.c
*** opcodes/ia64-opc.c	14 Sep 2003 15:16:57 -0000	1.6
--- opcodes/ia64-opc.c	23 Feb 2005 15:57:46 -0000
*************** locate_opcode_ent (ia64_insn opcode, enu
*** 365,371 ****
        unsigned int op;
        int currbitnum = bitpos[currstatenum];
        int oplen;
!       int opval[3];
        int next_op;
        int currbit;
  
--- 365,371 ----
        unsigned int op;
        int currbitnum = bitpos[currstatenum];
        int oplen;
!       int opval[3] = {0};
        int next_op;
        int currbit;
  


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