Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete functions from llvm_ext.cc #13177

Merged
merged 11 commits into from
Mar 15, 2023

Conversation

HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Mar 10, 2023

Removes the functions that are known to be present since LLVM 8. No public interfaces are affected.

Here is a breakdown of the remaining functions in llvm_ext.cc:

  • DIBuilder functions
    All of them exist on LLVM 8, but LLVM claims that the C interface is still experimental, and I haven't verified that the API remains unchanged in all versions up to 15. Also fun LLVMDisposeDIBuilder(builder : DIBuilderRef) was missing so it probably doesn't make sense for LLVM::DIBuilder to be a struct anymore. EDIT: LLVMExtDIBuilderCreateEnumerator did not exist in LLVM 8.0.
  • LLVMExtSetCurrentDebugLocation
    This can be replaced by LLVMSetCurrentDebugLocation in LLVM 8, and LLVMSetCurrentDebugLocation2 in LLVM 9+. The first one accepts a non-nil LibLLVM::ValueRef, the second a nilable LibLLVM::MetadataRef (passing nil clears the debug location). LLVMDIBuilderCreateDebugLocation can create the corresponding LibLLVM::MetadataRef, but it also requires a LibLLVM::ContextRef. So far I haven't found a good way to pass the context around without causing any breaking changes in our "public" LLVM API. EDIT: I think this is just @llvm_module.context
  • LLVMExtWriteBitcodeWithSummaryToFile
    5 arguments are passed to llvm::WriteBitcodeToFile here, whereas the LLVM C API can only accept the first 2. Two of the extra arguments are only relevant for the now removed ThinLTO support. I have no idea if the other extra argument, ShouldPreserveUseListOrder, must be true; if not then this function can be replaced by LLVMWriteBitcodeToFile.
  • LLVMExtBuildOperandBundleDef, LLVMExtBuildCall2, LLVMExtBuildInvoke2
    The LLVM C API still doesn't expose functions that deal with operand bundles, which are apparently needed for exception handling. There is a stale LLVM revision for this.
  • LLVMExtTargetMachineEnableGlobalIsel, LLVMExtCreateMCJITCompilerForModule
    The LLVM C API still doesn't expose functions that deal with global instruction selection. See also Disable LLVM Global Isel #9401.

@straight-shoota straight-shoota added this to the 1.8.0 milestone Mar 14, 2023
@straight-shoota straight-shoota changed the title Remove some functions from llvm_ext.cc Remove obsolete functions from llvm_ext.cc Mar 15, 2023
@straight-shoota straight-shoota merged commit 766a64d into crystal-lang:master Mar 15, 2023
@HertzDevil HertzDevil deleted the refactor/llvm-ext branch March 15, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants