OSDN Git Service

Delete !REGISTER_CONSTRAINTS code
[pf3gnuchains/gcc-fork.git] / gcc / final.c
index 706a308..5ef12ef 100644 (file)
@@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "tree.h"
 #include "rtl.h"
+#include "tm_p.h"
 #include "regs.h"
 #include "insn-config.h"
 #include "insn-flags.h"
@@ -1027,7 +1028,7 @@ shorten_branches (first)
 
   max_labelno = max_label_num ();
   min_labelno = get_first_label_num ();
-  label_align = (struct label_alignment **)
+  label_align = (struct label_alignment *)
     xcalloc ((max_labelno - min_labelno + 1), sizeof (struct label_alignment));
 
   uid_shuid = (int *) xmalloc (max_uid * sizeof *uid_shuid);
@@ -2034,6 +2035,27 @@ final (first, file, optimize, prescan)
   free_insn_eh_region ();
 }
 \f
+const char *
+get_insn_template (code, insn)
+     int code;
+     rtx insn;
+{
+  const void *output = insn_data[code].output;
+  switch (insn_data[code].output_format)
+    {
+    case INSN_OUTPUT_FORMAT_SINGLE:
+      return (const char *) output;
+    case INSN_OUTPUT_FORMAT_MULTI:
+      return ((const char * const *) output)[which_alternative];
+    case INSN_OUTPUT_FORMAT_FUNCTION:
+      if (insn == NULL)
+       abort ();
+      return (* (insn_output_fn) output) (recog_data.operand, insn);
+
+    default:
+      abort ();
+    }
+}
 /* The final scan for one insn, INSN.
    Args are same as in `final', except that INSN
    is the insn being scanned.
@@ -2078,11 +2100,11 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
          && ! exceptions_via_longjmp)
        {
-         ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_BLOCK_NUMBER (insn));
+         ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_EH_HANDLER (insn));
           if (! flag_new_exceptions)
-            add_eh_table_entry (NOTE_BLOCK_NUMBER (insn));
+            add_eh_table_entry (NOTE_EH_HANDLER (insn));
 #ifdef ASM_OUTPUT_EH_REGION_BEG
-         ASM_OUTPUT_EH_REGION_BEG (file, NOTE_BLOCK_NUMBER (insn));
+         ASM_OUTPUT_EH_REGION_BEG (file, NOTE_EH_HANDLER (insn));
 #endif
          break;
        }
@@ -2090,11 +2112,11 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END
          && ! exceptions_via_longjmp)
        {
-         ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_BLOCK_NUMBER (insn));
+         ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_EH_HANDLER (insn));
           if (flag_new_exceptions)
-            add_eh_table_entry (NOTE_BLOCK_NUMBER (insn));
+            add_eh_table_entry (NOTE_EH_HANDLER (insn));
 #ifdef ASM_OUTPUT_EH_REGION_END
-         ASM_OUTPUT_EH_REGION_END (file, NOTE_BLOCK_NUMBER (insn));
+         ASM_OUTPUT_EH_REGION_END (file, NOTE_EH_HANDLER (insn));
 #endif
          break;
        }
@@ -2864,16 +2886,14 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
        extract_insn (insn);
        cleanup_subreg_operands (insn);
 
-#ifdef REGISTER_CONSTRAINTS
        if (! constrain_operands (1))
          fatal_insn_not_found (insn);
-#endif
 
        /* Some target machines need to prescan each insn before
           it is output.  */
 
 #ifdef FINAL_PRESCAN_INSN
-       FINAL_PRESCAN_INSN (insn, recog_operand, recog_n_operands);
+       FINAL_PRESCAN_INSN (insn, recog_data.operand, recog_data.n_operands);
 #endif
 
 #ifdef HAVE_cc0
@@ -2895,24 +2915,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
          dwarf2out_frame_debug (insn);
 #endif
 
-       /* If the proper template needs to be chosen by some C code,
-          run that code and get the real template.  */
+       /* Find the proper template for this insn.  */
+       template = get_insn_template (insn_code_number, insn);
 
