epiphany-protos.h (epiphany_start_function): Declare.
authorJoern Rennecke <joern.rennecke@embecosm.com>
Sat, 10 Dec 2011 10:22:56 +0000 (10:22 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Sat, 10 Dec 2011 10:22:56 +0000 (10:22 +0000)
gcc:
        * config/epiphany/epiphany-protos.h (epiphany_start_function): Declare.
        * config/epiphany/epiphany.c (epiphany_handle_interrupt_attribute):
        Split "timer" value into "timer0" and "timer1".
        Handle page_miss, message and wand.  Don't handle static_flag.
        Adjust warning text.
        (epiphany_start_function): New function.
        (epiphany_compute_function_type): Split "timer" value into "timer0"
        and "timer1".  Handle page_miss, message and wand.
        Don't handle static_flag.
        (epiphany_expand_epilogue): Don't use frame_insn for status / iret
        restore.
        * config/epiphany/epiphany.h: ASM_DECLARE_FUNCTION_NAME: Define.
        (enum epiphany_function_type):
        Split EPIPHANY_FUNCTION_TIMER value into EPIPHANY_FUNCTION_TIMER0
        and EPIPHANY_FUNCTION_TIMER1.
        Remove EPIPHANY_FUNCTION_ILINK1 and EPIPHANY_FUNCTION_ILINK2 values.
        Add EPIPHANY_FUNCTION_PAGE_MISS and EPIPHANY_FUNCTION_MESSAGE values.
        Rename EPIPHANY_FUNCTION_STATIC_FLAG to EPIPHANY_FUNCTION_WAND.
gcc/testsuite:
        * gcc.target/epiphany/interrupt.c: Add dg-options "-g".
        Add a scan-assembler-time clause to test for the interupt vector jump.
        (f): Rename to ...
        (dma0_handler): ... this.

From-SVN: r182187

gcc/ChangeLog
gcc/config/epiphany/epiphany-protos.h
gcc/config/epiphany/epiphany.c
gcc/config/epiphany/epiphany.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/epiphany/interrupt.c

index 153f397524eda46b5f3e2b95e2273f001eeaf587..811ea3181ca7aab7ec37d4d6db808b4bdf52ebfa 100644 (file)
@@ -9,6 +9,25 @@
        (INCOMING_RETURN_ADDR_RTX) .. this.  Use EPIPHANY_RETURN_REGNO.
        (DWARF_FRAME_RETURN_COLUMN): New macro.
 
+       * config/epiphany/epiphany-protos.h (epiphany_start_function): Declare.
+       * config/epiphany/epiphany.c (epiphany_handle_interrupt_attribute):
+       Split "timer" value into "timer0" and "timer1".
+       Handle page_miss, message and wand.  Don't handle static_flag.
+       Adjust warning text.
+       (epiphany_start_function): New function.
+       (epiphany_compute_function_type): Split "timer" value into "timer0"
+       and "timer1".  Handle page_miss, message and wand.
+       Don't handle static_flag.
+       (epiphany_expand_epilogue): Don't use frame_insn for status / iret
+       restore.
+       * config/epiphany/epiphany.h: ASM_DECLARE_FUNCTION_NAME: Define.
+       (enum epiphany_function_type):
+       Split EPIPHANY_FUNCTION_TIMER value into EPIPHANY_FUNCTION_TIMER0
+       and EPIPHANY_FUNCTION_TIMER1.
+       Remove EPIPHANY_FUNCTION_ILINK1 and EPIPHANY_FUNCTION_ILINK2 values.
+       Add EPIPHANY_FUNCTION_PAGE_MISS and EPIPHANY_FUNCTION_MESSAGE values.
+       Rename EPIPHANY_FUNCTION_STATIC_FLAG to EPIPHANY_FUNCTION_WAND.
+
 2011-12-10  Nathan Sidwell  <nathan@acm.org>
 
        PR gcov-profile/51449
index 334c5337f7ceb66d1e6cd412d5effc7799ba6a71..2e787da857992964ae35cf5c103f6be293f9be16 100644 (file)
@@ -53,3 +53,4 @@ extern bool epiphany_optimize_mode_switching (int entity);
 extern bool epiphany_is_interrupt_p (tree);
 extern unsigned epiphany_special_round_type_align (tree, unsigned, unsigned);
 extern unsigned epiphany_adjust_field_align (tree, unsigned);
+extern void epiphany_start_function (FILE *f, const char *name, tree decl);
index a4652da87b815ea4ac73fa85d333cd481ee31ec3..a8fc034811ba19047156555633270d8899f0002a 100644 (file)
@@ -435,14 +435,17 @@ epiphany_handle_interrupt_attribute (tree *node ATTRIBUTE_UNUSED,
     }
   else if (strcmp (TREE_STRING_POINTER (value), "reset")
           && strcmp (TREE_STRING_POINTER (value), "software_exception")
-          && strcmp (TREE_STRING_POINTER (value), "timer")
+          && strcmp (TREE_STRING_POINTER (value), "page_miss")
+          && strcmp (TREE_STRING_POINTER (value), "timer0")
+          && strcmp (TREE_STRING_POINTER (value), "timer1")
+          && strcmp (TREE_STRING_POINTER (value), "message")
           && strcmp (TREE_STRING_POINTER (value), "dma0")
           && strcmp (TREE_STRING_POINTER (value), "dma1")
-          && strcmp (TREE_STRING_POINTER (value), "static_flag")
+          && strcmp (TREE_STRING_POINTER (value), "wand")
           && strcmp (TREE_STRING_POINTER (value), "swi"))
     {
       warning (OPT_Wattributes,
-              "argument of %qE attribute is not \"reset\", \"software_exception\", \"timer\", \"dma0\", \"dma1\", \"static_flag\" or \"swi\"",
+              "argument of %qE attribute is not \"reset\", \"software_exception\", \"page_miss\", \"timer0\", \"timer1\", \"message\", \"dma0\", \"dma1\", \"wand\" or \"swi\"",
               name);
       *no_add_attrs = true;
     }
@@ -892,14 +895,20 @@ epiphany_compute_function_type (tree decl)
            fn_type = EPIPHANY_FUNCTION_RESET;
          else if (!strcmp (TREE_STRING_POINTER (value), "software_exception"))
            fn_type = EPIPHANY_FUNCTION_SOFTWARE_EXCEPTION;
-         else if (!strcmp (TREE_STRING_POINTER (value), "timer"))
-           fn_type = EPIPHANY_FUNCTION_TIMER;
+         else if (!strcmp (TREE_STRING_POINTER (value), "page_miss"))
+           fn_type = EPIPHANY_FUNCTION_PAGE_MISS;
+         else if (!strcmp (TREE_STRING_POINTER (value), "timer0"))
+           fn_type = EPIPHANY_FUNCTION_TIMER0;
+         else if (!strcmp (TREE_STRING_POINTER (value), "timer1"))
+           fn_type = EPIPHANY_FUNCTION_TIMER1;
+         else if (!strcmp (TREE_STRING_POINTER (value), "message"))
+           fn_type = EPIPHANY_FUNCTION_MESSAGE;
          else if (!strcmp (TREE_STRING_POINTER (value), "dma0"))
            fn_type = EPIPHANY_FUNCTION_DMA0;
          else if (!strcmp (TREE_STRING_POINTER (value), "dma1"))
            fn_type = EPIPHANY_FUNCTION_DMA1;
-         else if (!strcmp (TREE_STRING_POINTER (value), "static_flag"))
-           fn_type = EPIPHANY_FUNCTION_STATIC_FLAG;
+         else if (!strcmp (TREE_STRING_POINTER (value), "wand"))
+           fn_type = EPIPHANY_FUNCTION_WAND;
          else if (!strcmp (TREE_STRING_POINTER (value), "swi"))
            fn_type = EPIPHANY_FUNCTION_SWI;
          else
@@ -1812,14 +1821,14 @@ epiphany_expand_epilogue (int sibcall_p)
     }
   if (interrupt_p)
     {
-      frame_move_insn (gen_rtx_REG (word_mode, STATUS_REGNUM),
-                      gen_rtx_REG (SImode, GPR_0));
-      frame_move_insn (gen_rtx_REG (word_mode, IRET_REGNUM),
-                      gen_rtx_REG (SImode, GPR_0+1));
+      emit_move_insn (gen_rtx_REG (word_mode, STATUS_REGNUM),
+                     gen_rtx_REG (SImode, GPR_0));
+      emit_move_insn (gen_rtx_REG (word_mode, IRET_REGNUM),
+                     gen_rtx_REG (SImode, GPR_0+1));
       addr = plus_constant (stack_pointer_rtx,
                            - (HOST_WIDE_INT) 2 * UNITS_PER_WORD);
-      frame_move_insn (gen_rtx_REG (DImode, GPR_0),
-                      gen_frame_mem (DImode, addr));
+      emit_move_insn (gen_rtx_REG (DImode, GPR_0),
+                     gen_frame_mem (DImode, addr));
     }
   addr = plus_constant (stack_pointer_rtx,
                        epiphany_stack_offset - (HOST_WIDE_INT) UNITS_PER_WORD);
