h8300.c (h8300_output_function_epilogue): Remove.

* 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.

From-SVN: r72827
This commit is contained in:
Kazu Hirata 2003-10-22 23:21:14 +00:00 committed by Kazu Hirata
parent dc70e81d6e
commit 3cfa37023c
3 changed files with 57 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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