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

source code of clang/include/clang/Basic/TargetInfo.h