* elf32-hppa.c: (LONG_BRANCH_PIC_IN_SHLIB): Delete. Remove all
[deliverable/binutils-gdb.git] / opcodes / m32r-ibld.c
index f999bcd8d7d60c371c9c31fd1c9b459e3cf299e4..3541f71d40046f67a610fcb20070373699922e4c 100644 (file)
@@ -25,7 +25,6 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
    Keep that in mind.  */
 
 #include "sysdep.h"
-#include <ctype.h>
 #include <stdio.h>
 #include "ansidecl.h"
 #include "dis-asm.h"
@@ -59,7 +58,18 @@ static int extract_insn_normal
              CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma));
 static void put_insn_int_value
      PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT));
-
+const char * m32r_cgen_insert_operand
+     PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma));
+int m32r_cgen_extract_operand
+     PARAMS ((CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma));
+int m32r_cgen_get_int_operand
+     PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *));
+bfd_vma m32r_cgen_get_vma_operand
+     PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *));
+void m32r_cgen_set_int_operand
+     PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, int));
+void m32r_cgen_set_vma_operand
+     PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma));
 \f
 /* Operand insertion.  */
 
@@ -145,7 +155,22 @@ insert_normal (cd, value, attrs, word_offset, start, length, word_length,
     }
 
   /* Ensure VALUE will fit.  */
-  if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
+  if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
+    {
+      long minval = - (1L << (length - 1));
+      unsigned long maxval = mask;
+      
+      if ((value > 0 && (unsigned long) value > maxval)
+         || value < minval)
+       {
+         /* xgettext:c-format */
+         sprintf (errbuf,
+                  _("operand out of range (%ld not between %ld and %lu)"),
+                  value, minval, maxval);
+         return errbuf;
+       }
+    }
+  else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
     {
       unsigned long maxval = mask;
       
@@ -400,7 +425,7 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
 #endif
      long *valuep;
 {
-  CGEN_INSN_INT value, mask;
+  long value, mask;
 
   /* If LENGTH is zero, this operand doesn't contribute to the value
      so give it a standard value of zero.  */
@@ -428,9 +453,9 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
        word_length = total_length;
     }
 
-  /* Does the value reside in INSN_VALUE?  */
+  /* Does the value reside in INSN_VALUE, and at the right alignment?  */
 
-  if (CGEN_INT_INSN_P || word_offset == 0)
+  if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
     {
       if (CGEN_INSN_LSB0_P)
        value = insn_value >> ((word_offset + start + 1) - length);
@@ -783,7 +808,7 @@ cgen_extract_fn * const m32r_cgen_extract_handlers[] =
 
 int
 m32r_cgen_get_int_operand (cd, opindex, fields)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      int opindex;
      const CGEN_FIELDS * fields;
 {
@@ -873,7 +898,7 @@ m32r_cgen_get_int_operand (cd, opindex, fields)
 
 bfd_vma
 m32r_cgen_get_vma_operand (cd, opindex, fields)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      int opindex;
      const CGEN_FIELDS * fields;
 {
@@ -968,7 +993,7 @@ m32r_cgen_get_vma_operand (cd, opindex, fields)
 
 void
 m32r_cgen_set_int_operand (cd, opindex, fields, value)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      int opindex;
      CGEN_FIELDS * fields;
      int value;
@@ -1054,7 +1079,7 @@ m32r_cgen_set_int_operand (cd, opindex, fields, value)
 
 void
 m32r_cgen_set_vma_operand (cd, opindex, fields, value)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      int opindex;
      CGEN_FIELDS * fields;
      bfd_vma value;
This page took 0.02403 seconds and 4 git commands to generate.