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" |
22 | #include "clang/Basic/SyncScope.h" |
23 | #include "clang/Basic/TargetInfo.h" |
24 | #include "llvm/ADT/SmallString.h" |
25 | #include "llvm/ADT/StringRef.h" |
26 | |
27 | namespace llvm { |
28 | class Constant; |
29 | class GlobalValue; |
30 | class Type; |
31 | class Value; |
32 | } |
33 | |
34 | namespace clang { |
35 | class Decl; |
36 | |
37 | namespace CodeGen { |
38 | class ABIInfo; |
39 | class CallArgList; |
40 | class CodeGenFunction; |
41 | class CGBlockInfo; |
42 | class SwiftABIInfo; |
43 | |
44 | /// TargetCodeGenInfo - This class organizes various target-specific |
45 | /// codegeneration issues, like target-specific attributes, builtins and so |
46 | /// on. |
47 | class TargetCodeGenInfo { |
48 | std::unique_ptr<ABIInfo> Info; |
49 | |
50 | protected: |
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 | |
61 | public: |
62 | TargetCodeGenInfo(std::unique_ptr<ABIInfo> Info); |
63 | virtual ~TargetCodeGenInfo(); |
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. |
69 | const SwiftABIInfo &getSwiftABIInfo() const { |
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( |
82 | CodeGen::CodeGenModule &CGM, |
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. |
90 | virtual void checkFunctionABI(CodeGenModule &CGM, |
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. |
95 | virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc, |
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. |
124 | virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const { |
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. |
132 | virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, |
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(). |
142 | virtual llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF, |
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(). |
152 | virtual llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF, |
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. |
172 | virtual llvm::Type *adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, |
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. |
180 | virtual bool isScalarizableAsmOperand(CodeGen::CodeGenFunction &CGF, |
181 | llvm::Type *Ty) const { |
182 | return false; |
183 | } |
184 | |
185 | /// Adds constraints and types for result registers. |
186 | virtual void addReturnRegisterOutputs( |
187 | CodeGen::CodeGenFunction &CGF, CodeGen::LValue ReturnValue, |
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. |
207 | virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const { |
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 * |
219 | getUBSanFunctionSignature(CodeGen::CodeGenModule &CGM) const { |
220 | return llvm::ConstantInt::get(Ty: CGM.Int32Ty, V: 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. |
294 | virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM, |
295 | const VarDecl *D) const; |
296 | |
297 | /// Get the AST address space for alloca. |
298 | virtual LangAS getASTAllocaAddressSpace() const { return LangAS::Default; } |
299 | |
300 | Address performAddrSpaceCast(CodeGen::CodeGenFunction &CGF, Address Addr, |
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. |
327 | virtual LangAS getAddrSpaceOfCxaAtexitPtrParam() const { |
328 | return LangAS::Default; |
329 | } |
330 | |
331 | /// Get the syncscope used in LLVM IR. |
332 | virtual llvm::SyncScope::ID getLLVMSyncScopeID(const LangOptions &LangOpts, |
333 | SyncScope Scope, |
334 | llvm::AtomicOrdering Ordering, |
335 | llvm::LLVMContext &Ctx) const; |
336 | |
337 | /// Interface class for filling custom fields of a block literal for OpenCL. |
338 | class TargetOpenCLBlockHelper { |
339 | public: |
340 | typedef std::pair<llvm::Value *, StringRef> ValueTy; |
341 | TargetOpenCLBlockHelper() {} |
342 | virtual ~TargetOpenCLBlockHelper() {} |
343 | /// Get the custom field types for OpenCL blocks. |
344 | virtual llvm::SmallVector<llvm::Type *, 1> getCustomFieldTypes() = 0; |
345 | /// Get the custom field values for OpenCL blocks. |
346 | virtual llvm::SmallVector<ValueTy, 1> |
347 | getCustomFieldValues(CodeGenFunction &CGF, const CGBlockInfo &Info) = 0; |
348 | virtual bool areAllCustomFieldValuesConstant(const CGBlockInfo &Info) = 0; |
349 | /// Get the custom field values for OpenCL blocks if all values are LLVM |
350 | /// constants. |
351 | virtual llvm::SmallVector<llvm::Constant *, 1> |
352 | getCustomFieldValues(CodeGenModule &CGM, const CGBlockInfo &Info) = 0; |
353 | }; |
354 | virtual TargetOpenCLBlockHelper *getTargetOpenCLBlockHelper() const { |
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 * |
364 | createEnqueuedBlockKernel(CodeGenFunction &CGF, |
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. |
398 | virtual bool emitCUDADeviceBuiltinSurfaceDeviceCopy(CodeGenFunction &CGF, |
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. |
405 | virtual bool emitCUDADeviceBuiltinTextureDeviceCopy(CodeGenFunction &CGF, |
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 | // Set the Branch Protection Attributes of the Function accordingly to the |
418 | // BPI. Remove attributes that contradict with current BPI. |
419 | static void |
420 | setBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, |
421 | llvm::Function &F); |
422 | |
423 | // Add the Branch Protection Attributes of the FuncAttrs. |
424 | static void |
425 | initBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, |
426 | llvm::AttrBuilder &FuncAttrs); |
427 | |
428 | protected: |
429 | static std::string qualifyWindowsLibrary(StringRef Lib); |
430 | |
431 | void addStackProbeTargetAttributes(const Decl *D, llvm::GlobalValue *GV, |
432 | CodeGen::CodeGenModule &CGM) const; |
433 | }; |
434 | |
435 | std::unique_ptr<TargetCodeGenInfo> |
436 | createDefaultTargetCodeGenInfo(CodeGenModule &CGM); |
437 | |
438 | enum class AArch64ABIKind { |
439 | AAPCS = 0, |
440 | DarwinPCS, |
441 | Win64, |
442 | AAPCSSoft, |
443 | PAuthTest, |
444 | }; |
445 | |
446 | std::unique_ptr<TargetCodeGenInfo> |
447 | createAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind Kind); |
448 | |
449 | std::unique_ptr<TargetCodeGenInfo> |
450 | createWindowsAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind K); |
451 | |
452 | std::unique_ptr<TargetCodeGenInfo> |
453 | createAMDGPUTargetCodeGenInfo(CodeGenModule &CGM); |
454 | |
455 | std::unique_ptr<TargetCodeGenInfo> |
456 | createARCTargetCodeGenInfo(CodeGenModule &CGM); |
457 | |
458 | enum class ARMABIKind { |
459 | APCS = 0, |
460 | AAPCS = 1, |
461 | AAPCS_VFP = 2, |
462 | AAPCS16_VFP = 3, |
463 | }; |
464 | |
465 | std::unique_ptr<TargetCodeGenInfo> |
466 | createARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind Kind); |
467 | |
468 | std::unique_ptr<TargetCodeGenInfo> |
469 | createWindowsARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind K); |
470 | |
471 | std::unique_ptr<TargetCodeGenInfo> |
472 | createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR); |
473 | |
474 | std::unique_ptr<TargetCodeGenInfo> |
475 | createBPFTargetCodeGenInfo(CodeGenModule &CGM); |
476 | |
477 | std::unique_ptr<TargetCodeGenInfo> |
478 | createCSKYTargetCodeGenInfo(CodeGenModule &CGM, unsigned FLen); |
479 | |
480 | std::unique_ptr<TargetCodeGenInfo> |
481 | createHexagonTargetCodeGenInfo(CodeGenModule &CGM); |
482 | |
483 | std::unique_ptr<TargetCodeGenInfo> |
484 | createLanaiTargetCodeGenInfo(CodeGenModule &CGM); |
485 | |
486 | std::unique_ptr<TargetCodeGenInfo> |
487 | createLoongArchTargetCodeGenInfo(CodeGenModule &CGM, unsigned GRLen, |
488 | unsigned FLen); |
489 | |
490 | std::unique_ptr<TargetCodeGenInfo> |
491 | createM68kTargetCodeGenInfo(CodeGenModule &CGM); |
492 | |
493 | std::unique_ptr<TargetCodeGenInfo> |
494 | createMIPSTargetCodeGenInfo(CodeGenModule &CGM, bool IsOS32); |
495 | |
496 | std::unique_ptr<TargetCodeGenInfo> |
497 | createMSP430TargetCodeGenInfo(CodeGenModule &CGM); |
498 | |
499 | std::unique_ptr<TargetCodeGenInfo> |
500 | createNVPTXTargetCodeGenInfo(CodeGenModule &CGM); |
501 | |
502 | std::unique_ptr<TargetCodeGenInfo> |
503 | createPNaClTargetCodeGenInfo(CodeGenModule &CGM); |
504 | |
505 | enum class PPC64_SVR4_ABIKind { |
506 | ELFv1 = 0, |
507 | ELFv2, |
508 | }; |
509 | |
510 | std::unique_ptr<TargetCodeGenInfo> |
511 | createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit); |
512 | |
513 | std::unique_ptr<TargetCodeGenInfo> |
514 | createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI); |
515 | |
516 | std::unique_ptr<TargetCodeGenInfo> |
517 | createPPC64TargetCodeGenInfo(CodeGenModule &CGM); |
518 | |
519 | std::unique_ptr<TargetCodeGenInfo> |
520 | createPPC64_SVR4_TargetCodeGenInfo(CodeGenModule &CGM, PPC64_SVR4_ABIKind Kind, |
521 | bool SoftFloatABI); |
522 | |
523 | std::unique_ptr<TargetCodeGenInfo> |
524 | createRISCVTargetCodeGenInfo(CodeGenModule &CGM, unsigned XLen, unsigned FLen, |
525 | bool EABI); |
526 | |
527 | std::unique_ptr<TargetCodeGenInfo> |
528 | createCommonSPIRTargetCodeGenInfo(CodeGenModule &CGM); |
529 | |
530 | std::unique_ptr<TargetCodeGenInfo> |
531 | createSPIRVTargetCodeGenInfo(CodeGenModule &CGM); |
532 | |
533 | std::unique_ptr<TargetCodeGenInfo> |
534 | createSparcV8TargetCodeGenInfo(CodeGenModule &CGM); |
535 | |
536 | std::unique_ptr<TargetCodeGenInfo> |
537 | createSparcV9TargetCodeGenInfo(CodeGenModule &CGM); |
538 | |
539 | std::unique_ptr<TargetCodeGenInfo> |
540 | createSystemZTargetCodeGenInfo(CodeGenModule &CGM, bool HasVector, |
541 | bool SoftFloatABI); |
542 | |
543 | std::unique_ptr<TargetCodeGenInfo> |
544 | createTCETargetCodeGenInfo(CodeGenModule &CGM); |
545 | |
546 | std::unique_ptr<TargetCodeGenInfo> |
547 | createVETargetCodeGenInfo(CodeGenModule &CGM); |
548 | |
549 | enum class WebAssemblyABIKind { |
550 | MVP = 0, |
551 | ExperimentalMV = 1, |
552 | }; |
553 | |
554 | std::unique_ptr<TargetCodeGenInfo> |
555 | createWebAssemblyTargetCodeGenInfo(CodeGenModule &CGM, WebAssemblyABIKind K); |
556 | |
557 | /// The AVX ABI level for X86 targets. |
558 | enum class X86AVXABILevel { |
559 | None, |
560 | AVX, |
561 | AVX512, |
562 | }; |
563 | |
564 | std::unique_ptr<TargetCodeGenInfo> createX86_32TargetCodeGenInfo( |
565 | CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI, |
566 | unsigned NumRegisterParameters, bool SoftFloatABI); |
567 | |
568 | std::unique_ptr<TargetCodeGenInfo> |
569 | createWinX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI, |
570 | bool Win32StructABI, |
571 | unsigned NumRegisterParameters); |
572 | |
573 | std::unique_ptr<TargetCodeGenInfo> |
574 | createX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel); |
575 | |
576 | std::unique_ptr<TargetCodeGenInfo> |
577 | createWinX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel); |
578 | |
579 | std::unique_ptr<TargetCodeGenInfo> |
580 | createXCoreTargetCodeGenInfo(CodeGenModule &CGM); |
581 | |
582 | } // namespace CodeGen |
583 | } // namespace clang |
584 | |
585 | #endif // LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H |
586 | |