[PATCH] MIPS function attributes for interrupt handlers

Richard Sandiford rdsandiford@googlemail.com
Tue Oct 21 23:11:00 GMT 2008


Mark Mitchell <mark@codesourcery.com> writes:
> Weddington, Eric wrote:
>
>> The AVR port has a "naked" attribute available which, in rare circumstances, can still be useful. Probably because the AVR is an 8-bit micro, and can be very code constrained. This, of course, does not compare to something like the MIPS port.
>
> It turns out that the GCC manual already says that the only thing you
> can put in a naked function are asm statements without operands.
>
> Given that constraint, I have to adjust my position.  I think that given
> that we've already constrained it that well, we might well allow this on
> all ports.  I don't see any reason why it should be impossible to
> support that on all architectures.  If we don't presently enforce the
> constraint, we certainly can; it's an easy thing for the front-ends to
> check.
>
> Richard, thoughts?

I still disagree, for the reasons given before.  MIPS assembly coders
already have preprocessor macros to prettify the assembly function
declaration syntax.  If the only point of the attribute is to write
out that syntax, I don't think the attribute is a win.

(The reason the manual says what it does is that people used to try
to use operands with naked function asms, and tripped over problems.
The "asm with no operands" rule is a recent change (2008-05-23) and
hasn't yet appeared in any released compiler, so we don't really know
yet what effect the restriction has on real-world uses.  I bet the
version of gcc that the MIPS attribute was written for didn't enforce
this constraint.)

I don't think we've ever written down how the attribute interacts
with other features, such as function profiling.

Richard



More information about the Gcc-patches mailing list