[llvm-dev] When a libcall will be generated?

Nemanja Ivanovic via llvm-dev llvm-dev at lists.llvm.org
Mon May 29 05:41:19 PDT 2017


If I'm not mistaken, legalization will introduce the libcalls as per the
call to `InitLibcallNames()` in `TargetLoweringBase::TargetLoweringBase()`
(or anything your target overrides). This would seem to imply that your
target doesn't have i64 as a legal type (or at the very least,
shift-right-logical is not legal for i64 types on your target).

For an example of how this ends up in the code, you can compile a program
such as this with triple -mtriple=powerpc64le-unknown-unknown
```
define ppc_fp128 @test(ppc_fp128 %a, ppc_fp128 %b) {
entry:
  %add = fadd ppc_fp128 %a, %b
  ret ppc_fp128 %add
}
```
You can see when the result type of the `fadd` is legalized, a libcall is
added to the SDAG (since ppcf128 is not a legal type - no registers on PPC
for it).

I hope this helps (and I hope I'm not misleading you here).

On Fri, May 19, 2017 at 9:44 AM, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> Hi All,
>
>   I am looking at a linker error under O2:
>
>      undefined symbol __lshrdi3
>
> I have two questions here:
>
>   1. Does that mean our libgcc (?) doesn't implement __lshrdi3? Or more
> generally, why I have
>       such linker error?
>
>   2. Seems some operations are combined, and replaced with __lshrdi3
> call. I am interested in
>       when such libcall will be generated? Could you show me one example
> so that I can trace
>       the LLVM source code on my own?
>
> Thanks.
>
> Regards,
> chenwj
>
> --
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170529/477e922d/attachment-0001.html>


More information about the llvm-dev mailing list