* gas/cris/addi.d: Tweak for 64-bit BFD.
[deliverable/binutils-gdb.git] / gas / cgen.c
index 9c9497158c40e252e3189569135c50bd4c530948..759b38200822f3ff787493ce989745dc4b124c24 100644 (file)
@@ -1,5 +1,6 @@
 /* GAS interface for targets using CGEN: Cpu tools GENerator.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
 
@@ -26,6 +27,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "as.h"
 #include "subsegs.h"
 #include "cgen.h"
+#include "dwarf2dbg.h"
 
 /* Opcode table descriptor, must be set by md_begin.  */
 
@@ -57,8 +59,7 @@ cgen_asm_record_register (name, number)
    OPINDEX is the index in the operand table.
    OPINFO is something the caller chooses to help in reloc determination.  */
 
-struct fixup
-{
+struct fixup {
   int opindex;
   int opinfo;
   expressionS exp;
@@ -87,7 +88,7 @@ queue_fixup (opindex, opinfo, expP)
   /* We need to generate a fixup for this expression.  */
   if (num_fixups >= GAS_CGEN_MAX_FIXUPS)
     as_fatal (_("too many fixups"));
-  fixups[num_fixups].exp     = * expP;
+  fixups[num_fixups].exp     = *expP;
   fixups[num_fixups].opindex = opindex;
   fixups[num_fixups].opinfo  = opinfo;
   ++ num_fixups;
@@ -315,7 +316,7 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
       *resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER;
       break;
     default:
-      queue_fixup (opindex, opinfo, & exp);
+      queue_fixup (opindex, opinfo, &exp);
       *valueP = 0;
       *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED;
       break;
@@ -397,6 +398,9 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
     {
       int max_len;
       fragS *old_frag;
+      expressionS *exp;
+      symbolS *sym;
+      offsetT off;
 
 #ifdef TC_CGEN_MAX_RELAX
       max_len = TC_CGEN_MAX_RELAX (insn, byte_len);
@@ -413,14 +417,24 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
       /* Create a relaxable fragment for this instruction.  */
       old_frag = frag_now;
 
+      exp = &fixups[relax_operand].exp;
+      sym = exp->X_add_symbol;
+      off = exp->X_add_number;
+      if (exp->X_op != O_constant && exp->X_op != O_symbol)
+       {
+         /* Handle complex expressions.  */
+         sym = make_expr_symbol (exp);
+         off = 0;
+       }
+
       frag_var (rs_machine_dependent,
                max_len - byte_len /* max chars */,
                0 /* variable part already allocated */,
                /* FIXME: When we machine generate the relax table,
                   machine generate a macro to compute subtype.  */
                1 /* subtype */,
-               fixups[relax_operand].exp.X_add_symbol,
-               fixups[relax_operand].exp.X_add_number,
+               sym,
+               off,
                f);
 
       /* Record the operand number with the fragment so md_convert_frag
@@ -446,6 +460,9 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
   memcpy (f, buf, byte_len);
 #endif
 
+  /* Emit DWARF2 debugging information.  */
+  dwarf2_emit_insn (byte_len);
+
   /* Create any fixups.  */
   for (i = 0; i < num_fixups; ++i)
     {
@@ -612,7 +629,9 @@ gas_cgen_md_apply_fix3 (fixP, valueP, seg)
        case BFD_RELOC_32:
          md_number_to_chars (where, value, 4);
          break;
-       /* FIXME: later add support for 64 bits.  */
+       case BFD_RELOC_64:
+         md_number_to_chars (where, value, 8);
+         break;
        default:
          as_bad_where (fixP->fx_file, fixP->fx_line,
                        _("internal error: can't install fix for reloc type %d (`%s')"),
@@ -650,8 +669,7 @@ gas_cgen_tc_gen_reloc (section, fixP)
   if (reloc->howto == (reloc_howto_type *) NULL)
     {
       as_bad_where (fixP->fx_file, fixP->fx_line,
-                   _("internal error: can't export reloc type %d (`%s')"),
-                   fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type));
+                   _("relocation is not supported"));
       return NULL;
     }
 
This page took 0.0255 seconds and 4 git commands to generate.