Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:27

0001 //===-- CommandFlags.h - Command Line Flags Interface -----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains codegen-specific flags that are shared between different
0010 // command line tools. The tools "llc" and "opt" both use this file to prevent
0011 // flag duplication.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_CODEGEN_COMMANDFLAGS_H
0016 #define LLVM_CODEGEN_COMMANDFLAGS_H
0017 
0018 #include "llvm/ADT/FloatingPointMode.h"
0019 #include "llvm/Support/CodeGen.h"
0020 #include "llvm/Target/TargetOptions.h"
0021 #include <optional>
0022 #include <string>
0023 #include <vector>
0024 
0025 namespace llvm {
0026 
0027 class Module;
0028 class AttrBuilder;
0029 class Function;
0030 class Triple;
0031 class TargetMachine;
0032 
0033 namespace codegen {
0034 
0035 std::string getMArch();
0036 
0037 std::string getMCPU();
0038 
0039 std::vector<std::string> getMAttrs();
0040 
0041 Reloc::Model getRelocModel();
0042 std::optional<Reloc::Model> getExplicitRelocModel();
0043 
0044 ThreadModel::Model getThreadModel();
0045 
0046 CodeModel::Model getCodeModel();
0047 std::optional<CodeModel::Model> getExplicitCodeModel();
0048 
0049 uint64_t getLargeDataThreshold();
0050 std::optional<uint64_t> getExplicitLargeDataThreshold();
0051 
0052 llvm::ExceptionHandling getExceptionModel();
0053 
0054 std::optional<CodeGenFileType> getExplicitFileType();
0055 
0056 CodeGenFileType getFileType();
0057 
0058 FramePointerKind getFramePointerUsage();
0059 
0060 bool getEnableUnsafeFPMath();
0061 
0062 bool getEnableNoInfsFPMath();
0063 
0064 bool getEnableNoNaNsFPMath();
0065 
0066 bool getEnableNoSignedZerosFPMath();
0067 
0068 bool getEnableApproxFuncFPMath();
0069 
0070 bool getEnableNoTrappingFPMath();
0071 
0072 DenormalMode::DenormalModeKind getDenormalFPMath();
0073 DenormalMode::DenormalModeKind getDenormalFP32Math();
0074 
0075 bool getEnableHonorSignDependentRoundingFPMath();
0076 
0077 llvm::FloatABI::ABIType getFloatABIForCalls();
0078 
0079 llvm::FPOpFusion::FPOpFusionMode getFuseFPOps();
0080 
0081 SwiftAsyncFramePointerMode getSwiftAsyncFramePointer();
0082 
0083 bool getDontPlaceZerosInBSS();
0084 
0085 bool getEnableGuaranteedTailCallOpt();
0086 
0087 bool getEnableAIXExtendedAltivecABI();
0088 
0089 bool getDisableTailCalls();
0090 
0091 bool getStackSymbolOrdering();
0092 
0093 bool getStackRealign();
0094 
0095 std::string getTrapFuncName();
0096 
0097 bool getUseCtors();
0098 
0099 bool getDisableIntegratedAS();
0100 
0101 bool getDataSections();
0102 std::optional<bool> getExplicitDataSections();
0103 
0104 bool getFunctionSections();
0105 std::optional<bool> getExplicitFunctionSections();
0106 
0107 bool getIgnoreXCOFFVisibility();
0108 
0109 bool getXCOFFTracebackTable();
0110 
0111 std::string getBBSections();
0112 
0113 unsigned getTLSSize();
0114 
0115 bool getEmulatedTLS();
0116 std::optional<bool> getExplicitEmulatedTLS();
0117 
0118 bool getEnableTLSDESC();
0119 std::optional<bool> getExplicitEnableTLSDESC();
0120 
0121 bool getUniqueSectionNames();
0122 
0123 bool getUniqueBasicBlockSectionNames();
0124 
0125 bool getSeparateNamedSections();
0126 
0127 llvm::EABI getEABIVersion();
0128 
0129 llvm::DebuggerKind getDebuggerTuningOpt();
0130 
0131 bool getEnableStackSizeSection();
0132 
0133 bool getEnableAddrsig();
0134 
0135 bool getEmitCallSiteInfo();
0136 
0137 bool getEnableMachineFunctionSplitter();
0138 
0139 bool getEnableDebugEntryValues();
0140 
0141 bool getValueTrackingVariableLocations();
0142 std::optional<bool> getExplicitValueTrackingVariableLocations();
0143 
0144 bool getForceDwarfFrameSection();
0145 
0146 bool getXRayFunctionIndex();
0147 
0148 bool getDebugStrictDwarf();
0149 
0150 unsigned getAlignLoops();
0151 
0152 bool getJMCInstrument();
0153 
0154 bool getXCOFFReadOnlyPointers();
0155 
0156 /// Create this object with static storage to register codegen-related command
0157 /// line options.
0158 struct RegisterCodeGenFlags {
0159   RegisterCodeGenFlags();
0160 };
0161 
0162 bool getEnableBBAddrMap();
0163 
0164 llvm::BasicBlockSection getBBSectionsMode(llvm::TargetOptions &Options);
0165 
0166 /// Common utility function tightly tied to the options listed here. Initializes
0167 /// a TargetOptions object with CodeGen flags and returns it.
0168 /// \p TheTriple is used to determine the default value for options if
0169 ///    options are not explicitly specified. If those triple dependant options
0170 ///    value do not have effect for your component, a default Triple() could be
0171 ///    passed in.
0172 TargetOptions InitTargetOptionsFromCodeGenFlags(const llvm::Triple &TheTriple);
0173 
0174 std::string getCPUStr();
0175 
0176 std::string getFeaturesStr();
0177 
0178 std::vector<std::string> getFeatureList();
0179 
0180 void renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val);
0181 
0182 /// Set function attributes of function \p F based on CPU, Features, and command
0183 /// line flags.
0184 void setFunctionAttributes(StringRef CPU, StringRef Features, Function &F);
0185 
0186 /// Set function attributes of functions in Module M based on CPU,
0187 /// Features, and command line flags.
0188 void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
0189 
0190 /// Should value-tracking variable locations / instruction referencing be
0191 /// enabled by default for this triple?
0192 bool getDefaultValueTrackingVariableLocations(const llvm::Triple &T);
0193 
0194 /// Creates a TargetMachine instance with the options defined on the command
0195 /// line. This can be used for tools that do not need further customization of
0196 /// the TargetOptions.
0197 Expected<std::unique_ptr<TargetMachine>> createTargetMachineForTriple(
0198     StringRef TargetTriple,
0199     CodeGenOptLevel OptLevel = CodeGenOptLevel::Default);
0200 
0201 } // namespace codegen
0202 } // namespace llvm
0203 
0204 #endif // LLVM_CODEGEN_COMMANDFLAGS_H