clang 19.0.0git
TargetInfo.h
Go to the documentation of this file.
1//===---- TargetInfo.h - Encapsulate target details -------------*- 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// These classes wrap the information about a call or function
10// definition used to handle ABI compliancy.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
15#define LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
16
17#include "CGBuilder.h"
18#include "CodeGenModule.h"
19#include "CGValue.h"
20#include "clang/AST/Type.h"
21#include "clang/Basic/LLVM.h"
23#include "llvm/ADT/SmallString.h"
24#include "llvm/ADT/StringRef.h"
25
26namespace llvm {
27class Constant;
28class GlobalValue;
29class Type;
30class Value;
31}
32
33namespace clang {
34class Decl;
35
36namespace CodeGen {
37class ABIInfo;
38class CallArgList;
39class CodeGenFunction;
40class CGBlockInfo;
41class SwiftABIInfo;
42
43/// TargetCodeGenInfo - This class organizes various target-specific
44/// codegeneration issues, like target-specific attributes, builtins and so
45/// on.
47 std::unique_ptr<ABIInfo> Info;
48
49protected:
50 // Target hooks supporting Swift calling conventions. The target must
51 // initialize this field if it claims to support these calling conventions
52 // by returning true from TargetInfo::checkCallingConvention for them.
53 std::unique_ptr<SwiftABIInfo> SwiftInfo;
54
55 // Returns ABI info helper for the target. This is for use by derived classes.
56 template <typename T> const T &getABIInfo() const {
57 return static_cast<const T &>(*Info);
58 }
59
60public:
61 TargetCodeGenInfo(std::unique_ptr<ABIInfo> Info);
63
64 /// getABIInfo() - Returns ABI info helper for the target.
65 const ABIInfo &getABIInfo() const { return *Info; }
66
67 /// Returns Swift ABI info helper for the target.
69 assert(SwiftInfo && "Swift ABI info has not been initialized");
70 return *SwiftInfo;
71 }
72
73 /// setTargetAttributes - Provides a convenient hook to handle extra
74 /// target-specific attributes for the given global.
75 virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
76 CodeGen::CodeGenModule &M) const {}
77
78 /// emitTargetMetadata - Provides a convenient hook to handle extra
79 /// target-specific metadata for the given globals.
80 virtual void emitTargetMetadata(
82 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames) const {}
83
84 /// Provides a convenient hook to handle extra target-specific globals.
85 virtual void emitTargetGlobals(CodeGen::CodeGenModule &CGM) const {}
86
87 /// Any further codegen related checks that need to be done on a function
88 /// signature in a target specific manner.
90 const FunctionDecl *Decl) const {}
91
92 /// Any further codegen related checks that need to be done on a function call
93 /// in a target specific manner.
95 const FunctionDecl *Caller,
96 const FunctionDecl *Callee,
97 const CallArgList &Args,
98 QualType ReturnType) const {}
99
100 /// Determines the size of struct _Unwind_Exception on this platform,
101 /// in 8-bit units. The Itanium ABI defines this as:
102 /// struct _Unwind_Exception {
103 /// uint64 exception_class;
104 /// _Unwind_Exception_Cleanup_Fn exception_cleanup;
105 /// uint64 private_1;
106 /// uint64 private_2;
107 /// };
108 virtual unsigned getSizeOfUnwindException() const;
109
110 /// Controls whether __builtin_extend_pointer should sign-extend
111 /// pointers to uint64_t or zero-extend them (the default). Has
112 /// no effect for targets:
113 /// - that have 64-bit pointers, or
114 /// - that cannot address through registers larger than pointers, or
115 /// - that implicitly ignore/truncate the top bits when addressing
116 /// through such registers.
117 virtual bool extendPointerWithSExt() const { return false; }
118
119 /// Determines the DWARF register number for the stack pointer, for
120 /// exception-handling purposes. Implements __builtin_dwarf_sp_column.
121 ///
122 /// Returns -1 if the operation is unsupported by this target.
124 return -1;
125 }
126
127 /// Initializes the given DWARF EH register-size table, a char*.
128 /// Implements __builtin_init_dwarf_reg_size_table.
129 ///
130 /// Returns true if the operation is unsupported by this target.
132 llvm::Value *Address) const {
133 return true;
134 }
135
136 /// Performs the code-generation required to convert a return
137 /// address as stored by the system into the actual address of the
138 /// next instruction that will be executed.
139 ///
140 /// Used by __builtin_extract_return_addr().
142 llvm::Value *Address) const {
143 return Address;
144 }
145
146 /// Performs the code-generation required to convert the address
147 /// of an instruction into a return address suitable for storage
148 /// by the system in a return slot.
149 ///
150 /// Used by __builtin_frob_return_addr().
152 llvm::Value *Address) const {
153 return Address;
154 }
155
156 /// Performs a target specific test of a floating point value for things
157 /// like IsNaN, Infinity, ... Nullptr is returned if no implementation
158 /// exists.
159 virtual llvm::Value *
160 testFPKind(llvm::Value *V, unsigned BuiltinID, CGBuilderTy &Builder,
161 CodeGenModule &CGM) const {
162 assert(V->getType()->isFloatingPointTy() && "V should have an FP type.");
163 return nullptr;
164 }
165
166 /// Corrects the low-level LLVM type for a given constraint and "usual"
167 /// type.
168 ///
169 /// \returns A pointer to a new LLVM type, possibly the same as the original
170 /// on success; 0 on failure.
172 StringRef Constraint,
173 llvm::Type *Ty) const {
174 return Ty;
175 }
176
177 /// Target hook to decide whether an inline asm operand can be passed
178 /// by value.
180 llvm::Type *Ty) const {
181 return false;
182 }
183
184 /// Adds constraints and types for result registers.
187 std::string &Constraints, std::vector<llvm::Type *> &ResultRegTypes,
188 std::vector<llvm::Type *> &ResultTruncRegTypes,
189 std::vector<CodeGen::LValue> &ResultRegDests, std::string &AsmString,
190 unsigned NumOutputs) const {}
191
192 /// doesReturnSlotInterfereWithArgs - Return true if the target uses an
193 /// argument slot for an 'sret' type.
194 virtual bool doesReturnSlotInterfereWithArgs() const { return true; }
195
196 /// Retrieve the address of a function to call immediately before
197 /// calling objc_retainAutoreleasedReturnValue. The
198 /// implementation of objc_autoreleaseReturnValue sniffs the
199 /// instruction stream following its return address to decide
200 /// whether it's a call to objc_retainAutoreleasedReturnValue.
201 /// This can be prohibitively expensive, depending on the
202 /// relocation model, and so on some targets it instead sniffs for
203 /// a particular instruction sequence. This functions returns
204 /// that instruction sequence in inline assembly, which will be
205 /// empty if none is required.
207 return "";
208 }
209
210 /// Determine whether a call to objc_retainAutoreleasedReturnValue or
211 /// objc_unsafeClaimAutoreleasedReturnValue should be marked as 'notail'.
212 virtual bool markARCOptimizedReturnCallsAsNoTail() const { return false; }
213
214 /// Return a constant used by UBSan as a signature to identify functions
215 /// possessing type information, or 0 if the platform is unsupported.
216 /// This magic number is invalid instruction encoding in many targets.
217 virtual llvm::Constant *
219 return llvm::ConstantInt::get(CGM.Int32Ty, 0xc105cafe);
220 }
221
222 /// Determine whether a call to an unprototyped functions under
223 /// the given calling convention should use the variadic
224 /// convention or the non-variadic convention.
225 ///
226 /// There's a good reason to make a platform's variadic calling
227 /// convention be different from its non-variadic calling
228 /// convention: the non-variadic arguments can be passed in
229 /// registers (better for performance), and the variadic arguments
230 /// can be passed on the stack (also better for performance). If
231 /// this is done, however, unprototyped functions *must* use the
232 /// non-variadic convention, because C99 states that a call
233 /// through an unprototyped function type must succeed if the
234 /// function was defined with a non-variadic prototype with
235 /// compatible parameters. Therefore, splitting the conventions
236 /// makes it impossible to call a variadic function through an
237 /// unprototyped type. Since function prototypes came out in the
238 /// late 1970s, this is probably an acceptable trade-off.
239 /// Nonetheless, not all platforms are willing to make it, and in
240 /// particularly x86-64 bends over backwards to make the
241 /// conventions compatible.
242 ///
243 /// The default is false. This is correct whenever:
244 /// - the conventions are exactly the same, because it does not
245 /// matter and the resulting IR will be somewhat prettier in
246 /// certain cases; or
247 /// - the conventions are substantively different in how they pass
248 /// arguments, because in this case using the variadic convention
249 /// will lead to C99 violations.
250 ///
251 /// However, some platforms make the conventions identical except
252 /// for passing additional out-of-band information to a variadic
253 /// function: for example, x86-64 passes the number of SSE
254 /// arguments in %al. On these platforms, it is desirable to
255 /// call unprototyped functions using the variadic convention so
256 /// that unprototyped calls to varargs functions still succeed.
257 ///
258 /// Relatedly, platforms which pass the fixed arguments to this:
259 /// A foo(B, C, D);
260 /// differently than they would pass them to this:
261 /// A foo(B, C, D, ...);
262 /// may need to adjust the debugger-support code in Sema to do the
263 /// right thing when calling a function with no know signature.
264 virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args,
265 const FunctionNoProtoType *fnType) const;
266
267 /// Gets the linker options necessary to link a dependent library on this
268 /// platform.
269 virtual void getDependentLibraryOption(llvm::StringRef Lib,
270 llvm::SmallString<24> &Opt) const;
271
272 /// Gets the linker options necessary to detect object file mismatches on
273 /// this platform.
274 virtual void getDetectMismatchOption(llvm::StringRef Name,
275 llvm::StringRef Value,
276 llvm::SmallString<32> &Opt) const {}
277
278 /// Get LLVM calling convention for OpenCL kernel.
279 virtual unsigned getOpenCLKernelCallingConv() const;
280
281 /// Get target specific null pointer.
282 /// \param T is the LLVM type of the null pointer.
283 /// \param QT is the clang QualType of the null pointer.
284 /// \return ConstantPointerNull with the given type \p T.
285 /// Each target can override it to return its own desired constant value.
286 virtual llvm::Constant *getNullPointer(const CodeGen::CodeGenModule &CGM,
287 llvm::PointerType *T, QualType QT) const;
288
289 /// Get target favored AST address space of a global variable for languages
290 /// other than OpenCL and CUDA.
291 /// If \p D is nullptr, returns the default target favored address space
292 /// for global variable.
294 const VarDecl *D) const;
295
296 /// Get the AST address space for alloca.
298
300 LangAS SrcAddr, LangAS DestAddr,
301 llvm::Type *DestTy,
302 bool IsNonNull = false) const;
303
304 /// Perform address space cast of an expression of pointer type.
305 /// \param V is the LLVM value to be casted to another address space.
306 /// \param SrcAddr is the language address space of \p V.
307 /// \param DestAddr is the targeted language address space.
308 /// \param DestTy is the destination LLVM pointer type.
309 /// \param IsNonNull is the flag indicating \p V is known to be non null.
310 virtual llvm::Value *performAddrSpaceCast(CodeGen::CodeGenFunction &CGF,
311 llvm::Value *V, LangAS SrcAddr,
312 LangAS DestAddr, llvm::Type *DestTy,
313 bool IsNonNull = false) const;
314
315 /// Perform address space cast of a constant expression of pointer type.
316 /// \param V is the LLVM constant to be casted to another address space.
317 /// \param SrcAddr is the language address space of \p V.
318 /// \param DestAddr is the targeted language address space.
319 /// \param DestTy is the destination LLVM pointer type.
320 virtual llvm::Constant *performAddrSpaceCast(CodeGenModule &CGM,
321 llvm::Constant *V,
322 LangAS SrcAddr, LangAS DestAddr,
323 llvm::Type *DestTy) const;
324
325 /// Get address space of pointer parameter for __cxa_atexit.
327 return LangAS::Default;
328 }
329
330 /// Get the syncscope used in LLVM IR.
331 virtual llvm::SyncScope::ID getLLVMSyncScopeID(const LangOptions &LangOpts,
333 llvm::AtomicOrdering Ordering,
334 llvm::LLVMContext &Ctx) const;
335
336 /// Interface class for filling custom fields of a block literal for OpenCL.
338 public:
339 typedef std::pair<llvm::Value *, StringRef> ValueTy;
342 /// Get the custom field types for OpenCL blocks.
344 /// Get the custom field values for OpenCL blocks.
347 virtual bool areAllCustomFieldValuesConstant(const CGBlockInfo &Info) = 0;
348 /// Get the custom field values for OpenCL blocks if all values are LLVM
349 /// constants.
352 };
354 return nullptr;
355 }
356
357 /// Create an OpenCL kernel for an enqueued block. The kernel function is
358 /// a wrapper for the block invoke function with target-specific calling
359 /// convention and ABI as an OpenCL kernel. The wrapper function accepts
360 /// block context and block arguments in target-specific way and calls
361 /// the original block invoke function.
362 virtual llvm::Value *
364 llvm::Function *BlockInvokeFunc,
365 llvm::Type *BlockTy) const;
366
367 /// \return true if the target supports alias from the unmangled name to the
368 /// mangled name of functions declared within an extern "C" region and marked
369 /// as 'used', and having internal linkage.
370 virtual bool shouldEmitStaticExternCAliases() const { return true; }
371
372 /// \return true if annonymous zero-sized bitfields should be emitted to
373 /// correctly distinguish between struct types whose memory layout is the
374 /// same, but whose layout may differ when used as argument passed by value
375 virtual bool shouldEmitDWARFBitFieldSeparators() const { return false; }
376
377 virtual void setCUDAKernelCallingConvention(const FunctionType *&FT) const {}
378
379 /// Return the device-side type for the CUDA device builtin surface type.
380 virtual llvm::Type *getCUDADeviceBuiltinSurfaceDeviceType() const {
381 // By default, no change from the original one.
382 return nullptr;
383 }
384 /// Return the device-side type for the CUDA device builtin texture type.
385 virtual llvm::Type *getCUDADeviceBuiltinTextureDeviceType() const {
386 // By default, no change from the original one.
387 return nullptr;
388 }
389
390 /// Return the WebAssembly externref reference type.
391 virtual llvm::Type *getWasmExternrefReferenceType() const { return nullptr; }
392
393 /// Return the WebAssembly funcref reference type.
394 virtual llvm::Type *getWasmFuncrefReferenceType() const { return nullptr; }
395
396 /// Emit the device-side copy of the builtin surface type.
398 LValue Dst,
399 LValue Src) const {
400 // DO NOTHING by default.
401 return false;
402 }
403 /// Emit the device-side copy of the builtin texture type.
405 LValue Dst,
406 LValue Src) const {
407 // DO NOTHING by default.
408 return false;
409 }
410
411 /// Return an LLVM type that corresponds to an OpenCL type.
412 virtual llvm::Type *getOpenCLType(CodeGenModule &CGM, const Type *T) const {
413 return nullptr;
414 }
415
416protected:
417 static std::string qualifyWindowsLibrary(StringRef Lib);
418
419 void addStackProbeTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
420 CodeGen::CodeGenModule &CGM) const;
421};
422
423std::unique_ptr<TargetCodeGenInfo>
424createDefaultTargetCodeGenInfo(CodeGenModule &CGM);
425
426enum class AArch64ABIKind {
427 AAPCS = 0,
428 DarwinPCS,
429 Win64,
430 AAPCSSoft,
431};
432
433std::unique_ptr<TargetCodeGenInfo>
434createAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind Kind);
435
436std::unique_ptr<TargetCodeGenInfo>
438
439std::unique_ptr<TargetCodeGenInfo>
440createAMDGPUTargetCodeGenInfo(CodeGenModule &CGM);
441
442std::unique_ptr<TargetCodeGenInfo>
443createARCTargetCodeGenInfo(CodeGenModule &CGM);
444
445enum class ARMABIKind {
446 APCS = 0,
447 AAPCS = 1,
448 AAPCS_VFP = 2,
449 AAPCS16_VFP = 3,
450};
451
452std::unique_ptr<TargetCodeGenInfo>
453createARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind Kind);
454
455std::unique_ptr<TargetCodeGenInfo>
456createWindowsARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind K);
457
458std::unique_ptr<TargetCodeGenInfo>
459createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR);
460
461std::unique_ptr<TargetCodeGenInfo>
462createBPFTargetCodeGenInfo(CodeGenModule &CGM);
463
464std::unique_ptr<TargetCodeGenInfo>
465createCSKYTargetCodeGenInfo(CodeGenModule &CGM, unsigned FLen);
466
467std::unique_ptr<TargetCodeGenInfo>
468createHexagonTargetCodeGenInfo(CodeGenModule &CGM);
469
470std::unique_ptr<TargetCodeGenInfo>
471createLanaiTargetCodeGenInfo(CodeGenModule &CGM);
472
473std::unique_ptr<TargetCodeGenInfo>
474createLoongArchTargetCodeGenInfo(CodeGenModule &CGM, unsigned GRLen,
475 unsigned FLen);
476
477std::unique_ptr<TargetCodeGenInfo>
478createM68kTargetCodeGenInfo(CodeGenModule &CGM);
479
480std::unique_ptr<TargetCodeGenInfo>
481createMIPSTargetCodeGenInfo(CodeGenModule &CGM, bool IsOS32);
482
483std::unique_ptr<TargetCodeGenInfo>
484createMSP430TargetCodeGenInfo(CodeGenModule &CGM);
485
486std::unique_ptr<TargetCodeGenInfo>
487createNVPTXTargetCodeGenInfo(CodeGenModule &CGM);
488
489std::unique_ptr<TargetCodeGenInfo>
490createPNaClTargetCodeGenInfo(CodeGenModule &CGM);
491
493 ELFv1 = 0,
494 ELFv2,
495};
496
497std::unique_ptr<TargetCodeGenInfo>
498createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit);
499
500std::unique_ptr<TargetCodeGenInfo>
501createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI);
502
503std::unique_ptr<TargetCodeGenInfo>
504createPPC64TargetCodeGenInfo(CodeGenModule &CGM);
505
506std::unique_ptr<TargetCodeGenInfo>
508 bool SoftFloatABI);
509
510std::unique_ptr<TargetCodeGenInfo>
511createRISCVTargetCodeGenInfo(CodeGenModule &CGM, unsigned XLen, unsigned FLen,
512 bool EABI);
513
514std::unique_ptr<TargetCodeGenInfo>
515createCommonSPIRTargetCodeGenInfo(CodeGenModule &CGM);
516
517std::unique_ptr<TargetCodeGenInfo>
518createSPIRVTargetCodeGenInfo(CodeGenModule &CGM);
519
520std::unique_ptr<TargetCodeGenInfo>
521createSparcV8TargetCodeGenInfo(CodeGenModule &CGM);
522
523std::unique_ptr<TargetCodeGenInfo>
524createSparcV9TargetCodeGenInfo(CodeGenModule &CGM);
525
526std::unique_ptr<TargetCodeGenInfo>
527createSystemZTargetCodeGenInfo(CodeGenModule &CGM, bool HasVector,
528 bool SoftFloatABI);
529
530std::unique_ptr<TargetCodeGenInfo>
531createTCETargetCodeGenInfo(CodeGenModule &CGM);
532
533std::unique_ptr<TargetCodeGenInfo>
534createVETargetCodeGenInfo(CodeGenModule &CGM);
535
537 MVP = 0,
538 ExperimentalMV = 1,
539};
540
541std::unique_ptr<TargetCodeGenInfo>
543
544/// The AVX ABI level for X86 targets.
545enum class X86AVXABILevel {
546 None,
547 AVX,
548 AVX512,
549};
550
551std::unique_ptr<TargetCodeGenInfo> createX86_32TargetCodeGenInfo(
552 CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI,
553 unsigned NumRegisterParameters, bool SoftFloatABI);
554
555std::unique_ptr<TargetCodeGenInfo>
556createWinX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI,
557 bool Win32StructABI,
558 unsigned NumRegisterParameters);
559
560std::unique_ptr<TargetCodeGenInfo>
561createX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel);
562
563std::unique_ptr<TargetCodeGenInfo>
564createWinX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel);
565
566std::unique_ptr<TargetCodeGenInfo>
567createXCoreTargetCodeGenInfo(CodeGenModule &CGM);
568
569} // namespace CodeGen
570} // namespace clang
571
572#endif // LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
#define V(N, I)
Definition: ASTContext.h:3294
MatchType Type
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Provides definitions for the atomic synchronization scopes.
C Language Family Type Representation.
ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.
Definition: ABIInfo.h:45
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
Definition: Address.h:111
CGBlockInfo - Information to generate a block literal.
Definition: CGBlocks.h:156
CallArgList - Type for representing both the value and type of arguments in a call.
Definition: CGCall.h:258
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
This class organizes the cross-function state that is used while generating LLVM code.
LValue - This represents an lvalue references.
Definition: CGValue.h:181
Target specific hooks for defining how a type should be passed or returned from functions with one of...
Definition: ABIInfo.h:128
Interface class for filling custom fields of a block literal for OpenCL.
Definition: TargetInfo.h:337
virtual llvm::SmallVector< llvm::Type *, 1 > getCustomFieldTypes()=0
Get the custom field types for OpenCL blocks.
virtual llvm::SmallVector< llvm::Constant *, 1 > getCustomFieldValues(CodeGenModule &CGM, const CGBlockInfo &Info)=0
Get the custom field values for OpenCL blocks if all values are LLVM constants.
virtual bool areAllCustomFieldValuesConstant(const CGBlockInfo &Info)=0
virtual llvm::SmallVector< ValueTy, 1 > getCustomFieldValues(CodeGenFunction &CGF, const CGBlockInfo &Info)=0
Get the custom field values for OpenCL blocks.
std::pair< llvm::Value *, StringRef > ValueTy
Definition: TargetInfo.h:339
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
Definition: TargetInfo.h:46
virtual void addReturnRegisterOutputs(CodeGen::CodeGenFunction &CGF, CodeGen::LValue ReturnValue, std::string &Constraints, std::vector< llvm::Type * > &ResultRegTypes, std::vector< llvm::Type * > &ResultTruncRegTypes, std::vector< CodeGen::LValue > &ResultRegDests, std::string &AsmString, unsigned NumOutputs) const
Adds constraints and types for result registers.
Definition: TargetInfo.h:185
virtual bool emitCUDADeviceBuiltinSurfaceDeviceCopy(CodeGenFunction &CGF, LValue Dst, LValue Src) const
Emit the device-side copy of the builtin surface type.
Definition: TargetInfo.h:397
virtual llvm::Type * getWasmFuncrefReferenceType() const
Return the WebAssembly funcref reference type.
Definition: TargetInfo.h:394
virtual unsigned getSizeOfUnwindException() const
Determines the size of struct _Unwind_Exception on this platform, in 8-bit units.
Definition: TargetInfo.cpp:76
virtual llvm::Type * getWasmExternrefReferenceType() const
Return the WebAssembly externref reference type.
Definition: TargetInfo.h:391
virtual llvm::Type * getOpenCLType(CodeGenModule &CGM, const Type *T) const
Return an LLVM type that corresponds to an OpenCL type.
Definition: TargetInfo.h:412
virtual bool emitCUDADeviceBuiltinTextureDeviceCopy(CodeGenFunction &CGF, LValue Dst, LValue Src) const
Emit the device-side copy of the builtin texture type.
Definition: TargetInfo.h:404
virtual bool doesReturnSlotInterfereWithArgs() const
doesReturnSlotInterfereWithArgs - Return true if the target uses an argument slot for an 'sret' type.
Definition: TargetInfo.h:194
std::unique_ptr< SwiftABIInfo > SwiftInfo
Definition: TargetInfo.h:53
virtual void setCUDAKernelCallingConvention(const FunctionType *&FT) const
Definition: TargetInfo.h:377
virtual llvm::Type * getCUDADeviceBuiltinSurfaceDeviceType() const
Return the device-side type for the CUDA device builtin surface type.
Definition: TargetInfo.h:380
virtual llvm::Type * adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, StringRef Constraint, llvm::Type *Ty) const
Corrects the low-level LLVM type for a given constraint and "usual" type.
Definition: TargetInfo.h:171
virtual void getDependentLibraryOption(llvm::StringRef Lib, llvm::SmallString< 24 > &Opt) const
Gets the linker options necessary to link a dependent library on this platform.
Definition: TargetInfo.cpp:96
virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const
Retrieve the address of a function to call immediately before calling objc_retainAutoreleasedReturnVa...
Definition: TargetInfo.h:206
const SwiftABIInfo & getSwiftABIInfo() const
Returns Swift ABI info helper for the target.
Definition: TargetInfo.h:68
Address performAddrSpaceCast(CodeGen::CodeGenFunction &CGF, Address Addr, LangAS SrcAddr, LangAS DestAddr, llvm::Type *DestTy, bool IsNonNull=false) const
virtual llvm::Value * encodeReturnAddress(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
Performs the code-generation required to convert the address of an instruction into a return address ...
Definition: TargetInfo.h:151
virtual llvm::SyncScope::ID getLLVMSyncScopeID(const LangOptions &LangOpts, SyncScope Scope, llvm::AtomicOrdering Ordering, llvm::LLVMContext &Ctx) const
Get the syncscope used in LLVM IR.
Definition: TargetInfo.cpp:154
virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc, const FunctionDecl *Caller, const FunctionDecl *Callee, const CallArgList &Args, QualType ReturnType) const
Any further codegen related checks that need to be done on a function call in a target specific manne...
Definition: TargetInfo.h:94
virtual llvm::Value * decodeReturnAddress(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
Performs the code-generation required to convert a return address as stored by the system into the ac...
Definition: TargetInfo.h:141
virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
Initializes the given DWARF EH register-size table, a char*.
Definition: TargetInfo.h:131
const T & getABIInfo() const
Definition: TargetInfo.h:56
virtual unsigned getOpenCLKernelCallingConv() const
Get LLVM calling convention for OpenCL kernel.
Definition: TargetInfo.cpp:105
virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM, const VarDecl *D) const
Get target favored AST address space of a global variable for languages other than OpenCL and CUDA.
Definition: TargetInfo.cpp:124
virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const
setTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the g...
Definition: TargetInfo.h:75
virtual llvm::Type * getCUDADeviceBuiltinTextureDeviceType() const
Return the device-side type for the CUDA device builtin texture type.
Definition: TargetInfo.h:385
virtual void checkFunctionABI(CodeGenModule &CGM, const FunctionDecl *Decl) const
Any further codegen related checks that need to be done on a function signature in a target specific ...
Definition: TargetInfo.h:89
virtual bool isScalarizableAsmOperand(CodeGen::CodeGenFunction &CGF, llvm::Type *Ty) const
Target hook to decide whether an inline asm operand can be passed by value.
Definition: TargetInfo.h:179
static std::string qualifyWindowsLibrary(StringRef Lib)
Definition: X86.cpp:1613
void addStackProbeTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const
Definition: TargetInfo.cpp:161
const ABIInfo & getABIInfo() const
getABIInfo() - Returns ABI info helper for the target.
Definition: TargetInfo.h:65
virtual bool shouldEmitDWARFBitFieldSeparators() const
Definition: TargetInfo.h:375
virtual LangAS getAddrSpaceOfCxaAtexitPtrParam() const
Get address space of pointer parameter for __cxa_atexit.
Definition: TargetInfo.h:326
virtual bool extendPointerWithSExt() const
Controls whether __builtin_extend_pointer should sign-extend pointers to uint64_t or zero-extend them...
Definition: TargetInfo.h:117
virtual llvm::Constant * getNullPointer(const CodeGen::CodeGenModule &CGM, llvm::PointerType *T, QualType QT) const
Get target specific null pointer.
Definition: TargetInfo.cpp:119
virtual TargetOpenCLBlockHelper * getTargetOpenCLBlockHelper() const
Definition: TargetInfo.h:353
virtual LangAS getASTAllocaAddressSpace() const
Get the AST address space for alloca.
Definition: TargetInfo.h:297
virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const
Determines the DWARF register number for the stack pointer, for exception-handling purposes.
Definition: TargetInfo.h:123
virtual void emitTargetMetadata(CodeGen::CodeGenModule &CGM, const llvm::MapVector< GlobalDecl, StringRef > &MangledDeclNames) const
emitTargetMetadata - Provides a convenient hook to handle extra target-specific metadata for the give...
Definition: TargetInfo.h:80
virtual llvm::Value * createEnqueuedBlockKernel(CodeGenFunction &CGF, llvm::Function *BlockInvokeFunc, llvm::Type *BlockTy) const
Create an OpenCL kernel for an enqueued block.
Definition: TargetInfo.cpp:177
virtual llvm::Value * testFPKind(llvm::Value *V, unsigned BuiltinID, CGBuilderTy &Builder, CodeGenModule &CGM) const
Performs a target specific test of a floating point value for things like IsNaN, Infinity,...
Definition: TargetInfo.h:160
virtual bool markARCOptimizedReturnCallsAsNoTail() const
Determine whether a call to objc_retainAutoreleasedReturnValue or objc_unsafeClaimAutoreleasedReturnV...
Definition: TargetInfo.h:212
virtual void emitTargetGlobals(CodeGen::CodeGenModule &CGM) const
Provides a convenient hook to handle extra target-specific globals.
Definition: TargetInfo.h:85
virtual void getDetectMismatchOption(llvm::StringRef Name, llvm::StringRef Value, llvm::SmallString< 32 > &Opt) const
Gets the linker options necessary to detect object file mismatches on this platform.
Definition: TargetInfo.h:274
virtual llvm::Constant * getUBSanFunctionSignature(CodeGen::CodeGenModule &CGM) const
Return a constant used by UBSan as a signature to identify functions possessing type information,...
Definition: TargetInfo.h:218
virtual bool shouldEmitStaticExternCAliases() const
Definition: TargetInfo.h:370
virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args, const FunctionNoProtoType *fnType) const
Determine whether a call to an unprototyped functions under the given calling convention should use t...
Definition: TargetInfo.cpp:86
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
Represents a function declaration or definition.
Definition: Decl.h:1971
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Definition: Type.h:4627
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:4272
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:461
A (possibly-)qualified type.
Definition: Type.h:940
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
Encodes a location in the source.
The base class of the type hierarchy.
Definition: Type.h:1827
Represents a variable declaration or definition.
Definition: Decl.h:918
std::unique_ptr< TargetCodeGenInfo > createARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind Kind)
Definition: ARM.cpp:806
std::unique_ptr< TargetCodeGenInfo > createM68kTargetCodeGenInfo(CodeGenModule &CGM)
Definition: M68k.cpp:53
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
std::unique_ptr< TargetCodeGenInfo > createBPFTargetCodeGenInfo(CodeGenModule &CGM)
Definition: BPF.cpp:98
std::unique_ptr< TargetCodeGenInfo > createMSP430TargetCodeGenInfo(CodeGenModule &CGM)
Definition: MSP430.cpp:92
std::unique_ptr< TargetCodeGenInfo > createX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel)
Definition: X86.cpp:3447
std::unique_ptr< TargetCodeGenInfo > createWebAssemblyTargetCodeGenInfo(CodeGenModule &CGM, WebAssemblyABIKind K)
std::unique_ptr< TargetCodeGenInfo > createPPC64_SVR4_TargetCodeGenInfo(CodeGenModule &CGM, PPC64_SVR4_ABIKind Kind, bool SoftFloatABI)
Definition: PPC.cpp:1049
std::unique_ptr< TargetCodeGenInfo > createMIPSTargetCodeGenInfo(CodeGenModule &CGM, bool IsOS32)
Definition: Mips.cpp:439
std::unique_ptr< TargetCodeGenInfo > createHexagonTargetCodeGenInfo(CodeGenModule &CGM)
Definition: Hexagon.cpp:421
std::unique_ptr< TargetCodeGenInfo > createNVPTXTargetCodeGenInfo(CodeGenModule &CGM)
Definition: NVPTX.cpp:358
std::unique_ptr< TargetCodeGenInfo > createSystemZTargetCodeGenInfo(CodeGenModule &CGM, bool HasVector, bool SoftFloatABI)
Definition: SystemZ.cpp:533
std::unique_ptr< TargetCodeGenInfo > createWinX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI, unsigned NumRegisterParameters)
Definition: X86.cpp:3436
std::unique_ptr< TargetCodeGenInfo > createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit)
Definition: PPC.cpp:1032
std::unique_ptr< TargetCodeGenInfo > createAMDGPUTargetCodeGenInfo(CodeGenModule &CGM)
Definition: AMDGPU.cpp:692
X86AVXABILevel
The AVX ABI level for X86 targets.
Definition: TargetInfo.h:545
std::unique_ptr< TargetCodeGenInfo > createTCETargetCodeGenInfo(CodeGenModule &CGM)
Definition: TCE.cpp:80
std::unique_ptr< TargetCodeGenInfo > createWindowsARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind K)
Definition: ARM.cpp:811
std::unique_ptr< TargetCodeGenInfo > createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR)
Definition: AVR.cpp:151
std::unique_ptr< TargetCodeGenInfo > createARCTargetCodeGenInfo(CodeGenModule &CGM)
Definition: ARC.cpp:156
std::unique_ptr< TargetCodeGenInfo > createDefaultTargetCodeGenInfo(CodeGenModule &CGM)
Definition: TargetInfo.cpp:218
std::unique_ptr< TargetCodeGenInfo > createAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind Kind)
Definition: AArch64.cpp:971
std::unique_ptr< TargetCodeGenInfo > createSPIRVTargetCodeGenInfo(CodeGenModule &CGM)
Definition: SPIR.cpp:216
std::unique_ptr< TargetCodeGenInfo > createSparcV8TargetCodeGenInfo(CodeGenModule &CGM)
Definition: Sparc.cpp:406
std::unique_ptr< TargetCodeGenInfo > createVETargetCodeGenInfo(CodeGenModule &CGM)
Definition: VE.cpp:69
std::unique_ptr< TargetCodeGenInfo > createCommonSPIRTargetCodeGenInfo(CodeGenModule &CGM)
Definition: SPIR.cpp:211
std::unique_ptr< TargetCodeGenInfo > createRISCVTargetCodeGenInfo(CodeGenModule &CGM, unsigned XLen, unsigned FLen, bool EABI)
Definition: RISCV.cpp:560
std::unique_ptr< TargetCodeGenInfo > createWindowsAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind K)
Definition: AArch64.cpp:977
std::unique_ptr< TargetCodeGenInfo > createSparcV9TargetCodeGenInfo(CodeGenModule &CGM)
Definition: Sparc.cpp:411
std::unique_ptr< TargetCodeGenInfo > createPNaClTargetCodeGenInfo(CodeGenModule &CGM)
Definition: PNaCl.cpp:107
std::unique_ptr< TargetCodeGenInfo > createX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI, unsigned NumRegisterParameters, bool SoftFloatABI)
Definition: X86.cpp:3426
std::unique_ptr< TargetCodeGenInfo > createLanaiTargetCodeGenInfo(CodeGenModule &CGM)
Definition: Lanai.cpp:152
std::unique_ptr< TargetCodeGenInfo > createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI)
Definition: PPC.cpp:1037
std::unique_ptr< TargetCodeGenInfo > createLoongArchTargetCodeGenInfo(CodeGenModule &CGM, unsigned GRLen, unsigned FLen)
Definition: LoongArch.cpp:457
std::unique_ptr< TargetCodeGenInfo > createPPC64TargetCodeGenInfo(CodeGenModule &CGM)
Definition: PPC.cpp:1045
std::unique_ptr< TargetCodeGenInfo > createWinX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel)
Definition: X86.cpp:3453
std::unique_ptr< TargetCodeGenInfo > createXCoreTargetCodeGenInfo(CodeGenModule &CGM)
Definition: XCore.cpp:660
std::unique_ptr< TargetCodeGenInfo > createCSKYTargetCodeGenInfo(CodeGenModule &CGM, unsigned FLen)
Definition: CSKY.cpp:173
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
const FunctionProtoType * T
SyncScope
Defines synch scope values used internally by clang.
Definition: SyncScope.h:42
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30