[llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html

Dale Johannesen dalej at apple.com
Thu Sep 24 15:27:07 PDT 2009


On Sep 24, 2009, at 1:49 PMPDT, Török Edwin wrote:

> On 2009-09-24 21:38, Dale Johannesen wrote:
>>
>> Clarify that llvm attaches C language semantics to
>> functions with names that match the C library.
>
> In fact this list is longer [1], it includes (excluding Andersens.cpp
> and SimplifyLibcalls)
> abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl,
> __dso_handle,
> exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, realloc,
> _setjmp, setjmp,
> sinf, sinl.

Functions starting with __ are fair game, I don't think we need  
document those at this level.  Could you add the others to my list?

> Although it is very good that LLVM handles these for C/C++, it is not
> necesarely good for Java/Python/some other language.

I know.  I'm just documenting existing behavior, partly in order to  
warn people interested in non-C-based languages that they have to deal  
with this.

> Suggestion: could we have all these special function names in one  
> place,
> and an enum?
> Then all the analysis/transforms that need special function names  
> can call:
>
> enum SpecialFunctions  
> KnownFunctions::classifySpecialFunction(StringRef
> name, Module &M);
> bool KnownFunctions::isKnown(StringRef name, Module &M);
> Function *KnownFunctions::getSpecial(StringRef name, Module &M);
> Function *KnownFunctions::getOrInsertSpecial(StringRef name, Module
> &M);//allowed to return null for failure
>
> If you don't want these special functions there could be a command- 
> line
> flag and an llvm:: variable default true that could be set to false.
>
> [1] I generated this list with these, which is not entirely accurate  
> so
> there may be more:
> cd lib
> git grep getFunction\(\"|grep -v Andersens|grep -v SimplifyLibCalls| 
> grep
> -E -o \"[^\"]+\"|grep -v llvm|sort -u
> git grep getName\(\)|grep -v Andersen|grep -v SimplifyLibCalls|grep -E
> ==.+\"|grep -E -o \"[^\"]+\"|grep -v llvm |sort -u
> git grep -E Name.+==.+\"|grep -v Andersen|grep -v SimplifyLibCalls| 
> grep
> -E -o \"[^\"]+\"|grep -v llvm|sort -u
>
> Best regards,
> --Edwin





More information about the llvm-commits mailing list