LLVM 18.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
102
104std::optional<bool> getExplicitDataSections();
105
107std::optional<bool> getExplicitFunctionSections();
108
110
112
113std::string getBBSections();
114
115unsigned getTLSSize();
116
118std::optional<bool> getExplicitEmulatedTLS();
119
121
123
125
127
129
131
133
135
137
140
142
144
146
147unsigned getAlignLoops();
148
150
152
153/// Create this object with static storage to register codegen-related command
154/// line options.
157};
158
160
161/// Common utility function tightly tied to the options listed here. Initializes
162/// a TargetOptions object with CodeGen flags and returns it.
163/// \p TheTriple is used to determine the default value for options if
164/// options are not explicitly specified. If those triple dependant options
165/// value do not have effect for your component, a default Triple() could be
166/// passed in.
168
169std::string getCPUStr();
170
171std::string getFeaturesStr();
172
173std::vector<std::string> getFeatureList();
174
176
177/// Set function attributes of function \p F based on CPU, Features, and command
178/// line flags.
180
181/// Set function attributes of functions in Module M based on CPU,
182/// Features, and command line flags.
183void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
184
185/// Should value-tracking variable locations / instruction referencing be
186/// enabled by default for this triple?
188
189/// Creates a TargetMachine instance with the options defined on the command
190/// line. This can be used for tools that do not need further customization of
191/// the TargetOptions.
193 StringRef TargetTriple,
195
196} // namespace codegen
197} // namespace llvm
198
199#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()
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 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.
llvm::FPOpFusion::FPOpFusionMode getFuseFPOps()
llvm::EABI getEABIVersion()
bool getEnableDebugEntryValues()
bool getUseCtors()
bool getJMCInstrument()
bool getDebugStrictDwarf()
bool getFunctionSections()
uint64_t getLargeDataThreshold()
bool getRelaxELFRelocations()
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:155