[cfe-dev] Custom calling conventions in C code
Holger Schurig
hs4233 at mail.mn-solutions.de
Tue Jun 24 00:00:53 PDT 2008
> I think it would be a great thing for compiler hackers to have
> a mechanism to access an arbitrary calling convention, but I
> also think it would be a disaster to expose this to end user
> code.
Maybe via attributes and macros.
#define _CC_WEIRD_EMBEDDED_COMPILER \
__attribute__(("cc-call-randomly")) \
__attribute__(("cc-indirect-accumulator-access")) \
__attribute__(("cc-halt-instruction-after-every-jump"))
And then I write
void weird_function(void) __CC_WEIRD_EMBEDDED_COMPILER
{
// ...
}
> The problem is that not all constructs are valid with
> every calling convention, and if there is ever a large install
> base of code using "calling convention 19" in their C code,
> we'd have to support that forever.
Not with a scheme similar to the like above.
However, you'd need to support the specific attribute forever.
Not sure if that is a win :-)
More information about the cfe-dev
mailing list