LLVM 17.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;
31
32namespace codegen {
33
34std::string getMArch();
35
36std::string getMCPU();
37
38std::vector<std::string> getMAttrs();
39
41std::optional<Reloc::Model> getExplicitRelocModel();
42
44
46std::optional<CodeModel::Model> getExplicitCodeModel();
47
49
50std::optional<CodeGenFileType> getExplicitFileType();
51
53
55
57
59
61
63
65
67
70
72
74
76
78
80
82
84
86
88
90
92
93std::string getTrapFuncName();
94
96
98
100std::optional<bool> getExplicitDataSections();
101
103std::optional<bool> getExplicitFunctionSections();
104
106
108
109std::string getBBSections();
110
111unsigned getTLSSize();
112
114std::optional<bool> getExplicitEmulatedTLS();
115
117
119
121
123
125
127
129
131
133
136
138
140
142
143unsigned getAlignLoops();
144
146
148
149/// Create this object with static storage to register codegen-related command
150/// line options.
153};
154
156
157/// Common utility function tightly tied to the options listed here. Initializes
158/// a TargetOptions object with CodeGen flags and returns it.
159/// \p TheTriple is used to determine the default value for options if
160/// options are not explicitly specified. If those triple dependant options
161/// value do not have effect for your component, a default Triple() could be
162/// passed in.
164
165std::string getCPUStr();
166
167std::string getFeaturesStr();
168
169std::vector<std::string> getFeatureList();
170
172
173/// Set function attributes of function \p F based on CPU, Features, and command
174/// line flags.
176
177/// Set function attributes of functions in Module M based on CPU,
178/// Features, and command line flags.
179void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
180
181/// Should value-tracking variable locations / instruction referencing be
182/// enabled by default for this triple?
184} // namespace codegen
185} // namespace llvm
186
187#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
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()
unsigned getOverrideStackAlignment()
std::string getFeaturesStr()
std::vector< std::string > getMAttrs()
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()
bool getXRayOmitFunctionIndex()
std::optional< CodeModel::Model > getExplicitCodeModel()
CodeModel::Model getCodeModel()
bool getDataSections()
bool getEnableApproxFuncFPMath()
std::vector< std::string > getFeatureList()
Reloc::Model getRelocModel()
unsigned getAlignLoops()
std::string getTrapFuncName()
llvm::ExceptionHandling getExceptionModel()
bool getValueTrackingVariableLocations()
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()
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:91
ExceptionHandling
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition: CodeGen.h:84
SwiftAsyncFramePointerMode
Indicates when and how the Swift async frame pointer bit should be set.
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:151