LLVM 20.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
21#include <optional>
22#include <string>
23#include <vector>
24
25namespace llvm {
26
27class Module;
28class AttrBuilder;
29class Function;
30class Triple;
31class TargetMachine;
32
33namespace codegen {
34
35std::string getMArch();
36
37std::string getMCPU();
38
39std::vector<std::string> getMAttrs();
40
42std::optional<Reloc::Model> getExplicitRelocModel();
43
45
47std::optional<CodeModel::Model> getExplicitCodeModel();
48
50std::optional<uint64_t> getExplicitLargeDataThreshold();
51
53
54std::optional<CodeGenFileType> getExplicitFileType();
55
57
59
61
63
65
67
69
71
74
76
78
80
82
84
86
88
90
92
94
95std::string getTrapFuncName();
96
98
100
102std::optional<bool> getExplicitDataSections();
103
105std::optional<bool> getExplicitFunctionSections();
106
108
110
111std::string getBBSections();
112
113unsigned getTLSSize();
114
116std::optional<bool> getExplicitEmulatedTLS();
117
119std::optional<bool> getExplicitEnableTLSDESC();
120
122
124
126
128
130
132
134
136
138
140
143
145
147
149
150unsigned getAlignLoops();
151
153
155
156/// Create this object with static storage to register codegen-related command
157/// line options.
160};
161
163
165
166/// Common utility function tightly tied to the options listed here. Initializes
167/// a TargetOptions object with CodeGen flags and returns it.
168/// \p TheTriple is used to determine the default value for options if
169/// options are not explicitly specified. If those triple dependant options
170/// value do not have effect for your component, a default Triple() could be
171/// passed in.
173
174std::string getCPUStr();
175
176std::string getFeaturesStr();
177
178std::vector<std::string> getFeatureList();
179
181
182/// Set function attributes of function \p F based on CPU, Features, and command
183/// line flags.
185
186/// Set function attributes of functions in Module M based on CPU,
187/// Features, and command line flags.
188void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
189
190/// Should value-tracking variable locations / instruction referencing be
191/// enabled by default for this triple?
193
194/// Creates a TargetMachine instance with the options defined on the command
195/// line. This can be used for tools that do not need further customization of
196/// the TargetOptions.
198 StringRef TargetTriple,
200
201} // namespace codegen
202} // namespace llvm
203
204#endif // LLVM_CODEGEN_COMMANDFLAGS_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
std::string Name
Utilities for dealing with flags related to floating point properties and mode controls.
static void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream, unsigned Task, Module &Mod, const ModuleSummaryIndex &CombinedIndex)
Definition: LTOBackend.cpp:378
static LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
Tagged union holding either a T or a Error.
Definition: Error.h:481
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
std::string getBBSections()
std::string getMArch()
std::string getMCPU()
bool getEnableGuaranteedTailCallOpt()
std::string getCPUStr()
std::string getFeaturesStr()
std::vector< std::string > getMAttrs()
bool getDisableIntegratedAS()
CodeGenFileType getFileType()
DenormalMode::DenormalModeKind getDenormalFPMath()
bool getUniqueSectionNames()
FramePointerKind getFramePointerUsage()
bool getEnableNoSignedZerosFPMath()
bool getEnableStackSizeSection()
std::optional< bool > getExplicitEnableTLSDESC()
void renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val)
bool getEmitCallSiteInfo()
bool getDontPlaceZerosInBSS()
bool getIgnoreXCOFFVisibility()
std::optional< bool > getExplicitDataSections()
std::optional< bool > getExplicitEmulatedTLS()
unsigned getTLSSize()
bool getEnableMachineFunctionSplitter()
llvm::FloatABI::ABIType getFloatABIForCalls()
std::optional< CodeModel::Model > getExplicitCodeModel()
CodeModel::Model getCodeModel()
bool getDataSections()
bool getEnableApproxFuncFPMath()
std::vector< std::string > getFeatureList()
bool getEnableTLSDESC()
bool getXRayFunctionIndex()
Reloc::Model getRelocModel()
unsigned getAlignLoops()
std::string getTrapFuncName()
llvm::ExceptionHandling getExceptionModel()
bool getValueTrackingVariableLocations()
Expected< std::unique_ptr< TargetMachine > > createTargetMachineForTriple(StringRef TargetTriple, CodeGenOptLevel OptLevel=CodeGenOptLevel::Default)
Creates a TargetMachine instance with the options defined on the command line.
std::optional< uint64_t > getExplicitLargeDataThreshold()
bool getEnableAddrsig()
std::optional< CodeGenFileType > getExplicitFileType()
std::optional< bool > getExplicitFunctionSections()
bool getEnableUnsafeFPMath()
bool getStackRealign()
bool getSeparateNamedSections()
bool getEnableNoInfsFPMath()
bool getXCOFFReadOnlyPointers()
bool getUniqueBasicBlockSectionNames()
bool getDisableTailCalls()
std::optional< Reloc::Model > getExplicitRelocModel()
bool getDefaultValueTrackingVariableLocations(const llvm::Triple &T)
Should value-tracking variable locations / instruction referencing be enabled by default for this tri...
llvm::DebuggerKind getDebuggerTuningOpt()
bool getForceDwarfFrameSection()
void setFunctionAttributes(StringRef CPU, StringRef Features, Function &F)
Set function attributes of function F based on CPU, Features, and command line flags.
DenormalMode::DenormalModeKind getDenormalFP32Math()
bool getEnableNoTrappingFPMath()
llvm::BasicBlockSection getBBSectionsMode(llvm::TargetOptions &Options)
TargetOptions InitTargetOptionsFromCodeGenFlags(const llvm::Triple &TheTriple)
Common utility function tightly tied to the options listed here.
bool getEnableBBAddrMap()
llvm::FPOpFusion::FPOpFusionMode getFuseFPOps()
llvm::EABI getEABIVersion()
bool getEnableDebugEntryValues()
bool getUseCtors()
bool getJMCInstrument()
bool getDebugStrictDwarf()
bool getFunctionSections()
uint64_t getLargeDataThreshold()
bool getEnableAIXExtendedAltivecABI()
ThreadModel::Model getThreadModel()
bool getStackSymbolOrdering()
bool getEnableHonorSignDependentRoundingFPMath()
bool getEnableNoNaNsFPMath()
SwiftAsyncFramePointerMode getSwiftAsyncFramePointer()
bool getEmulatedTLS()
bool getXCOFFTracebackTable()
std::optional< bool > getExplicitValueTrackingVariableLocations()
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FramePointerKind
Definition: CodeGen.h:90
ExceptionHandling
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition: CodeGen.h:83
SwiftAsyncFramePointerMode
Indicates when and how the Swift async frame pointer bit should be set.
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
BasicBlockSection
Definition: TargetOptions.h:61
DebuggerKind
Identify a debugger for "tuning" the debug info.
Definition: TargetOptions.h:97
DenormalModeKind
Represent handled modes for denormal (aka subnormal) modes in the floating point environment.
Create this object with static storage to register codegen-related command line options.
Definition: CommandFlags.h:158