|
24 | 24 | #include "llvm/Passes/StandardInstrumentations.h" |
25 | 25 | #include "llvm/Support/CBindingWrapping.h" |
26 | 26 | #include "llvm/Support/FileSystem.h" |
27 | | -#if LLVM_VERSION_GE(17, 0) |
28 | 27 | #include "llvm/Support/VirtualFileSystem.h" |
29 | | -#endif |
30 | 28 | #include "llvm/Target/TargetMachine.h" |
31 | 29 | #include "llvm/Transforms/IPO/AlwaysInliner.h" |
32 | 30 | #include "llvm/Transforms/IPO/FunctionImport.h" |
@@ -334,14 +332,8 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, |
334 | 332 |
|
335 | 333 | std::ostringstream Buf; |
336 | 334 |
|
337 | | -#if LLVM_VERSION_GE(17, 0) |
338 | 335 | const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); |
339 | 336 | const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getAllProcessorDescriptions(); |
340 | | -#else |
341 | | - Buf << "Full target CPU help is not supported by this LLVM version.\n\n"; |
342 | | - SubtargetSubTypeKV TargetCPUKV = { TargetCPU, {{}}, {{}} }; |
343 | | - const ArrayRef<SubtargetSubTypeKV> CPUTable = TargetCPUKV; |
344 | | -#endif |
345 | 337 | unsigned MaxCPULen = getLongestEntryLength(CPUTable); |
346 | 338 |
|
347 | 339 | Buf << "Available CPUs for this target:\n"; |
@@ -476,10 +468,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( |
476 | 468 | Options.RelaxELFRelocations = RelaxELFRelocations; |
477 | 469 | #endif |
478 | 470 | Options.UseInitArray = UseInitArray; |
479 | | - |
480 | | -#if LLVM_VERSION_LT(17, 0) |
481 | | - Options.ExplicitEmulatedTLS = true; |
482 | | -#endif |
483 | 471 | Options.EmulatedTLS = UseEmulatedTls; |
484 | 472 |
|
485 | 473 | if (TrapUnreachable) { |
@@ -761,50 +749,32 @@ LLVMRustOptimize( |
761 | 749 | } |
762 | 750 |
|
763 | 751 | std::optional<PGOOptions> PGOOpt; |
764 | | -#if LLVM_VERSION_GE(17, 0) |
765 | 752 | auto FS = vfs::getRealFileSystem(); |
766 | | -#endif |
767 | 753 | if (PGOGenPath) { |
768 | 754 | assert(!PGOUsePath && !PGOSampleUsePath); |
769 | | - PGOOpt = PGOOptions(PGOGenPath, "", "", |
770 | | -#if LLVM_VERSION_GE(17, 0) |
771 | | - "", |
772 | | - FS, |
773 | | -#endif |
| 755 | + PGOOpt = PGOOptions(PGOGenPath, "", "", "", FS, |
774 | 756 | PGOOptions::IRInstr, PGOOptions::NoCSAction, |
775 | 757 | #if LLVM_VERSION_GE(19, 0) |
776 | 758 | PGOOptions::ColdFuncOpt::Default, |
777 | 759 | #endif |
778 | 760 | DebugInfoForProfiling); |
779 | 761 | } else if (PGOUsePath) { |
780 | 762 | assert(!PGOSampleUsePath); |
781 | | - PGOOpt = PGOOptions(PGOUsePath, "", "", |
782 | | -#if LLVM_VERSION_GE(17, 0) |
783 | | - "", |
784 | | - FS, |
785 | | -#endif |
| 763 | + PGOOpt = PGOOptions(PGOUsePath, "", "", "", FS, |
786 | 764 | PGOOptions::IRUse, PGOOptions::NoCSAction, |
787 | 765 | #if LLVM_VERSION_GE(19, 0) |
788 | 766 | PGOOptions::ColdFuncOpt::Default, |
789 | 767 | #endif |
790 | 768 | DebugInfoForProfiling); |
791 | 769 | } else if (PGOSampleUsePath) { |
792 | | - PGOOpt = PGOOptions(PGOSampleUsePath, "", "", |
793 | | -#if LLVM_VERSION_GE(17, 0) |
794 | | - "", |
795 | | - FS, |
796 | | -#endif |
| 770 | + PGOOpt = PGOOptions(PGOSampleUsePath, "", "", "", FS, |
797 | 771 | PGOOptions::SampleUse, PGOOptions::NoCSAction, |
798 | 772 | #if LLVM_VERSION_GE(19, 0) |
799 | 773 | PGOOptions::ColdFuncOpt::Default, |
800 | 774 | #endif |
801 | 775 | DebugInfoForProfiling); |
802 | 776 | } else if (DebugInfoForProfiling) { |
803 | | - PGOOpt = PGOOptions("", "", "", |
804 | | -#if LLVM_VERSION_GE(17, 0) |
805 | | - "", |
806 | | - FS, |
807 | | -#endif |
| 777 | + PGOOpt = PGOOptions("", "", "", "", FS, |
808 | 778 | PGOOptions::NoAction, PGOOptions::NoCSAction, |
809 | 779 | #if LLVM_VERSION_GE(19, 0) |
810 | 780 | PGOOptions::ColdFuncOpt::Default, |
@@ -1353,9 +1323,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, |
1353 | 1323 | ComputeCrossModuleImport( |
1354 | 1324 | Ret->Index, |
1355 | 1325 | Ret->ModuleToDefinedGVSummaries, |
1356 | | -#if LLVM_VERSION_GE(17, 0) |
1357 | 1326 | isPrevailing, |
1358 | | -#endif |
1359 | 1327 | Ret->ImportLists, |
1360 | 1328 | Ret->ExportLists |
1361 | 1329 | ); |
|
0 commit comments