@@ -2748,4 +2757,28 @@ epiphany_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
     }
 }
 
+void
+epiphany_start_function (FILE *file, const char *name, tree decl)
+{
+  tree attrs, int_attr;
+
+  attrs = DECL_ATTRIBUTES (decl);
+  int_attr = lookup_attribute ("interrupt", attrs);
+  if (int_attr)
+    {
+      char buf[99];
+      const char *fname;
+
+      int_attr = TREE_VALUE (TREE_VALUE (int_attr));
+      sprintf (buf, "ivt_entry_%.80s", TREE_STRING_POINTER (int_attr));
+      switch_to_section (get_section (buf, SECTION_CODE, decl));
+      fname = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+      fputs ("\tb\t", file);
+      assemble_name (file, fname);
+      fputc ('\n', file);
+      switch_to_section (function_section (decl));
+    }
+  ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
+}
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index f6f6df7c244e8239a391c9ec4f425ad8ce71b00d..f92e1973e36f84ce1721a87cebaf33dff986fb5b 100644 (file)
@@ -831,14 +831,12 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); } while (0)
 enum epiphany_function_type
 {
   EPIPHANY_FUNCTION_UNKNOWN, EPIPHANY_FUNCTION_NORMAL,
-  /* These are interrupt handlers.  The name corresponds to the register
-     name that contains the return address.  */
-  EPIPHANY_FUNCTION_ILINK1, EPIPHANY_FUNCTION_ILINK2,
   /* These are interrupt handlers. The name corresponds to which type
      of interrupt handler we're dealing with. */
   EPIPHANY_FUNCTION_RESET, EPIPHANY_FUNCTION_SOFTWARE_EXCEPTION,
-  EPIPHANY_FUNCTION_TIMER, EPIPHANY_FUNCTION_DMA0,
-  EPIPHANY_FUNCTION_DMA1, EPIPHANY_FUNCTION_STATIC_FLAG,
+  EPIPHANY_FUNCTION_PAGE_MISS,
+  EPIPHANY_FUNCTION_TIMER0, EPIPHANY_FUNCTION_TIMER1, EPIPHANY_FUNCTION_MESSAGE,
+  EPIPHANY_FUNCTION_DMA0, EPIPHANY_FUNCTION_DMA1, EPIPHANY_FUNCTION_WAND,
   EPIPHANY_FUNCTION_SWI
 };
 
