[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:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/ARM/ARMISelLowering.cpp#L874

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.

-Tom

> 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