[llvm-dev] RTLIB and Custom Library calls

Miguel Inigo J. Manalac via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 11 20:59:22 PDT 2020


Hi LLVM-Dev,

Upon investigation, to implement the custom library calls, we have to do the following:

-      Add cases for the operations in getRTLibDesc static function (LegalizerHelper.cpp)

-      Add cases for the operations in SelectionDAGLegalize::ConvertNodeToLibcall (LegalizeDAG.cpp)

-      Add the enums for the operations in the RuntimeLibcalls.def

-      Add a setLibcallName function call for each operation and implement Lower operations in the target ISelLowering class

We do not want to modify non-target files/projects as this will have side effects for other targets. Will this be possible?
If not, are there boolean functions available for checking the triple/architecture used in the mentioned classes above? Example : isArch(x86)
Does setLibcallName(RTLIB::SDIV_I8, nullptr) set the RTLIB::SDIV_I8 as not supported?
Is there a guide that exists which could help us in implementing custom library calls? Or perhaps a target which implemented something like this? I have checked google and the LLVM youtube channel, not much help.

Thank you very much in advance for all the help!

Best,
Miguel

From: Miguel Inigo J. Manalac
Sent: March 02, 2020 3:34 PM
To: llvm-dev
Subject: RTLIB and Custom Library calls

Hello LLVM-Dev,

Most of the processing for i64 and f64 types for our backend are emulation library calls. Some of the library calls are not defined in the RuntimeLibcalls.def Libcall enum so we have to define custom library calls.

How is the ideal way of implementing the custom library calls? Providing us with a target backend having a similar functionality would also help us significantly.
Say for a i64 type compare, does adding it in the RuntimeLibcalls.def enum, SelectionDAGLegalize::ConvertNodeToLibcall function, and the target ISelLowering Class solve our problem?
Is it okay to modify RuntimeLibcalls.def and SelectionDAGLegalize::ConvertNodeToLibcall function?
A starting point for processing lib calls other than the ISelLowering class would also help!

Thank you in advance for your help!

Sincerely,
Miguel Inigo J. Manalac (1852)

JAPANESE: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ENGLISH: This e-mail is intended for the person(s) to which it is addressed. If you have received it by mistake, please notify the sender and delete the received email. In addition, our company shall not assume any responsibility even if it causes any inconvenience, such as loss of mail, inconsistencies, delays, etc., due to the inclusion of computer viruses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200312/37debcbc/attachment-0001.html>


More information about the llvm-dev mailing list