@@ -895,4 +893,8 @@ extern struct rtl_opt_pass pass_resolve_sw_modes;
    implemented.  */
 #define TARGET_FUSED_MADD (flag_fp_contract_mode == FP_CONTRACT_FAST)
 
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+  epiphany_start_function ((FILE), (NAME), (DECL))
+
 #endif /* !GCC_EPIPHANY_H */
index b17e0fe4d7769ff79e128305254de5e5e04eb7e0..83e73b2a9ba0f0d41700e5e9ea079bba743c6d43 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-10  Joern Rennecke <joern.rennecke@embecosm.com>
+
+       * gcc.target/epiphany/interrupt.c: Add dg-options "-g".
+       Add a scan-assembler-time clause to test for the interupt vector jump.
+       (f): Rename to ...
+       (dma0_handler): ... this.
+
 2011-12-10  Nathan Sidwell  <nathan@acm.org>
 
        PR gcov-profile/51449
index a44c79e432e69fd6b71256c3880265dc22b97145..86fb255613b3e5bfd8a51ea685ddfc08c444029a 100644 (file)
@@ -1,5 +1,7 @@
+/* { dg-options "-g" } */
+
 void __attribute__((interrupt("dma0")))
-f (void)
+dma0_handler (void)
 {
 }
 
@@ -12,3 +14,5 @@ void __attribute__((interrupt(42)))
 h (void)
 { /* { dg-warning "is not a string constant" } */
 }
+
+/* { dg-final { scan-assembler-times "b\[ \t\]*_dma0_handler" 1 } } */