[llvm-dev] linking an ISD node to a function

Tom Stellard via llvm-dev llvm-dev at lists.llvm.org
Fri May 3 16:18:03 PDT 2019

On 05/03/2019 03:42 PM, Josh Sharp via llvm-dev wrote:
> Hi all,
> Is there any way to link an ISD node to a specific function? What I mean by that is that my target CPU architecture doesn't have a DIV instruction but there is a divide() function implemented in C. Whenever an ISD::UDIV or ISD::SDIV node is encountered, rather than trying to match a DAG pattern, I just want divide() to be called.

You can mark the node as LibCall in your TargetLowering implementation.  For example:

Also, a few lines lower in the file, there is an example of how to specify
your own function name for the library call if you don't want to use
the default.


> Thanks.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list