diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-07-27 23:34:35 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-10-23 18:26:01 +0000 |
commit | 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch) | |
tree | 6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp | |
parent | 6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff) | |
parent | ac9a064cb179f3425b310fa2847f8764ac970a4d (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp b/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp index 51406fb287e6..9e42deb94903 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp @@ -85,17 +85,18 @@ CGOPT(bool, StackRealign) CGOPT(std::string, TrapFuncName) CGOPT(bool, UseCtors) CGOPT(bool, DisableIntegratedAS) -CGOPT(bool, RelaxELFRelocations) CGOPT_EXP(bool, DataSections) CGOPT_EXP(bool, FunctionSections) CGOPT(bool, IgnoreXCOFFVisibility) CGOPT(bool, XCOFFTracebackTable) +CGOPT(bool, EnableBBAddrMap) CGOPT(std::string, BBSections) CGOPT(unsigned, TLSSize) CGOPT_EXP(bool, EmulatedTLS) CGOPT_EXP(bool, EnableTLSDESC) CGOPT(bool, UniqueSectionNames) CGOPT(bool, UniqueBasicBlockSectionNames) +CGOPT(bool, SeparateNamedSections) CGOPT(EABI, EABIVersion) CGOPT(DebuggerKind, DebuggerTuningOpt) CGOPT(bool, EnableStackSizeSection) @@ -210,6 +211,9 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { "Disable frame pointer elimination"), clEnumValN(FramePointerKind::NonLeaf, "non-leaf", "Disable frame pointer elimination for non-leaf frame"), + clEnumValN(FramePointerKind::Reserved, "reserved", + "Enable frame pointer elimination, but reserve the frame " + "pointer register"), clEnumValN(FramePointerKind::None, "none", "Enable frame pointer elimination"))); CGBINDOPT(FramePointerUsage); @@ -361,13 +365,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { cl::init(false)); CGBINDOPT(UseCtors); - static cl::opt<bool> RelaxELFRelocations( - "relax-elf-relocations", - cl::desc( - "Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"), - cl::init(true)); - CGBINDOPT(RelaxELFRelocations); - static cl::opt<bool> DataSections( "data-sections", cl::desc("Emit data into separate sections"), cl::init(false)); @@ -390,6 +387,11 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { cl::init(true)); CGBINDOPT(XCOFFTracebackTable); + static cl::opt<bool> EnableBBAddrMap( + "basic-block-address-map", + cl::desc("Emit the basic block address map section"), cl::init(false)); + CGBINDOPT(EnableBBAddrMap); + static cl::opt<std::string> BBSections( "basic-block-sections", cl::desc("Emit basic blocks into separate sections"), @@ -421,6 +423,12 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { cl::init(false)); CGBINDOPT(UniqueBasicBlockSectionNames); + static cl::opt<bool> SeparateNamedSections( + "separate-named-sections", + cl::desc("Use separate unique sections for named sections"), + cl::init(false)); + CGBINDOPT(SeparateNamedSections); + static cl::opt<EABI> EABIVersion( "meabi", cl::desc("Set EABI type (default depends on triple):"), cl::init(EABI::Default), @@ -562,15 +570,16 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) { Options.StackSymbolOrdering = getStackSymbolOrdering(); Options.UseInitArray = !getUseCtors(); Options.DisableIntegratedAS = getDisableIntegratedAS(); - Options.RelaxELFRelocations = getRelaxELFRelocations(); Options.DataSections = getExplicitDataSections().value_or(TheTriple.hasDefaultDataSections()); Options.FunctionSections = getFunctionSections(); Options.IgnoreXCOFFVisibility = getIgnoreXCOFFVisibility(); Options.XCOFFTracebackTable = getXCOFFTracebackTable(); + Options.BBAddrMap = getEnableBBAddrMap(); Options.BBSections = getBBSectionsMode(Options); Options.UniqueSectionNames = getUniqueSectionNames(); Options.UniqueBasicBlockSectionNames = getUniqueBasicBlockSectionNames(); + Options.SeparateNamedSections = getSeparateNamedSections(); Options.TLSSize = getTLSSize(); Options.EmulatedTLS = getExplicitEmulatedTLS().value_or(TheTriple.hasDefaultEmulatedTLS()); @@ -615,12 +624,9 @@ std::string codegen::getFeaturesStr() { // This is necessary for x86 where the CPU might not support all the // features the autodetected CPU name lists in the target. For example, // not all Sandybridge processors support AVX. - if (getMCPU() == "native") { - StringMap<bool> HostFeatures; - if (sys::getHostCPUFeatures(HostFeatures)) - for (const auto &[Feature, IsEnabled] : HostFeatures) - Features.AddFeature(Feature, IsEnabled); - } + if (getMCPU() == "native") + for (const auto &[Feature, IsEnabled] : sys::getHostCPUFeatures()) + Features.AddFeature(Feature, IsEnabled); for (auto const &MAttr : getMAttrs()) Features.AddFeature(MAttr); @@ -635,12 +641,9 @@ std::vector<std::string> codegen::getFeatureList() { // This is necessary for x86 where the CPU might not support all the // features the autodetected CPU name lists in the target. For example, // not all Sandybridge processors support AVX. - if (getMCPU() == "native") { - StringMap<bool> HostFeatures; - if (sys::getHostCPUFeatures(HostFeatures)) - for (const auto &[Feature, IsEnabled] : HostFeatures) - Features.AddFeature(Feature, IsEnabled); - } + if (getMCPU() == "native") + for (const auto &[Feature, IsEnabled] : sys::getHostCPUFeatures()) + Features.AddFeature(Feature, IsEnabled); for (auto const &MAttr : getMAttrs()) Features.AddFeature(MAttr); @@ -687,6 +690,8 @@ void codegen::setFunctionAttributes(StringRef CPU, StringRef Features, NewAttrs.addAttribute("frame-pointer", "all"); else if (getFramePointerUsage() == FramePointerKind::NonLeaf) NewAttrs.addAttribute("frame-pointer", "non-leaf"); + else if (getFramePointerUsage() == FramePointerKind::Reserved) + NewAttrs.addAttribute("frame-pointer", "reserved"); else if (getFramePointerUsage() == FramePointerKind::None) NewAttrs.addAttribute("frame-pointer", "none"); } |