LLVM 21.0.0git
TargetMachine.h
Go to the documentation of this file.
1//===-- llvm/Target/TargetMachine.h - Target Information --------*- 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 defines the TargetMachine class.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_TARGET_TARGETMACHINE_H
14#define LLVM_TARGET_TARGETMACHINE_H
15
16#include "llvm/ADT/StringRef.h"
17#include "llvm/IR/DataLayout.h"
18#include "llvm/IR/PassManager.h"
19#include "llvm/MC/MCStreamer.h"
23#include "llvm/Support/Error.h"
28#include <optional>
29#include <string>
30#include <utility>
31
33
34namespace llvm {
35
36class AAManager;
37using ModulePassManager = PassManager<Module>;
38
39class Function;
40class GlobalValue;
41class MachineModuleInfoWrapperPass;
42class Mangler;
43class MCAsmInfo;
44class MCContext;
45class MCInstrInfo;
46class MCRegisterInfo;
47class MCSubtargetInfo;
48class MCSymbol;
49class raw_pwrite_stream;
50class PassBuilder;
51class PassInstrumentationCallbacks;
52struct PerFunctionMIParsingState;
53class SMDiagnostic;
54class SMRange;
55class Target;
56class TargetIntrinsicInfo;
57class TargetIRAnalysis;
58class TargetTransformInfo;
59class TargetLoweringObjectFile;
60class TargetPassConfig;
61class TargetSubtargetInfo;
62
63// The old pass manager infrastructure is hidden in a legacy namespace now.
64namespace legacy {
65class PassManagerBase;
66} // namespace legacy
67using legacy::PassManagerBase;
68
69struct MachineFunctionInfo;
70namespace yaml {
71struct MachineFunctionInfo;
72} // namespace yaml
73
74//===----------------------------------------------------------------------===//
75///
76/// Primary interface to the complete machine description for the target
77/// machine. All target-specific information should be accessible through this
78/// interface.
79///
81protected: // Can only create subclasses.
82 TargetMachine(const Target &T, StringRef DataLayoutString,
83 const Triple &TargetTriple, StringRef CPU, StringRef FS,
84 const TargetOptions &Options);
85
86 /// The Target that this machine was created for.
88
89 /// DataLayout for the target: keep ABI type size and alignment.
90 ///
91 /// The DataLayout is created based on the string representation provided
92 /// during construction. It is kept here only to avoid reparsing the string
93 /// but should not really be used during compilation, because it has an
94 /// internal cache that is context specific.
96
97 /// Triple string, CPU name, and target feature strings the TargetMachine
98 /// instance is created with.
100 std::string TargetCPU;
101 std::string TargetFS;
102
107
108 /// Contains target specific asm information.
109 std::unique_ptr<const MCAsmInfo> AsmInfo;
110 std::unique_ptr<const MCRegisterInfo> MRI;
111 std::unique_ptr<const MCInstrInfo> MII;
112 std::unique_ptr<const MCSubtargetInfo> STI;
113
115 unsigned O0WantsFastISel : 1;
116
117 // PGO related tunables.
118 std::optional<PGOOptions> PGOOption;
119
120public:
122
123 TargetMachine(const TargetMachine &) = delete;
124 void operator=(const TargetMachine &) = delete;
125 virtual ~TargetMachine();
126
127 const Target &getTarget() const { return TheTarget; }
128
129 const Triple &getTargetTriple() const { return TargetTriple; }
130 StringRef getTargetCPU() const { return TargetCPU; }
132 void setTargetFeatureString(StringRef FS) { TargetFS = std::string(FS); }
133
134 /// Virtual method implemented by subclasses that returns a reference to that
135 /// target's TargetSubtargetInfo-derived member variable.
136 virtual const TargetSubtargetInfo *getSubtargetImpl(const Function &) const {
137 return nullptr;
138 }
140 return nullptr;
141 }
142
143 /// Create the target's instance of MachineFunctionInfo
144 virtual MachineFunctionInfo *
146 const TargetSubtargetInfo *STI) const {
147 return nullptr;
148 }
149
150 /// Allocate and return a default initialized instance of the YAML
151 /// representation for the MachineFunctionInfo.
153 return nullptr;
154 }
155
156 /// Allocate and initialize an instance of the YAML representation of the
157 /// MachineFunctionInfo.
160 return nullptr;
161 }
162
163 /// Parse out the target's MachineFunctionInfo from the YAML reprsentation.
167 SMRange &SourceRange) const {
168 return false;
169 }
170
171 /// This method returns a pointer to the specified type of
172 /// TargetSubtargetInfo. In debug builds, it verifies that the object being
173 /// returned is of the correct type.
174 template <typename STC> const STC &getSubtarget(const Function &F) const {
175 return *static_cast<const STC*>(getSubtargetImpl(F));
176 }
177
178 /// Create a DataLayout.
179 const DataLayout createDataLayout() const { return DL; }
180
181 /// Test if a DataLayout if compatible with the CodeGen for this target.
182 ///
183 /// The LLVM Module owns a DataLayout that is used for the target independent
184 /// optimizations and code generation. This hook provides a target specific
185 /// check on the validity of this DataLayout.
186 bool isCompatibleDataLayout(const DataLayout &Candidate) const {
187 return DL == Candidate;
188 }
189
190 /// Get the pointer size for this target.
191 ///
192 /// This is the only time the DataLayout in the TargetMachine is used.
193 unsigned getPointerSize(unsigned AS) const {
194 return DL.getPointerSize(AS);
195 }
196
197 unsigned getPointerSizeInBits(unsigned AS) const {
198 return DL.getPointerSizeInBits(AS);
199 }
200
201 unsigned getProgramPointerSize() const {
203 }
204
205 unsigned getAllocaPointerSize() const {
207 }
208
209 /// Reset the target options based on the function's attributes.
210 // FIXME: Remove TargetOptions that affect per-function code generation
211 // from TargetMachine.
212 void resetTargetOptions(const Function &F) const;
213
214 /// Return target specific asm information.
215 const MCAsmInfo *getMCAsmInfo() const { return AsmInfo.get(); }
216
217 const MCRegisterInfo *getMCRegisterInfo() const { return MRI.get(); }
218 const MCInstrInfo *getMCInstrInfo() const { return MII.get(); }
219 const MCSubtargetInfo *getMCSubtargetInfo() const { return STI.get(); }
220
221 /// If intrinsic information is available, return it. If not, return null.
222 virtual const TargetIntrinsicInfo *getIntrinsicInfo() const {
223 return nullptr;
224 }
225
228
229 /// Returns the code generation relocation model. The choices are static, PIC,
230 /// and dynamic-no-pic, and target default.
232
233 /// Returns the code model. The choices are small, kernel, medium, large, and
234 /// target default.
236
237 /// Returns the maximum code size possible under the code model.
238 uint64_t getMaxCodeSize() const;
239
240 /// Set the code model.
242
244 bool isLargeGlobalValue(const GlobalValue *GV) const;
245
246 bool isPositionIndependent() const;
247
248 bool shouldAssumeDSOLocal(const GlobalValue *GV) const;
249
250 /// Returns true if this target uses emulated TLS.
251 bool useEmulatedTLS() const;
252
253 /// Returns true if this target uses TLS Descriptors.
254 bool useTLSDESC() const;
255
256 /// Returns the TLS model which should be used for the given global variable.
257 TLSModel::Model getTLSModel(const GlobalValue *GV) const;
258
259 /// Returns the optimization level: None, Less, Default, or Aggressive.
261
262 /// Overrides the optimization level.
263 void setOptLevel(CodeGenOptLevel Level) { OptLevel = Level; }
264
271 }
274 }
277 }
280 }
281
283
286 }
287
289
290 /// Return true if unique basic block section names must be generated.
293 }
294
297 }
298
299 /// Return true if data objects should be emitted into their own section,
300 /// corresponds to -fdata-sections.
301 bool getDataSections() const {
302 return Options.DataSections;
303 }
304
305 /// Return true if functions should be emitted into their own section,
306 /// corresponding to -ffunction-sections.
307 bool getFunctionSections() const {
309 }
310
313 }
314
315 /// Return true if visibility attribute should not be emitted in XCOFF,
316 /// corresponding to -mignore-xcoff-visibility.
319 }
320
321 /// Return true if XCOFF traceback table should be emitted,
322 /// corresponding to -xcoff-traceback-table.
324
325 /// If basic blocks should be emitted into their own section,
326 /// corresponding to -fbasic-block-sections.
328 return Options.BBSections;
329 }
330
331 /// Get the list of functions and basic block ids that need unique sections.
333 return Options.BBSectionsFuncListBuf.get();
334 }
335
336 /// Returns true if a cast between SrcAS and DestAS is a noop.
337 virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const {
338 return false;
339 }
340
341 void setPGOOption(std::optional<PGOOptions> PGOOpt) { PGOOption = PGOOpt; }
342 const std::optional<PGOOptions> &getPGOOption() const { return PGOOption; }
343
344 /// If the specified generic pointer could be assumed as a pointer to a
345 /// specific address space, return that address space.
346 ///
347 /// Under offloading programming, the offloading target may be passed with
348 /// values only prepared on the host side and could assume certain
349 /// properties.
350 virtual unsigned getAssumedAddrSpace(const Value *V) const { return -1; }
351
352 /// If the specified predicate checks whether a generic pointer falls within
353 /// a specified address space, return that generic pointer and the address
354 /// space being queried.
355 ///
356 /// Such predicates could be specified in @llvm.assume intrinsics for the
357 /// optimizer to assume that the given generic pointer always falls within
358 /// the address space based on that predicate.
359 virtual std::pair<const Value *, unsigned>
361 return std::make_pair(nullptr, -1);
362 }
363
364 /// Get a \c TargetIRAnalysis appropriate for the target.
365 ///
366 /// This is used to construct the new pass manager's target IR analysis pass,
367 /// set up appropriately for this target machine. Even the old pass manager
368 /// uses this to answer queries about the IR.
370
371 /// Return a TargetTransformInfo for a given function.
372 ///
373 /// The returned TargetTransformInfo is specialized to the subtarget
374 /// corresponding to \p F.
376
377 /// Allow the target to modify the pass pipeline.
378 // TODO: Populate all pass names by using <Target>PassRegistry.def.
380
381 /// Allow the target to register alias analyses with the AAManager for use
382 /// with the new pass manager. Only affects the "default" AAManager.
384
385 /// Add passes to the specified pass manager to get the specified file
386 /// emitted. Typically this will involve several steps of code generation.
387 /// This method should return true if emission of this file type is not
388 /// supported, or false on success.
389 /// \p MMIWP is an optional parameter that, if set to non-nullptr,
390 /// will be used to set the MachineModuloInfo for this PM.
391 virtual bool
394 bool /*DisableVerify*/ = true,
395 MachineModuleInfoWrapperPass *MMIWP = nullptr) {
396 return true;
397 }
398
399 /// Add passes to the specified pass manager to get machine code emitted with
400 /// the MCJIT. This method returns true if machine code is not supported. It
401 /// fills the MCContext Ctx pointer which can be used to build custom
402 /// MCStreamer.
403 ///
406 bool /*DisableVerify*/ = true) {
407 return true;
408 }
409
410 /// True if subtarget inserts the final scheduling pass on its own.
411 ///
412 /// Branch relaxation, which must happen after block placement, can
413 /// on some targets (e.g. SystemZ) expose additional post-RA
414 /// scheduling opportunities.
415 virtual bool targetSchedulesPostRAScheduling() const { return false; };
416
418 Mangler &Mang, bool MayAlwaysUsePrivate = false) const;
419 MCSymbol *getSymbol(const GlobalValue *GV) const;
420
421 /// The integer bit size to use for SjLj based exception handling.
422 static constexpr unsigned DefaultSjLjDataSize = 32;
423 virtual unsigned getSjLjDataSize() const { return DefaultSjLjDataSize; }
424
425 static std::pair<int, int> parseBinutilsVersion(StringRef Version);
426
427 /// getAddressSpaceForPseudoSourceKind - Given the kind of memory
428 /// (e.g. stack) the target returns the corresponding address space.
429 virtual unsigned getAddressSpaceForPseudoSourceKind(unsigned Kind) const {
430 return 0;
431 }
432
433 /// Entry point for module splitting. Targets can implement custom module
434 /// splitting logic, mainly used by LTO for --lto-partitions.
435 ///
436 /// \returns `true` if the module was split, `false` otherwise. When `false`
437 /// is returned, it is assumed that \p ModuleCallback has never been called
438 /// and \p M has not been modified.
439 virtual bool splitModule(
440 Module &M, unsigned NumParts,
441 function_ref<void(std::unique_ptr<Module> MPart)> ModuleCallback) {
442 return false;
443 }
444
445 /// Create a pass configuration object to be used by addPassToEmitX methods
446 /// for generating a pipeline of CodeGen passes.
448 return nullptr;
449 }
450
453 const CGPassBuilderOption &,
455 return make_error<StringError>("buildCodeGenPipeline is not overridden",
457 }
458
459 /// Returns true if the target is expected to pass all machine verifier
460 /// checks. This is a stopgap measure to fix targets one by one. We will
461 /// remove this at some point and always enable the verifier when
462 /// EXPENSIVE_CHECKS is enabled.
463 virtual bool isMachineVerifierClean() const { return true; }
464
465 /// Adds an AsmPrinter pass to the pipeline that prints assembly or
466 /// machine code from the MI representation.
468 raw_pwrite_stream *DwoOut,
469 CodeGenFileType FileType, MCContext &Context) {
470 return false;
471 }
472
475 CodeGenFileType FileType, MCContext &Ctx) {
476 return nullptr;
477 }
478
479 /// True if the target uses physical regs (as nearly all targets do). False
480 /// for stack machines such as WebAssembly and other virtual-register
481 /// machines. If true, all vregs must be allocated before PEI. If false, then
482 /// callee-save register spilling and scavenging are not needed or used. If
483 /// false, implicitly defined registers will still be assumed to be physical
484 /// registers, except that variadic defs will be allocated vregs.
485 virtual bool usesPhysRegsForValues() const { return true; }
486
487 /// True if the target wants to use interprocedural register allocation by
488 /// default. The -enable-ipra flag can be used to override this.
489 virtual bool useIPRA() const { return false; }
490
491 /// The default variant to use in unqualified `asm` instructions.
492 /// If this returns 0, `asm "$(foo$|bar$)"` will evaluate to `asm "foo"`.
493 virtual int unqualifiedInlineAsmVariant() const { return 0; }
494
495 // MachineRegisterInfo callback function
497};
498
499} // end namespace llvm
500
501#endif // LLVM_TARGET_TARGETMACHINE_H
This file defines the BumpPtrAllocator interface.
std::string Name
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
Define option tunables for PGO.
Basic Register Allocator
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
A manager for alias analyses.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
unsigned getProgramAddressSpace() const
Definition: DataLayout.h:246
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
Definition: DataLayout.h:364
unsigned getAllocaAddrSpace() const
Definition: DataLayout.h:229
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size in bytes, rounded up to a whole number of bytes.
Definition: DataLayout.cpp:739
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:481
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:83
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:51
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:105
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:281
Represents a range in source code.
Definition: SMLoc.h:48
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Analysis pass providing the TargetTransformInfo.
TargetIntrinsicInfo - Interface to description of machine instruction set.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:80
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
void setSupportsDebugEntryValues(bool Enable)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
Definition: TargetMachine.h:99
std::unique_ptr< const MCAsmInfo > AsmInfo
Contains target specific asm information.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
bool isPositionIndependent() const
virtual unsigned getAddressSpaceForPseudoSourceKind(unsigned Kind) const
getAddressSpaceForPseudoSourceKind - Given the kind of memory (e.g.
virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, bool=true, MachineModuleInfoWrapperPass *MMIWP=nullptr)
Add passes to the specified pass manager to get the specified file emitted.
unsigned getAllocaPointerSize() const
virtual std::pair< const Value *, unsigned > getPredicatedAddrSpace(const Value *V) const
If the specified predicate checks whether a generic pointer falls within a specified address space,...
virtual Expected< std::unique_ptr< MCStreamer > > createMCStreamer(raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Ctx)
virtual void registerPassBuilderCallbacks(PassBuilder &)
Allow the target to modify the pass pipeline.
virtual const TargetIntrinsicInfo * getIntrinsicInfo() const
If intrinsic information is available, return it. If not, return null.
virtual bool usesPhysRegsForValues() const
True if the target uses physical regs (as nearly all targets do).
uint64_t getMaxCodeSize() const
Returns the maximum code size possible under the code model.
bool getAIXExtendedAltivecABI() const
CodeModel::Model CMModel
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const
Returns true if a cast between SrcAS and DestAS is a noop.
virtual MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const
Create the target's instance of MachineFunctionInfo.
const Triple & getTargetTriple() const
virtual bool splitModule(Module &M, unsigned NumParts, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback)
Entry point for module splitting.
const DataLayout createDataLayout() const
Create a DataLayout.
void setMachineOutliner(bool Enable)
void setFastISel(bool Enable)
const std::optional< PGOOptions > & getPGOOption() const
bool useTLSDESC() const
Returns true if this target uses TLS Descriptors.
uint64_t LargeDataThreshold
const MCSubtargetInfo * getMCSubtargetInfo() const
virtual bool addAsmPrinter(PassManagerBase &PM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Context)
Adds an AsmPrinter pass to the pipeline that prints assembly or machine code from the MI representati...
bool getSeparateNamedSections() const
const MemoryBuffer * getBBSectionsFuncListBuf() const
Get the list of functions and basic block ids that need unique sections.
virtual unsigned getSjLjDataSize() const
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.
unsigned getPointerSizeInBits(unsigned AS) const
bool getIgnoreXCOFFVisibility() const
Return true if visibility attribute should not be emitted in XCOFF, corresponding to -mignore-xcoff-v...
virtual int unqualifiedInlineAsmVariant() const
The default variant to use in unqualified asm instructions.
void setCFIFixup(bool Enable)
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
bool getUniqueBasicBlockSectionNames() const
Return true if unique basic block section names must be generated.
bool getUniqueSectionNames() const
unsigned getPointerSize(unsigned AS) const
Get the pointer size for this target.
std::unique_ptr< const MCInstrInfo > MII
void setSupportsDefaultOutlining(bool Enable)
TargetMachine(const TargetMachine &)=delete
void setGlobalISelAbort(GlobalISelAbortMode Mode)
virtual unsigned getAssumedAddrSpace(const Value *V) const
If the specified generic pointer could be assumed as a pointer to a specific address space,...
virtual TargetLoweringObjectFile * getObjFileLowering() const
std::string TargetFS
std::optional< PGOOptions > PGOOption
virtual yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
bool getEnableStaticDataPartitioning() const
StringRef getTargetFeatureString() const
virtual Error buildCodeGenPipeline(ModulePassManager &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, const CGPassBuilderOption &, PassInstrumentationCallbacks *)
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
static constexpr unsigned DefaultSjLjDataSize
The integer bit size to use for SjLj based exception handling.
virtual bool targetSchedulesPostRAScheduling() const
True if subtarget inserts the final scheduling pass on its own.
virtual TargetTransformInfo getTargetTransformInfo(const Function &F) const
Return a TargetTransformInfo for a given function.
virtual bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_pwrite_stream &, bool=true)
Add passes to the specified pass manager to get machine code emitted with the MCJIT.
const DataLayout DL
DataLayout for the target: keep ABI type size and alignment.
Definition: TargetMachine.h:95
StringRef getTargetCPU() const
const MCInstrInfo * getMCInstrInfo() const
void setOptLevel(CodeGenOptLevel Level)
Overrides the optimization level.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
std::string TargetCPU
bool requiresStructuredCFG() const
bool shouldAssumeDSOLocal(const GlobalValue *GV) const
void setRequiresStructuredCFG(bool Value)
virtual bool isMachineVerifierClean() const
Returns true if the target is expected to pass all machine verifier checks.
static std::pair< int, int > parseBinutilsVersion(StringRef Version)
std::unique_ptr< const MCSubtargetInfo > STI
void setGlobalISel(bool Enable)
TargetIRAnalysis getTargetIRAnalysis() const
Get a TargetIRAnalysis appropriate for the target.
TargetOptions Options
virtual void registerDefaultAliasAnalyses(AAManager &)
Allow the target to register alias analyses with the AAManager for use with the new pass manager.
void setLargeDataThreshold(uint64_t LDT)
virtual void registerMachineRegisterInfoCallback(MachineFunction &MF) const
unsigned RequireStructuredCFG
void setO0WantsFastISel(bool Enable)
virtual yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
virtual ~TargetMachine()
virtual TargetPassConfig * createPassConfig(PassManagerBase &PM)
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
bool isCompatibleDataLayout(const DataLayout &Candidate) const
Test if a DataLayout if compatible with the CodeGen for this target.
void operator=(const TargetMachine &)=delete
MCSymbol * getSymbol(const GlobalValue *GV) const
unsigned getProgramPointerSize() const
bool getXCOFFTracebackTable() const
Return true if XCOFF traceback table should be emitted, corresponding to -xcoff-traceback-table.
bool getDataSections() const
Return true if data objects should be emitted into their own section, corresponds to -fdata-sections.
const Target & getTarget() const
void setTargetFeatureString(StringRef FS)
const Target & TheTarget
The Target that this machine was created for.
Definition: TargetMachine.h:87
CodeModel::Model getCodeModel() const
Returns the code model.
const MCRegisterInfo * getMCRegisterInfo() const
bool isLargeGlobalValue(const GlobalValue *GV) const
virtual bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
virtual bool useIPRA() const
True if the target wants to use interprocedural register allocation by default.
void setCodeModel(CodeModel::Model CM)
Set the code model.
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
void setPGOOption(std::optional< PGOOptions > PGOOpt)
std::unique_ptr< const MCRegisterInfo > MRI
bool getFunctionSections() const
Return true if functions should be emitted into their own section, corresponding to -ffunction-sectio...
CodeGenOptLevel OptLevel
llvm::BasicBlockSection getBBSectionsType() const
If basic blocks should be emitted into their own section, corresponding to -fbasic-block-sections.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
unsigned EnableAIXExtendedAltivecABI
EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is specified.
unsigned EnableMachineOutliner
Enables the MachineOutliner pass.
unsigned SeparateNamedSections
Emit named sections with the same name into different sections.
unsigned SupportsDebugEntryValues
Set if the target supports the debug entry values by default.
BasicBlockSection BBSections
Emit basic blocks into separate sections.
GlobalISelAbortMode GlobalISelAbort
EnableGlobalISelAbort - Control abort behaviour when global instruction selection fails to lower/sele...
unsigned XCOFFTracebackTable
Emit XCOFF traceback table.
unsigned IgnoreXCOFFVisibility
Do not emit visibility attribute for xcoff.
unsigned EnableCFIFixup
Enable the CFIFixup pass.
unsigned SupportsDefaultOutlining
Set if the target supports default outlining behaviour.
unsigned UniqueBasicBlockSectionNames
Use unique names for basic block sections.
unsigned EnableStaticDataPartitioning
Enables the StaticDataSplitter pass.
unsigned UniqueSectionNames
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
std::shared_ptr< MemoryBuffer > BBSectionsFuncListBuf
Memory Buffer that contains information on sampled basic blocks and used to selectively generate basi...
unsigned FunctionSections
Emit functions into separate sections.
unsigned EnableGlobalISel
EnableGlobalISel - This flag enables global instruction selection.
unsigned DataSections
Emit data into separate sections.
Target-Independent Code Generator Pass Configuration Options.
TargetSubtargetInfo - Generic base class for all target subtargets.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
LLVM Value Representation.
Definition: Value.h:74
An efficient, type-erasing, non-owning reference to a callable.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:434
llvm::cl::opt< bool > NoKernelInfoEndLTO
This file defines the TargetMachine class.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
Definition: PassManager.h:237
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:98
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition: CodeGen.h:83
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
BasicBlockSection
Definition: TargetOptions.h:61
GlobalISelAbortMode
Enable abort calls when global instruction selection fails to lower/select an instruction.
@ Enable
Enable colors.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.