This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [Patch] SH : trap_exit and sp_switch with interrupt_handler attribute
- From: "Asgari J. Jinia" <AsgariJ at KPITCummins dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 12 Mar 2004 15:40:12 +0530
- Subject: RE: [Patch] SH : trap_exit and sp_switch with interrupt_handler attribute
Please review this ASAP.
Hi,
Looking at the document of trap_exit and sp_switch attributes, they should work with interrupt_handler attribute. But compiler issues warning as "warning: `trap_exit' attribute only applies to interrupt functions".
Following patch removes above warning and enables trap_exit and sp_switch attributes with interrupt_handler attribute for SH target. Presently they work with #pragma interrupt directive only on SH target.
Regards,
Asgari Jinia
_________________________________________________________________________
/gcc/ChangeLog:
2004-03-09 Asgari Jinia <asgarij@kpitcummins.com>
* config/sh/sh.c (sh_output_function_epilogue): current_function_interrupt
flag is reset.
(sh_handle_interrupt_handler_attribute): current_function_interrupt flag is set.
(sh_handle_sp_switch_attribute): Modified test to support sp_switch with interrupt_handler attribute.
(sh_handle_trap_exit_attribute): Modified test to support trap_exit with interrupt_handler attribute.
--- temp/sh.old.c 2004-01-19 04:10:00.000000000 +0530
+++ sh.c 2004-03-04 10:17:43.000000000 +0530
@@ -63,7 +63,7 @@ int code_for_indirect_jump_scratch = COD
#define GEN_ADD3 (*(TARGET_SHMEDIA64 ? gen_adddi3 : gen_addsi3))
#define GEN_SUB3 (*(TARGET_SHMEDIA64 ? gen_subdi3 : gen_subsi3))
-/* Set to 1 by expand_prologue() when the function is an interrupt handler. */
+/* Reset to 0 in sh_output_function_epilogue() and set to 1 by sh_handle_interrupt_handler_attribute() and expand_prologue() when the function is an interrupt handler. */
int current_function_interrupt;
/* ??? The pragma interrupt support will not work for SH3. */
@@ -5784,7 +5784,7 @@ static void
sh_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{
- trap_exit = pragma_interrupt = pragma_trapa = pragma_nosave_low_regs = 0;
+ trap_exit = pragma_interrupt = pragma_trapa = pragma_nosave_low_regs = current_function_interrupt = 0;
sh_need_epilogue_known = 0;
sp_switch = NULL_RTX;
}
@@ -6743,7 +6743,7 @@ sh_handle_interrupt_handler_attribute (t
error ("attribute interrupt_handler is not compatible with -m5-compact");
*no_add_attrs = true;
}
-
+ current_function_interrupt = 1;
return NULL_TREE;
}
@@ -6759,7 +6759,7 @@ sh_handle_sp_switch_attribute (tree *nod
IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
- else if (!pragma_interrupt)
+ else if (!(pragma_interrupt || current_function_interrupt))
{
/* The sp_switch attribute only has meaning for interrupt functions. */
warning ("`%s' attribute only applies to interrupt functions",
@@ -6794,7 +6794,7 @@ sh_handle_trap_exit_attribute (tree *nod
IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
- else if (!pragma_interrupt)
+ else if (!(pragma_interrupt || current_function_interrupt))
{
/* The trap_exit attribute only has meaning for interrupt functions. */
warning ("`%s' attribute only applies to interrupt functions",