*** msp430.c.old	Wed Dec 31 12:07:44 2003
--- msp430.c	Sun Feb 15 06:07:50 2004
*************** static int msp430_func_num_saved_regs PA
*** 81,86 ****
--- 81,87 ----
  static int noint_hwmul_function_p PARAMS ((tree func));
  static int interrupt_function_p PARAMS ((tree func));
  static int msp430_naked_function_p PARAMS ((tree func));
+ static int msp430_task_function_p PARAMS ((tree func));
  static int signal_function_p PARAMS ((tree func));
  static int wakeup_function_p PARAMS ((tree func));
  static int msp430_num_arg_regs PARAMS ((enum machine_mode mode, tree type));
*************** const struct attribute_spec msp430_attri
*** 231,236 ****
--- 232,238 ----
    {"signal", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
    {"interrupt", 1, 1, true, false, false, msp430_handle_fndecl_attribute},
    {"naked", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
+   {"task", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
    {"wakeup", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
    {"critical", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
    {"reentrant", 0, 0, true, false, false, msp430_handle_fndecl_attribute},
*************** msp430_naked_function_p (func)
*** 286,291 ****
--- 288,304 ----
  }
  
  static int
+ msp430_task_function_p (func)
+      tree func;
+ {
+   tree a;
+   if (TREE_CODE (func) != FUNCTION_DECL)
+     abort ();
+   a = lookup_attribute ("task", DECL_ATTRIBUTES (func));
+   return a != NULL_TREE;
+ }
+ 
+ static int
  msp430_save_prologue_function_p (func)
       tree func;
  {
*************** function_prologue (file, size)
*** 679,684 ****
--- 692,698 ----
    const char *fnname = XSTR (XEXP (x, 0), 0);
    int offset;
    int cfp = msp430_critical_function_p (current_function_decl);
+   int tfp = msp430_task_function_p (current_function_decl);
    int ree = msp430_reentrant_function_p (current_function_decl);
    int save_prologue_p =
        msp430_save_prologue_function_p (current_function_decl);
*************** function_prologue (file, size)
*** 717,722 ****
--- 731,743 ----
        return;
      }
  
+   if (msp430_naked_function_p (current_function_decl))
+     {
+       fprintf (file, "/* prologue: naked */\n");
+       fprintf (file, ".L__FrameSize_%s=0x%x\n", fnname, size);
+       return;
+     }
+ 
    ss = lookup_attribute ("reserve", DECL_ATTRIBUTES (current_function_decl));
    if (ss)
      {
*************** function_prologue (file, size)
*** 803,809 ****
  
  	  prologue_size += 7;
  	}
!       else
  	{
  	  for (i = 15; i >= 4; i--)
  	    {
--- 824,830 ----
  
  	  prologue_size += 7;
  	}
!       else if(!tfp)
  	{
  	  for (i = 15; i >= 4; i--)
  	    {
*************** function_epilogue (file, size)
*** 905,910 ****
--- 926,937 ----
    epilogue_size = 0;
    function_size = (INSN_ADDRESSES (INSN_UID (get_last_insn ()))
  		   - INSN_ADDRESSES (INSN_UID (get_insns ())));
+ 
+   if (msp430_task_function_p (current_function_decl))
+     {
+       fprintf (file, "/* epilogue: empty, task functions never return */\n");
+       return;
+     }
  
    if (msp430_naked_function_p (current_function_decl))
      {
