Josh Sharp via llvm-dev
2019-May-03 22:42 UTC
[llvm-dev] linking an ISD node to a function
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. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190503/66be06b8/attachment.html>
Tom Stellard via llvm-dev
2019-May-03 23:18 UTC
[llvm-dev] linking an ISD node to a function
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 >