Subject: Re: `-ffreestanding'
To: None <thorpej@zembu.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: tech-toolchain
Date: 07/16/2001 17:54:39
>
> thorpej@zembu.com said:
> > > #define memcpy(x,y,z) __builtin_memcpy(x,y,z)
> >
> > So, how does this work in GCC? If you expressly use a __builtin_*()
> > version of a function, will it still emit a call to e.g. memcpy() if
> > it can't emit an inline optimized block move?
>
> Yes... at least for some builtins.
From a quick perusal of the source, I believe that the following library
calls can be safely #defined into their builtin equivalents and that they
will safely fall back. Not that we probably need to support the floating
point ones.
This list is taken from GCC-3 BTW. We would need to check whether 2.95
was a subset of this.
BUILT_IN_MEMCPY,
BUILT_IN_MEMCMP,
BUILT_IN_MEMSET,
BUILT_IN_STRCAT,
BUILT_IN_STRNCAT,
BUILT_IN_STRCPY,
BUILT_IN_STRNCPY,
BUILT_IN_STRCMP,
BUILT_IN_STRNCMP,
BUILT_IN_STRLEN,
BUILT_IN_STRSTR,
BUILT_IN_STRPBRK,
BUILT_IN_STRSPN,
BUILT_IN_STRCSPN,
BUILT_IN_STRCHR,
BUILT_IN_STRRCHR,
BUILT_IN_FSQRT,
BUILT_IN_SIN,
BUILT_IN_COS,
BUILT_IN_SQRTF,
BUILT_IN_SINF,
BUILT_IN_COSF,
BUILT_IN_SQRTL,
BUILT_IN_SINL,
BUILT_IN_COSL,
There may be further calls which are not strictly ANSI (or are C99) which
can also be inlined; but I don't know whether we would need these.
R.