|
6 | 6 | #include "llvm/ADT/SmallVector.h" |
7 | 7 | #include "llvm/Analysis/Lint.h" |
8 | 8 | #include "llvm/Analysis/TargetLibraryInfo.h" |
| 9 | +#if LLVM_VERSION_GE(22, 0) |
| 10 | +#include "llvm/Analysis/RuntimeLibcallInfo.h" |
| 11 | +#endif |
9 | 12 | #include "llvm/Bitcode/BitcodeWriter.h" |
10 | 13 | #include "llvm/Bitcode/BitcodeWriterPass.h" |
11 | 14 | #include "llvm/CodeGen/CommandFlags.h" |
@@ -379,13 +382,20 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( |
379 | 382 |
|
380 | 383 | // Unfortunately, the LLVM C API doesn't provide a way to create the |
381 | 384 | // TargetLibraryInfo pass, so we use this method to do so. |
382 | | -extern "C" void LLVMRustAddLibraryInfo(LLVMPassManagerRef PMR, LLVMModuleRef M, |
| 385 | +extern "C" void LLVMRustAddLibraryInfo(LLVMTargetMachineRef T, |
| 386 | + LLVMPassManagerRef PMR, LLVMModuleRef M, |
383 | 387 | bool DisableSimplifyLibCalls) { |
384 | 388 | auto TargetTriple = Triple(unwrap(M)->getTargetTriple()); |
| 389 | + TargetOptions *Options = &unwrap(T)->Options; |
385 | 390 | auto TLII = TargetLibraryInfoImpl(TargetTriple); |
386 | 391 | if (DisableSimplifyLibCalls) |
387 | 392 | TLII.disableAllFunctions(); |
388 | 393 | unwrap(PMR)->add(new TargetLibraryInfoWrapperPass(TLII)); |
| 394 | +#if LLVM_VERSION_GE(22, 0) |
| 395 | + unwrap(PMR)->add(new RuntimeLibraryInfoWrapper( |
| 396 | + TargetTriple, Options->ExceptionModel, Options->FloatABIType, |
| 397 | + Options->EABIVersion, Options->MCOptions.ABIName, Options->VecLib)); |
| 398 | +#endif |
389 | 399 | } |
390 | 400 |
|
391 | 401 | extern "C" void LLVMRustSetLLVMOptions(int Argc, char **Argv) { |
|
0 commit comments