1 //===- CGPassBuilderOption.h - Options for pass builder ---------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file declares the CCState and CCValAssign classes, used for lowering 10 // and implementing calling conventions. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_TARGET_CGPASSBUILDEROPTION_H 15 #define LLVM_TARGET_CGPASSBUILDEROPTION_H 16 17 #include "llvm/Support/CommandLine.h" 18 #include "llvm/Support/Compiler.h" 19 #include "llvm/Target/TargetOptions.h" 20 #include <optional> 21 22 namespace llvm { 23 24 enum class RunOutliner { TargetDefault, AlwaysOutline, NeverOutline }; 25 enum class RegAllocType { Unset, Default, Basic, Fast, Greedy, PBQP }; 26 27 class RegAllocTypeParser : public cl::parser<RegAllocType> { 28 public: RegAllocTypeParser(cl::Option & O)29 RegAllocTypeParser(cl::Option &O) : cl::parser<RegAllocType>(O) {} initialize()30 void initialize() { 31 cl::parser<RegAllocType>::initialize(); 32 addLiteralOption("default", RegAllocType::Default, 33 "Default register allocator"); 34 addLiteralOption("pbqp", RegAllocType::PBQP, "PBQP register allocator"); 35 addLiteralOption("fast", RegAllocType::Fast, "Fast register allocator"); 36 addLiteralOption("basic", RegAllocType::Basic, "Basic register allocator"); 37 addLiteralOption("greedy", RegAllocType::Greedy, 38 "Greedy register allocator"); 39 } 40 }; 41 42 // Not one-on-one but mostly corresponding to commandline options in 43 // TargetPassConfig.cpp. 44 struct CGPassBuilderOption { 45 std::optional<bool> OptimizeRegAlloc; 46 std::optional<bool> EnableIPRA; 47 bool DebugPM = false; 48 bool DisableVerify = false; 49 bool EnableImplicitNullChecks = false; 50 bool EnableBlockPlacementStats = false; 51 bool EnableGlobalMergeFunc = false; 52 bool EnableMachineFunctionSplitter = false; 53 bool EnableSinkAndFold = false; 54 bool EnableTailMerge = true; 55 bool MISchedPostRA = false; 56 bool EarlyLiveIntervals = false; 57 bool GCEmptyBlocks = false; 58 59 bool DisableLSR = false; 60 bool DisableCGP = false; 61 bool DisableMergeICmps = false; 62 bool DisablePartialLibcallInlining = false; 63 bool DisableConstantHoisting = false; 64 bool DisableSelectOptimize = true; 65 bool DisableAtExitBasedGlobalDtorLowering = false; 66 bool DisableExpandReductions = false; 67 bool DisableRAFSProfileLoader = false; 68 bool DisableCFIFixup = false; 69 bool PrintAfterISel = false; 70 bool PrintISelInput = false; 71 bool RequiresCodeGenSCCOrder = false; 72 73 RunOutliner EnableMachineOutliner = RunOutliner::TargetDefault; 74 RegAllocType RegAlloc = RegAllocType::Unset; 75 std::optional<GlobalISelAbortMode> EnableGlobalISelAbort; 76 std::string FSProfileFile; 77 std::string FSRemappingFile; 78 79 std::optional<bool> VerifyMachineCode; 80 std::optional<bool> EnableFastISelOption; 81 std::optional<bool> EnableGlobalISelOption; 82 std::optional<bool> DebugifyAndStripAll; 83 std::optional<bool> DebugifyCheckAndStripAll; 84 }; 85 86 LLVM_ABI CGPassBuilderOption getCGPassBuilderOption(); 87 88 } // namespace llvm 89 90 #endif // LLVM_TARGET_CGPASSBUILDEROPTION_H 91