LLVM 22.0.0git
CommandFlags.h
Go to the documentation of this file.
1//===-- CommandFlags.h - Command Line Flags Interface -----------*- 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 contains codegen-specific flags that are shared between different
10// command line tools. The tools "llc" and "opt" both use this file to prevent
11// flag duplication.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CODEGEN_COMMANDFLAGS_H
16#define LLVM_CODEGEN_COMMANDFLAGS_H
17
22#include <optional>
23#include <string>
24#include <vector>
25
26namespace llvm {
27
28class Module;
29class AttrBuilder;
30class Function;
31class Triple;
32class TargetMachine;
33
34namespace codegen {
35
36LLVM_ABI std::string getMArch();
37
38LLVM_ABI std::string getMCPU();
39
40LLVM_ABI std::vector<std::string> getMAttrs();
41
43LLVM_ABI std::optional<Reloc::Model> getExplicitRelocModel();
44
46
48LLVM_ABI std::optional<CodeModel::Model> getExplicitCodeModel();
49
51LLVM_ABI std::optional<uint64_t> getExplicitLargeDataThreshold();
52
54
55LLVM_ABI std::optional<CodeGenFileType> getExplicitFileType();
56
58
60
62
64
66
68
70
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101LLVM_ABI std::optional<bool> getExplicitDataSections();
102
105
107
109
111
113
115LLVM_ABI std::optional<bool> getExplicitEmulatedTLS();
116
118LLVM_ABI std::optional<bool> getExplicitEnableTLSDESC();
119
121
123
125
127
129
131
133
135
137
139
141
143
146
148
150
152
154
156
158
159/// Create this object with static storage to register codegen-related command
160/// line options.
164
166
169
170/// Common utility function tightly tied to the options listed here. Initializes
171/// a TargetOptions object with CodeGen flags and returns it.
172/// \p TheTriple is used to determine the default value for options if
173/// options are not explicitly specified. If those triple dependant options
174/// value do not have effect for your component, a default Triple() could be
175/// passed in.
178
179LLVM_ABI std::string getCPUStr();
180
181LLVM_ABI std::string getFeaturesStr();
182
183LLVM_ABI std::vector<std::string> getFeatureList();
184
185LLVM_ABI void renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val);
186
187/// Set function attributes of function \p F based on CPU, Features, and command
188/// line flags.
190 Function &F);
191
192/// Set function attributes of functions in Module M based on CPU,
193/// Features, and command line flags.
195 Module &M);
196
197/// Should value-tracking variable locations / instruction referencing be
198/// enabled by default for this triple?
200
201/// Creates a TargetMachine instance with the options defined on the command
202/// line. This can be used for tools that do not need further customization of
203/// the TargetOptions.
205 StringRef TargetTriple,
207
208} // namespace codegen
209} // namespace llvm
210
211#endif // LLVM_CODEGEN_COMMANDFLAGS_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
Utilities for dealing with flags related to floating point properties and mode controls.
static LVOptions Options
Definition LVOptions.cpp:25
#define F(x, y, z)
Definition MD5.cpp:55
#define T
Tagged union holding either a T or a Error.
Definition Error.h:485
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
LLVM_ABI bool getEnableMachineFunctionSplitter()
LLVM_ABI bool getEnableHonorSignDependentRoundingFPMath()
LLVM_ABI std::string getTrapFuncName()
LLVM_ABI bool getEnableDebugEntryValues()
LLVM_ABI unsigned getTLSSize()
LLVM_ABI bool getEnableGuaranteedTailCallOpt()
LLVM_ABI llvm::FPOpFusion::FPOpFusionMode getFuseFPOps()
LLVM_ABI std::optional< CodeModel::Model > getExplicitCodeModel()
LLVM_ABI bool getFunctionSections()
LLVM_ABI bool getDisableTailCalls()
LLVM_ABI std::string getCPUStr()
LLVM_ABI bool getXCOFFReadOnlyPointers()
LLVM_ABI std::string getFeaturesStr()
LLVM_ABI bool getUniqueSectionNames()
LLVM_ABI DenormalMode::DenormalModeKind getDenormalFPMath()
LLVM_ABI llvm::FloatABI::ABIType getFloatABIForCalls()
LLVM_ABI void renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val)
LLVM_ABI Reloc::Model getRelocModel()
LLVM_ABI bool getDebugStrictDwarf()
LLVM_ABI bool getEmulatedTLS()
LLVM_ABI bool getForceDwarfFrameSection()
LLVM_ABI bool getStackRealign()
LLVM_ABI std::string getMCPU()
LLVM_ABI bool getJMCInstrument()
LLVM_ABI bool getValueTrackingVariableLocations()
LLVM_ABI bool getDataSections()
LLVM_ABI bool getEnableAddrsig()
LLVM_ABI bool getStackSymbolOrdering()
LLVM_ABI SwiftAsyncFramePointerMode getSwiftAsyncFramePointer()
LLVM_ABI bool getEnableBBAddrMap()
LLVM_ABI std::optional< bool > getExplicitFunctionSections()
LLVM_ABI uint64_t getLargeDataThreshold()
LLVM_ABI std::vector< std::string > getFeatureList()
LLVM_ABI bool getEnableStaticDataPartitioning()
LLVM_ABI std::string getMArch()
LLVM_ABI DenormalMode::DenormalModeKind getDenormalFP32Math()
LLVM_ABI CodeGenFileType getFileType()
LLVM_ABI bool getEnableNoSignedZerosFPMath()
LLVM_ABI bool getEnableStackSizeSection()
LLVM_ABI bool getDefaultValueTrackingVariableLocations(const llvm::Triple &T)
Should value-tracking variable locations / instruction referencing be enabled by default for this tri...
LLVM_ABI llvm::EABI getEABIVersion()
LLVM_ABI bool getEnableCallGraphSection()
LLVM_ABI bool getEnableNoTrappingFPMath()
LLVM_ABI Expected< std::unique_ptr< TargetMachine > > createTargetMachineForTriple(StringRef TargetTriple, CodeGenOptLevel OptLevel=CodeGenOptLevel::Default)
Creates a TargetMachine instance with the options defined on the command line.
LLVM_ABI bool getUniqueBasicBlockSectionNames()
LLVM_ABI FramePointerKind getFramePointerUsage()
LLVM_ABI bool getDontPlaceZerosInBSS()
LLVM_ABI bool getSeparateNamedSections()
LLVM_ABI bool getEnableNoInfsFPMath()
LLVM_ABI bool getEnableUnsafeFPMath()
LLVM_ABI bool getEnableNoNaNsFPMath()
LLVM_ABI std::optional< bool > getExplicitDataSections()
LLVM_ABI ThreadModel::Model getThreadModel()
LLVM_ABI bool getXCOFFTracebackTable()
LLVM_ABI bool getIgnoreXCOFFVisibility()
LLVM_ABI std::optional< bool > getExplicitValueTrackingVariableLocations()
LLVM_ABI bool getDisableIntegratedAS()
LLVM_ABI bool getUseCtors()
LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt()
LLVM_ABI std::vector< std::string > getMAttrs()
LLVM_ABI CodeModel::Model getCodeModel()
LLVM_ABI void setFunctionAttributes(StringRef CPU, StringRef Features, Function &F)
Set function attributes of function F based on CPU, Features, and command line flags.
LLVM_ABI llvm::BasicBlockSection getBBSectionsMode(llvm::TargetOptions &Options)
LLVM_ABI TargetOptions InitTargetOptionsFromCodeGenFlags(const llvm::Triple &TheTriple)
Common utility function tightly tied to the options listed here.
LLVM_ABI std::string getBBSections()
LLVM_ABI std::optional< bool > getExplicitEnableTLSDESC()
LLVM_ABI std::optional< uint64_t > getExplicitLargeDataThreshold()
LLVM_ABI unsigned getAlignLoops()
LLVM_ABI std::optional< Reloc::Model > getExplicitRelocModel()
LLVM_ABI std::optional< CodeGenFileType > getExplicitFileType()
LLVM_ABI bool getEnableAIXExtendedAltivecABI()
LLVM_ABI bool getXRayFunctionIndex()
LLVM_ABI llvm::ExceptionHandling getExceptionModel()
LLVM_ABI bool getEmitCallSiteInfo()
LLVM_ABI std::optional< bool > getExplicitEmulatedTLS()
LLVM_ABI bool getEnableTLSDESC()
This is an optimization pass for GlobalISel generic memory operations.
FramePointerKind
Definition CodeGen.h:118
ExceptionHandling
Definition CodeGen.h:53
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition CodeGen.h:111
SwiftAsyncFramePointerMode
Indicates when and how the Swift async frame pointer bit should be set.
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:82
@ Default
-O2, -Os
Definition CodeGen.h:85
BasicBlockSection
EABI
Definition CodeGen.h:73
DebuggerKind
Identify a debugger for "tuning" the debug info.
DenormalModeKind
Represent handled modes for denormal (aka subnormal) modes in the floating point environment.