[LLVMdev] How can I remove Intrinsic Functions during llvm-gcc compilation?
SHEN Hao
hao.shen at imag.fr
Mon May 10 08:18:16 PDT 2010
Thanks a lot for your answer.
As what you said, I can not have any options to avoid generating this kind
of intrinsic for byte code. Is it possible to modify gcc and ask it take
all memset liked functions as a general function call? I know this solution
is less performance efficient, but I would like to have it for my llvm
assembly level modification works.
But anyway, thanks for you help.
Hao
On Mon, May 10, 2010 at 6:30 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Hao Shen,
>
>> I am using llvm-gcc --emit-llvm to generate byte code. With llvm
>> readable ll format, I found some standard C library function such as
>> llvm.memset.
>
> this is not a C library function, it is an LLVM intrinsic. An intrinsic is
> analogous to a builtin in gcc. An intrinsic may be expanded out into a code
> sequence by the compiler, or may get turned into a library call (which sounds
> like is what you are seeing).
>
>> In fact, I'm trying to compile newlibc with llvm, I do not need this
>> kind of llvm functions. How can I remove them during the compilation?
>
> You can't avoid them. The same problem exists with gcc: you can't always
> avoid having gcc use the gcc memset builtin. However it has to be said
> that gcc generates its memset builtin less often than llvm-gcc generates
> llvm.memset, so this is not as visible. Also (I'm not sure about this)
> it may be that on some platforms gcc always expands builtin_memset into a
> code sequence rather than generating a call to the library memset function.
> However, gcc is not obliged to use a code sequence even in a freestanding
> environment. The environment is always required to provide memset. Here's
> what the gcc docs say:
>
> GCC requires the freestanding environment provide `memcpy', `memmove',
> `memset' and `memcmp'.
>
> Ciao,
>
> Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Hao Shen
More information about the llvm-dev
mailing list