This is an archive of the discontinued LLVM Phabricator instance.

expose get/set tail call kind in the C api
Needs ReviewPublic

Authored by folkertdev on Jul 21 2023, 5:16 AM.

Details

Reviewers
deadalnix
Summary

adds LLVMGetTailCallKind and LLVMSetTailCallKind to the public C API

The C api does not currently allow us to force tail calls to be preserved. Guaranteed tail calls are essential for performance in our case. We have found that LLVM optimizations will move calls out of tail position in certain cases.

An alternative api would be to add LLVMSetMustTail and LLVMGetMustTail (and the same for notail, I guess). That would keep the TailCallKind enum members private, but is inconsistent with the internal API.

background: I am one of the main contributors to the roc programming language. We use LLVM via the inkwell crate, which in turn uses the LLVM C api to construct LLVM modules.

Diff Detail

Event Timeline

folkertdev created this revision.Jul 21 2023, 5:16 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
folkertdev requested review of this revision.Jul 21 2023, 5:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 5:16 AM