Skip to content

Commit

Permalink
llvm-wrapper: adapt for LLVM API changes
Browse files Browse the repository at this point in the history
Updates the wrapper for 5c4lar/llvm-project@21eddfa.
  • Loading branch information
krasimirgg committed Aug 29, 2024
1 parent 6cf068d commit 9c910e8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,11 @@ struct LLVMRustThinLTOData {
// Not 100% sure what these are, but they impact what's internalized and
// what's inlined across modules, I believe.
#if LLVM_VERSION_GE(18, 0)
#if LLVM_VERSION_GE(20, 0)
FunctionImporter::ImportListsTy ImportLists;
#else
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
#endif
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;
#else
Expand Down Expand Up @@ -1414,13 +1418,13 @@ LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data,
return true;
}

extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
extern "C" bool LLVMRustPrepareThinLTOImport(LLVMRustThinLTOData *Data,
LLVMModuleRef M,
LLVMTargetMachineRef TM) {
Module &Mod = *unwrap(M);
TargetMachine &Target = *unwrap(TM);

const auto &ImportList = Data->ImportLists.lookup(Mod.getModuleIdentifier());
const auto &ImportList = Data->ImportLists[Mod.getModuleIdentifier()];
auto Loader = [&](StringRef Identifier) {
const auto &Memory = Data->ModuleMap.lookup(Identifier);
auto &Context = Mod.getContext();
Expand Down Expand Up @@ -1603,7 +1607,7 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
LLVMRustThinLTOData *Data) {
SmallString<40> Key;
llvm::lto::Config conf;
const auto &ImportList = Data->ImportLists.lookup(ModId);
const auto &ImportList = Data->ImportLists[ModId];
const auto &ExportList = Data->ExportLists.lookup(ModId);
const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);
Expand Down

0 comments on commit 9c910e8

Please sign in to comment.