clang 17.0.0git
TargetInfo.h
Go to the documentation of this file.
1//===--- TargetInfo.h - Expose information about the target -----*- 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/// \file
10/// Defines the clang::TargetInfo interface.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_BASIC_TARGETINFO_H
15#define LLVM_CLANG_BASIC_TARGETINFO_H
16
20#include "clang/Basic/LLVM.h"
25#include "llvm/ADT/APFloat.h"
26#include "llvm/ADT/APInt.h"
27#include "llvm/ADT/ArrayRef.h"
28#include "llvm/ADT/IntrusiveRefCntPtr.h"
29#include "llvm/ADT/SmallSet.h"
30#include "llvm/ADT/StringMap.h"
31#include "llvm/ADT/StringRef.h"
32#include "llvm/Frontend/OpenMP/OMPGridValues.h"
33#include "llvm/IR/DerivedTypes.h"
34#include "llvm/Support/DataTypes.h"
35#include "llvm/Support/Error.h"
36#include "llvm/Support/VersionTuple.h"
37#include "llvm/TargetParser/Triple.h"
38#include <cassert>
39#include <optional>
40#include <string>
41#include <vector>
42
43namespace llvm {
44struct fltSemantics;
45}
46
47namespace clang {
48class DiagnosticsEngine;
49class LangOptions;
50class CodeGenOptions;
51class MacroBuilder;
52
53/// Contains information gathered from parsing the contents of TargetAttr.
55 std::vector<std::string> Features;
56 StringRef CPU;
57 StringRef Tune;
59 StringRef Duplicate;
60 bool operator ==(const ParsedTargetAttr &Other) const {
61 return Duplicate == Other.Duplicate && CPU == Other.CPU &&
62 Tune == Other.Tune && BranchProtection == Other.BranchProtection &&
63 Features == Other.Features;
64 }
65};
66
67namespace Builtin { struct Info; }
68
69enum class FloatModeKind {
70 NoFloat = 0,
71 Half = 1 << 0,
72 Float = 1 << 1,
73 Double = 1 << 2,
74 LongDouble = 1 << 3,
75 Float128 = 1 << 4,
76 Ibm128 = 1 << 5,
77 LLVM_MARK_AS_BITMASK_ENUM(Ibm128)
78};
79
80/// Fields controlling how types are laid out in memory; these may need to
81/// be copied for targets like AMDGPU that base their ABIs on an auxiliary
82/// CPU target.
84 unsigned char PointerWidth, PointerAlign;
85 unsigned char BoolWidth, BoolAlign;
86 unsigned char IntWidth, IntAlign;
87 unsigned char HalfWidth, HalfAlign;
89 unsigned char FloatWidth, FloatAlign;
90 unsigned char DoubleWidth, DoubleAlign;
93 unsigned char LongWidth, LongAlign;
95 unsigned char Int128Align;
96
97 // Fixed point bit widths
99 unsigned char AccumWidth, AccumAlign;
102 unsigned char FractWidth, FractAlign;
104
105 // If true, unsigned fixed point types have the same number of fractional bits
106 // as their signed counterparts, forcing the unsigned types to have one extra
107 // bit of padding. Otherwise, unsigned fixed point types have
108 // one more fractional bit than its corresponding signed type. This is false
109 // by default.
111
112 // Fixed point integral and fractional bit sizes
113 // Saturated types share the same integral/fractional bits as their
114 // corresponding unsaturated types.
115 // For simplicity, the fractional bits in a _Fract type will be one less the
116 // width of that _Fract type. This leaves all signed _Fract types having no
117 // padding and unsigned _Fract types will only have 1 bit of padding after the
118 // sign if PaddingOnUnsignedFixedPoint is set.
119 unsigned char ShortAccumScale;
120 unsigned char AccumScale;
121 unsigned char LongAccumScale;
122
124 unsigned char MinGlobalAlign;
125
126 unsigned short SuitableAlign;
127 unsigned short NewAlign;
129 unsigned MaxTLSAlign;
130
131 const llvm::fltSemantics *HalfFormat, *BFloat16Format, *FloatFormat,
133
134 ///===---- Target Data Type Query Methods -------------------------------===//
135 enum IntType {
136 NoInt = 0,
147 };
148
149protected:
153
154 /// Whether Objective-C's built-in boolean type should be signed char.
155 ///
156 /// Otherwise, when this flag is not set, the normal built-in boolean type is
157 /// used.
159
160 /// Control whether the alignment of bit-field types is respected when laying
161 /// out structures. If true, then the alignment of the bit-field type will be
162 /// used to (a) impact the alignment of the containing structure, and (b)
163 /// ensure that the individual bit-field will not straddle an alignment
164 /// boundary.
166
167 /// Whether zero length bitfields (e.g., int : 0;) force alignment of
168 /// the next bitfield.
169 ///
170 /// If the alignment of the zero length bitfield is greater than the member
171 /// that follows it, `bar', `bar' will be aligned as the type of the
172 /// zero-length bitfield.
174
175 /// Whether zero length bitfield alignment is respected if they are the
176 /// leading members.
178
179 /// Whether explicit bit field alignment attributes are honored.
181
182 /// If non-zero, specifies a fixed alignment value for bitfields that follow
183 /// zero length bitfield, regardless of the zero length bitfield type.
185
186 /// If non-zero, specifies a maximum alignment to truncate alignment
187 /// specified in the aligned attribute of a static variable to this value.
189};
190
191/// OpenCL type kinds.
192enum OpenCLTypeKind : uint8_t {
201};
202
203/// Exposes information about the current target.
204///
206 public RefCountedBase<TargetInfo> {
207 std::shared_ptr<TargetOptions> TargetOpts;
208 llvm::Triple Triple;
209protected:
210 // Target values set by the ctor of the actual target implementation. Default
211 // values are specified by the TargetInfo constructor.
215 bool NoAsmVariants; // True if {|} are normal characters.
216 bool HasLegalHalfType; // True if the backend supports operations on the half
217 // LLVM IR type.
222 bool HasFullBFloat16; // True if the backend supports native bfloat16
223 // arithmetic. Used to determine excess precision
224 // support in the frontend.
229
231 std::string DataLayoutString;
232 const char *UserLabelPrefix;
233 const char *MCountName;
234 unsigned char RegParmMax, SSERegParmMax;
237
238 mutable StringRef PlatformName;
239 mutable VersionTuple PlatformMinVersion;
240
242 unsigned RealTypeUsesObjCFPRetMask : llvm::BitWidth<FloatModeKind>;
244
245 unsigned HasBuiltinMSVaList : 1;
246
248
249 unsigned HasAArch64SVETypes : 1;
250
251 unsigned HasRISCVVTypes : 1;
252
254
255 unsigned ARMCDECoprocMask : 8;
256
258
259 std::optional<unsigned> MaxBitIntWidth;
260
261 std::optional<llvm::Triple> DarwinTargetVariantTriple;
262
263 // TargetInfo Constructor. Default initializes all fields.
264 TargetInfo(const llvm::Triple &T);
265
266 // UserLabelPrefix must match DL's getGlobalPrefix() when interpreted
267 // as a DataLayout object.
268 void resetDataLayout(StringRef DL, const char *UserLabelPrefix = "");
269
270public:
271 /// Construct a target for the given options.
272 ///
273 /// \param Opts - The options to use to initialize the target. The target may
274 /// modify the options to canonicalize the target feature information to match
275 /// what the backend expects.
276 static TargetInfo *
278 const std::shared_ptr<TargetOptions> &Opts);
279
280 virtual ~TargetInfo();
281
282 /// Retrieve the target options.
284 assert(TargetOpts && "Missing target options");
285 return *TargetOpts;
286 }
287
288 /// The different kinds of __builtin_va_list types defined by
289 /// the target implementation.
291 /// typedef char* __builtin_va_list;
293
294 /// typedef void* __builtin_va_list;
296
297 /// __builtin_va_list as defined by the AArch64 ABI
298 /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
300
301 /// __builtin_va_list as defined by the PNaCl ABI:
302 /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types
304
305 /// __builtin_va_list as defined by the Power ABI:
306 /// https://www.power.org
307 /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf
309
310 /// __builtin_va_list as defined by the x86-64 ABI:
311 /// http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
313
314 /// __builtin_va_list as defined by ARM AAPCS ABI
315 /// http://infocenter.arm.com
316 // /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
318
319 // typedef struct __va_list_tag
320 // {
321 // long __gpr;
322 // long __fpr;
323 // void *__overflow_arg_area;
324 // void *__reg_save_area;
325 // } va_list[1];
327
328 // typedef struct __va_list_tag {
329 // void *__current_saved_reg_area_pointer;
330 // void *__saved_reg_area_end_pointer;
331 // void *__overflow_area_pointer;
332 //} va_list;
334 };
335
336protected:
337 /// Specify if mangling based on address space map should be used or
338 /// not for language specific address spaces
340
341public:
342 IntType getSizeType() const { return SizeType; }
344 switch (SizeType) {
345 case UnsignedShort:
346 return SignedShort;
347 case UnsignedInt:
348 return SignedInt;
349 case UnsignedLong:
350 return SignedLong;
351 case UnsignedLongLong:
352 return SignedLongLong;
353 default:
354 llvm_unreachable("Invalid SizeType");
355 }
356 }
357 IntType getIntMaxType() const { return IntMaxType; }
360 }
361 IntType getPtrDiffType(LangAS AddrSpace) const {
362 return AddrSpace == LangAS::Default ? PtrDiffType
363 : getPtrDiffTypeV(AddrSpace);
364 }
367 }
368 IntType getIntPtrType() const { return IntPtrType; }
371 }
372 IntType getWCharType() const { return WCharType; }
373 IntType getWIntType() const { return WIntType; }
374 IntType getChar16Type() const { return Char16Type; }
375 IntType getChar32Type() const { return Char32Type; }
376 IntType getInt64Type() const { return Int64Type; }
379 }
380 IntType getInt16Type() const { return Int16Type; }
383 }
386
388 switch (T) {
389 case SignedChar:
390 return UnsignedChar;
391 case SignedShort:
392 return UnsignedShort;
393 case SignedInt:
394 return UnsignedInt;
395 case SignedLong:
396 return UnsignedLong;
397 case SignedLongLong:
398 return UnsignedLongLong;
399 default:
400 llvm_unreachable("Unexpected signed integer type");
401 }
402 }
403
404 /// In the event this target uses the same number of fractional bits for its
405 /// unsigned types as it does with its signed counterparts, there will be
406 /// exactly one bit of padding.
407 /// Return true if unsigned fixed point types have padding for this target.
410 }
411
412 /// Return the width (in bits) of the specified integer type enum.
413 ///
414 /// For example, SignedInt -> getIntWidth().
415 unsigned getTypeWidth(IntType T) const;
416
417 /// Return integer type with specified width.
418 virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const;
419
420 /// Return the smallest integer type with at least the specified width.
421 virtual IntType getLeastIntTypeByWidth(unsigned BitWidth,
422 bool IsSigned) const;
423
424 /// Return floating point type with specified width. On PPC, there are
425 /// three possible types for 128-bit floating point: "PPC double-double",
426 /// IEEE 754R quad precision, and "long double" (which under the covers
427 /// is represented as one of those two). At this time, there is no support
428 /// for an explicit "PPC double-double" type (i.e. __ibm128) so we only
429 /// need to differentiate between "long double" and IEEE quad precision.
430 FloatModeKind getRealTypeByWidth(unsigned BitWidth,
431 FloatModeKind ExplicitType) const;
432
433 /// Return the alignment (in bits) of the specified integer type enum.
434 ///
435 /// For example, SignedInt -> getIntAlign().
436 unsigned getTypeAlign(IntType T) const;
437
438 /// Returns true if the type is signed; false otherwise.
439 static bool isTypeSigned(IntType T);
440
441 /// Return the width of pointers on this target, for the
442 /// specified address space.
443 uint64_t getPointerWidth(LangAS AddrSpace) const {
444 return AddrSpace == LangAS::Default ? PointerWidth
445 : getPointerWidthV(AddrSpace);
446 }
447 uint64_t getPointerAlign(LangAS AddrSpace) const {
448 return AddrSpace == LangAS::Default ? PointerAlign
449 : getPointerAlignV(AddrSpace);
450 }
451
452 /// Return the maximum width of pointers on this target.
453 virtual uint64_t getMaxPointerWidth() const {
454 return PointerWidth;
455 }
456
457 /// Get integer value for null pointer.
458 /// \param AddrSpace address space of pointee in source language.
459 virtual uint64_t getNullPointerValue(LangAS AddrSpace) const { return 0; }
460
461 /// Return the size of '_Bool' and C++ 'bool' for this target, in bits.
462 unsigned getBoolWidth() const { return BoolWidth; }
463
464 /// Return the alignment of '_Bool' and C++ 'bool' for this target.
465 unsigned getBoolAlign() const { return BoolAlign; }
466
467 unsigned getCharWidth() const { return 8; } // FIXME
468 unsigned getCharAlign() const { return 8; } // FIXME
469
470 /// Return the size of 'signed short' and 'unsigned short' for this
471 /// target, in bits.
472 unsigned getShortWidth() const { return 16; } // FIXME
473
474 /// Return the alignment of 'signed short' and 'unsigned short' for
475 /// this target.
476 unsigned getShortAlign() const { return 16; } // FIXME
477
478 /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
479 /// this target, in bits.
480 unsigned getIntWidth() const { return IntWidth; }
481 unsigned getIntAlign() const { return IntAlign; }
482
483 /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
484 /// for this target, in bits.
485 unsigned getLongWidth() const { return LongWidth; }
486 unsigned getLongAlign() const { return LongAlign; }
487
488 /// getLongLongWidth/Align - Return the size of 'signed long long' and
489 /// 'unsigned long long' for this target, in bits.
490 unsigned getLongLongWidth() const { return LongLongWidth; }
491 unsigned getLongLongAlign() const { return LongLongAlign; }
492
493 /// getInt128Align() - Returns the alignment of Int128.
494 unsigned getInt128Align() const { return Int128Align; }
495
496 /// getShortAccumWidth/Align - Return the size of 'signed short _Accum' and
497 /// 'unsigned short _Accum' for this target, in bits.
498 unsigned getShortAccumWidth() const { return ShortAccumWidth; }
499 unsigned getShortAccumAlign() const { return ShortAccumAlign; }
500
501 /// getAccumWidth/Align - Return the size of 'signed _Accum' and
502 /// 'unsigned _Accum' for this target, in bits.
503 unsigned getAccumWidth() const { return AccumWidth; }
504 unsigned getAccumAlign() const { return AccumAlign; }
505
506 /// getLongAccumWidth/Align - Return the size of 'signed long _Accum' and
507 /// 'unsigned long _Accum' for this target, in bits.
508 unsigned getLongAccumWidth() const { return LongAccumWidth; }
509 unsigned getLongAccumAlign() const { return LongAccumAlign; }
510
511 /// getShortFractWidth/Align - Return the size of 'signed short _Fract' and
512 /// 'unsigned short _Fract' for this target, in bits.
513 unsigned getShortFractWidth() const { return ShortFractWidth; }
514 unsigned getShortFractAlign() const { return ShortFractAlign; }
515
516 /// getFractWidth/Align - Return the size of 'signed _Fract' and
517 /// 'unsigned _Fract' for this target, in bits.
518 unsigned getFractWidth() const { return FractWidth; }
519 unsigned getFractAlign() const { return FractAlign; }
520
521 /// getLongFractWidth/Align - Return the size of 'signed long _Fract' and
522 /// 'unsigned long _Fract' for this target, in bits.
523 unsigned getLongFractWidth() const { return LongFractWidth; }
524 unsigned getLongFractAlign() const { return LongFractAlign; }
525
526 /// getShortAccumScale/IBits - Return the number of fractional/integral bits
527 /// in a 'signed short _Accum' type.
528 unsigned getShortAccumScale() const { return ShortAccumScale; }
529 unsigned getShortAccumIBits() const {
530 return ShortAccumWidth - ShortAccumScale - 1;
531 }
532
533 /// getAccumScale/IBits - Return the number of fractional/integral bits
534 /// in a 'signed _Accum' type.
535 unsigned getAccumScale() const { return AccumScale; }
536 unsigned getAccumIBits() const { return AccumWidth - AccumScale - 1; }
537
538 /// getLongAccumScale/IBits - Return the number of fractional/integral bits
539 /// in a 'signed long _Accum' type.
540 unsigned getLongAccumScale() const { return LongAccumScale; }
541 unsigned getLongAccumIBits() const {
542 return LongAccumWidth - LongAccumScale - 1;
543 }
544
545 /// getUnsignedShortAccumScale/IBits - Return the number of
546 /// fractional/integral bits in a 'unsigned short _Accum' type.
547 unsigned getUnsignedShortAccumScale() const {
549 }
550 unsigned getUnsignedShortAccumIBits() const {
554 }
555
556 /// getUnsignedAccumScale/IBits - Return the number of fractional/integral
557 /// bits in a 'unsigned _Accum' type.
558 unsigned getUnsignedAccumScale() const {
560 }
561 unsigned getUnsignedAccumIBits() const {
564 }
565
566 /// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral
567 /// bits in a 'unsigned long _Accum' type.
568 unsigned getUnsignedLongAccumScale() const {
570 }
571 unsigned getUnsignedLongAccumIBits() const {
575 }
576
577 /// getShortFractScale - Return the number of fractional bits
578 /// in a 'signed short _Fract' type.
579 unsigned getShortFractScale() const { return ShortFractWidth - 1; }
580
581 /// getFractScale - Return the number of fractional bits
582 /// in a 'signed _Fract' type.
583 unsigned getFractScale() const { return FractWidth - 1; }
584
585 /// getLongFractScale - Return the number of fractional bits
586 /// in a 'signed long _Fract' type.
587 unsigned getLongFractScale() const { return LongFractWidth - 1; }
588
589 /// getUnsignedShortFractScale - Return the number of fractional bits
590 /// in a 'unsigned short _Fract' type.
591 unsigned getUnsignedShortFractScale() const {
593 : getShortFractScale() + 1;
594 }
595
596 /// getUnsignedFractScale - Return the number of fractional bits
597 /// in a 'unsigned _Fract' type.
598 unsigned getUnsignedFractScale() const {
600 }
601
602 /// getUnsignedLongFractScale - Return the number of fractional bits
603 /// in a 'unsigned long _Fract' type.
604 unsigned getUnsignedLongFractScale() const {
606 : getLongFractScale() + 1;
607 }
608
609 /// Determine whether the __int128 type is supported on this target.
610 virtual bool hasInt128Type() const {
611 return (getPointerWidth(LangAS::Default) >= 64) ||
613 } // FIXME
614
615 /// Determine whether the _BitInt type is supported on this target. This
616 /// limitation is put into place for ABI reasons.
617 /// FIXME: _BitInt is a required type in C23, so there's not much utility in
618 /// asking whether the target supported it or not; I think this should be
619 /// removed once backends have been alerted to the type and have had the
620 /// chance to do implementation work if needed.
621 virtual bool hasBitIntType() const {
622 return false;
623 }
624
625 // Different targets may support a different maximum width for the _BitInt
626 // type, depending on what operations are supported.
627 virtual size_t getMaxBitIntWidth() const {
628 // Consider -fexperimental-max-bitint-width= first.
629 if (MaxBitIntWidth)
630 return std::min<size_t>(*MaxBitIntWidth, llvm::IntegerType::MAX_INT_BITS);
631
632 // FIXME: this value should be llvm::IntegerType::MAX_INT_BITS, which is
633 // maximum bit width that LLVM claims its IR can support. However, most
634 // backends currently have a bug where they only support float to int
635 // conversion (and vice versa) on types that are <= 128 bits and crash
636 // otherwise. We're setting the max supported value to 128 to be
637 // conservative.
638 return 128;
639 }
640
641 /// Determine whether _Float16 is supported on this target.
642 virtual bool hasLegalHalfType() const { return HasLegalHalfType; }
643
644 /// Whether half args and returns are supported.
645 virtual bool allowHalfArgsAndReturns() const { return HalfArgsAndReturns; }
646
647 /// Determine whether the __float128 type is supported on this target.
648 virtual bool hasFloat128Type() const { return HasFloat128; }
649
650 /// Determine whether the _Float16 type is supported on this target.
651 virtual bool hasFloat16Type() const { return HasFloat16; }
652
653 /// Determine whether the _BFloat16 type is supported on this target.
654 virtual bool hasBFloat16Type() const {
656 }
657
658 /// Determine whether the BFloat type is fully supported on this target, i.e
659 /// arithemtic operations.
660 virtual bool hasFullBFloat16Type() const { return HasFullBFloat16; }
661
662 /// Determine whether the __ibm128 type is supported on this target.
663 virtual bool hasIbm128Type() const { return HasIbm128; }
664
665 /// Determine whether the long double type is supported on this target.
666 virtual bool hasLongDoubleType() const { return HasLongDouble; }
667
668 /// Determine whether return of a floating point value is supported
669 /// on this target.
670 virtual bool hasFPReturn() const { return HasFPReturn; }
671
672 /// Determine whether constrained floating point is supported on this target.
673 virtual bool hasStrictFP() const { return HasStrictFP; }
674
675 /// Return the alignment that is the largest alignment ever used for any
676 /// scalar/SIMD data type on the target machine you are compiling for
677 /// (including types with an extended alignment requirement).
678 unsigned getSuitableAlign() const { return SuitableAlign; }
679
680 /// Return the default alignment for __attribute__((aligned)) on
681 /// this target, to be used if no alignment value is specified.
684 }
685
686 /// getMinGlobalAlign - Return the minimum alignment of a global variable,
687 /// unless its alignment is explicitly reduced via attributes.
688 virtual unsigned getMinGlobalAlign (uint64_t) const {
689 return MinGlobalAlign;
690 }
691
692 /// Return the largest alignment for which a suitably-sized allocation with
693 /// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
694 /// pointer.
695 unsigned getNewAlign() const {
696 return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
697 }
698
699 /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
700 /// bits.
701 unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
702 unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
703
704 /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
705 /// bits.
706 unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
707 unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
708
709 /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
710 /// bits.
711 unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
712 unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
713
714 /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
715 unsigned getHalfWidth() const { return HalfWidth; }
716 unsigned getHalfAlign() const { return HalfAlign; }
717 const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
718
719 /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
720 unsigned getFloatWidth() const { return FloatWidth; }
721 unsigned getFloatAlign() const { return FloatAlign; }
722 const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
723
724 /// getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
725 unsigned getBFloat16Width() const { return BFloat16Width; }
726 unsigned getBFloat16Align() const { return BFloat16Align; }
727 const llvm::fltSemantics &getBFloat16Format() const { return *BFloat16Format; }
728
729 /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
730 unsigned getDoubleWidth() const { return DoubleWidth; }
731 unsigned getDoubleAlign() const { return DoubleAlign; }
732 const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
733
734 /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
735 /// double'.
736 unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
737 unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
738 const llvm::fltSemantics &getLongDoubleFormat() const {
739 return *LongDoubleFormat;
740 }
741
742 /// getFloat128Width/Align/Format - Return the size/align/format of
743 /// '__float128'.
744 unsigned getFloat128Width() const { return 128; }
745 unsigned getFloat128Align() const { return Float128Align; }
746 const llvm::fltSemantics &getFloat128Format() const {
747 return *Float128Format;
748 }
749
750 /// getIbm128Width/Align/Format - Return the size/align/format of
751 /// '__ibm128'.
752 unsigned getIbm128Width() const { return 128; }
753 unsigned getIbm128Align() const { return Ibm128Align; }
754 const llvm::fltSemantics &getIbm128Format() const { return *Ibm128Format; }
755
756 /// Return the mangled code of long double.
757 virtual const char *getLongDoubleMangling() const { return "e"; }
758
759 /// Return the mangled code of __float128.
760 virtual const char *getFloat128Mangling() const { return "g"; }
761
762 /// Return the mangled code of __ibm128.
763 virtual const char *getIbm128Mangling() const {
764 llvm_unreachable("ibm128 not implemented on this target");
765 }
766
767 /// Return the mangled code of bfloat.
768 virtual const char *getBFloat16Mangling() const { return "DF16b"; }
769
770 /// Return the value for the C99 FLT_EVAL_METHOD macro.
773 }
774
775 virtual bool supportSourceEvalMethod() const { return true; }
776
777 // getLargeArrayMinWidth/Align - Return the minimum array size that is
778 // 'large' and its alignment.
779 unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
780 unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
781
782 /// Return the maximum width lock-free atomic operation which will
783 /// ever be supported for the given target
785 /// Return the maximum width lock-free atomic operation which can be
786 /// inlined given the supported features of the given target.
788 /// Set the maximum inline or promote width lock-free atomic operation
789 /// for the given target.
790 virtual void setMaxAtomicWidth() {}
791 /// Returns true if the given target supports lock-free atomic
792 /// operations at the specified width and alignment.
793 virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits,
794 uint64_t AlignmentInBits) const {
795 return AtomicSizeInBits <= AlignmentInBits &&
796 AtomicSizeInBits <= getMaxAtomicInlineWidth() &&
797 (AtomicSizeInBits <= getCharWidth() ||
798 llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth()));
799 }
800
801 /// Return the maximum vector alignment supported for the given target.
802 unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
803
805
806 /// Return the alignment (in bits) of the thrown exception object. This is
807 /// only meaningful for targets that allocate C++ exceptions in a system
808 /// runtime, such as those using the Itanium C++ ABI.
809 virtual unsigned getExnObjectAlignment() const {
810 // Itanium says that an _Unwind_Exception has to be "double-word"
811 // aligned (and thus the end of it is also so-aligned), meaning 16
812 // bytes. Of course, that was written for the actual Itanium,
813 // which is a 64-bit platform. Classically, the ABI doesn't really
814 // specify the alignment on other platforms, but in practice
815 // libUnwind declares the struct with __attribute__((aligned)), so
816 // we assume that alignment here. (It's generally 16 bytes, but
817 // some targets overwrite it.)
819 }
820
821 /// Return the size of intmax_t and uintmax_t for this target, in bits.
822 unsigned getIntMaxTWidth() const {
823 return getTypeWidth(IntMaxType);
824 }
825
826 // Return the size of unwind_word for this target.
827 virtual unsigned getUnwindWordWidth() const {
829 }
830
831 /// Return the "preferred" register width on this target.
832 virtual unsigned getRegisterWidth() const {
833 // Currently we assume the register width on the target matches the pointer
834 // width, we can introduce a new variable for this if/when some target wants
835 // it.
836 return PointerWidth;
837 }
838
839 /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro,
840 /// which is the prefix given to user symbols by default.
841 ///
842 /// On most platforms this is "", but it is "_" on some.
843 const char *getUserLabelPrefix() const { return UserLabelPrefix; }
844
845 /// Returns the name of the mcount instrumentation function.
846 const char *getMCountName() const {
847 return MCountName;
848 }
849
850 /// Check if the Objective-C built-in boolean type should be signed
851 /// char.
852 ///
853 /// Otherwise, if this returns false, the normal built-in boolean type
854 /// should also be used for Objective-C.
857 }
860 }
861
862 /// Check whether the alignment of bit-field types is respected
863 /// when laying out structures.
866 }
867
868 /// Check whether zero length bitfields should force alignment of
869 /// the next member.
872 }
873
874 /// Check whether zero length bitfield alignment is respected if they are
875 /// leading members.
878 }
879
880 /// Get the fixed alignment value in bits for a member that follows
881 /// a zero length bitfield.
884 }
885
886 /// Get the maximum alignment in bits for a static variable with
887 /// aligned attribute.
888 unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
889
890 /// Check whether explicit bitfield alignment attributes should be
891 // honored, as in "__attribute__((aligned(2))) int b : 1;".
894 }
895
896 /// Check whether this target support '\#pragma options align=mac68k'.
899 }
900
901 /// Return the user string for the specified integer type enum.
902 ///
903 /// For example, SignedShort -> "short".
904 static const char *getTypeName(IntType T);
905
906 /// Return the constant suffix for the specified integer type enum.
907 ///
908 /// For example, SignedLong -> "L".
909 const char *getTypeConstantSuffix(IntType T) const;
910
911 /// Return the printf format modifier for the specified
912 /// integer type enum.
913 ///
914 /// For example, SignedLong -> "l".
915 static const char *getTypeFormatModifier(IntType T);
916
917 /// Check whether the given real type should use the "fpret" flavor of
918 /// Objective-C message passing on this target.
920 return (int)((FloatModeKind)RealTypeUsesObjCFPRetMask & T);
921 }
922
923 /// Check whether _Complex long double should use the "fp2ret" flavor
924 /// of Objective-C message passing on this target.
927 }
928
929 /// Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used
930 /// to convert to and from __fp16.
931 /// FIXME: This function should be removed once all targets stop using the
932 /// conversion intrinsics.
933 virtual bool useFP16ConversionIntrinsics() const {
934 return true;
935 }
936
937 /// Specify if mangling based on address space map should be used or
938 /// not for language specific address spaces
941 }
942
943 ///===---- Other target property query methods --------------------------===//
944
945 /// Appends the target-specific \#define values for this
946 /// target set to the specified buffer.
947 virtual void getTargetDefines(const LangOptions &Opts,
948 MacroBuilder &Builder) const = 0;
949
950
951 /// Return information about target-specific builtins for
952 /// the current primary target, and info about which builtins are non-portable
953 /// across the current set of primary and secondary targets.
955
956 /// Returns target-specific min and max values VScale_Range.
957 virtual std::optional<std::pair<unsigned, unsigned>>
958 getVScaleRange(const LangOptions &LangOpts) const {
959 return std::nullopt;
960 }
961 /// The __builtin_clz* and __builtin_ctz* built-in
962 /// functions are specified to have undefined results for zero inputs, but
963 /// on targets that support these operations in a way that provides
964 /// well-defined results for zero without loss of performance, it is a good
965 /// idea to avoid optimizing based on that undef behavior.
966 virtual bool isCLZForZeroUndef() const { return true; }
967
968 /// Returns the kind of __builtin_va_list type that should be used
969 /// with this target.
971
972 /// Returns whether or not type \c __builtin_ms_va_list type is
973 /// available on this target.
974 bool hasBuiltinMSVaList() const { return HasBuiltinMSVaList; }
975
976 /// Returns true for RenderScript.
978
979 /// Returns whether or not the AArch64 SVE built-in types are
980 /// available on this target.
981 bool hasAArch64SVETypes() const { return HasAArch64SVETypes; }
982
983 /// Returns whether or not the RISC-V V built-in types are
984 /// available on this target.
985 bool hasRISCVVTypes() const { return HasRISCVVTypes; }
986
987 /// Returns whether or not the AMDGPU unsafe floating point atomics are
988 /// allowed.
990
991 /// For ARM targets returns a mask defining which coprocessors are configured
992 /// as Custom Datapath.
993 uint32_t getARMCDECoprocMask() const { return ARMCDECoprocMask; }
994
995 /// Returns whether the passed in string is a valid clobber in an
996 /// inline asm statement.
997 ///
998 /// This is used by Sema.
999 bool isValidClobber(StringRef Name) const;
1000
1001 /// Returns whether the passed in string is a valid register name
1002 /// according to GCC.
1003 ///
1004 /// This is used by Sema for inline asm statements.
1005 virtual bool isValidGCCRegisterName(StringRef Name) const;
1006
1007 /// Returns the "normalized" GCC register name.
1008 ///
1009 /// ReturnCannonical true will return the register name without any additions
1010 /// such as "{}" or "%" in it's canonical form, for example:
1011 /// ReturnCanonical = true and Name = "rax", will return "ax".
1012 StringRef getNormalizedGCCRegisterName(StringRef Name,
1013 bool ReturnCanonical = false) const;
1014
1015 virtual bool isSPRegName(StringRef) const { return false; }
1016
1017 /// Extracts a register from the passed constraint (if it is a
1018 /// single-register constraint) and the asm label expression related to a
1019 /// variable in the input or output list of an inline asm statement.
1020 ///
1021 /// This function is used by Sema in order to diagnose conflicts between
1022 /// the clobber list and the input/output lists.
1023 virtual StringRef getConstraintRegister(StringRef Constraint,
1024 StringRef Expression) const {
1025 return "";
1026 }
1027
1029 enum {
1030 CI_None = 0x00,
1033 CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
1034 CI_HasMatchingInput = 0x08, // This output operand has a matching input.
1035 CI_ImmediateConstant = 0x10, // This operand must be an immediate constant
1036 CI_EarlyClobber = 0x20, // "&" output constraint (early clobber).
1037 };
1038 unsigned Flags;
1040 struct {
1041 int Min;
1042 int Max;
1045 llvm::SmallSet<int, 4> ImmSet;
1046
1047 std::string ConstraintStr; // constraint: "=rm"
1048 std::string Name; // Operand name: [foo] with no []'s.
1049 public:
1050 ConstraintInfo(StringRef ConstraintStr, StringRef Name)
1051 : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
1052 Name(Name.str()) {
1053 ImmRange.Min = ImmRange.Max = 0;
1054 ImmRange.isConstrained = false;
1055 }
1056
1057 const std::string &getConstraintStr() const { return ConstraintStr; }
1058 const std::string &getName() const { return Name; }
1059 bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
1060 bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; }
1061 bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
1062 bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
1063
1064 /// Return true if this output operand has a matching
1065 /// (tied) input operand.
1066 bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
1067
1068 /// Return true if this input operand is a matching
1069 /// constraint that ties it to an output operand.
1070 ///
1071 /// If this returns true then getTiedOperand will indicate which output
1072 /// operand this is tied to.
1073 bool hasTiedOperand() const { return TiedOperand != -1; }
1074 unsigned getTiedOperand() const {
1075 assert(hasTiedOperand() && "Has no tied operand!");
1076 return (unsigned)TiedOperand;
1077 }
1078
1080 return (Flags & CI_ImmediateConstant) != 0;
1081 }
1082 bool isValidAsmImmediate(const llvm::APInt &Value) const {
1083 if (!ImmSet.empty())
1084 return Value.isSignedIntN(32) && ImmSet.contains(Value.getZExtValue());
1085 return !ImmRange.isConstrained ||
1086 (Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max));
1087 }
1088
1096 ImmRange.Min = Min;
1097 ImmRange.Max = Max;
1098 ImmRange.isConstrained = true;
1099 }
1102 for (int Exact : Exacts)
1103 ImmSet.insert(Exact);
1104 }
1105 void setRequiresImmediate(int Exact) {
1107 ImmSet.insert(Exact);
1108 }
1111 }
1112
1113 /// Indicate that this is an input operand that is tied to
1114 /// the specified output operand.
1115 ///
1116 /// Copy over the various constraint information from the output.
1117 void setTiedOperand(unsigned N, ConstraintInfo &Output) {
1118 Output.setHasMatchingInput();
1119 Flags = Output.Flags;
1120 TiedOperand = N;
1121 // Don't copy Name or constraint string.
1122 }
1123 };
1124
1125 /// Validate register name used for global register variables.
1126 ///
1127 /// This function returns true if the register passed in RegName can be used
1128 /// for global register variables on this target. In addition, it returns
1129 /// true in HasSizeMismatch if the size of the register doesn't match the
1130 /// variable size passed in RegSize.
1131 virtual bool validateGlobalRegisterVariable(StringRef RegName,
1132 unsigned RegSize,
1133 bool &HasSizeMismatch) const {
1134 HasSizeMismatch = false;
1135 return true;
1136 }
1137
1138 // validateOutputConstraint, validateInputConstraint - Checks that
1139 // a constraint is valid and provides information about it.
1140 // FIXME: These should return a real error instead of just true/false.
1141 bool validateOutputConstraint(ConstraintInfo &Info) const;
1143 ConstraintInfo &info) const;
1144
1145 virtual bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
1146 StringRef /*Constraint*/,
1147 unsigned /*Size*/) const {
1148 return true;
1149 }
1150
1151 virtual bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
1152 StringRef /*Constraint*/,
1153 unsigned /*Size*/) const {
1154 return true;
1155 }
1156 virtual bool
1157 validateConstraintModifier(StringRef /*Constraint*/,
1158 char /*Modifier*/,
1159 unsigned /*Size*/,
1160 std::string &/*SuggestedModifier*/) const {
1161 return true;
1162 }
1163 virtual bool
1164 validateAsmConstraint(const char *&Name,
1165 TargetInfo::ConstraintInfo &info) const = 0;
1166
1167 bool resolveSymbolicName(const char *&Name,
1168 ArrayRef<ConstraintInfo> OutputConstraints,
1169 unsigned &Index) const;
1170
1171 // Constraint parm will be left pointing at the last character of
1172 // the constraint. In practice, it won't be changed unless the
1173 // constraint is longer than one character.
1174 virtual std::string convertConstraint(const char *&Constraint) const {
1175 // 'p' defaults to 'r', but can be overridden by targets.
1176 if (*Constraint == 'p')
1177 return std::string("r");
1178 return std::string(1, *Constraint);
1179 }
1180
1181 /// Replace some escaped characters with another string based on
1182 /// target-specific rules
1183 virtual std::optional<std::string> handleAsmEscapedChar(char C) const {
1184 return std::nullopt;
1185 }
1186
1187 /// Returns a string of target-specific clobbers, in LLVM format.
1188 virtual std::string_view getClobbers() const = 0;
1189
1190 /// Returns true if NaN encoding is IEEE 754-2008.
1191 /// Only MIPS allows a different encoding.
1192 virtual bool isNan2008() const {
1193 return true;
1194 }
1195
1196 /// Returns the target triple of the primary target.
1197 const llvm::Triple &getTriple() const {
1198 return Triple;
1199 }
1200
1201 /// Returns the target ID if supported.
1202 virtual std::optional<std::string> getTargetID() const {
1203 return std::nullopt;
1204 }
1205
1206 const char *getDataLayoutString() const {
1207 assert(!DataLayoutString.empty() && "Uninitialized DataLayout!");
1208 return DataLayoutString.c_str();
1209 }
1210
1212 const char * const Aliases[5];
1213 const char * const Register;
1214 };
1215
1217 const char * const Names[5];
1218 const unsigned RegNum;
1219 };
1220
1221 /// Does this target support "protected" visibility?
1222 ///
1223 /// Any target which dynamic libraries will naturally support
1224 /// something like "default" (meaning that the symbol is visible
1225 /// outside this shared object) and "hidden" (meaning that it isn't)
1226 /// visibilities, but "protected" is really an ELF-specific concept
1227 /// with weird semantics designed around the convenience of dynamic
1228 /// linker implementations. Which is not to suggest that there's
1229 /// consistent target-independent semantics for "default" visibility
1230 /// either; the entire thing is pretty badly mangled.
1231 virtual bool hasProtectedVisibility() const { return true; }
1232
1233 /// Does this target aim for semantic compatibility with
1234 /// Microsoft C++ code using dllimport/export attributes?
1235 virtual bool shouldDLLImportComdatSymbols() const {
1236 return getTriple().isWindowsMSVCEnvironment() ||
1237 getTriple().isWindowsItaniumEnvironment() || getTriple().isPS();
1238 }
1239
1240 // Does this target have PS4 specific dllimport/export handling?
1241 virtual bool hasPS4DLLImportExport() const {
1242 return getTriple().isPS() ||
1243 // Windows Itanium support allows for testing the SCEI flavour of
1244 // dllimport/export handling on a Windows system.
1245 (getTriple().isWindowsItaniumEnvironment() &&
1246 getTriple().getVendor() == llvm::Triple::SCEI);
1247 }
1248
1249 /// Set forced language options.
1250 ///
1251 /// Apply changes to the target information with respect to certain
1252 /// language options which change the target configuration and adjust
1253 /// the language based on the target options where applicable.
1254 virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts);
1255
1256 /// Adjust target options based on codegen options.
1257 virtual void adjustTargetOptions(const CodeGenOptions &CGOpts,
1258 TargetOptions &TargetOpts) const {}
1259
1260 /// Initialize the map with the default set of target features for the
1261 /// CPU this should include all legal feature strings on the target.
1262 ///
1263 /// \return False on error (invalid features).
1264 virtual bool initFeatureMap(llvm::StringMap<bool> &Features,
1265 DiagnosticsEngine &Diags, StringRef CPU,
1266 const std::vector<std::string> &FeatureVec) const;
1267
1268 /// Get the ABI currently in use.
1269 virtual StringRef getABI() const { return StringRef(); }
1270
1271 /// Get the C++ ABI currently in use.
1273 return TheCXXABI;
1274 }
1275
1276 /// Target the specified CPU.
1277 ///
1278 /// \return False on error (invalid CPU name).
1279 virtual bool setCPU(const std::string &Name) {
1280 return false;
1281 }
1282
1283 /// Fill a SmallVectorImpl with the valid values to setCPU.
1284 virtual void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {}
1285
1286 /// Fill a SmallVectorImpl with the valid values for tuning CPU.
1288 fillValidCPUList(Values);
1289 }
1290
1291 /// brief Determine whether this TargetInfo supports the given CPU name.
1292 virtual bool isValidCPUName(StringRef Name) const {
1293 return true;
1294 }
1295
1296 /// brief Determine whether this TargetInfo supports the given CPU name for
1297 // tuning.
1298 virtual bool isValidTuneCPUName(StringRef Name) const {
1299 return isValidCPUName(Name);
1300 }
1301
1302 virtual ParsedTargetAttr parseTargetAttr(StringRef Str) const;
1303
1304 /// brief Determine whether this TargetInfo supports tune in target attribute.
1305 virtual bool supportsTargetAttributeTune() const {
1306 return false;
1307 }
1308
1309 /// Use the specified ABI.
1310 ///
1311 /// \return False on error (invalid ABI name).
1312 virtual bool setABI(const std::string &Name) {
1313 return false;
1314 }
1315
1316 /// Use the specified unit for FP math.
1317 ///
1318 /// \return False on error (invalid unit name).
1319 virtual bool setFPMath(StringRef Name) {
1320 return false;
1321 }
1322
1323 /// Check if target has a given feature enabled
1324 virtual bool hasFeatureEnabled(const llvm::StringMap<bool> &Features,
1325 StringRef Name) const {
1326 return Features.lookup(Name);
1327 }
1328
1329 /// Enable or disable a specific target feature;
1330 /// the feature name must be valid.
1331 virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,
1332 StringRef Name,
1333 bool Enabled) const {
1334 Features[Name] = Enabled;
1335 }
1336
1337 /// Determine whether this TargetInfo supports the given feature.
1338 virtual bool isValidFeatureName(StringRef Feature) const {
1339 return true;
1340 }
1341
1342 /// Returns true if feature has an impact on target code
1343 /// generation.
1344 virtual bool doesFeatureAffectCodeGen(StringRef Feature) const {
1345 return true;
1346 }
1347
1348 /// For given feature return dependent ones.
1349 virtual StringRef getFeatureDependencies(StringRef Feature) const {
1350 return StringRef();
1351 }
1352
1359 };
1360
1361 /// Determine if the Architecture in this TargetInfo supports branch
1362 /// protection
1363 virtual bool isBranchProtectionSupportedArch(StringRef Arch) const {
1364 return false;
1365 }
1366
1367 /// Determine if this TargetInfo supports the given branch protection
1368 /// specification
1369 virtual bool validateBranchProtection(StringRef Spec, StringRef Arch,
1371 StringRef &Err) const {
1372 Err = "";
1373 return false;
1374 }
1375
1376 /// Perform initialization based on the user configured
1377 /// set of features (e.g., +sse4).
1378 ///
1379 /// The list is guaranteed to have at most one entry per feature.
1380 ///
1381 /// The target may modify the features list, to change which options are
1382 /// passed onwards to the backend.
1383 /// FIXME: This part should be fixed so that we can change handleTargetFeatures
1384 /// to merely a TargetInfo initialization routine.
1385 ///
1386 /// \return False on error.
1387 virtual bool handleTargetFeatures(std::vector<std::string> &Features,
1388 DiagnosticsEngine &Diags) {
1389 return true;
1390 }
1391
1392 /// Determine whether the given target has the given feature.
1393 virtual bool hasFeature(StringRef Feature) const {
1394 return false;
1395 }
1396
1397 /// Identify whether this target supports multiversioning of functions,
1398 /// which requires support for cpu_supports and cpu_is functionality.
1400 return getTriple().isX86() || getTriple().isAArch64();
1401 }
1402
1403 /// Identify whether this target supports IFuncs.
1404 bool supportsIFunc() const {
1405 return getTriple().isOSBinFormatELF() && !getTriple().isOSFuchsia();
1406 }
1407
1408 // Validate the contents of the __builtin_cpu_supports(const char*)
1409 // argument.
1410 virtual bool validateCpuSupports(StringRef Name) const { return false; }
1411
1412 // Return the target-specific priority for features/cpus/vendors so
1413 // that they can be properly sorted for checking.
1414 virtual unsigned multiVersionSortPriority(StringRef Name) const {
1415 return 0;
1416 }
1417
1418 // Return the target-specific cost for feature
1419 // that taken into account in priority sorting.
1420 virtual unsigned multiVersionFeatureCost() const { return 0; }
1421
1422 // Validate the contents of the __builtin_cpu_is(const char*)
1423 // argument.
1424 virtual bool validateCpuIs(StringRef Name) const { return false; }
1425
1426 // Validate a cpu_dispatch/cpu_specific CPU option, which is a different list
1427 // from cpu_is, since it checks via features rather than CPUs directly.
1428 virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const {
1429 return false;
1430 }
1431
1432 // Get the character to be added for mangling purposes for cpu_specific.
1433 virtual char CPUSpecificManglingCharacter(StringRef Name) const {
1434 llvm_unreachable(
1435 "cpu_specific Multiversioning not implemented on this target");
1436 }
1437
1438 // Get the value for the 'tune-cpu' flag for a cpu_specific variant with the
1439 // programmer-specified 'Name'.
1440 virtual StringRef getCPUSpecificTuneName(StringRef Name) const {
1441 llvm_unreachable(
1442 "cpu_specific Multiversioning not implemented on this target");
1443 }
1444
1445 // Get a list of the features that make up the CPU option for
1446 // cpu_specific/cpu_dispatch so that it can be passed to llvm as optimization
1447 // options.
1449 StringRef Name, llvm::SmallVectorImpl<StringRef> &Features) const {
1450 llvm_unreachable(
1451 "cpu_specific Multiversioning not implemented on this target");
1452 }
1453
1454 // Get the cache line size of a given cpu. This method switches over
1455 // the given cpu and returns "std::nullopt" if the CPU is not found.
1456 virtual std::optional<unsigned> getCPUCacheLineSize() const {
1457 return std::nullopt;
1458 }
1459
1460 // Returns maximal number of args passed in registers.
1461 unsigned getRegParmMax() const {
1462 assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
1463 return RegParmMax;
1464 }
1465
1466 /// Whether the target supports thread-local storage.
1467 bool isTLSSupported() const {
1468 return TLSSupported;
1469 }
1470
1471 /// Return the maximum alignment (in bits) of a TLS variable
1472 ///
1473 /// Gets the maximum alignment (in bits) of a TLS variable on this target.
1474 /// Returns zero if there is no such constraint.
1475 unsigned getMaxTLSAlign() const { return MaxTLSAlign; }
1476
1477 /// Whether target supports variable-length arrays.
1478 bool isVLASupported() const { return VLASupported; }
1479
1480 /// Whether the target supports SEH __try.
1481 bool isSEHTrySupported() const {
1482 return getTriple().isOSWindows() &&
1483 (getTriple().isX86() ||
1484 getTriple().getArch() == llvm::Triple::aarch64);
1485 }
1486
1487 /// Return true if {|} are normal characters in the asm string.
1488 ///
1489 /// If this returns false (the default), then {abc|xyz} is syntax
1490 /// that says that when compiling for asm variant #0, "abc" should be
1491 /// generated, but when compiling for asm variant #1, "xyz" should be
1492 /// generated.
1493 bool hasNoAsmVariants() const {
1494 return NoAsmVariants;
1495 }
1496
1497 /// Return the register number that __builtin_eh_return_regno would
1498 /// return with the specified argument.
1499 /// This corresponds with TargetLowering's getExceptionPointerRegister
1500 /// and getExceptionSelectorRegister in the backend.
1501 virtual int getEHDataRegisterNumber(unsigned RegNo) const {
1502 return -1;
1503 }
1504
1505 /// Return the section to use for C++ static initialization functions.
1506 virtual const char *getStaticInitSectionSpecifier() const {
1507 return nullptr;
1508 }
1509
1510 const LangASMap &getAddressSpaceMap() const { return *AddrSpaceMap; }
1511 unsigned getTargetAddressSpace(LangAS AS) const {
1512 if (isTargetAddressSpace(AS))
1513 return toTargetAddressSpace(AS);
1514 return getAddressSpaceMap()[(unsigned)AS];
1515 }
1516
1517 /// Map from the address space field in builtin description strings to the
1518 /// language address space.
1519 virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const {
1520 return getLangASFromTargetAS(AS);
1521 }
1522
1523 /// Map from the address space field in builtin description strings to the
1524 /// language address space.
1525 virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const {
1526 return getLangASFromTargetAS(AS);
1527 }
1528
1529 /// Return an AST address space which can be used opportunistically
1530 /// for constant global memory. It must be possible to convert pointers into
1531 /// this address space to LangAS::Default. If no such address space exists,
1532 /// this may return std::nullopt, and such optimizations will be disabled.
1533 virtual std::optional<LangAS> getConstantAddressSpace() const {
1534 return LangAS::Default;
1535 }
1536
1537 // access target-specific GPU grid values that must be consistent between
1538 // host RTL (plugin), deviceRTL and clang.
1539 virtual const llvm::omp::GV &getGridValue() const {
1540 llvm_unreachable("getGridValue not implemented on this target");
1541 }
1542
1543 /// Retrieve the name of the platform as it is used in the
1544 /// availability attribute.
1545 StringRef getPlatformName() const { return PlatformName; }
1546
1547 /// Retrieve the minimum desired version of the platform, to
1548 /// which the program should be compiled.
1549 VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
1550
1551 bool isBigEndian() const { return BigEndian; }
1552 bool isLittleEndian() const { return !BigEndian; }
1553
1554 /// Whether the option -fextend-arguments={32,64} is supported on the target.
1555 virtual bool supportsExtendIntArgs() const { return false; }
1556
1557 /// Controls if __arithmetic_fence is supported in the targeted backend.
1558 virtual bool checkArithmeticFenceSupported() const { return false; }
1559
1560 /// Gets the default calling convention for the given target and
1561 /// declaration context.
1563 // Not all targets will specify an explicit calling convention that we can
1564 // express. This will always do the right thing, even though it's not
1565 // an explicit calling convention.
1566 return CC_C;
1567 }
1568
1574 };
1575
1576 /// Determines whether a given calling convention is valid for the
1577 /// target. A calling convention can either be accepted, produce a warning
1578 /// and be substituted with the default calling convention, or (someday)
1579 /// produce an error (such as using thiscall on a non-instance function).
1581 switch (CC) {
1582 default:
1583 return CCCR_Warning;
1584 case CC_C:
1585 return CCCR_OK;
1586 }
1587 }
1588
1594
1595 virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const;
1596
1597 /// Controls whether explicitly defaulted (`= default`) special member
1598 /// functions disqualify something from being POD-for-the-purposes-of-layout.
1599 /// Historically, Clang didn't consider these acceptable for POD, but GCC
1600 /// does. So in newer Clang ABIs they are acceptable for POD to be compatible
1601 /// with GCC/Itanium ABI, and remains disqualifying for targets that need
1602 /// Clang backwards compatibility rather than GCC/Itanium ABI compatibility.
1603 virtual bool areDefaultedSMFStillPOD(const LangOptions&) const;
1604
1605 /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to
1606 /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp.
1607 virtual bool hasSjLjLowering() const {
1608 return false;
1609 }
1610
1611 /// Check if the target supports CFProtection branch.
1612 virtual bool
1614
1615 /// Check if the target supports CFProtection return.
1616 virtual bool
1618
1619 /// Whether target allows to overalign ABI-specified preferred alignment
1620 virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
1621
1622 /// Whether target defaults to the `power` alignment rules of AIX.
1623 virtual bool defaultsToAIXPowerAlignment() const { return false; }
1624
1625 /// Set supported OpenCL extensions and optional core features.
1626 virtual void setSupportedOpenCLOpts() {}
1627
1628 virtual void supportAllOpenCLOpts(bool V = true) {
1629#define OPENCLEXTNAME(Ext) \
1630 setFeatureEnabled(getTargetOpts().OpenCLFeaturesMap, #Ext, V);
1631#include "clang/Basic/OpenCLExtensions.def"
1632 }
1633
1634 /// Set supported OpenCL extensions as written on command line
1636 for (const auto &Ext : getTargetOpts().OpenCLExtensionsAsWritten) {
1637 bool IsPrefixed = (Ext[0] == '+' || Ext[0] == '-');
1638 std::string Name = IsPrefixed ? Ext.substr(1) : Ext;
1639 bool V = IsPrefixed ? Ext[0] == '+' : true;
1640
1641 if (Name == "all") {
1643 continue;
1644 }
1645
1647 }
1648 }
1649
1650 /// Get supported OpenCL extensions and optional core features.
1651 llvm::StringMap<bool> &getSupportedOpenCLOpts() {
1653 }
1654
1655 /// Get const supported OpenCL extensions and optional core features.
1656 const llvm::StringMap<bool> &getSupportedOpenCLOpts() const {
1658 }
1659
1660 /// Get address space for OpenCL type.
1662
1663 /// \returns Target specific vtbl ptr address space.
1664 virtual unsigned getVtblPtrAddressSpace() const {
1665 return 0;
1666 }
1667
1668 /// \returns If a target requires an address within a target specific address
1669 /// space \p AddressSpace to be converted in order to be used, then return the
1670 /// corresponding target specific DWARF address space.
1671 ///
1672 /// \returns Otherwise return std::nullopt and no conversion will be emitted
1673 /// in the DWARF.
1674 virtual std::optional<unsigned> getDWARFAddressSpace(unsigned AddressSpace)
1675 const {
1676 return std::nullopt;
1677 }
1678
1679 /// \returns The version of the SDK which was used during the compilation if
1680 /// one was specified, or an empty version otherwise.
1681 const llvm::VersionTuple &getSDKVersion() const {
1682 return getTargetOpts().SDKVersion;
1683 }
1684
1685 /// Check the target is valid after it is fully initialized.
1686 virtual bool validateTarget(DiagnosticsEngine &Diags) const {
1687 return true;
1688 }
1689
1690 /// Check that OpenCL target has valid options setting based on OpenCL
1691 /// version.
1692 virtual bool validateOpenCLTarget(const LangOptions &Opts,
1693 DiagnosticsEngine &Diags) const;
1694
1695 virtual void setAuxTarget(const TargetInfo *Aux) {}
1696
1697 /// Whether target allows debuginfo types for decl only variables/functions.
1698 virtual bool allowDebugInfoForExternalRef() const { return false; }
1699
1700 /// Returns the darwin target variant triple, the variant of the deployment
1701 /// target for which the code is being compiled.
1702 const llvm::Triple *getDarwinTargetVariantTriple() const {
1704 }
1705
1706 /// Returns the version of the darwin target variant SDK which was used during
1707 /// the compilation if one was specified, or an empty version otherwise.
1708 const std::optional<VersionTuple> getDarwinTargetVariantSDKVersion() const {
1711 : std::optional<VersionTuple>();
1712 }
1713
1714protected:
1715 /// Copy type and layout related info.
1716 void copyAuxTarget(const TargetInfo *Aux);
1717 virtual uint64_t getPointerWidthV(LangAS AddrSpace) const {
1718 return PointerWidth;
1719 }
1720 virtual uint64_t getPointerAlignV(LangAS AddrSpace) const {
1721 return PointerAlign;
1722 }
1723 virtual enum IntType getPtrDiffTypeV(LangAS AddrSpace) const {
1724 return PtrDiffType;
1725 }
1729 return std::nullopt;
1730 }
1731
1732 private:
1733 // Assert the values for the fractional and integral bits for each fixed point
1734 // type follow the restrictions given in clause 6.2.6.3 of N1169.
1735 void CheckFixedPointBits() const;
1736};
1737
1738} // end namespace clang
1739
1740#endif
#define V(N, I)
Definition: ASTContext.h:3230
Provides definitions for the various language-specific address spaces.
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::TargetOptions class.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:82
@ AKey
Return address signing uses APIA key.
FPEvalMethodKind
Possible float expression evaluation method choices.
Definition: LangOptions.h:282
@ FEM_Source
Use the declared type for fp arithmetic.
Definition: LangOptions.h:287
The basic abstraction for the target C++ ABI.
Definition: TargetCXXABI.h:28
Exposes information about the current target.
Definition: TargetInfo.h:206
const LangASMap & getAddressSpaceMap() const
Definition: TargetInfo.h:1510
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with '::operator new(size_t)' is g...
Definition: TargetInfo.h:695
unsigned getUnsignedLongFractScale() const
getUnsignedLongFractScale - Return the number of fractional bits in a 'unsigned long _Fract' type.
Definition: TargetInfo.h:604
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
Definition: TargetInfo.cpp:811
virtual bool setCPU(const std::string &Name)
Target the specified CPU.
Definition: TargetInfo.h:1279
virtual ~TargetInfo()
Definition: TargetInfo.cpp:187
IntType getUnsignedPtrDiffType(LangAS AddrSpace) const
Definition: TargetInfo.h:365
virtual std::optional< unsigned > getDWARFAddressSpace(unsigned AddressSpace) const
Definition: TargetInfo.h:1674
TargetOptions & getTargetOpts() const
Retrieve the target options.
Definition: TargetInfo.h:283
virtual std::optional< std::string > handleAsmEscapedChar(char C) const
Replace some escaped characters with another string based on target-specific rules.
Definition: TargetInfo.h:1183
unsigned getLongFractAlign() const
Definition: TargetInfo.h:524
virtual bool validateCpuIs(StringRef Name) const
Definition: TargetInfo.h:1424
virtual bool hasLegalHalfType() const
Determine whether _Float16 is supported on this target.
Definition: TargetInfo.h:642
virtual bool hasLongDoubleType() const
Determine whether the long double type is supported on this target.
Definition: TargetInfo.h:666
unsigned getShortAccumAlign() const
Definition: TargetInfo.h:499
virtual unsigned getExnObjectAlignment() const
Return the alignment (in bits) of the thrown exception object.
Definition: TargetInfo.h:809
virtual bool hasBitIntType() const
Determine whether the _BitInt type is supported on this target.
Definition: TargetInfo.h:621
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
Definition: TargetInfo.cpp:788
virtual bool hasFullBFloat16Type() const
Determine whether the BFloat type is fully supported on this target, i.e arithemtic operations.
Definition: TargetInfo.h:660
unsigned getLargeArrayAlign() const
Definition: TargetInfo.h:780
unsigned getIbm128Align() const
Definition: TargetInfo.h:753
void copyAuxTarget(const TargetInfo *Aux)
Copy type and layout related info.
Definition: TargetInfo.cpp:988
const char * getMCountName() const
Returns the name of the mcount instrumentation function.
Definition: TargetInfo.h:846
virtual std::optional< std::string > getTargetID() const
Returns the target ID if supported.
Definition: TargetInfo.h:1202
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection return.
Definition: TargetInfo.cpp:201
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
Definition: TargetInfo.h:472
unsigned getUnsignedAccumScale() const
getUnsignedAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned _Accum' ty...
Definition: TargetInfo.h:558
unsigned getIntAlign() const
Definition: TargetInfo.h:481
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1728
unsigned getUnsignedAccumIBits() const
Definition: TargetInfo.h:561
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:1197
virtual const char * getFloat128Mangling() const
Return the mangled code of __float128.
Definition: TargetInfo.h:760
unsigned getAccumWidth() const
getAccumWidth/Align - Return the size of 'signed _Accum' and 'unsigned _Accum' for this target,...
Definition: TargetInfo.h:503
IntType getUIntPtrType() const
Definition: TargetInfo.h:369
bool useLeadingZeroLengthBitfield() const
Check whether zero length bitfield alignment is respected if they are leading members.
Definition: TargetInfo.h:876
const LangASMap * AddrSpaceMap
Definition: TargetInfo.h:236
const char * UserLabelPrefix
Definition: TargetInfo.h:232
IntType getInt64Type() const
Definition: TargetInfo.h:376
virtual void adjustTargetOptions(const CodeGenOptions &CGOpts, TargetOptions &TargetOpts) const
Adjust target options based on codegen options.
Definition: TargetInfo.h:1257
virtual StringRef getFeatureDependencies(StringRef Feature) const
For given feature return dependent ones.
Definition: TargetInfo.h:1349
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
Definition: TargetInfo.h:787
virtual bool supportSourceEvalMethod() const
Definition: TargetInfo.h:775
unsigned getUnsignedFractScale() const
getUnsignedFractScale - Return the number of fractional bits in a 'unsigned _Fract' type.
Definition: TargetInfo.h:598
bool hasAlignMac68kSupport() const
Check whether this target support '#pragma options align=mac68k'.
Definition: TargetInfo.h:897
virtual void getCPUSpecificCPUDispatchFeatures(StringRef Name, llvm::SmallVectorImpl< StringRef > &Features) const
Definition: TargetInfo.h:1448
unsigned getWCharAlign() const
Definition: TargetInfo.h:702
virtual enum IntType getPtrDiffTypeV(LangAS AddrSpace) const
Definition: TargetInfo.h:1723
unsigned getLongAlign() const
Definition: TargetInfo.h:486
virtual bool isCLZForZeroUndef() const
The __builtin_clz* and __builtin_ctz* built-in functions are specified to have undefined results for ...
Definition: TargetInfo.h:966
virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
Definition: TargetInfo.cpp:300
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
Definition: TargetInfo.h:1525
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
Definition: TargetInfo.h:1519
virtual std::optional< LangAS > getConstantAddressSpace() const
Return an AST address space which can be used opportunistically for constant global memory.
Definition: TargetInfo.h:1533
const char * getDataLayoutString() const
Definition: TargetInfo.h:1206
std::optional< llvm::Triple > DarwinTargetVariantTriple
Definition: TargetInfo.h:261
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
Definition: TargetInfo.h:1545
virtual bool isBranchProtectionSupportedArch(StringRef Arch) const
Determine if the Architecture in this TargetInfo supports branch protection.
Definition: TargetInfo.h:1363
unsigned getLongLongAlign() const
Definition: TargetInfo.h:491
virtual bool hasFeatureEnabled(const llvm::StringMap< bool > &Features, StringRef Name) const
Check if target has a given feature enabled.
Definition: TargetInfo.h:1324
virtual const char * getStaticInitSectionSpecifier() const
Return the section to use for C++ static initialization functions.
Definition: TargetInfo.h:1506
unsigned HasAArch64SVETypes
Definition: TargetInfo.h:249
void resetDataLayout(StringRef DL, const char *UserLabelPrefix="")
Definition: TargetInfo.cpp:189
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
Definition: TargetInfo.h:682
unsigned getBFloat16Width() const
getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
Definition: TargetInfo.h:725
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:290
@ AArch64ABIBuiltinVaList
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com....
Definition: TargetInfo.h:299
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
Definition: TargetInfo.h:303
@ PowerABIBuiltinVaList
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
Definition: TargetInfo.h:308
@ AAPCSABIBuiltinVaList
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
Definition: TargetInfo.h:317
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
Definition: TargetInfo.h:292
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition: TargetInfo.h:295
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
Definition: TargetInfo.h:312
virtual size_t getMaxBitIntWidth() const
Definition: TargetInfo.h:627
virtual bool setFPMath(StringRef Name)
Use the specified unit for FP math.
Definition: TargetInfo.h:1319
bool isSEHTrySupported() const
Whether the target supports SEH __try.
Definition: TargetInfo.h:1481
unsigned getChar32Width() const
getChar32Width/Align - Return the size of 'char32_t' for this target, in bits.
Definition: TargetInfo.h:711
unsigned char RegParmMax
Definition: TargetInfo.h:234
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Definition: TargetInfo.h:933
const llvm::Triple * getDarwinTargetVariantTriple() const
Returns the darwin target variant triple, the variant of the deployment target for which the code is ...
Definition: TargetInfo.h:1702
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
Definition: TargetInfo.h:459
virtual ArrayRef< const char * > getGCCRegNames() const =0
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:269
virtual std::optional< unsigned > getCPUCacheLineSize() const
Definition: TargetInfo.h:1456
virtual unsigned getMinGlobalAlign(uint64_t) const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
Definition: TargetInfo.h:688
virtual ArrayRef< Builtin::Info > getTargetBuiltins() const =0
Return information about target-specific builtins for the current primary target, and info about whic...
unsigned getLongAccumScale() const
getLongAccumScale/IBits - Return the number of fractional/integral bits in a 'signed long _Accum' typ...
Definition: TargetInfo.h:540
unsigned getLongFractScale() const
getLongFractScale - Return the number of fractional bits in a 'signed long _Fract' type.
Definition: TargetInfo.h:587
unsigned getIbm128Width() const
getIbm128Width/Align/Format - Return the size/align/format of '__ibm128'.
Definition: TargetInfo.h:752
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
Definition: TargetInfo.h:443
virtual bool allowHalfArgsAndReturns() const
Whether half args and returns are supported.
Definition: TargetInfo.h:645
static TargetInfo * CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr< TargetOptions > &Opts)
Construct a target for the given options.
Definition: Targets.cpp:772
unsigned getShortFractAlign() const
Definition: TargetInfo.h:514
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
Definition: TargetInfo.cpp:369
virtual unsigned multiVersionSortPriority(StringRef Name) const
Definition: TargetInfo.h:1414
virtual bool validateOpenCLTarget(const LangOptions &Opts, DiagnosticsEngine &Diags) const
Check that OpenCL target has valid options setting based on OpenCL version.
Definition: Targets.cpp:851
unsigned getFractAlign() const
Definition: TargetInfo.h:519
std::optional< unsigned > MaxBitIntWidth
Definition: TargetInfo.h:259
const llvm::StringMap< bool > & getSupportedOpenCLOpts() const
Get const supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1656
virtual void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const
Enable or disable a specific target feature; the feature name must be valid.
Definition: TargetInfo.h:1331
virtual CallingConv getDefaultCallingConv() const
Gets the default calling convention for the given target and declaration context.
Definition: TargetInfo.h:1562
bool useSignedCharForObjCBool() const
Check if the Objective-C built-in boolean type should be signed char.
Definition: TargetInfo.h:855
virtual bool hasPS4DLLImportExport() const
Definition: TargetInfo.h:1241
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
Definition: TargetInfo.h:610
unsigned getAccumIBits() const
Definition: TargetInfo.h:536
bool useObjCFPRetForRealType(FloatModeKind T) const
Check whether the given real type should use the "fpret" flavor of Objective-C message passing on thi...
Definition: TargetInfo.h:919
virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const
Definition: TargetInfo.cpp:582
virtual LangOptions::FPEvalMethodKind getFPEvalMethod() const
Return the value for the C99 FLT_EVAL_METHOD macro.
Definition: TargetInfo.h:771
unsigned getHalfAlign() const
Definition: TargetInfo.h:716
IntType getSigAtomicType() const
Definition: TargetInfo.h:384
virtual bool validateOutputSize(const llvm::StringMap< bool > &FeatureMap, StringRef, unsigned) const
Definition: TargetInfo.h:1145
unsigned getAccumScale() const
getAccumScale/IBits - Return the number of fractional/integral bits in a 'signed _Accum' type.
Definition: TargetInfo.h:535
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
Definition: TargetInfo.h:651
unsigned getBFloat16Align() const
Definition: TargetInfo.h:726
virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const
Determines whether a given calling convention is valid for the target.
Definition: TargetInfo.h:1580
unsigned getMaxVectorAlign() const
Return the maximum vector alignment supported for the given target.
Definition: TargetInfo.h:802
VersionTuple PlatformMinVersion
Definition: TargetInfo.h:239
unsigned getChar16Width() const
getChar16Width/Align - Return the size of 'char16_t' for this target, in bits.
Definition: TargetInfo.h:706
virtual unsigned getVtblPtrAddressSpace() const
Definition: TargetInfo.h:1664
virtual void setAuxTarget(const TargetInfo *Aux)
Definition: TargetInfo.h:1695
unsigned getLongAccumAlign() const
Definition: TargetInfo.h:509
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target,...
Definition: TargetInfo.h:480
IntType getPtrDiffType(LangAS AddrSpace) const
Definition: TargetInfo.h:361
const char * MCountName
Definition: TargetInfo.h:233
virtual bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags)
Perform initialization based on the user configured set of features (e.g., +sse4).
Definition: TargetInfo.h:1387
bool isLittleEndian() const
Definition: TargetInfo.h:1552
unsigned getShortAccumIBits() const
Definition: TargetInfo.h:529
virtual const char * getIbm128Mangling() const
Return the mangled code of __ibm128.
Definition: TargetInfo.h:763
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
Definition: TargetInfo.h:720
unsigned IsRenderScriptTarget
Definition: TargetInfo.h:247
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
Definition: TargetInfo.cpp:673
unsigned getLongAccumIBits() const
Definition: TargetInfo.h:541
IntType getSizeType() const
Definition: TargetInfo.h:342
IntType getWIntType() const
Definition: TargetInfo.h:373
virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const =0
===-— Other target property query methods -----------------------—===//
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
Definition: TargetInfo.cpp:315
static IntType getCorrespondingUnsignedType(IntType T)
Definition: TargetInfo.h:387
unsigned getLongAccumWidth() const
getLongAccumWidth/Align - Return the size of 'signed long _Accum' and 'unsigned long _Accum' for this...
Definition: TargetInfo.h:508
virtual bool setABI(const std::string &Name)
Use the specified ABI.
Definition: TargetInfo.h:1312
void noSignedCharForObjCBool()
Definition: TargetInfo.h:858
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Definition: TargetInfo.cpp:285
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
Definition: TargetInfo.h:715
virtual bool validateInputSize(const llvm::StringMap< bool > &FeatureMap, StringRef, unsigned) const
Definition: TargetInfo.h:1151
bool allowAMDGPUUnsafeFPAtomics() const
Returns whether or not the AMDGPU unsafe floating point atomics are allowed.
Definition: TargetInfo.h:989
unsigned getShortAccumScale() const
getShortAccumScale/IBits - Return the number of fractional/integral bits in a 'signed short _Accum' t...
Definition: TargetInfo.h:528
unsigned getBoolAlign() const
Return the alignment of '_Bool' and C++ 'bool' for this target.
Definition: TargetInfo.h:465
virtual bool defaultsToAIXPowerAlignment() const
Whether target defaults to the power alignment rules of AIX.
Definition: TargetInfo.h:1623
const llvm::fltSemantics & getDoubleFormat() const
Definition: TargetInfo.h:732
virtual bool hasStrictFP() const
Determine whether constrained floating point is supported on this target.
Definition: TargetInfo.h:673
unsigned char SSERegParmMax
Definition: TargetInfo.h:234
virtual char CPUSpecificManglingCharacter(StringRef Name) const
Definition: TargetInfo.h:1433
virtual void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values) const
Fill a SmallVectorImpl with the valid values for tuning CPU.
Definition: TargetInfo.h:1287
unsigned char MaxAtomicPromoteWidth
Definition: TargetInfo.h:230
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
Definition: TargetInfo.cpp:593
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
Definition: TargetInfo.cpp:208
virtual bool allowDebugInfoForExternalRef() const
Whether target allows debuginfo types for decl only variables/functions.
Definition: TargetInfo.h:1698
unsigned getCharAlign() const
Definition: TargetInfo.h:468
VersionTuple getPlatformMinVersion() const
Retrieve the minimum desired version of the platform, to which the program should be compiled.
Definition: TargetInfo.h:1549
unsigned RealTypeUsesObjCFPRetMask
Definition: TargetInfo.h:242
unsigned MaxOpenCLWorkGroupSize
Definition: TargetInfo.h:257
virtual unsigned multiVersionFeatureCost() const
Definition: TargetInfo.h:1420
const std::optional< VersionTuple > getDarwinTargetVariantSDKVersion() const
Returns the version of the darwin target variant SDK which was used during the compilation if one was...
Definition: TargetInfo.h:1708
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
Definition: TargetInfo.h:490
unsigned getMaxOpenCLWorkGroupSize() const
Definition: TargetInfo.h:804
virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits, uint64_t AlignmentInBits) const
Returns true if the given target supports lock-free atomic operations at the specified width and alig...
Definition: TargetInfo.h:793
bool isTLSSupported() const
Whether the target supports thread-local storage.
Definition: TargetInfo.h:1467
unsigned getZeroLengthBitfieldBoundary() const
Get the fixed alignment value in bits for a member that follows a zero length bitfield.
Definition: TargetInfo.h:882
IntType getIntPtrType() const
Definition: TargetInfo.h:368
uint32_t getARMCDECoprocMask() const
For ARM targets returns a mask defining which coprocessors are configured as Custom Datapath.
Definition: TargetInfo.h:993
unsigned getMaxAlignedAttribute() const
Get the maximum alignment in bits for a static variable with aligned attribute.
Definition: TargetInfo.h:888
IntType getInt16Type() const
Definition: TargetInfo.h:380
const llvm::fltSemantics & getHalfFormat() const
Definition: TargetInfo.h:717
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
virtual void supportAllOpenCLOpts(bool V=true)
Definition: TargetInfo.h:1628
llvm::StringMap< bool > & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1651
StringRef PlatformName
Definition: TargetInfo.h:238
virtual uint64_t getPointerAlignV(LangAS AddrSpace) const
Definition: TargetInfo.h:1720
virtual const char * getLongDoubleMangling() const
Return the mangled code of long double.
Definition: TargetInfo.h:757
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:339
virtual bool supportsExtendIntArgs() const
Whether the option -fextend-arguments={32,64} is supported on the target.
Definition: TargetInfo.h:1555
unsigned getLargeArrayMinWidth() const
Definition: TargetInfo.h:779
unsigned getMaxTLSAlign() const
Return the maximum alignment (in bits) of a TLS variable.
Definition: TargetInfo.h:1475
virtual unsigned getRegisterWidth() const
Return the "preferred" register width on this target.
Definition: TargetInfo.h:832
bool supportsIFunc() const
Identify whether this target supports IFuncs.
Definition: TargetInfo.h:1404
virtual bool isValidTuneCPUName(StringRef Name) const
brief Determine whether this TargetInfo supports the given CPU name for
Definition: TargetInfo.h:1298
virtual bool validateCpuSupports(StringRef Name) const
Definition: TargetInfo.h:1410
IntType getWCharType() const
Definition: TargetInfo.h:372
unsigned ComplexLongDoubleUsesFP2Ret
Definition: TargetInfo.h:243
IntType getUInt16Type() const
Definition: TargetInfo.h:381
unsigned getChar16Align() const
Definition: TargetInfo.h:707
bool isBigEndian() const
Definition: TargetInfo.h:1551
virtual BuiltinVaListKind getBuiltinVaListKind() const =0
Returns the kind of __builtin_va_list type that should be used with this target.
bool isVLASupported() const
Whether target supports variable-length arrays.
Definition: TargetInfo.h:1478
unsigned getTargetAddressSpace(LangAS AS) const
Definition: TargetInfo.h:1511
const llvm::fltSemantics & getBFloat16Format() const
Definition: TargetInfo.h:727
const char * getUserLabelPrefix() const
Returns the default value of the USER_LABEL_PREFIX macro, which is the prefix given to user symbols b...
Definition: TargetInfo.h:843
unsigned getAccumAlign() const
Definition: TargetInfo.h:504
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
Definition: TargetInfo.h:744
virtual bool hasIbm128Type() const
Determine whether the __ibm128 type is supported on this target.
Definition: TargetInfo.h:663
bool useExplicitBitFieldAlignment() const
Check whether explicit bitfield alignment attributes should be.
Definition: TargetInfo.h:892
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts)
Set forced language options.
Definition: TargetInfo.cpp:391
virtual bool doesFeatureAffectCodeGen(StringRef Feature) const
Returns true if feature has an impact on target code generation.
Definition: TargetInfo.h:1344
virtual bool validateConstraintModifier(StringRef, char, unsigned, std::string &) const
Definition: TargetInfo.h:1157
uint64_t getPointerAlign(LangAS AddrSpace) const
Definition: TargetInfo.h:447
IntType getChar16Type() const
Definition: TargetInfo.h:374
unsigned getUnsignedShortAccumIBits() const
Definition: TargetInfo.h:550
IntType getChar32Type() const
Definition: TargetInfo.h:375
unsigned getWCharWidth() const
getWCharWidth/Align - Return the size of 'wchar_t' for this target, in bits.
Definition: TargetInfo.h:701
bool isRenderScriptTarget() const
Returns true for RenderScript.
Definition: TargetInfo.h:977
IntType getUInt64Type() const
Definition: TargetInfo.h:377
virtual bool hasFPReturn() const
Determine whether return of a floating point value is supported on this target.
Definition: TargetInfo.h:670
std::string DataLayoutString
Definition: TargetInfo.h:231
unsigned getUnsignedLongAccumScale() const
getUnsignedLongAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned long _...
Definition: TargetInfo.h:568
virtual StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const
Extracts a register from the passed constraint (if it is a single-register constraint) and the asm la...
Definition: TargetInfo.h:1023
virtual void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const
Fill a SmallVectorImpl with the valid values to setCPU.
Definition: TargetInfo.h:1284
IntType getSignedSizeType() const
Definition: TargetInfo.h:343
bool hasBuiltinMSVaList() const
Returns whether or not type __builtin_ms_va_list type is available on this target.
Definition: TargetInfo.h:974
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition: TargetInfo.h:648
unsigned getUnsignedLongAccumIBits() const
Definition: TargetInfo.h:571
virtual void setMaxAtomicWidth()
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition: TargetInfo.h:790
unsigned getUnsignedShortFractScale() const
getUnsignedShortFractScale - Return the number of fractional bits in a 'unsigned short _Fract' type.
Definition: TargetInfo.h:591
bool hasNoAsmVariants() const
Return true if {|} are normal characters in the asm string.
Definition: TargetInfo.h:1493
unsigned HasAlignMac68kSupport
Definition: TargetInfo.h:241
virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const
Definition: TargetInfo.h:1428
const llvm::fltSemantics & getLongDoubleFormat() const
Definition: TargetInfo.h:738
virtual StringRef getCPUSpecificTuneName(StringRef Name) const
Definition: TargetInfo.h:1440
const llvm::fltSemantics & getFloatFormat() const
Definition: TargetInfo.h:722
bool validateOutputConstraint(ConstraintInfo &Info) const
Definition: TargetInfo.cpp:714
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1272
bool hasAArch64SVETypes() const
Returns whether or not the AArch64 SVE built-in types are available on this target.
Definition: TargetInfo.h:981
unsigned getDoubleAlign() const
Definition: TargetInfo.h:731
virtual bool hasProtectedVisibility() const
Does this target support "protected" visibility?
Definition: TargetInfo.h:1231
unsigned getRegParmMax() const
Definition: TargetInfo.h:1461
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
Definition: TargetInfo.cpp:226
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
Definition: TargetInfo.h:730
virtual bool checkArithmeticFenceSupported() const
Controls if __arithmetic_fence is supported in the targeted backend.
Definition: TargetInfo.h:1558
unsigned getIntMaxTWidth() const
Return the size of intmax_t and uintmax_t for this target, in bits.
Definition: TargetInfo.h:822
virtual int getEHDataRegisterNumber(unsigned RegNo) const
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition: TargetInfo.h:1501
unsigned getShortAccumWidth() const
getShortAccumWidth/Align - Return the size of 'signed short _Accum' and 'unsigned short _Accum' for t...
Definition: TargetInfo.h:498
virtual StringRef getABI() const
Get the ABI currently in use.
Definition: TargetInfo.h:1269
unsigned getSuitableAlign() const
Return the alignment that is the largest alignment ever used for any scalar/SIMD data type on the tar...
Definition: TargetInfo.h:678
bool useObjCFP2RetForComplexLongDouble() const
Check whether _Complex long double should use the "fp2ret" flavor of Objective-C message passing on t...
Definition: TargetInfo.h:925
virtual const llvm::omp::GV & getGridValue() const
Definition: TargetInfo.h:1539
virtual uint64_t getPointerWidthV(LangAS AddrSpace) const
Definition: TargetInfo.h:1717
virtual bool allowsLargerPreferedTypeAlignment() const
Whether target allows to overalign ABI-specified preferred alignment.
Definition: TargetInfo.h:1620
virtual std::string_view getClobbers() const =0
Returns a string of target-specific clobbers, in LLVM format.
virtual unsigned getUnwindWordWidth() const
Definition: TargetInfo.h:827
unsigned getBoolWidth() const
Return the size of '_Bool' and C++ 'bool' for this target, in bits.
Definition: TargetInfo.h:462
virtual bool isValidFeatureName(StringRef Feature) const
Determine whether this TargetInfo supports the given feature.
Definition: TargetInfo.h:1338
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:939
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
Definition: TargetInfo.cpp:620
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
Definition: TargetInfo.cpp:589
unsigned getCharWidth() const
Definition: TargetInfo.h:467
unsigned HasRISCVVTypes
Definition: TargetInfo.h:251
bool useZeroLengthBitfieldAlignment() const
Check whether zero length bitfields should force alignment of the next member.
Definition: TargetInfo.h:870
virtual bool validateTarget(DiagnosticsEngine &Diags) const
Check the target is valid after it is fully initialized.
Definition: TargetInfo.h:1686
virtual ParsedTargetAttr parseTargetAttr(StringRef Str) const
Definition: TargetInfo.cpp:537
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
Definition: TargetInfo.h:485
unsigned getLongFractWidth() const
getLongFractWidth/Align - Return the size of 'signed long _Fract' and 'unsigned long _Fract' for this...
Definition: TargetInfo.h:523
IntType getIntMaxType() const
Definition: TargetInfo.h:357
virtual bool supportsTargetAttributeTune() const
brief Determine whether this TargetInfo supports tune in target attribute.
Definition: TargetInfo.h:1305
unsigned getFractScale() const
getFractScale - Return the number of fractional bits in a 'signed _Fract' type.
Definition: TargetInfo.h:583
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
Definition: TargetInfo.cpp:521
bool supportsMultiVersioning() const
Identify whether this target supports multiversioning of functions, which requires support for cpu_su...
Definition: TargetInfo.h:1399
virtual bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const
Validate register name used for global register variables.
Definition: TargetInfo.h:1131
virtual bool shouldDLLImportComdatSymbols() const
Does this target aim for semantic compatibility with Microsoft C++ code using dllimport/export attrib...
Definition: TargetInfo.h:1235
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
Definition: TargetInfo.cpp:195
unsigned getFractWidth() const
getFractWidth/Align - Return the size of 'signed _Fract' and 'unsigned _Fract' for this target,...
Definition: TargetInfo.h:518
virtual std::string convertConstraint(const char *&Constraint) const
Definition: TargetInfo.h:1174
unsigned char MaxAtomicInlineWidth
Definition: TargetInfo.h:230
virtual void setCommandLineOpenCLOpts()
Set supported OpenCL extensions as written on command line.
Definition: TargetInfo.h:1635
unsigned AllowAMDGPUUnsafeFPAtomics
Definition: TargetInfo.h:253
unsigned getFloat128Align() const
Definition: TargetInfo.h:745
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
Definition: TargetInfo.h:654
unsigned getShortFractScale() const
getShortFractScale - Return the number of fractional bits in a 'signed short _Fract' type.
Definition: TargetInfo.h:579
IntType getProcessIDType() const
Definition: TargetInfo.h:385
unsigned getFloatAlign() const
Definition: TargetInfo.h:721
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition: TargetInfo.h:453
unsigned getShortFractWidth() const
getShortFractWidth/Align - Return the size of 'signed short _Fract' and 'unsigned short _Fract' for t...
Definition: TargetInfo.h:513
TargetCXXABI TheCXXABI
Definition: TargetInfo.h:235
unsigned ARMCDECoprocMask
Definition: TargetInfo.h:255
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
Definition: TargetInfo.h:1393
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
Definition: TargetInfo.cpp:251
unsigned getUnsignedShortAccumScale() const
getUnsignedShortAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned short...
Definition: TargetInfo.h:547
virtual bool isValidCPUName(StringRef Name) const
brief Determine whether this TargetInfo supports the given CPU name.
Definition: TargetInfo.h:1292
unsigned getChar32Align() const
Definition: TargetInfo.h:712
bool doUnsignedFixedPointTypesHavePadding() const
In the event this target uses the same number of fractional bits for its unsigned types as it does wi...
Definition: TargetInfo.h:408
unsigned getMaxAtomicPromoteWidth() const
Return the maximum width lock-free atomic operation which will ever be supported for the given target...
Definition: TargetInfo.h:784
virtual bool isSPRegName(StringRef) const
Definition: TargetInfo.h:1015
unsigned getInt128Align() const
getInt128Align() - Returns the alignment of Int128.
Definition: TargetInfo.h:494
IntType getUIntMaxType() const
Definition: TargetInfo.h:358
const llvm::fltSemantics & getFloat128Format() const
Definition: TargetInfo.h:746
unsigned HasBuiltinMSVaList
Definition: TargetInfo.h:245
virtual bool hasSjLjLowering() const
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm....
Definition: TargetInfo.h:1607
const llvm::VersionTuple & getSDKVersion() const
Definition: TargetInfo.h:1681
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
Definition: TargetInfo.h:736
unsigned getLongDoubleAlign() const
Definition: TargetInfo.h:737
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts) const
Returns target-specific min and max values VScale_Range.
Definition: TargetInfo.h:958
const llvm::fltSemantics & getIbm128Format() const
Definition: TargetInfo.h:754
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:351
bool useBitFieldTypeAlignment() const
Check whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:864
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
Definition: TargetInfo.h:476
virtual const char * getBFloat16Mangling() const
Return the mangled code of bfloat.
Definition: TargetInfo.h:768
virtual bool isNan2008() const
Returns true if NaN encoding is IEEE 754-2008.
Definition: TargetInfo.h:1192
virtual void setSupportedOpenCLOpts()
Set supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1626
bool hasRISCVVTypes() const
Returns whether or not the RISC-V V built-in types are available on this target.
Definition: TargetInfo.h:985
virtual bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Definition: TargetInfo.cpp:628
virtual bool validateBranchProtection(StringRef Spec, StringRef Arch, BranchProtectionInfo &BPI, StringRef &Err) const
Determine if this TargetInfo supports the given branch protection specification.
Definition: TargetInfo.h:1369
Options for controlling the target.
Definition: TargetOptions.h:26
llvm::VersionTuple SDKVersion
The version of the SDK which was used during the compilation.
llvm::VersionTuple DarwinTargetVariantSDKVersion
The version of the darwin target variant SDK which was used during the compilation.
bool ForceEnableInt128
If given, enables support for __int128_t and __uint128_t types.
Definition: TargetOptions.h:72
llvm::StringMap< bool > OpenCLFeaturesMap
Supported OpenCL extensions and optional core features.
Definition: TargetOptions.h:65
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones.
Definition: AddressSpaces.h:73
bool isTargetAddressSpace(LangAS AS)
Definition: AddressSpaces.h:77
OpenCLTypeKind
OpenCL type kinds.
Definition: TargetInfo.h:192
@ OCLTK_ReserveID
Definition: TargetInfo.h:199
@ OCLTK_Image
Definition: TargetInfo.h:196
@ OCLTK_Sampler
Definition: TargetInfo.h:200
@ OCLTK_Pipe
Definition: TargetInfo.h:197
@ OCLTK_ClkEvent
Definition: TargetInfo.h:194
@ OCLTK_Event
Definition: TargetInfo.h:195
@ OCLTK_Default
Definition: TargetInfo.h:193
@ OCLTK_Queue
Definition: TargetInfo.h:198
unsigned toTargetAddressSpace(LangAS AS)
Definition: AddressSpaces.h:81
@ C
Languages that the frontend can parse and compile.
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
FloatModeKind
Definition: TargetInfo.h:69
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:269
@ CC_C
Definition: Specifiers.h:270
LangAS getLangASFromTargetAS(unsigned TargetAS)
Definition: AddressSpaces.h:86
YAML serialization mapping.
Definition: Dominators.h:30
Contains information gathered from parsing the contents of TargetAttr.
Definition: TargetInfo.h:54
std::vector< std::string > Features
Definition: TargetInfo.h:55
StringRef BranchProtection
Definition: TargetInfo.h:58
bool operator==(const ParsedTargetAttr &Other) const
Definition: TargetInfo.h:60
const char *const Names[5]
Definition: TargetInfo.h:1217
LangOptions::SignReturnAddressScopeKind SignReturnAddr
Definition: TargetInfo.h:1354
LangOptions::SignReturnAddressKeyKind SignKey
Definition: TargetInfo.h:1356
llvm::SmallSet< int, 4 > ImmSet
Definition: TargetInfo.h:1045
const std::string & getConstraintStr() const
Definition: TargetInfo.h:1057
bool hasMatchingInput() const
Return true if this output operand has a matching (tied) input operand.
Definition: TargetInfo.h:1066
const std::string & getName() const
Definition: TargetInfo.h:1058
ConstraintInfo(StringRef ConstraintStr, StringRef Name)
Definition: TargetInfo.h:1050
void setRequiresImmediate(int Exact)
Definition: TargetInfo.h:1105
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
Definition: TargetInfo.h:1117
bool isValidAsmImmediate(const llvm::APInt &Value) const
Definition: TargetInfo.h:1082
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand.
Definition: TargetInfo.h:1073
struct clang::TargetInfo::ConstraintInfo::@180 ImmRange
void setRequiresImmediate(llvm::ArrayRef< int > Exacts)
Definition: TargetInfo.h:1100
void setRequiresImmediate(int Min, int Max)
Definition: TargetInfo.h:1094
const char *const Aliases[5]
Definition: TargetInfo.h:1212
const char *const Register
Definition: TargetInfo.h:1213
Fields controlling how types are laid out in memory; these may need to be copied for targets like AMD...
Definition: TargetInfo.h:83
const llvm::fltSemantics * DoubleFormat
Definition: TargetInfo.h:132
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition: TargetInfo.h:173
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition: TargetInfo.h:180
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition: TargetInfo.h:135
const llvm::fltSemantics * LongDoubleFormat
Definition: TargetInfo.h:132
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield,...
Definition: TargetInfo.h:184
const llvm::fltSemantics * Float128Format
Definition: TargetInfo.h:132
unsigned UseLeadingZeroLengthBitfield
Whether zero length bitfield alignment is respected if they are the leading members.
Definition: TargetInfo.h:177
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:165
unsigned char LargeArrayMinWidth
Definition: TargetInfo.h:92
unsigned MaxAlignedAttribute
If non-zero, specifies a maximum alignment to truncate alignment specified in the aligned attribute o...
Definition: TargetInfo.h:188
const llvm::fltSemantics * Ibm128Format
Definition: TargetInfo.h:132
const llvm::fltSemantics * FloatFormat
Definition: TargetInfo.h:131
const llvm::fltSemantics * HalfFormat
Definition: TargetInfo.h:131
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
Definition: TargetInfo.h:158
const llvm::fltSemantics * BFloat16Format
Definition: TargetInfo.h:131
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:123