summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-22 23:21:14 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-22 23:21:14 +0000
commit5344805f25b93fb079e5dbcb3f854f2bc58ef84b (patch)
tree32f455c4c785fdb1e4dc368921fa489c92ad58db
parent129b92e3c54bdc7af2c68e0476f46822d871ea5c (diff)
downloadppe42-gcc-5344805f25b93fb079e5dbcb3f854f2bc58ef84b.tar.gz
ppe42-gcc-5344805f25b93fb079e5dbcb3f854f2bc58ef84b.zip
* config/h8300/h8300.c (h8300_output_function_epilogue): Remove.
(h8300_saveall_function_p): New. (h8300_insert_attributes): Insert the saveall attribute if #pragma saveall is specified. (h8300_attribute_table): Add saveall. (TARGET_ASM_FUNCTION_EPILOGUE): Remove. * doc/extend.texi: Mention the saveall attribute. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72827 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/h8300/h8300.c62
-rw-r--r--gcc/doc/extend.texi6
3 files changed, 57 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cf4a4bc2bc..4786bebd57c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-10-22 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.c (h8300_output_function_epilogue): Remove.
+ (h8300_saveall_function_p): New.
+ (h8300_insert_attributes): Insert the saveall attribute if
+ #pragma saveall is specified.
+ (h8300_attribute_table): Add saveall.
+ (TARGET_ASM_FUNCTION_EPILOGUE): Remove.
+ * doc/extend.texi: Mention the saveall attribute.
+
2003-10-22 Joseph S. Myers <jsm@polyomino.org.uk>
* c-typeck.c (pedantic_lvalue_warning): Unconditionally warn of
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 18ee4c6e003..88e9a63a6dd 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA. */
/* Forward declarations. */
static const char *byte_reg (rtx, int);
static int h8300_interrupt_function_p (tree);
+static int h8300_saveall_function_p (tree);
static int h8300_monitor_function_p (tree);
static int h8300_os_task_function_p (tree);
static void dosize (int, unsigned int);
@@ -346,7 +347,7 @@ byte_reg (rtx x, int b)
(regno < SP_REG \
/* No need to save registers if this function will not return. */ \
&& ! TREE_THIS_VOLATILE (current_function_decl) \
- && (pragma_saveall \
+ && (h8300_saveall_function_p (current_function_decl) \
/* Save any call saved register that was used. */ \
|| (regs_ever_live[regno] && !call_used_regs[regno]) \
/* Save the frame pointer if it was used. */ \
@@ -635,15 +636,6 @@ h8300_expand_epilogue (void)
pop (FRAME_POINTER_REGNUM);
}
-/* Output assembly language code for the function epilogue. */
-
-static void
-h8300_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
- HOST_WIDE_INT size ATTRIBUTE_UNUSED)
-{
- pragma_saveall = 0;
-}
-
/* Return nonzero if the current function is an interrupt
function. */
@@ -4101,6 +4093,21 @@ h8300_interrupt_function_p (tree func)
return a != NULL_TREE;
}
+/* Return nonzero if FUNC is a saveall function as specified by the
+ "saveall" attribute. */
+
+static int
+h8300_saveall_function_p (tree func)
+{
+ tree a;
+
+ if (TREE_CODE (func) != FUNCTION_DECL)
+ return 0;
+
+ a = lookup_attribute ("saveall", DECL_ATTRIBUTES (func));
+ return a != NULL_TREE;
+}
+
/* Return nonzero if FUNC is an OS_Task function as specified
by the "OS_Task" attribute. */
@@ -4176,20 +4183,32 @@ h8300_tiny_data_p (tree decl)
return a != NULL_TREE;
}
-/* Generate an 'interrupt_handler' attribute for decls. */
+/* Generate an 'interrupt_handler' attribute for decls. We convert
+ all the pragmas to corresponding attributes. */
static void
h8300_insert_attributes (tree node, tree *attributes)
{
- if (!pragma_interrupt
- || TREE_CODE (node) != FUNCTION_DECL)
- return;
+ if (TREE_CODE (node) == FUNCTION_DECL)
+ {
+ if (pragma_interrupt)
+ {
+ pragma_interrupt = 0;
- pragma_interrupt = 0;
+ /* Add an 'interrupt_handler' attribute. */
+ *attributes = tree_cons (get_identifier ("interrupt_handler"),
+ NULL, *attributes);
+ }
- /* Add an 'interrupt_handler' attribute. */
- *attributes = tree_cons (get_identifier ("interrupt_handler"),
- NULL, *attributes);
+ if (pragma_saveall)
+ {
+ pragma_saveall = 0;
+
+ /* Add an 'saveall' attribute. */
+ *attributes = tree_cons (get_identifier ("saveall"),
+ NULL, *attributes);
+ }
+ }
}
/* Supported attributes:
@@ -4197,6 +4216,9 @@ h8300_insert_attributes (tree node, tree *attributes)
interrupt_handler: output a prologue and epilogue suitable for an
interrupt handler.
+ saveall: output a prologue and epilogue that saves and restores
+ all registers except the stack pointer.
+
function_vector: This function should be called through the
function vector.
@@ -4210,6 +4232,7 @@ const struct attribute_spec h8300_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
{ "interrupt_handler", 0, 0, true, false, false, h8300_handle_fndecl_attribute },
+ { "saveall", 0, 0, true, false, false, h8300_handle_fndecl_attribute },
{ "OS_Task", 0, 0, true, false, false, h8300_handle_fndecl_attribute },
{ "monitor", 0, 0, true, false, false, h8300_handle_fndecl_attribute },
{ "function_vector", 0, 0, true, false, false, h8300_handle_fndecl_attribute },
@@ -4526,9 +4549,6 @@ h8300_init_libfuncs (void)
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
-#undef TARGET_ASM_FUNCTION_EPILOGUE
-#define TARGET_ASM_FUNCTION_EPILOGUE h8300_output_function_epilogue
-
#undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START h8300_file_start
#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8ebcc41017f..63677f16148 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2550,6 +2550,12 @@ The compiler will generate more efficient code for loads and stores
on data in the tiny data section. Note the tiny data area is limited to
slightly under 32kbytes of data.
+@item saveall
+@cindex save all registers on the H8/300, H8/300H, and H8S
+Use this attribute on the H8/300, H8/300H, and H8S to indicate that
+all registers except the stack pointer should be saved in the prologue
+regardless of whether they are used or not.
+
@item signal
@cindex signal handler functions on the AVR processors
Use this attribute on the AVR to indicate that the specified
OpenPOWER on IntegriCloud