Enable -Werror by default
[deliverable/binutils-gdb.git] / gas / cgen.c
index 76e6826b1eaee5d4aebf4ae653f2cb3c0aa5f2b7..ab30778abb96c74b55cc6b030b045f373b64f3f7 100644 (file)
@@ -1,5 +1,5 @@
 /* GAS interface for targets using CGEN: Cpu tools GENerator.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -29,7 +29,7 @@
 #include "cgen.h"
 #include "dwarf2dbg.h"
 
-static void queue_fixup PARAMS ((int, int, expressionS *));
+static void queue_fixup (int, int, expressionS *);
 
 /* Opcode table descriptor, must be set by md_begin.  */
 
@@ -355,6 +355,10 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
   *strP = input_line_pointer;
   input_line_pointer = hold;
 
+#ifdef TC_CGEN_PARSE_FIX_EXP
+  opinfo = TC_CGEN_PARSE_FIX_EXP (opinfo, & exp);
+#endif 
+
   /* FIXME: Need to check `want'.  */
 
   switch (exp.X_op)
@@ -368,6 +372,8 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
       *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR;
       break;
     case O_constant:
+      if (want == CGEN_PARSE_OPERAND_SYMBOLIC)
+       goto de_fault;
       *valueP = exp.X_add_number;
       *resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER;
       break;
@@ -375,6 +381,7 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
       *valueP = exp.X_add_number;
       *resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER;
       break;
+    de_fault:
     default:
       queue_fixup (opindex, opinfo, &exp);
       *valueP = 0;
@@ -431,7 +438,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
      Relaxable instructions: We need to ensure we allocate enough
      space for the largest insn.  */
 
-  if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX))
+  if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED))
     /* These currently shouldn't get here.  */
     abort ();
 
@@ -515,7 +522,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
   /* If we're recording insns as numbers (rather than a string of bytes),
      target byte order handling is deferred until now.  */
 #if CGEN_INT_INSN_P
-  cgen_put_insn_value (gas_cgen_cpu_desc, f, length, *buf);
+  cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) f, length, *buf);
 #else
   memcpy (f, buf, byte_len);
 #endif
@@ -531,7 +538,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
        cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex);
 
       /* Don't create fixups for these.  That's done during relaxation.
-        We don't need to test for CGEN_INSN_RELAX as they can't get here
+        We don't need to test for CGEN_INSN_RELAXED as they can't get here
         (see above).  */
       if (relax_p
          && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXABLE)
@@ -609,17 +616,19 @@ gas_cgen_md_apply_fix3 (fixP, valP, seg)
 #if CGEN_INT_INSN_P
          {
            CGEN_INSN_INT insn_value =
-             cgen_get_insn_value (cd, where, CGEN_INSN_BITSIZE (insn));
+             cgen_get_insn_value (cd, (unsigned char *) where,
+                                  CGEN_INSN_BITSIZE (insn));
 
            /* ??? 0 is passed for `pc'.  */
            errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields,
                                                   &insn_value, (bfd_vma) 0);
-           cgen_put_insn_value (cd, where, CGEN_INSN_BITSIZE (insn),
-                                insn_value);
+           cgen_put_insn_value (cd, (unsigned char *) where,
+                                CGEN_INSN_BITSIZE (insn), insn_value);
          }
 #else
          /* ??? 0 is passed for `pc'.  */
-         errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, where,
+         errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields,
+                                                (unsigned char *) where,
                                                 (bfd_vma) 0);
 #endif
          if (errmsg)
@@ -716,3 +725,15 @@ gas_cgen_tc_gen_reloc (section, fixP)
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
   return reloc;
 }
+
+/* Perform any cgen specific initialisation.
+   Called after gas_cgen_cpu_desc has been created.  */
+
+void
+gas_cgen_begin ()
+{
+  if (flag_signed_overflow_ok)
+    cgen_set_signed_overflow_ok (gas_cgen_cpu_desc);
+  else
+    cgen_clear_signed_overflow_ok (gas_cgen_cpu_desc);
+}
This page took 0.024561 seconds and 4 git commands to generate.