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