Re: need help with builtin function prototypes

2007-08-09 Thread DJ Delorie

I'm hoping I can get it to do what I want, if only I can get the MI to
treat the function definition given to it by the target as the one
true definition, and not just some advisory one.


Re: need help with builtin function prototypes

2007-08-09 Thread Ian Lance Taylor
DJ Delorie [EMAIL PROTECTED] writes:

 Is there a trick to this?  I need this type of functionality because
 some builtins modify multiple values, so a simple return value is
 insufficient, plus this worked with older versions of gcc so our users
 are used to it syntax-wise.

I've never found a good solution for builtins which return multiple
values.  The best approximation I found was to return a magic
structure, and to provide other builtin functions to get the values
from the structure (defining the structure in the backend was
problematic when using C++).

It doesn't sound like that will help you, though, if you are stuck
with the existing syntax.

Ian


Re: need help with builtin function prototypes

2007-08-09 Thread Kaveh R. GHAZI
On Thu, 9 Aug 2007, DJ Delorie wrote:

 Could someone provide a hint for me?  I'm trying to put in real
 prototypes for a builtin function where the arguments don't follow the
 default promotion rules.  Specifically, one of the arguments is a
 reference type (like C++'s int).  However, I'm bumping into two
 problems:

 1. The compiler emits a compatibility warning:

 dj.c:4: warning: incompatible implicit declaration of built-in function 
 'mep_and'

 2. The compiler seems to be using the implicit declaration instead of
the builtin one, resulting in the builtin's arguments being
incorrect, especially when optimizing:

 dj.c:4: error: non-lvalue passed to argument 1 of `mep_and'

 Is there a trick to this?  I need this type of functionality because
 some builtins modify multiple values, so a simple return value is
 insufficient, plus this worked with older versions of gcc so our users
 are used to it syntax-wise.

I don't know about using reference types, but there are several math
builtins that return multiple values, the extra ones via pointer
arguments.  E.g. see frexp, lgamma_r, modf, remquo and/or sincos.

--Kaveh
--
Kaveh R. Ghazi  [EMAIL PROTECTED]


Re: need help with builtin function prototypes

2007-08-09 Thread DJ Delorie

 I don't know about using reference types, but there are several math
 builtins that return multiple values, the extra ones via pointer
 arguments.  E.g. see frexp, lgamma_r, modf, remquo and/or sincos.

Like I said, I'm kinda locked into the syntax.  People have been using
these builtins for many years now.  Everything was fine when we
expanded the builtins to insns before optimization, and we could block
optimizations using RTL, but we don't have that option with tree
optimizations.