[PATCH][2/3] Instruction patterns changes and instruction attributes

Roman Zippel zippel@linux-m68k.org
Thu Sep 13 07:18:00 GMT 2007


Hi,

On Thu, 13 Sep 2007, Roman Zippel wrote:

> Below is example patch which would annotate the assembler source already 
> with some basic split information and only there it can't be determined 
> attributes are needed.

Sorry, here it is:

---
 gcc/config/m68k/m68k-protos.h |    1 
 gcc/config/m68k/m68k.c        |   47 ++++++++++++++++++++++++++++++++++++++++++
 gcc/config/m68k/m68k.h        |    3 ++
 3 files changed, 51 insertions(+)

Index: gcc/gcc/config/m68k/m68k-protos.h
===================================================================
--- gcc.orig/gcc/config/m68k/m68k-protos.h
+++ gcc/gcc/config/m68k/m68k-protos.h
@@ -50,6 +50,7 @@ extern bool strict_low_part_peephole_ok 
 extern int standard_68881_constant_p (rtx);
 extern void print_operand_address (FILE *, rtx);
 extern void print_operand (FILE *, rtx, int);
+extern void m68k_final_prescan_insn (rtx, rtx *, int);
 extern void notice_update_cc (rtx, rtx);
 extern bool m68k_legitimate_base_reg_p (rtx, bool);
 extern bool m68k_legitimate_index_reg_p (rtx, bool);
Index: gcc/gcc/config/m68k/m68k.c
===================================================================
--- gcc.orig/gcc/config/m68k/m68k.c
+++ gcc/gcc/config/m68k/m68k.c
@@ -3878,6 +3878,53 @@ print_operand_address (FILE *file, rtx a
 	}
     }
 }
+
+void
+m68k_final_prescan_insn (rtx insn,
+			 rtx *opvec ATTRIBUTE_UNUSED,
+			 int noperands ATTRIBUTE_UNUSED)
+{
+  rtx body;
+  const char *template;
+  int icode;
+
+  body = PATTERN (insn);
+  if (asm_noperands (body) >= 0) {
+    fprintf(asm_out_file, "%s %u {%s}: asm\n",
+	    ASM_COMMENT_START, INSN_UID(insn));
+    return;
+  }
+
+  gcc_assert (recog_data.insn == insn);
+  icode = recog_memoized (insn);
+  fprintf(asm_out_file, "%s %u {%s}: ",
+	  ASM_COMMENT_START, INSN_UID(insn),
+	  insn_data[icode].name);
+  switch (insn_data[icode].output_format)
+    {
+    case INSN_OUTPUT_FORMAT_SINGLE:
+      template = insn_data[icode].output.single;
+      break;
+    case INSN_OUTPUT_FORMAT_MULTI:
+      template = insn_data[icode].output.multi[which_alternative];
+      break;
+    default:
+      template = NULL;
+      break;
+    }
+
+  if (template)
+    {
+      if (strchr(template, ';') || strchr(template, '\n'))
+        fprintf(asm_out_file, "splitting needed\n");
+      else
+        fprintf(asm_out_file, "fully splitted\n");
+    }
+  else
+    {
+      fprintf(asm_out_file, "split unknown\n");
+    }
+}
 
 /* Check for cases where a clr insns can be omitted from code using
    strict_low_part sets.  For example, the second clrl here is not needed:
Index: gcc/gcc/config/m68k/m68k.h
===================================================================
--- gcc.orig/gcc/config/m68k/m68k.h
+++ gcc/gcc/config/m68k/m68k.h
@@ -1072,6 +1072,9 @@ do { if (cc_prev_status.flags & CC_IN_68
 
 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
 
+#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
+  m68k_final_prescan_insn (INSN, OPVEC, NOPERANDS)
+
 /* Values used in the MICROARCH argument to M68K_DEVICE.  */
 enum uarch_type
 {



More information about the Gcc-patches mailing list