LLVM 24.0.0git
CommandFlags.cpp
Go to the documentation of this file.
1//===-- CommandFlags.cpp - 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
18#include "llvm/ADT/Statistic.h"
20#include "llvm/ADT/StringRef.h"
22#include "llvm/IR/Intrinsics.h"
23#include "llvm/IR/Module.h"
31#include "llvm/Support/Path.h"
38#include <cassert>
39#include <memory>
40#include <optional>
41#include <system_error>
42
43using namespace llvm;
44
45#define OPTIONS_STRUCT_DECL
46#include "CodeGenToolOptions.inc"
47
48#define OPTIONS_STRUCT_DEFS
49#include "CodeGenToolOptions.inc"
50
51static const CodeGenToolOptions &getCodeGenToolOptions(const LLVMContext &C) {
52 return C.getLibraryOptions().get<CodeGenToolOptions>();
53}
54
56 return C.get<CodeGenToolOptions>().march.str();
57}
58
60 return C.get<CodeGenToolOptions>().mcpu.str();
61}
62
63std::vector<std::string>
65 ArrayRef<StringRef> MAttrs = C.get<CodeGenToolOptions>().mattr;
66 return std::vector<std::string>(MAttrs.begin(), MAttrs.end());
67}
68
69std::optional<Reloc::Model>
71 return C.get<CodeGenToolOptions>().relocation_model;
72}
73
74std::optional<CodeModel::Model>
76 return C.get<CodeGenToolOptions>().code_model;
77}
78
79std::optional<uint64_t>
81 return C.get<CodeGenToolOptions>().large_data_threshold;
82}
83
84std::optional<CodeGenFileType>
86 return C.get<CodeGenToolOptions>().filetype;
87}
88
92
95 return C.get<CodeGenToolOptions>().float_abi;
96}
97
98std::optional<bool>
100 return toOptional(C.get<CodeGenToolOptions>().data_sections);
101}
102
103std::optional<bool>
105 return toOptional(C.get<CodeGenToolOptions>().function_sections);
106}
107
108std::optional<bool>
110 return toOptional(C.get<CodeGenToolOptions>().emulated_tls);
111}
112
114 return C.get<CodeGenToolOptions>().mtune.str();
115}
116
119 return C.get<CodeGenToolOptions>().save_stats;
120}
121
123 static constexpr opt::LibraryOptionsParser Parser(
124 std::in_place_type<CodeGenToolOptions>);
126 static const cl::LibraryOptions *const Libraries[] = {mc::getToolOptions()[0],
127 &Parser};
128 return Libraries;
129}
130
131static BasicBlockSection getBBSectionsMode(const CodeGenToolOptions &Opts,
133 if (Opts.basic_block_sections == "all")
135 else if (Opts.basic_block_sections == "none")
137 else {
139 MemoryBuffer::getFile(Opts.basic_block_sections);
140 if (!MBOrErr) {
141 errs() << "Error loading basic block sections function list file: "
142 << MBOrErr.getError().message() << "\n";
143 } else {
144 Options.BBSectionsFuncListBuf = std::move(*MBOrErr);
145 }
147 }
148}
149
150// Common utility function tightly tied to the options listed here. Initializes
151// a TargetOptions object with CodeGen options and returns it.
154 const Triple &TheTriple) {
155 const CodeGenToolOptions &Opts = LibraryOptions.get<CodeGenToolOptions>();
157 Options.NoZerosInBSS = Opts.nozero_initialized_in_bss;
158 Options.GuaranteedTailCallOpt = Opts.tailcallopt;
159 Options.StackSymbolOrdering = Opts.stack_symbol_ordering;
160 Options.UseInitArray = !Opts.use_ctors;
161 Options.DataSections =
162 valueOr(Opts.data_sections, TheTriple.hasDefaultDataSections());
163 Options.FunctionSections = valueOr(Opts.function_sections, false);
164 Options.IgnoreXCOFFVisibility = Opts.ignore_xcoff_visibility;
165 Options.XCOFFTracebackTable = Opts.xcoff_traceback_table;
166 Options.BBAddrMap = Opts.basic_block_address_map;
167 Options.BBSections = getBBSectionsMode(Opts, Options);
168 Options.UniqueSectionNames = Opts.unique_section_names;
169 Options.UniqueBasicBlockSectionNames = Opts.unique_basic_block_section_names;
170 Options.SeparateNamedSections = Opts.separate_named_sections;
171 Options.TLSSize = Opts.tls_size;
172 Options.EmulatedTLS =
173 valueOr(Opts.emulated_tls, TheTriple.hasDefaultEmulatedTLS());
174 Options.EnableTLSDESC =
175 valueOr(Opts.enable_tlsdesc, TheTriple.hasDefaultTLSDESC());
176 Options.VecLib = Opts.vector_library;
177 Options.EmitStackSizeSection = Opts.stack_size_section;
178 Options.EnableStaticDataPartitioning = Opts.partition_static_data_sections;
179 Options.EmitAddrsig = Opts.addrsig;
180 Options.EmitCallGraphSection = Opts.call_graph_section;
181 Options.EmitCallSiteInfo = Opts.emit_call_site_info;
182 Options.EnableDebugEntryValues = Opts.debug_entry_values;
183 Options.ForceDwarfFrameSection = Opts.force_dwarf_frame_section;
184 Options.XRayFunctionIndex = Opts.xray_function_index;
185 Options.DebugStrictDwarf = Opts.strict_dwarf;
186 Options.LoopAlignment = Opts.align_loops;
187 Options.JMCInstrument = Opts.enable_jmc_instrument;
188 Options.XCOFFReadOnlyPointers = Opts.mxcoff_roptr;
189
190 Options.MCOptions = mc::getMCTargetOptions(LibraryOptions);
191
192 Options.SwiftAsyncFramePointer = Opts.swift_async_fp;
193 return Options;
194}
195
197 std::string MCPU = getMCPU(C);
198
199 // If user asked for the 'native' CPU, autodetect here. If auto-detection
200 // fails, this will set the CPU to an empty string which tells the target to
201 // pick a basic default.
202 if (MCPU == "native")
203 return std::string(sys::getHostCPUName());
204
205 return MCPU;
206}
207
209 std::string TuneCPU = getMTune(C);
210
211 // If user asked for the 'native' tune CPU, autodetect here. If auto-detection
212 // fails, this will set the tune CPU to an empty string which tells the target
213 // to pick a basic default.
214 if (TuneCPU == "native")
215 return std::string(sys::getHostCPUName());
216
217 return TuneCPU;
218}
219
221 SubtargetFeatures Features;
222
223 // If user asked for the 'native' CPU, we need to autodetect features.
224 // This is necessary for x86 where the CPU might not support all the
225 // features the autodetected CPU name lists in the target. For example,
226 // not all Sandybridge processors support AVX.
227 if (getMCPU(C) == "native")
228 for (const auto &[Feature, IsEnabled] : sys::getHostCPUFeatures())
229 Features.AddFeature(Feature, IsEnabled);
230
231 for (auto const &MAttr : getMAttrs(C))
232 Features.AddFeature(MAttr);
233
234 return Features.getString();
235}
236
237std::vector<std::string>
239 SubtargetFeatures Features;
240
241 // If user asked for the 'native' CPU, we need to autodetect features.
242 // This is necessary for x86 where the CPU might not support all the
243 // features the autodetected CPU name lists in the target. For example,
244 // not all Sandybridge processors support AVX.
245 if (getMCPU(C) == "native")
246 for (const auto &[Feature, IsEnabled] : sys::getHostCPUFeatures())
247 Features.AddFeature(Feature, IsEnabled);
248
249 for (auto const &MAttr : getMAttrs(C))
250 Features.AddFeature(MAttr);
251
252 return Features.getFeatures();
253}
254
255void codegen::renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val) {
256 B.addAttribute(Name, Val ? "true" : "false");
257}
258
260 StringRef Features, StringRef TuneCPU) {
261 auto &Ctx = F.getContext();
262 const CodeGenToolOptions &Opts = getCodeGenToolOptions(Ctx);
263 AttributeList Attrs = F.getAttributes();
264 AttrBuilder NewAttrs(Ctx);
265
266 if (!CPU.empty() && !F.hasFnAttribute("target-cpu"))
267 NewAttrs.addAttribute("target-cpu", CPU);
268 if (!TuneCPU.empty() && !F.hasFnAttribute("tune-cpu"))
269 NewAttrs.addAttribute("tune-cpu", TuneCPU);
270 if (!Features.empty()) {
271 // Append the command line features to any that are already on the function.
272 StringRef OldFeatures =
273 F.getFnAttribute("target-features").getValueAsString();
274 if (OldFeatures.empty())
275 NewAttrs.addAttribute("target-features", Features);
276 else {
277 SmallString<256> Appended(OldFeatures);
278 Appended.push_back(',');
279 Appended.append(Features);
280 NewAttrs.addAttribute("target-features", Appended);
281 }
282 }
283 if (Opts.frame_pointer && !F.hasFnAttribute("frame-pointer")) {
284 if (*Opts.frame_pointer == FramePointerKind::All)
285 NewAttrs.addAttribute("frame-pointer", "all");
286 else if (*Opts.frame_pointer == FramePointerKind::NonLeaf)
287 NewAttrs.addAttribute("frame-pointer", "non-leaf");
288 else if (*Opts.frame_pointer == FramePointerKind::NonLeafNoReserve)
289 NewAttrs.addAttribute("frame-pointer", "non-leaf-no-reserve");
290 else if (*Opts.frame_pointer == FramePointerKind::Reserved)
291 NewAttrs.addAttribute("frame-pointer", "reserved");
292 else if (*Opts.frame_pointer == FramePointerKind::None)
293 NewAttrs.addAttribute("frame-pointer", "none");
294 }
295 if (Opts.disable_tail_calls != BoolOrDefault::Default)
296 NewAttrs.addAttribute("disable-tail-calls",
297 toStringRef(valueOr(Opts.disable_tail_calls, false)));
298 if (Opts.stackrealign)
299 NewAttrs.addAttribute("stackrealign");
300
301 if ((Opts.denormal_fp_math || Opts.denormal_fp_math_f32) &&
302 !F.hasFnAttribute(Attribute::DenormalFPEnv)) {
304 Opts.denormal_fp_math.value_or(DenormalMode::IEEE);
305 DenormalMode::DenormalModeKind DenormKindF32 =
306 Opts.denormal_fp_math_f32.value_or(DenormalMode::Invalid);
307
308 DenormalFPEnv FPEnv(DenormalMode{DenormKind, DenormKind},
309 DenormalMode{DenormKindF32, DenormKindF32});
310 // FIXME: Command line flag should expose separate input/output modes.
311 NewAttrs.addDenormalFPEnvAttr(FPEnv);
312 }
313
314 if (Opts.trap_func)
315 for (auto &B : F)
316 for (auto &I : B)
317 if (auto *Call = dyn_cast<CallInst>(&I))
318 if (const auto *F = Call->getCalledFunction())
319 if (F->getIntrinsicID() == Intrinsic::debugtrap ||
320 F->getIntrinsicID() == Intrinsic::trap)
321 Call->addFnAttr(
322 Attribute::get(Ctx, "trap-func-name", *Opts.trap_func));
323
324 // Let NewAttrs override Attrs.
325 F.setAttributes(Attrs.addFnAttributes(Ctx, NewAttrs));
326}
327
329 StringRef Features, StringRef TuneCPU) {
330 const cl::LibraryOptionsContext &C = M.getContext().getLibraryOptions();
331 // Synthesize the "float-abi" module flag from the -float-abi option.
333 if (ABI != FloatABI::Default) {
334 if (auto *Existing =
335 dyn_cast_or_null<MDString>(M.getModuleFlag("float-abi"))) {
336 // The module already records a float ABI; -float-abi must not contradict
337 // it.
338 if (Existing->getString() != FloatABI::getABITypeName(ABI))
340 "-float-abi=" + FloatABI::getABITypeName(ABI) +
341 " conflicts with the \"float-abi\" module flag \"" +
342 Existing->getString() + "\"");
343 } else {
344 M.addModuleFlag(
345 Module::Error, "float-abi",
346 MDString::get(M.getContext(), FloatABI::getABITypeName(ABI)));
347 }
348 }
349
350 // Synthesize the "exception-model" module flag from the -exception-model
351 // option.
352 ExceptionHandling EH = getCodeGenToolOptions(M.getContext()).exception_model;
353 if (EH != ExceptionHandling::Default) {
354 if (auto *Existing =
355 dyn_cast_or_null<MDString>(M.getModuleFlag("exception-model"))) {
356 // The module already records an exception model; -exception-model must
357 // not contradict it.
358 if (Existing->getString() != getExceptionModelName(EH)) {
360 "-exception-model=" + getExceptionModelName(EH) +
361 " conflicts with the \"exception-model\" module flag \"" +
362 Existing->getString() + "\"");
363 }
364 } else {
365 M.addModuleFlag(Module::Error, "exception-model",
366 MDString::get(M.getContext(), getExceptionModelName(EH)));
367 }
368 }
369
370 // Synthesize the "target-abi" module flag from the -target-abi option.
371 //
372 // FIXME: verifyOptionsConsistency validates consistency for target-abi. We
373 // should consistently handle all ABI module flags either here or there.
374 StringRef ABIName = mc::getABIName(C);
375 if (!ABIName.empty() && !M.getModuleFlag("target-abi")) {
376 M.addModuleFlag(Module::Error, "target-abi",
377 MDString::get(M.getContext(), ABIName));
378 }
379
380 for (Function &F : M)
381 setFunctionAttributes(F, CPU, Features, TuneCPU);
382}
383
385 const cl::LibraryOptionsContext &LibraryOptions, const Triple &TargetTriple,
386 CodeGenOptLevel OptLevel) {
387 // lookupTarget may mutate the triple, so we need a copy.
388 Triple TheTriple(TargetTriple);
389 std::string Error;
390 const auto *TheTarget = TargetRegistry::lookupTarget(
391 codegen::getMArch(LibraryOptions), TheTriple, Error);
392 if (!TheTarget)
394 TargetOptions Options = codegen::getTargetOptions(LibraryOptions, TheTriple);
395 auto *Target = TheTarget->createTargetMachine(
396 TheTriple, codegen::getCPUStr(LibraryOptions),
397 codegen::getFeaturesStr(LibraryOptions), Options,
398 codegen::getExplicitRelocModel(LibraryOptions),
399 codegen::getExplicitCodeModel(LibraryOptions), OptLevel);
400 if (!Target)
402 Twine("could not allocate target machine for ") +
403 TheTriple.str());
404 return std::unique_ptr<TargetMachine>(Target);
405}
406
413
416 auto SaveStatsValue = getSaveStats(C);
417 if (SaveStatsValue == codegen::SaveStatsMode::None)
418 return 0;
419
420 SmallString<128> StatsFilename;
421 if (SaveStatsValue == codegen::SaveStatsMode::Obj) {
422 StatsFilename = OutputFilename;
424 } else {
425 assert(SaveStatsValue == codegen::SaveStatsMode::Cwd &&
426 "Should have been a valid --save-stats value");
427 }
428
430 llvm::sys::path::append(StatsFilename, BaseName);
431 llvm::sys::path::replace_extension(StatsFilename, "stats");
432
433 auto FileFlags = llvm::sys::fs::OF_TextWithCRLF;
434 std::error_code EC;
435 auto StatsOS =
436 std::make_unique<llvm::raw_fd_ostream>(StatsFilename, EC, FileFlags);
437 if (EC) {
438 WithColor::error(errs(), ToolName)
439 << "Unable to open statistics file: " << EC.message() << "\n";
440 return 1;
441 }
442
444 return 0;
445}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static BasicBlockSection getBBSectionsMode(const CodeGenToolOptions &Opts, TargetOptions &Options)
static const CodeGenToolOptions & getCodeGenToolOptions(const LLVMContext &C)
Utilities for dealing with flags related to floating point properties and mode controls.
Module.h This file contains the declarations for the Module class.
static LVOptions Options
Definition LVOptions.cpp:25
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
This file defines the SmallString class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
This file contains some functions that are useful when dealing with strings.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
iterator end() const
Definition ArrayRef.h:130
iterator begin() const
Definition ArrayRef.h:129
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Represents either an error or a value T.
Definition ErrorOr.h:56
std::error_code getError() const
Definition ErrorOr.h:152
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
Definition Metadata.cpp:595
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
@ Error
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition Module.h:121
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:28
void append(StringRef RHS)
Append from a StringRef.
Definition SmallString.h:70
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
Manages the enabling and disabling of subtarget specific features.
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
LLVM_ABI std::string getString() const
Returns features as a string.
LLVM_ABI void AddFeature(StringRef String, bool Enable=true)
Adds Features.
Target - Wrapper for Target specific information.
TargetMachine * createTargetMachine(const Triple &TT, StringRef CPU, StringRef Features, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM=std::nullopt, CodeGenOptLevel OL=CodeGenOptLevel::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
bool hasDefaultTLSDESC() const
True if the target uses TLSDESC by default.
Definition Triple.h:1322
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
Definition Triple.h:1327
const std::string & str() const
Definition Triple.h:582
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
Definition Triple.h:1316
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
static LLVM_ABI raw_ostream & error()
Convenience method for printing "error: " to stderr.
Definition WithColor.cpp:84
The options of a library that declares them in TableGen rather than as cl::opt (see llvm/Option/Libra...
Connects options struct T to cl::parseCommandLineOptions and cl::LibraryOptionsContext.
CallInst * Call
StringRef getABITypeName(ABIType ABI)
Returns the string spelling used by the "float-abi" IR module flag for a Soft or Hard ABIType.
Definition CodeGen.h:177
LLVM_ABI std::string getMArch(const cl::LibraryOptionsContext &C)
LLVM_ABI SaveStatsMode getSaveStats(const cl::LibraryOptionsContext &C)
LLVM_ABI std::string getMTune(const cl::LibraryOptionsContext &C)
LLVM_ABI void renderBoolStringAttr(AttrBuilder &B, StringRef Name, bool Val)
LLVM_ABI std::vector< std::string > getMAttrs(const cl::LibraryOptionsContext &C)
LLVM_ABI Expected< std::unique_ptr< TargetMachine > > createTargetMachineForTriple(const cl::LibraryOptionsContext &LibraryOptions, const Triple &TargetTriple, CodeGenOptLevel OptLevel=CodeGenOptLevel::Default)
Creates a TargetMachine instance with the options defined on the command line.
LLVM_ABI std::optional< Reloc::Model > getExplicitRelocModel(const cl::LibraryOptionsContext &C)
LLVM_ABI void setFunctionAttributes(Function &F, StringRef CPU, StringRef Features, StringRef TuneCPU="")
Set function attributes of function F based on CPU, TuneCPU, Features, and command line flags.
LLVM_ABI ArrayRef< const cl::LibraryOptions * > getToolOptions()
The options that a tool reading getTargetOptions passes to cl::parseCommandLineOptions.
LLVM_ABI TargetOptions getTargetOptions(const cl::LibraryOptionsContext &LibraryOptions, const llvm::Triple &TheTriple)
Common utility function tightly tied to the options listed here.
LLVM_ABI std::string getFeaturesStr(const cl::LibraryOptionsContext &C)
LLVM_ABI std::optional< bool > getExplicitFunctionSections(const cl::LibraryOptionsContext &C)
LLVM_ABI std::vector< std::string > getFeatureList(const cl::LibraryOptionsContext &C)
LLVM_ABI CodeGenFileType getFileType(const cl::LibraryOptionsContext &C)
LLVM_ABI std::string getCPUStr(const cl::LibraryOptionsContext &C)
LLVM_ABI std::optional< CodeModel::Model > getExplicitCodeModel(const cl::LibraryOptionsContext &C)
LLVM_ABI std::optional< bool > getExplicitDataSections(const cl::LibraryOptionsContext &C)
LLVM_ABI int maybeSaveStatistics(const cl::LibraryOptionsContext &C, StringRef OutputFilename, StringRef ToolName)
Conditionally saves the collected LLVM statistics to the received output file, based on the value of ...
LLVM_ABI std::optional< CodeGenFileType > getExplicitFileType(const cl::LibraryOptionsContext &C)
LLVM_ABI std::optional< uint64_t > getExplicitLargeDataThreshold(const cl::LibraryOptionsContext &C)
LLVM_ABI std::string getTuneCPUStr(const cl::LibraryOptionsContext &C)
LLVM_ABI std::optional< bool > getExplicitEmulatedTLS(const cl::LibraryOptionsContext &C)
LLVM_ABI llvm::FloatABI::ABIType getFloatABIForCalls(const cl::LibraryOptionsContext &C)
LLVM_ABI void maybeEnableStatistics(const cl::LibraryOptionsContext &C)
Conditionally enables the collection of LLVM statistics during the tool run, based on the value of th...
LLVM_ABI std::string getMCPU(const cl::LibraryOptionsContext &C)
LLVM_ABI MCTargetOptions getMCTargetOptions(const cl::LibraryOptionsContext &C)
LLVM_ABI ArrayRef< const cl::LibraryOptions * > getToolOptions()
The options that a tool reading getMCTargetOptions passes to cl::parseCommandLineOptions.
LLVM_ABI StringRef getABIName(const cl::LibraryOptionsContext &C)
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition FileSystem.h:802
LLVM_ABI void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
Definition Path.cpp:485
LLVM_ABI void replace_extension(SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)
Replace the file extension of path with extension.
Definition Path.cpp:491
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
Definition Path.cpp:594
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition Path.cpp:467
LLVM_ABI StringMap< bool, MallocAllocator > getHostCPUFeatures()
getHostCPUFeatures - Get the LLVM names for the host CPU features.
Definition Host.cpp:2666
LLVM_ABI StringRef getHostCPUName()
getHostCPUName - Get the LLVM name for the host CPU.
Definition Host.cpp:2047
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition STLExtras.h:1685
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition Error.cpp:94
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition Error.h:1321
StringRef getExceptionModelName(ExceptionHandling EH)
Returns the "exception-model" module flag spelling for an ExceptionHandling value.
Definition CodeGen.h:71
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
LLVM_ABI void EnableStatistics(bool DoPrintOnExit=true)
Enable the collection and printing of statistics.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition CodeGen.h:309
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:280
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
constexpr std::optional< bool > toOptional(BoolOrDefault X)
ExceptionHandling
Definition CodeGen.h:54
@ Default
Not specified; resolve to the target's default model.
Definition CodeGen.h:55
BasicBlockSection
constexpr bool valueOr(BoolOrDefault X, bool Default)
LLVM_ABI void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
Represents the full denormal controls for a function, including the default mode and the f32 specific...
Represent subnormal handling kind for floating point instruction inputs and outputs.
DenormalModeKind
Represent handled modes for denormal (aka subnormal) modes in the floating point environment.
@ IEEE
IEEE-754 denormal numbers preserved.
static LLVM_ABI const Target * lookupTarget(const Triple &TheTriple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.