[PATCH] Fix TargetLibraryInfo for which OS's have exp10 and family

Reid Kleckner rnk at google.com
Thu Dec 26 11:21:47 PST 2013


LGTM, committed in r198056.


On Tue, Dec 24, 2013 at 5:47 AM, Brad Smith <brad at comstyle.com> wrote:

> On 20/12/13 6:22 AM, Brad Smith wrote:
>
>> On 16/12/13 5:06 AM, Brad Smith wrote:
>>
>>> I noticed this commit...
>>>
>>> Author: joerg
>>> Date: Sun Dec 15 14:36:17 2013
>>> New Revision: 197348
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=197348&view=rev
>>> Log:
>>> There is no exp10 on NetBSD.
>>>
>>> Modified:
>>>      llvm/trunk/lib/Target/TargetLibraryInfo.cpp
>>>
>>> and went looking. This needs to be fixed to properly deal with the
>>> relevent
>>> OS's what is targetted. exp10 and family is a GNU extension and as far
>>> as I
>>> can see is only available on Linux and OS X/iOS. So this should be
>>> disabled
>>> by default and only enabled on OS's that are known to have the exp10
>>> family
>>> of functions.
>>>
>>
>> ping.
>>
>
> ... still broken.
>
>
>  Index: lib/Target/TargetLibraryInfo.cpp
>>> ===================================================================
>>> --- lib/Target/TargetLibraryInfo.cpp    (revision 197364)
>>> +++ lib/Target/TargetLibraryInfo.cpp    (working copy)
>>> @@ -401,37 +401,6 @@
>>>       TLI.setAvailableWithName(LibFunc::fputs, "fputs$UNIX2003");
>>>     }
>>>
>>> -  // exp10 and exp10f are not available on OS X until 10.9 and iOS
>>> until 7.0
>>> -  // and their names are __exp10 and __exp10f. exp10l is not
>>> available on
>>> -  // OS X or iOS.
>>> -  if (T.isMacOSX()) {
>>> -    TLI.setUnavailable(LibFunc::exp10l);
>>> -    if (T.isMacOSXVersionLT(10, 9)) {
>>> -      TLI.setUnavailable(LibFunc::exp10);
>>> -      TLI.setUnavailable(LibFunc::exp10f);
>>> -    } else {
>>> -      TLI.setAvailableWithName(LibFunc::exp10, "__exp10");
>>> -      TLI.setAvailableWithName(LibFunc::exp10f, "__exp10f");
>>> -    }
>>> -  }
>>> -
>>> -  if (T.getOS() == Triple::IOS) {
>>> -    TLI.setUnavailable(LibFunc::exp10l);
>>> -    if (T.isOSVersionLT(7, 0)) {
>>> -      TLI.setUnavailable(LibFunc::exp10);
>>> -      TLI.setUnavailable(LibFunc::exp10f);
>>> -    } else {
>>> -      TLI.setAvailableWithName(LibFunc::exp10, "__exp10");
>>> -      TLI.setAvailableWithName(LibFunc::exp10f, "__exp10f");
>>> -    }
>>> -  }
>>> -
>>> -  if (T.getOS() == Triple::NetBSD) {
>>> -    TLI.setUnavailable(LibFunc::exp10l);
>>> -    TLI.setUnavailable(LibFunc::exp10);
>>> -    TLI.setUnavailable(LibFunc::exp10f);
>>> -  }
>>> -
>>>     // iprintf and friends are only available on XCore and TCE.
>>>     if (T.getArch() != Triple::xcore && T.getArch() != Triple::tce) {
>>>       TLI.setUnavailable(LibFunc::iprintf);
>>> @@ -477,9 +446,6 @@
>>>       TLI.setUnavailable(LibFunc::cbrt);
>>>       TLI.setUnavailable(LibFunc::cbrtf);
>>>       TLI.setUnavailable(LibFunc::cbrtl);
>>> -    TLI.setUnavailable(LibFunc::exp10);
>>> -    TLI.setUnavailable(LibFunc::exp10f);
>>> -    TLI.setUnavailable(LibFunc::exp10l);
>>>       TLI.setUnavailable(LibFunc::exp2);
>>>       TLI.setUnavailable(LibFunc::exp2f);
>>>       TLI.setUnavailable(LibFunc::exp2l);
>>> @@ -598,6 +564,39 @@
>>>       TLI.setUnavailable(LibFunc::llabs);
>>>     }
>>>
>>> +  // exp10, exp10f, exp10l is available on at least Linux (GLIBC)
>>> +  // exp10 and exp10f are not available on OS X until 10.9 and iOS
>>> until 7.0
>>> +  // and their names are __exp10 and __exp10f. exp10l is not
>>> available on
>>> +  // OS X or iOS.
>>> +  switch (T.getOS()) {
>>> +  case Triple::Linux:
>>> +    break;
>>> +  case Triple::MacOSX:
>>> +    TLI.setUnavailable(LibFunc::exp10l);
>>> +    if (T.isMacOSXVersionLT(10, 9)) {
>>> +      TLI.setUnavailable(LibFunc::exp10);
>>> +      TLI.setUnavailable(LibFunc::exp10f);
>>> +    } else {
>>> +      TLI.setAvailableWithName(LibFunc::exp10, "__exp10");
>>> +      TLI.setAvailableWithName(LibFunc::exp10f, "__exp10f");
>>> +    }
>>> +    break;
>>> +  case Triple::IOS:
>>> +    TLI.setUnavailable(LibFunc::exp10l);
>>> +    if (T.isOSVersionLT(7, 0)) {
>>> +      TLI.setUnavailable(LibFunc::exp10);
>>> +      TLI.setUnavailable(LibFunc::exp10f);
>>> +    } else {
>>> +      TLI.setAvailableWithName(LibFunc::exp10, "__exp10");
>>> +      TLI.setAvailableWithName(LibFunc::exp10f, "__exp10f");
>>> +    }
>>> +    break;
>>> +  default:
>>> +    TLI.setUnavailable(LibFunc::exp10);
>>> +    TLI.setUnavailable(LibFunc::exp10f);
>>> +    TLI.setUnavailable(LibFunc::exp10l);
>>> +  }
>>> +
>>>     // ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and
>>>     // Linux (GLIBC):
>>>     //
>>> http://developer.apple.com/library/mac/#documentation/
>>> Darwin/Reference/ManPages/man3/ffsl.3.html
>>>
>>>
>>>
>>
>>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131226/cf91520b/attachment.html>


More information about the llvm-commits mailing list