]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rl78.c (rl78_attribute_table): Add naked.
authorNick Clifton <nickc@redhat.com>
Fri, 17 May 2013 07:51:53 +0000 (07:51 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Fri, 17 May 2013 07:51:53 +0000 (07:51 +0000)
* config/rl78/rl78.c (rl78_attribute_table): Add naked.
(rl78_is_naked_func): New function.
(rl78_expand_prologue): Skip prologue generation for naked
functions.
(rl78_expand_epilogue): Skip epilogue generation for naked
functions.
* doc/extend.texi (naked): Add RL78 to the list of processors
that supports this attribute.

From-SVN: r199001

gcc/ChangeLog
gcc/config/rl78/rl78.c
gcc/doc/extend.texi

index 38e8f183ac9cce3444caa616c5ad78dbf3c211b7..e47c76046c906675bff33e6de7ff58b9c2ca2e47 100644 (file)
@@ -1,3 +1,14 @@
+2013-05-16  Nick Clifton  <nickc@redhat.com>
+
+       * config/rl78/rl78.c (rl78_attribute_table): Add naked.
+       (rl78_is_naked_func): New function.
+       (rl78_expand_prologue): Skip prologue generation for naked
+       functions.
+       (rl78_expand_epilogue): Skip epilogue generation for naked
+       functions.
+       * doc/extend.texi (naked): Add RL78 to the list of processors
+       that supports this attribute.
+
 2013-05-16  Jeff Law  <law@redhat.com>
 
        * Makefile.in (tree-switch-conversion.o): Depend on $(OPTABS_H).
index 895d7db9a4423345d50326beeea83bfeb1031c9a..2e18bebf3d8e849683c8f090ad35a87ecb5f95f0 100644 (file)
@@ -499,6 +499,8 @@ const struct attribute_spec rl78_attribute_table[] =
     false },
   { "brk_interrupt",  0, 0, true, false, false, rl78_handle_func_attribute,
     false },
+  { "naked",          0, 0, true, false, false, rl78_handle_func_attribute,
+    false },
   { NULL,             0, 0, false, false, false, NULL, false }
 };
 
@@ -825,6 +827,12 @@ rl78_initial_elimination_offset (int from, int to)
   return rv;
 }
 
+static int
+rl78_is_naked_func (void)
+{
+  return (lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)) != NULL_TREE);
+}
+
 /* Expand the function prologue (from the prologue pattern).  */
 void
 rl78_expand_prologue (void)
@@ -833,6 +841,9 @@ rl78_expand_prologue (void)
   rtx sp = gen_rtx_REG (HImode, STACK_POINTER_REGNUM);
   int rb = 0;
 
+  if (rl78_is_naked_func ())
+    return;
+
   if (!cfun->machine->computed)
     rl78_compute_frame_info ();
 
@@ -877,6 +888,9 @@ rl78_expand_epilogue (void)
   rtx sp = gen_rtx_REG (HImode, STACK_POINTER_REGNUM);
   int rb = 0;
 
+  if (rl78_is_naked_func ())
+    return;
+
   if (frame_pointer_needed)
     {
       emit_move_insn (gen_rtx_REG (HImode, STACK_POINTER_REGNUM),
index 1e1f8b35a32dc5f8bd2b29cd322bcb941991850a..76a90ecb31f56d0a75db2ddb57d39278a87ca051 100644 (file)
@@ -3142,7 +3142,7 @@ and newer.
 
 @item naked
 @cindex function without a prologue/epilogue code
-Use this attribute on the ARM, AVR, MCORE, RX and SPU ports to indicate that
+Use this attribute on the ARM, AVR, MCORE, RL78, RX and SPU ports to indicate that
 the specified function does not need prologue/epilogue sequences generated by
 the compiler.  It is up to the programmer to provide these sequences. The
 only statements that can be safely included in naked functions are