-       template = insn_template[insn_code_number];
+       /* If the C code returns 0, it means that it is a jump insn
+          which follows a deleted test insn, and that test insn
+          needs to be reinserted.  */
        if (template == 0)
          {
-           template = (*insn_outfun[insn_code_number]) (recog_operand, insn);
-
-           /* If the C code returns 0, it means that it is a jump insn
-              which follows a deleted test insn, and that test insn
-              needs to be reinserted.  */
-           if (template == 0)
-             {
-               if (prev_nonnote_insn (insn) != last_ignored_compare)
-                 abort ();
-               new_block = 0;
-               return prev_nonnote_insn (insn);
-             }
+           if (prev_nonnote_insn (insn) != last_ignored_compare)
+             abort ();
+           new_block = 0;
+           return prev_nonnote_insn (insn);
          }
 
        /* If the template is the string "#", it means that this insn must
@@ -2941,7 +2955,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
 
        /* Output assembler code from the template.  */
 
-       output_asm_insn (template, recog_operand);
+       output_asm_insn (template, recog_data.operand);
 
 #if defined (DWARF2_UNWIND_INFO)
 #if !defined (ACCUMULATE_OUTGOING_ARGS)
@@ -3050,22 +3064,22 @@ cleanup_subreg_operands (insn)
   int i;
 
   extract_insn (insn);
-  for (i = 0; i < recog_n_operands; i++)
+  for (i = 0; i < recog_data.n_operands; i++)
     {
-      if (GET_CODE (recog_operand[i]) == SUBREG)
-        recog_operand[i] = alter_subreg (recog_operand[i]);
-      else if (GET_CODE (recog_operand[i]) == PLUS
-               || GET_CODE (recog_operand[i]) == MULT)
-       recog_operand[i] = walk_alter_subreg (recog_operand[i]);
+      if (GET_CODE (recog_data.operand[i]) == SUBREG)
+        recog_data.operand[i] = alter_subreg (recog_data.operand[i]);
+      else if (GET_CODE (recog_data.operand[i]) == PLUS
+               || GET_CODE (recog_data.operand[i]) == MULT)
+       recog_data.operand[i] = walk_alter_subreg (recog_data.operand[i]);
     }
 
-  for (i = 0; i < recog_n_dups; i++)
+  for (i = 0; i < recog_data.n_dups; i++)
     {
-      if (GET_CODE (*recog_dup_loc[i]) == SUBREG)
-        *recog_dup_loc[i] = alter_subreg (*recog_dup_loc[i]);
-      else if (GET_CODE (*recog_dup_loc[i]) == PLUS
-               || GET_CODE (*recog_dup_loc[i]) == MULT)
-        *recog_dup_loc[i] = walk_alter_subreg (*recog_dup_loc[i]);
+      if (GET_CODE (*recog_data.dup_loc[i]) == SUBREG)
+        *recog_data.dup_loc[i] = alter_subreg (*recog_data.dup_loc[i]);
+      else if (GET_CODE (*recog_data.dup_loc[i]) == PLUS
+               || GET_CODE (*recog_data.dup_loc[i]) == MULT)
+        *recog_data.dup_loc[i] = walk_alter_subreg (*recog_data.dup_loc[i]);
     }
 }
 
@@ -3358,11 +3372,13 @@ output_asm_name ()
        {
          register int num = INSN_CODE (debug_insn);
          fprintf (asm_out_file, "\t%s %d\t%s", 
-                  ASM_COMMENT_START, INSN_UID (debug_insn), insn_name[num]);
-         if (insn_n_alternatives[num] > 1)
+                  ASM_COMMENT_START, INSN_UID (debug_insn),
+                  insn_data[num].name);
+         if (insn_data[num].n_alternatives > 1)
            fprintf (asm_out_file, "/%d", which_alternative + 1);
 #ifdef HAVE_ATTR_length
-         fprintf (asm_out_file, "\t[length = %d]", get_attr_length (debug_insn));
+         fprintf (asm_out_file, "\t[length = %d]",
+                  get_attr_length (debug_insn));
 #endif
          /* Clear this so only the first assembler insn
             of any rtl insn will get the special comment for -dp.  */
@@ -3865,6 +3881,7 @@ asm_fprintf VPROTO((FILE *file, const char *p, ...))
       default:
        fputc (c, file);
       }
+  va_end (argptr);
 }
 \f
 /* Split up a CONST_DOUBLE or integer constant rtx