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

Deprecate LLVM::Module#write_bitcode_with_summary_to_file #13488

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions man/crystal.1
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ Generate the output with symbolic debug symbols.
These are read when debugging the built program with tools like lldb, gdb, valgrind etc. and provide mappings to the original source code for those tools.
.It Fl -no-debug
Generate the output without any symbolic debug symbols.
.It Fl -lto Ar FLAG
Use ThinLTO --lto=thin.
.It Fl D Ar FLAG, Fl -define Ar FLAG
Define a compile-time flag. This is useful to conditionally define types, methods, or commands based on flags available at compile time. The default flags are from the target triple given with --target-triple or the hosts default, if none is given.
.It Fl -emit Op asm|llvm-bc|llvm-ir|obj
Expand Down
20 changes: 0 additions & 20 deletions src/llvm/ext/llvm_ext.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <llvm/IR/DIBuilder.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/DebugLoc.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/FileSystem.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/RTDyldMemoryManager.h>

Expand All @@ -18,8 +16,6 @@ using namespace llvm;
(LLVM_VERSION_MAJOR < (major) || LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR <= (minor))

#include <llvm/Target/CodeGenCWrappers.h>
#include <llvm/Bitcode/BitcodeWriter.h>
#include <llvm/Analysis/ModuleSummaryAnalysis.h>

#if LLVM_VERSION_GE(16, 0)
#define makeArrayRef ArrayRef
Expand Down Expand Up @@ -85,22 +81,6 @@ LLVMValueRef LLVMExtBuildInvoke2(
Bundles, Name));
}

void LLVMExtWriteBitcodeWithSummaryToFile(LLVMModuleRef mref, const char *File) {
// https://github.com/ldc-developers/ldc/pull/1840/files
Module *m = unwrap(mref);

std::error_code EC;
#if LLVM_VERSION_GE(13, 0)
raw_fd_ostream OS(File, EC, sys::fs::OF_None);
#else
raw_fd_ostream OS(File, EC, sys::fs::F_None);
#endif
if (EC) return;

llvm::ModuleSummaryIndex moduleSummaryIndex = llvm::buildModuleSummaryIndex(*m, nullptr, nullptr);
llvm::WriteBitcodeToFile(*m, OS, true, &moduleSummaryIndex, true);
}

static TargetMachine *unwrap(LLVMTargetMachineRef P) {
return reinterpret_cast<TargetMachine *>(P);
}
Expand Down
2 changes: 0 additions & 2 deletions src/llvm/lib_llvm_ext.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ lib LibLLVMExt
bundle : LibLLVMExt::OperandBundleDefRef,
name : LibC::Char*) : LibLLVM::ValueRef

fun write_bitcode_with_summary_to_file = LLVMExtWriteBitcodeWithSummaryToFile(module : LibLLVM::ModuleRef, path : UInt8*) : Void

fun target_machine_enable_global_isel = LLVMExtTargetMachineEnableGlobalIsel(machine : LibLLVM::TargetMachineRef, enable : Bool)
fun create_mc_jit_compiler_for_module = LLVMExtCreateMCJITCompilerForModule(jit : LibLLVM::ExecutionEngineRef*, m : LibLLVM::ModuleRef, options : LibLLVM::JITCompilerOptions*, options_length : UInt32, enable_global_isel : Bool, error : UInt8**) : Int32
end
3 changes: 2 additions & 1 deletion src/llvm/module.cr
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ class LLVM::Module
LibLLVM.write_bitcode_to_file self, filename
end

@[Deprecated("ThinLTO is no longer supported; use `#write_bitcode_to_file` instead")]
def write_bitcode_with_summary_to_file(filename : String)
LibLLVMExt.write_bitcode_with_summary_to_file self, filename
LibLLVM.write_bitcode_to_file self, filename
end

def write_bitcode_to_memory_buffer
Expand Down