LLVM 19.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
141
143
145
147
148unsigned getAlignLoops();
149
151
153
154/// Create this object with static storage to register codegen-related command
155/// line options.
158};
159
161
163
164/// Common utility function tightly tied to the options listed here. Initializes
165/// a TargetOptions object with CodeGen flags and returns it.
166/// \p TheTriple is used to determine the default value for options if
167/// options are not explicitly specified. If those triple dependant options
168/// value do not have effect for your component, a default Triple() could be
169/// passed in.
171
172std::string getCPUStr();
173
174std::string getFeaturesStr();
175
176std::vector<std::string> getFeatureList();
177
179
180/// Set function attributes of function \p F based on CPU, Features, and command
181/// line flags.
183
184/// Set function attributes of functions in Module M based on CPU,
185/// Features, and command line flags.
186void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
187
188/// Should value-tracking variable locations / instruction referencing be
189/// enabled by default for this triple?
191
192/// Creates a TargetMachine instance with the options defined on the command
193/// line. This can be used for tools that do not need further customization of
194/// the TargetOptions.
196 StringRef TargetTriple,
198
199} // namespace codegen
200} // namespace llvm
201
202#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 LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
static void codegen(Module *M, llvm::raw_pwrite_stream &OS, function_ref< std::unique_ptr< TargetMachine >()> TMFactory, CodeGenFileType FileType)
Definition: ParallelCG.cpp:26
Tagged union holding either a T or a Error.
Definition: Error.h:474
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 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:156