__builtin_constant_p and inline assembly constraints
Simon Kagstrom
simon.kagstrom@bth.se
Thu Aug 24 07:59:00 GMT 2006
At Wed, 23 Aug 2006 13:43:06 +0100,
Andrew Haley wrote:
>
> Simon Kagstrom writes:
> > and it didn't work because of the
> >
> > :"r?i" (__builtin_constant_p(a) ? 0xfffd : 0xfffe), "r?i" (a), \
> >
> > part.
>
> But that __builtin_constant_p problem was because you put the call to
> it in a function, not because of any other issues. Why not put the
> *whole lot* in a macro? There's no need to break it into separate
> functions. Why was the function you had before not something like
>
> #define puts(string)
> ({ \
> register unsigned long __v0 asm ("$2"); \
> [...]
>
> Surely that would work.
Yes, it works, I've implemented it this way now. I would have
preferred functions because of type checking etc (and because it makes
the syscall definitions more readable, I think), but it seems this is
the only way to do it properly.
Thanks for helping me out with this! I've learned a lot in the process
:-)
// Simon
More information about the Gcc-help
mailing list