Hi Guys,
Is there a target specific way to add a flag bit to a function decl ?
For the RX port I want to be able to mark a function decl for which I
have issued a warning message. Unfortunately I could find no easy way
to do this other than stealing one of the generic bits (no_limit_stack
in this case). Is there a proper way to do this ?
I have attached my current implementation to demonstrate the problem.
Cheers
Nick
Index: gcc/config/rx/rx.c
===================================================================
--- gcc/config/rx/rx.c (revision 192034)
+++ gcc/config/rx/rx.c (working copy)
@@ -1288,6 +1288,24 @@
target_reinit ();
}
+ if (current_is_fast_interrupt && rx_warn_multiple_fast_interrupts)
+ {
+ static tree prev_fast_interrupt = NULL_TREE;
+
+ if (prev_fast_interrupt == NULL_TREE)
+ prev_fast_interrupt = fndecl;
+ else if (prev_fast_interrupt != fndecl
+ && ! DECL_NO_LIMIT_STACK (fndecl))
+ {
+ warning (0, "multiple fast interrupt routines seen: %qE and %qE",
+ fndecl, prev_fast_interrupt);
+ /* FIXME: We use the no_limit_stack bit in the tree_function_decl
+ structure to mark functions for which we have issued this warning.
+ There probably ought to be another way to do this. */
+ DECL_NO_LIMIT_STACK (fndecl) = 1;
+ }
+ }
+
rx_previous_fndecl = fndecl;
}
Index: gcc/config/rx/rx.opt
===================================================================
--- gcc/config/rx/rx.opt (revision 192034)
+++ gcc/config/rx/rx.opt (working copy)
@@ -118,3 +118,9 @@
mpid
Target Mask(PID)
Enables Position-Independent-Data (PID) mode.
+
+;---------------------------------------------------
+
+mwarn-multiple-fast-interrupts
+Target Report Var(rx_warn_multiple_fast_interrupts) Init(1) Warning
+Warn when multiple, different, fast interrupt handlers are in the compilation
unit.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 192034)
+++ gcc/doc/invoke.texi (working copy)
@@ -859,6 +859,7 @@
-mmax-constant-size=@gol
-mint-register=@gol
-mpid@gol
+-mno-warn-multiple-fast-interrupts@gol
-msave-acc-in-interrupts}
@emph{S/390 and zSeries Options}
@@ -17875,6 +17876,15 @@
By default this feature is not enabled. The default can be restored
via the @option{-mno-pid} command-line option.
+@item -mno-warn-multiple-fast-interrupts
+@itemx -mwarn-multiple-fast-interrupts
+@opindex mno-warn-multiple-fast-interrupts
+@opindex mwarn-multiple-fast-interrupts
+Prevents GCC from issuing a warning message if it finds more than one
+fast interrupt handler when it is compiling a file. The default is to
+issue a warning for each extra fast interrupt handler found, as the RX
+only supports one such interrupt.
+
@end table
@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}