LLVM: include/llvm/Target/TargetMachine.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_TARGET_TARGETMACHINE_H
14#define LLVM_TARGET_TARGETMACHINE_H
15
28#include
29#include
30#include
31
32namespace llvm {
33
35
38
65
66
69}
71
73namespace yaml {
75}
76
77
78
79
80
81
82
84protected:
88
89
91
92
93
94
95
96
97
99
100
101
105
110
111
116
119
120
122
123public:
125
129
131
136
137
138
140 return nullptr;
141 }
143 return nullptr;
144 }
145
146
150 return nullptr;
151 }
152
153
154
155
156
157
158
159
160
161
162
165 return nullptr;
166 }
167
168
169
172 return nullptr;
173 }
174
175
176
178 return nullptr;
179 }
180
181
182
185 return nullptr;
186 }
187
188
192 SMRange &SourceRange) const {
193 return false;
194 }
195
196
197
198
202
203
205
206
207
208
209
210
212 return DL == Candidate;
213 }
214
215
216
217
219 return DL.getPointerSize(AS);
220 }
221
223 return DL.getPointerSizeInBits(AS);
224 }
225
227 return DL.getPointerSize(DL.getProgramAddressSpace());
228 }
229
231 return DL.getPointerSize(DL.getAllocaAddrSpace());
232 }
233
234
235
236
237 void resetTargetOptions(const Function &F) const;
238
239
241
245
246
247
249
252 : Options.ExceptionModel;
253 }
254
257
258
259
261
262
263
265
266
267 uint64_t getMaxCodeSize() const;
268
269
271
273 bool isLargeGlobalValue(const GlobalValue *GV) const;
274
275 bool isPositionIndependent() const;
276
277 bool shouldAssumeDSOLocal(const GlobalValue *GV) const;
278
279
280 bool useEmulatedTLS() const;
281
282
283 bool useTLSDESC() const;
284
285
287
288
290
291
293
310
312
314 return Options.EnableAIXExtendedAltivecABI;
315 }
316
318
319
321 return Options.UniqueBasicBlockSectionNames;
322 }
323
325 return Options.SeparateNamedSections;
326 }
327
328
329
331 return Options.DataSections;
332 }
333
334
335
337 return Options.FunctionSections;
338 }
339
341 return Options.EnableStaticDataPartitioning;
342 }
343
344
345
347 return Options.IgnoreXCOFFVisibility;
348 }
349
350
351
353
354
355
357 return Options.BBSections;
358 }
359
360
362 return Options.BBSectionsFuncListBuf.get();
363 }
364
365
369
372
373
374
375
376
377
378
380
381
382
383
384
385
386
387
388 virtual std::pair<const Value *, unsigned>
390 return std::make_pair(nullptr, -1);
391 }
392
393
394
395
396
397
399
400
401
402
403
405
406
407
409
410
411
412
414
415
416
418
419
420
421
422
423
424
425 virtual bool
428 bool = true,
430 return true;
431 }
432
433
434
435
436
437
440 bool = true) {
441 return true;
442 }
443
444
445
446
447
448
450
452 Mangler &Mang, bool MayAlwaysUsePrivate = false) const;
454
455
458
459 static std::pair<int, int> parseBinutilsVersion(StringRef Version);
460
461
462
466
467
468
469
470
471
472
473
474
475
477 Module &M, unsigned NumParts,
478 function_ref<void(std::unique_ptr MPart)> ModuleCallback) {
479 return false;
480 }
481
482
483
485 return nullptr;
486 }
487
495
496
497
498
499
501
502
503
509
513
514
515
516
517
518
519
521
522
523
524 virtual bool useIPRA() const { return false; }
525
526
527
529
530
532
533
534
535
536
541};
542
543}
544
545#endif
static MCStreamer * createMCStreamer(const Triple &T, MCContext &Context, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter)
This file defines the BumpPtrAllocator interface.
This header defines various interfaces for pass management in LLVM.
Define option tunables for PGO.
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
A manager for alias analyses.
A parsed version of the target data layout string in and methods for querying it.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Context object for machine code objects.
Interface to description of machine instruction set.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A Module instance is used to store all the information related to an LLVM module.
This class provides access to building LLVM's passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Manages a sequence of passes over a particular unit of IR.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Represents a range in source code.
A ScheduleDAG for scheduling lists of MachineInstr.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Analysis pass providing the TargetTransformInfo.
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
Definition TargetMachine.h:289
void setSupportsDebugEntryValues(bool Enable)
Definition TargetMachine.h:307
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
Definition TargetMachine.h:102
std::unique_ptr< const MCAsmInfo > AsmInfo
Contains target specific asm information.
Definition TargetMachine.h:112
ExceptionHandling getExceptionModel() const
Return the ExceptionHandling to use, considering TargetOptions and the Triple's default.
Definition TargetMachine.h:248
virtual unsigned getAddressSpaceForPseudoSourceKind(unsigned Kind) const
getAddressSpaceForPseudoSourceKind - Given the kind of memory (e.g.
Definition TargetMachine.h:463
virtual void registerEarlyDefaultAliasAnalyses(AAManager &)
Allow the target to register early alias analyses (AA before BasicAA) with the AAManager for use with...
Definition TargetMachine.h:413
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.
Definition TargetMachine.h:426
unsigned getAllocaPointerSize() const
Definition TargetMachine.h:230
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,...
Definition TargetMachine.h:389
virtual void registerPassBuilderCallbacks(PassBuilder &)
Allow the target to modify the pass pipeline.
Definition TargetMachine.h:408
virtual bool usesPhysRegsForValues() const
True if the target uses physical regs (as nearly all targets do).
Definition TargetMachine.h:520
bool getAIXExtendedAltivecABI() const
Definition TargetMachine.h:313
CodeModel::Model CMModel
Definition TargetMachine.h:107
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const
Returns true if a cast between SrcAS and DestAS is a noop.
Definition TargetMachine.h:366
virtual ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
Definition TargetMachine.h:171
virtual MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const
Create the target's instance of MachineFunctionInfo.
Definition TargetMachine.h:148
const Triple & getTargetTriple() const
Definition TargetMachine.h:132
virtual bool splitModule(Module &M, unsigned NumParts, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback)
Entry point for module splitting.
Definition TargetMachine.h:476
const DataLayout createDataLayout() const
Create a DataLayout.
Definition TargetMachine.h:204
void setMachineOutliner(bool Enable)
Definition TargetMachine.h:301
void setFastISel(bool Enable)
Definition TargetMachine.h:294
const std::optional< PGOOptions > & getPGOOption() const
Definition TargetMachine.h:371
uint64_t LargeDataThreshold
Definition TargetMachine.h:108
const MCSubtargetInfo * getMCSubtargetInfo() const
Definition TargetMachine.h:244
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...
Definition TargetMachine.h:504
bool getSeparateNamedSections() const
Definition TargetMachine.h:324
const MemoryBuffer * getBBSectionsFuncListBuf() const
Get the list of functions and basic block ids that need unique sections.
Definition TargetMachine.h:361
virtual unsigned getSjLjDataSize() const
Definition TargetMachine.h:457
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.
Definition TargetMachine.h:199
Reloc::Model RM
Definition TargetMachine.h:106
unsigned getPointerSizeInBits(unsigned AS) const
Definition TargetMachine.h:222
bool getIgnoreXCOFFVisibility() const
Return true if visibility attribute should not be emitted in XCOFF, corresponding to -mignore-xcoff-v...
Definition TargetMachine.h:346
virtual int unqualifiedInlineAsmVariant() const
The default variant to use in unqualified asm instructions.
Definition TargetMachine.h:528
void setCFIFixup(bool Enable)
Definition TargetMachine.h:311
bool getUniqueBasicBlockSectionNames() const
Return true if unique basic block section names must be generated.
Definition TargetMachine.h:320
bool getUniqueSectionNames() const
Definition TargetMachine.h:317
unsigned getPointerSize(unsigned AS) const
Get the pointer size for this target.
Definition TargetMachine.h:218
std::unique_ptr< const MCInstrInfo > MII
Definition TargetMachine.h:114
void setSupportsDefaultOutlining(bool Enable)
Definition TargetMachine.h:304
TargetMachine(const TargetMachine &)=delete
void setGlobalISelAbort(GlobalISelAbortMode Mode)
Definition TargetMachine.h:298
virtual unsigned getAssumedAddrSpace(const Value *V) const
If the specified generic pointer could be assumed as a pointer to a specific address space,...
Definition TargetMachine.h:379
virtual TargetLoweringObjectFile * getObjFileLowering() const
Definition TargetMachine.h:142
std::string TargetFS
Definition TargetMachine.h:104
std::optional< PGOOptions > PGOOption
Definition TargetMachine.h:121
virtual yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
Definition TargetMachine.h:184
bool getEnableStaticDataPartitioning() const
Definition TargetMachine.h:340
StringRef getTargetFeatureString() const
Definition TargetMachine.h:134
virtual Error buildCodeGenPipeline(ModulePassManager &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, const CGPassBuilderOption &, PassInstrumentationCallbacks *)
Definition TargetMachine.h:488
static constexpr unsigned DefaultSjLjDataSize
The integer bit size to use for SjLj based exception handling.
Definition TargetMachine.h:456
virtual bool targetSchedulesPostRAScheduling() const
True if subtarget inserts the final scheduling pass on its own.
Definition TargetMachine.h:449
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.
Definition TargetMachine.h:438
const DataLayout DL
DataLayout for the target: keep ABI type size and alignment.
Definition TargetMachine.h:98
StringRef getTargetCPU() const
Definition TargetMachine.h:133
const MCInstrInfo * getMCInstrInfo() const
Definition TargetMachine.h:243
unsigned O0WantsFastISel
Definition TargetMachine.h:118
void setOptLevel(CodeGenOptLevel Level)
Overrides the optimization level.
Definition TargetMachine.h:292
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
Definition TargetMachine.h:139
std::string TargetCPU
Definition TargetMachine.h:103
virtual ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
Definition TargetMachine.h:164
bool requiresStructuredCFG() const
Definition TargetMachine.h:255
void setRequiresStructuredCFG(bool Value)
Definition TargetMachine.h:256
virtual bool isMachineVerifierClean() const
Returns true if the target is expected to pass all machine verifier checks.
Definition TargetMachine.h:500
std::unique_ptr< const MCSubtargetInfo > STI
Definition TargetMachine.h:115
void setGlobalISel(bool Enable)
Definition TargetMachine.h:297
TargetOptions Options
Definition TargetMachine.h:124
virtual void registerDefaultAliasAnalyses(AAManager &)
Allow the target to register alias analyses with the AAManager for use with the new pass manager.
Definition TargetMachine.h:417
void setLargeDataThreshold(uint64_t LDT)
Definition TargetMachine.h:272
virtual void registerMachineRegisterInfoCallback(MachineFunction &MF) const
Definition TargetMachine.h:531
bool getO0WantsFastISel()
Definition TargetMachine.h:295
unsigned RequireStructuredCFG
Definition TargetMachine.h:117
void setO0WantsFastISel(bool Enable)
Definition TargetMachine.h:296
virtual yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
Definition TargetMachine.h:177
virtual size_t clearLinkerOptimizationHints(const SmallPtrSetImpl< MachineInstr * > &MIs) const
Remove all Linker Optimization Hints (LOH) associated with instructions in MIs and.
Definition TargetMachine.h:537
virtual TargetPassConfig * createPassConfig(PassManagerBase &PM)
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition TargetMachine.h:484
bool isCompatibleDataLayout(const DataLayout &Candidate) const
Test if a DataLayout if compatible with the CodeGen for this target.
Definition TargetMachine.h:211
void operator=(const TargetMachine &)=delete
unsigned getProgramPointerSize() const
Definition TargetMachine.h:226
bool getXCOFFTracebackTable() const
Return true if XCOFF traceback table should be emitted, corresponding to -xcoff-traceback-table.
Definition TargetMachine.h:352
bool getDataSections() const
Return true if data objects should be emitted into their own section, corresponds to -fdata-sections.
Definition TargetMachine.h:330
const Target & getTarget() const
Definition TargetMachine.h:130
void setTargetFeatureString(StringRef FS)
Definition TargetMachine.h:135
const Target & TheTarget
The Target that this machine was created for.
Definition TargetMachine.h:90
CodeModel::Model getCodeModel() const
Returns the code model.
Definition TargetMachine.h:264
const MCRegisterInfo * getMCRegisterInfo() const
Definition TargetMachine.h:242
virtual bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
Definition TargetMachine.h:189
virtual bool useIPRA() const
True if the target wants to use interprocedural register allocation by default.
Definition TargetMachine.h:524
void setCodeModel(CodeModel::Model CM)
Set the code model.
Definition TargetMachine.h:270
TargetMachine(const Target &T, StringRef DataLayoutString, const Triple &TargetTriple, StringRef CPU, StringRef FS, const TargetOptions &Options)
void setPGOOption(std::optional< PGOOptions > PGOOpt)
Definition TargetMachine.h:370
std::unique_ptr< const MCRegisterInfo > MRI
Definition TargetMachine.h:113
bool getFunctionSections() const
Return true if functions should be emitted into their own section, corresponding to -ffunction-sectio...
Definition TargetMachine.h:336
CodeGenOptLevel OptLevel
Definition TargetMachine.h:109
llvm::BasicBlockSection getBBSectionsType() const
If basic blocks should be emitted into their own section, corresponding to -fbasic-block-sections.
Definition TargetMachine.h:356
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
Definition TargetMachine.h:240
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.
LLVM Value Representation.
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.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
@ None
No exception support.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
CodeGenOptLevel
Code generation optimization level.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
LLVM_ABI llvm:🆑:opt< bool > NoKernelInfoEndLTO
GlobalISelAbortMode
Enable abort calls when global instruction selection fails to lower/select an instruction.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.