clang  8.0.0
TargetInfo.h
Go to the documentation of this file.
1 //===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// Defines the clang::TargetInfo interface.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_BASIC_TARGETINFO_H
16 #define LLVM_CLANG_BASIC_TARGETINFO_H
17 
19 #include "clang/Basic/LLVM.h"
20 #include "clang/Basic/Specifiers.h"
23 #include "llvm/ADT/APInt.h"
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
25 #include "llvm/ADT/Optional.h"
26 #include "llvm/ADT/SmallSet.h"
27 #include "llvm/ADT/StringMap.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/ADT/Triple.h"
30 #include "llvm/IR/DataLayout.h"
31 #include "llvm/Support/DataTypes.h"
32 #include "llvm/Support/VersionTuple.h"
33 #include <cassert>
34 #include <string>
35 #include <vector>
36 
37 namespace llvm {
38 struct fltSemantics;
39 }
40 
41 namespace clang {
42 class DiagnosticsEngine;
43 class LangOptions;
44 class CodeGenOptions;
45 class MacroBuilder;
46 class QualType;
47 class SourceLocation;
48 class SourceManager;
49 
50 namespace Builtin { struct Info; }
51 
52 /// Exposes information about the current target.
53 ///
54 class TargetInfo : public RefCountedBase<TargetInfo> {
55  std::shared_ptr<TargetOptions> TargetOpts;
56  llvm::Triple Triple;
57 protected:
58  // Target values set by the ctor of the actual target implementation. Default
59  // values are specified by the TargetInfo constructor.
60  bool BigEndian;
63  bool NoAsmVariants; // True if {|} are normal characters.
64  bool HasLegalHalfType; // True if the backend supports operations on the half
65  // LLVM IR type.
67  bool HasFloat16;
68  unsigned char PointerWidth, PointerAlign;
69  unsigned char BoolWidth, BoolAlign;
70  unsigned char IntWidth, IntAlign;
71  unsigned char HalfWidth, HalfAlign;
72  unsigned char FloatWidth, FloatAlign;
73  unsigned char DoubleWidth, DoubleAlign;
74  unsigned char LongDoubleWidth, LongDoubleAlign, Float128Align;
75  unsigned char LargeArrayMinWidth, LargeArrayAlign;
76  unsigned char LongWidth, LongAlign;
77  unsigned char LongLongWidth, LongLongAlign;
78 
79  // Fixed point bit widths
80  unsigned char ShortAccumWidth, ShortAccumAlign;
81  unsigned char AccumWidth, AccumAlign;
82  unsigned char LongAccumWidth, LongAccumAlign;
83  unsigned char ShortFractWidth, ShortFractAlign;
84  unsigned char FractWidth, FractAlign;
85  unsigned char LongFractWidth, LongFractAlign;
86 
87  // If true, unsigned fixed point types have the same number of fractional bits
88  // as their signed counterparts, forcing the unsigned types to have one extra
89  // bit of padding. Otherwise, unsigned fixed point types have
90  // one more fractional bit than its corresponding signed type. This is false
91  // by default.
93 
94  // Fixed point integral and fractional bit sizes
95  // Saturated types share the same integral/fractional bits as their
96  // corresponding unsaturated types.
97  // For simplicity, the fractional bits in a _Fract type will be one less the
98  // width of that _Fract type. This leaves all signed _Fract types having no
99  // padding and unsigned _Fract types will only have 1 bit of padding after the
100  // sign if PaddingOnUnsignedFixedPoint is set.
101  unsigned char ShortAccumScale;
102  unsigned char AccumScale;
103  unsigned char LongAccumScale;
104 
105  unsigned char SuitableAlign;
107  unsigned char MinGlobalAlign;
108  unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
109  unsigned short MaxVectorAlign;
110  unsigned short MaxTLSAlign;
111  unsigned short SimdDefaultAlign;
112  unsigned short NewAlign;
113  std::unique_ptr<llvm::DataLayout> DataLayout;
114  const char *MCountName;
115  const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
116  *LongDoubleFormat, *Float128Format;
117  unsigned char RegParmMax, SSERegParmMax;
120 
121  mutable StringRef PlatformName;
122  mutable VersionTuple PlatformMinVersion;
123 
124  unsigned HasAlignMac68kSupport : 1;
125  unsigned RealTypeUsesObjCFPRet : 3;
127 
128  unsigned HasBuiltinMSVaList : 1;
129 
130  unsigned IsRenderScriptTarget : 1;
131 
132  // TargetInfo Constructor. Default initializes all fields.
133  TargetInfo(const llvm::Triple &T);
134 
135  void resetDataLayout(StringRef DL) {
136  DataLayout.reset(new llvm::DataLayout(DL));
137  }
138 
139 public:
140  /// Construct a target for the given options.
141  ///
142  /// \param Opts - The options to use to initialize the target. The target may
143  /// modify the options to canonicalize the target feature information to match
144  /// what the backend expects.
145  static TargetInfo *
146  CreateTargetInfo(DiagnosticsEngine &Diags,
147  const std::shared_ptr<TargetOptions> &Opts);
148 
149  virtual ~TargetInfo();
150 
151  /// Retrieve the target options.
153  assert(TargetOpts && "Missing target options");
154  return *TargetOpts;
155  }
156 
157  ///===---- Target Data Type Query Methods -------------------------------===//
158  enum IntType {
159  NoInt = 0,
169  UnsignedLongLong
170  };
171 
172  enum RealType {
173  NoFloat = 255,
174  Float = 0,
177  Float128
178  };
179 
180  /// The different kinds of __builtin_va_list types defined by
181  /// the target implementation.
183  /// typedef char* __builtin_va_list;
184  CharPtrBuiltinVaList = 0,
185 
186  /// typedef void* __builtin_va_list;
188 
189  /// __builtin_va_list as defined by the AArch64 ABI
190  /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
192 
193  /// __builtin_va_list as defined by the PNaCl ABI:
194  /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types
196 
197  /// __builtin_va_list as defined by the Power ABI:
198  /// https://www.power.org
199  /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf
201 
202  /// __builtin_va_list as defined by the x86-64 ABI:
203  /// http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
205 
206  /// __builtin_va_list as defined by ARM AAPCS ABI
207  /// http://infocenter.arm.com
208  // /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
210 
211  // typedef struct __va_list_tag
212  // {
213  // long __gpr;
214  // long __fpr;
215  // void *__overflow_arg_area;
216  // void *__reg_save_area;
217  // } va_list[1];
218  SystemZBuiltinVaList
219  };
220 
221 protected:
222  IntType SizeType, IntMaxType, PtrDiffType, IntPtrType, WCharType,
223  WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType,
224  ProcessIDType;
225 
226  /// Whether Objective-C's built-in boolean type should be signed char.
227  ///
228  /// Otherwise, when this flag is not set, the normal built-in boolean type is
229  /// used.
231 
232  /// Control whether the alignment of bit-field types is respected when laying
233  /// out structures. If true, then the alignment of the bit-field type will be
234  /// used to (a) impact the alignment of the containing structure, and (b)
235  /// ensure that the individual bit-field will not straddle an alignment
236  /// boundary.
238 
239  /// Whether zero length bitfields (e.g., int : 0;) force alignment of
240  /// the next bitfield.
241  ///
242  /// If the alignment of the zero length bitfield is greater than the member
243  /// that follows it, `bar', `bar' will be aligned as the type of the
244  /// zero-length bitfield.
246 
247  /// Whether explicit bit field alignment attributes are honored.
249 
250  /// If non-zero, specifies a fixed alignment value for bitfields that follow
251  /// zero length bitfield, regardless of the zero length bitfield type.
253 
254  /// Specify if mangling based on address space map should be used or
255  /// not for language specific address spaces
257 
258 public:
259  IntType getSizeType() const { return SizeType; }
261  switch (SizeType) {
262  case UnsignedShort:
263  return SignedShort;
264  case UnsignedInt:
265  return SignedInt;
266  case UnsignedLong:
267  return SignedLong;
268  case UnsignedLongLong:
269  return SignedLongLong;
270  default:
271  llvm_unreachable("Invalid SizeType");
272  }
273  }
274  IntType getIntMaxType() const { return IntMaxType; }
276  return getCorrespondingUnsignedType(IntMaxType);
277  }
278  IntType getPtrDiffType(unsigned AddrSpace) const {
279  return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
280  }
281  IntType getUnsignedPtrDiffType(unsigned AddrSpace) const {
282  return getCorrespondingUnsignedType(getPtrDiffType(AddrSpace));
283  }
284  IntType getIntPtrType() const { return IntPtrType; }
286  return getCorrespondingUnsignedType(IntPtrType);
287  }
288  IntType getWCharType() const { return WCharType; }
289  IntType getWIntType() const { return WIntType; }
290  IntType getChar16Type() const { return Char16Type; }
291  IntType getChar32Type() const { return Char32Type; }
292  IntType getInt64Type() const { return Int64Type; }
294  return getCorrespondingUnsignedType(Int64Type);
295  }
296  IntType getSigAtomicType() const { return SigAtomicType; }
297  IntType getProcessIDType() const { return ProcessIDType; }
298 
300  switch (T) {
301  case SignedChar:
302  return UnsignedChar;
303  case SignedShort:
304  return UnsignedShort;
305  case SignedInt:
306  return UnsignedInt;
307  case SignedLong:
308  return UnsignedLong;
309  case SignedLongLong:
310  return UnsignedLongLong;
311  default:
312  llvm_unreachable("Unexpected signed integer type");
313  }
314  }
315 
316  /// In the event this target uses the same number of fractional bits for its
317  /// unsigned types as it does with its signed counterparts, there will be
318  /// exactly one bit of padding.
319  /// Return true if unsigned fixed point types have padding for this target.
321  return PaddingOnUnsignedFixedPoint;
322  }
323 
324  /// Return the width (in bits) of the specified integer type enum.
325  ///
326  /// For example, SignedInt -> getIntWidth().
327  unsigned getTypeWidth(IntType T) const;
328 
329  /// Return integer type with specified width.
330  virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const;
331 
332  /// Return the smallest integer type with at least the specified width.
333  virtual IntType getLeastIntTypeByWidth(unsigned BitWidth,
334  bool IsSigned) const;
335 
336  /// Return floating point type with specified width.
337  RealType getRealTypeByWidth(unsigned BitWidth) const;
338 
339  /// Return the alignment (in bits) of the specified integer type enum.
340  ///
341  /// For example, SignedInt -> getIntAlign().
342  unsigned getTypeAlign(IntType T) const;
343 
344  /// Returns true if the type is signed; false otherwise.
345  static bool isTypeSigned(IntType T);
346 
347  /// Return the width of pointers on this target, for the
348  /// specified address space.
349  uint64_t getPointerWidth(unsigned AddrSpace) const {
350  return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
351  }
352  uint64_t getPointerAlign(unsigned AddrSpace) const {
353  return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
354  }
355 
356  /// Return the maximum width of pointers on this target.
357  virtual uint64_t getMaxPointerWidth() const {
358  return PointerWidth;
359  }
360 
361  /// Get integer value for null pointer.
362  /// \param AddrSpace address space of pointee in source language.
363  virtual uint64_t getNullPointerValue(LangAS AddrSpace) const { return 0; }
364 
365  /// Return the size of '_Bool' and C++ 'bool' for this target, in bits.
366  unsigned getBoolWidth() const { return BoolWidth; }
367 
368  /// Return the alignment of '_Bool' and C++ 'bool' for this target.
369  unsigned getBoolAlign() const { return BoolAlign; }
370 
371  unsigned getCharWidth() const { return 8; } // FIXME
372  unsigned getCharAlign() const { return 8; } // FIXME
373 
374  /// Return the size of 'signed short' and 'unsigned short' for this
375  /// target, in bits.
376  unsigned getShortWidth() const { return 16; } // FIXME
377 
378  /// Return the alignment of 'signed short' and 'unsigned short' for
379  /// this target.
380  unsigned getShortAlign() const { return 16; } // FIXME
381 
382  /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
383  /// this target, in bits.
384  unsigned getIntWidth() const { return IntWidth; }
385  unsigned getIntAlign() const { return IntAlign; }
386 
387  /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
388  /// for this target, in bits.
389  unsigned getLongWidth() const { return LongWidth; }
390  unsigned getLongAlign() const { return LongAlign; }
391 
392  /// getLongLongWidth/Align - Return the size of 'signed long long' and
393  /// 'unsigned long long' for this target, in bits.
394  unsigned getLongLongWidth() const { return LongLongWidth; }
395  unsigned getLongLongAlign() const { return LongLongAlign; }
396 
397  /// getShortAccumWidth/Align - Return the size of 'signed short _Accum' and
398  /// 'unsigned short _Accum' for this target, in bits.
399  unsigned getShortAccumWidth() const { return ShortAccumWidth; }
400  unsigned getShortAccumAlign() const { return ShortAccumAlign; }
401 
402  /// getAccumWidth/Align - Return the size of 'signed _Accum' and
403  /// 'unsigned _Accum' for this target, in bits.
404  unsigned getAccumWidth() const { return AccumWidth; }
405  unsigned getAccumAlign() const { return AccumAlign; }
406 
407  /// getLongAccumWidth/Align - Return the size of 'signed long _Accum' and
408  /// 'unsigned long _Accum' for this target, in bits.
409  unsigned getLongAccumWidth() const { return LongAccumWidth; }
410  unsigned getLongAccumAlign() const { return LongAccumAlign; }
411 
412  /// getShortFractWidth/Align - Return the size of 'signed short _Fract' and
413  /// 'unsigned short _Fract' for this target, in bits.
414  unsigned getShortFractWidth() const { return ShortFractWidth; }
415  unsigned getShortFractAlign() const { return ShortFractAlign; }
416 
417  /// getFractWidth/Align - Return the size of 'signed _Fract' and
418  /// 'unsigned _Fract' for this target, in bits.
419  unsigned getFractWidth() const { return FractWidth; }
420  unsigned getFractAlign() const { return FractAlign; }
421 
422  /// getLongFractWidth/Align - Return the size of 'signed long _Fract' and
423  /// 'unsigned long _Fract' for this target, in bits.
424  unsigned getLongFractWidth() const { return LongFractWidth; }
425  unsigned getLongFractAlign() const { return LongFractAlign; }
426 
427  /// getShortAccumScale/IBits - Return the number of fractional/integral bits
428  /// in a 'signed short _Accum' type.
429  unsigned getShortAccumScale() const { return ShortAccumScale; }
430  unsigned getShortAccumIBits() const {
431  return ShortAccumWidth - ShortAccumScale - 1;
432  }
433 
434  /// getAccumScale/IBits - Return the number of fractional/integral bits
435  /// in a 'signed _Accum' type.
436  unsigned getAccumScale() const { return AccumScale; }
437  unsigned getAccumIBits() const { return AccumWidth - AccumScale - 1; }
438 
439  /// getLongAccumScale/IBits - Return the number of fractional/integral bits
440  /// in a 'signed long _Accum' type.
441  unsigned getLongAccumScale() const { return LongAccumScale; }
442  unsigned getLongAccumIBits() const {
443  return LongAccumWidth - LongAccumScale - 1;
444  }
445 
446  /// getUnsignedShortAccumScale/IBits - Return the number of
447  /// fractional/integral bits in a 'unsigned short _Accum' type.
448  unsigned getUnsignedShortAccumScale() const {
449  return PaddingOnUnsignedFixedPoint ? ShortAccumScale : ShortAccumScale + 1;
450  }
451  unsigned getUnsignedShortAccumIBits() const {
452  return PaddingOnUnsignedFixedPoint
453  ? getShortAccumIBits()
454  : ShortAccumWidth - getUnsignedShortAccumScale();
455  }
456 
457  /// getUnsignedAccumScale/IBits - Return the number of fractional/integral
458  /// bits in a 'unsigned _Accum' type.
459  unsigned getUnsignedAccumScale() const {
460  return PaddingOnUnsignedFixedPoint ? AccumScale : AccumScale + 1;
461  }
462  unsigned getUnsignedAccumIBits() const {
463  return PaddingOnUnsignedFixedPoint ? getAccumIBits()
464  : AccumWidth - getUnsignedAccumScale();
465  }
466 
467  /// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral
468  /// bits in a 'unsigned long _Accum' type.
469  unsigned getUnsignedLongAccumScale() const {
470  return PaddingOnUnsignedFixedPoint ? LongAccumScale : LongAccumScale + 1;
471  }
472  unsigned getUnsignedLongAccumIBits() const {
473  return PaddingOnUnsignedFixedPoint
474  ? getLongAccumIBits()
475  : LongAccumWidth - getUnsignedLongAccumScale();
476  }
477 
478  /// getShortFractScale - Return the number of fractional bits
479  /// in a 'signed short _Fract' type.
480  unsigned getShortFractScale() const { return ShortFractWidth - 1; }
481 
482  /// getFractScale - Return the number of fractional bits
483  /// in a 'signed _Fract' type.
484  unsigned getFractScale() const { return FractWidth - 1; }
485 
486  /// getLongFractScale - Return the number of fractional bits
487  /// in a 'signed long _Fract' type.
488  unsigned getLongFractScale() const { return LongFractWidth - 1; }
489 
490  /// getUnsignedShortFractScale - Return the number of fractional bits
491  /// in a 'unsigned short _Fract' type.
492  unsigned getUnsignedShortFractScale() const {
493  return PaddingOnUnsignedFixedPoint ? getShortFractScale()
494  : getShortFractScale() + 1;
495  }
496 
497  /// getUnsignedFractScale - Return the number of fractional bits
498  /// in a 'unsigned _Fract' type.
499  unsigned getUnsignedFractScale() const {
500  return PaddingOnUnsignedFixedPoint ? getFractScale() : getFractScale() + 1;
501  }
502 
503  /// getUnsignedLongFractScale - Return the number of fractional bits
504  /// in a 'unsigned long _Fract' type.
505  unsigned getUnsignedLongFractScale() const {
506  return PaddingOnUnsignedFixedPoint ? getLongFractScale()
507  : getLongFractScale() + 1;
508  }
509 
510  /// Determine whether the __int128 type is supported on this target.
511  virtual bool hasInt128Type() const {
512  return (getPointerWidth(0) >= 64) || getTargetOpts().ForceEnableInt128;
513  } // FIXME
514 
515  /// Determine whether _Float16 is supported on this target.
516  virtual bool hasLegalHalfType() const { return HasLegalHalfType; }
517 
518  /// Determine whether the __float128 type is supported on this target.
519  virtual bool hasFloat128Type() const { return HasFloat128; }
520 
521  /// Determine whether the _Float16 type is supported on this target.
522  virtual bool hasFloat16Type() const { return HasFloat16; }
523 
524  /// Return the alignment that is suitable for storing any
525  /// object with a fundamental alignment requirement.
526  unsigned getSuitableAlign() const { return SuitableAlign; }
527 
528  /// Return the default alignment for __attribute__((aligned)) on
529  /// this target, to be used if no alignment value is specified.
531  return DefaultAlignForAttributeAligned;
532  }
533 
534  /// getMinGlobalAlign - Return the minimum alignment of a global variable,
535  /// unless its alignment is explicitly reduced via attributes.
536  unsigned getMinGlobalAlign() const { return MinGlobalAlign; }
537 
538  /// Return the largest alignment for which a suitably-sized allocation with
539  /// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
540  /// pointer.
541  unsigned getNewAlign() const {
542  return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
543  }
544 
545  /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
546  /// bits.
547  unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
548  unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
549 
550  /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
551  /// bits.
552  unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
553  unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
554 
555  /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
556  /// bits.
557  unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
558  unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
559 
560  /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
561  unsigned getHalfWidth() const { return HalfWidth; }
562  unsigned getHalfAlign() const { return HalfAlign; }
563  const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
564 
565  /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
566  unsigned getFloatWidth() const { return FloatWidth; }
567  unsigned getFloatAlign() const { return FloatAlign; }
568  const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
569 
570  /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
571  unsigned getDoubleWidth() const { return DoubleWidth; }
572  unsigned getDoubleAlign() const { return DoubleAlign; }
573  const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
574 
575  /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
576  /// double'.
577  unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
578  unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
579  const llvm::fltSemantics &getLongDoubleFormat() const {
580  return *LongDoubleFormat;
581  }
582 
583  /// getFloat128Width/Align/Format - Return the size/align/format of
584  /// '__float128'.
585  unsigned getFloat128Width() const { return 128; }
586  unsigned getFloat128Align() const { return Float128Align; }
587  const llvm::fltSemantics &getFloat128Format() const {
588  return *Float128Format;
589  }
590 
591  /// Return true if the 'long double' type should be mangled like
592  /// __float128.
593  virtual bool useFloat128ManglingForLongDouble() const { return false; }
594 
595  /// Return the value for the C99 FLT_EVAL_METHOD macro.
596  virtual unsigned getFloatEvalMethod() const { return 0; }
597 
598  // getLargeArrayMinWidth/Align - Return the minimum array size that is
599  // 'large' and its alignment.
600  unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
601  unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
602 
603  /// Return the maximum width lock-free atomic operation which will
604  /// ever be supported for the given target
605  unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; }
606  /// Return the maximum width lock-free atomic operation which can be
607  /// inlined given the supported features of the given target.
608  unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
609  /// Set the maximum inline or promote width lock-free atomic operation
610  /// for the given target.
611  virtual void setMaxAtomicWidth() {}
612  /// Returns true if the given target supports lock-free atomic
613  /// operations at the specified width and alignment.
614  virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits,
615  uint64_t AlignmentInBits) const {
616  return AtomicSizeInBits <= AlignmentInBits &&
617  AtomicSizeInBits <= getMaxAtomicInlineWidth() &&
618  (AtomicSizeInBits <= getCharWidth() ||
619  llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth()));
620  }
621 
622  /// Return the maximum vector alignment supported for the given target.
623  unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
624  /// Return default simd alignment for the given target. Generally, this
625  /// value is type-specific, but this alignment can be used for most of the
626  /// types for the given target.
627  unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; }
628 
629  /// Return the size of intmax_t and uintmax_t for this target, in bits.
630  unsigned getIntMaxTWidth() const {
631  return getTypeWidth(IntMaxType);
632  }
633 
634  // Return the size of unwind_word for this target.
635  virtual unsigned getUnwindWordWidth() const { return getPointerWidth(0); }
636 
637  /// Return the "preferred" register width on this target.
638  virtual unsigned getRegisterWidth() const {
639  // Currently we assume the register width on the target matches the pointer
640  // width, we can introduce a new variable for this if/when some target wants
641  // it.
642  return PointerWidth;
643  }
644 
645  /// Returns the name of the mcount instrumentation function.
646  const char *getMCountName() const {
647  return MCountName;
648  }
649 
650  /// Check if the Objective-C built-in boolean type should be signed
651  /// char.
652  ///
653  /// Otherwise, if this returns false, the normal built-in boolean type
654  /// should also be used for Objective-C.
656  return UseSignedCharForObjCBool;
657  }
659  UseSignedCharForObjCBool = false;
660  }
661 
662  /// Check whether the alignment of bit-field types is respected
663  /// when laying out structures.
665  return UseBitFieldTypeAlignment;
666  }
667 
668  /// Check whether zero length bitfields should force alignment of
669  /// the next member.
671  return UseZeroLengthBitfieldAlignment;
672  }
673 
674  /// Get the fixed alignment value in bits for a member that follows
675  /// a zero length bitfield.
676  unsigned getZeroLengthBitfieldBoundary() const {
677  return ZeroLengthBitfieldBoundary;
678  }
679 
680  /// Check whether explicit bitfield alignment attributes should be
681  // honored, as in "__attribute__((aligned(2))) int b : 1;".
683  return UseExplicitBitFieldAlignment;
684  }
685 
686  /// Check whether this target support '\#pragma options align=mac68k'.
687  bool hasAlignMac68kSupport() const {
688  return HasAlignMac68kSupport;
689  }
690 
691  /// Return the user string for the specified integer type enum.
692  ///
693  /// For example, SignedShort -> "short".
694  static const char *getTypeName(IntType T);
695 
696  /// Return the constant suffix for the specified integer type enum.
697  ///
698  /// For example, SignedLong -> "L".
699  const char *getTypeConstantSuffix(IntType T) const;
700 
701  /// Return the printf format modifier for the specified
702  /// integer type enum.
703  ///
704  /// For example, SignedLong -> "l".
705  static const char *getTypeFormatModifier(IntType T);
706 
707  /// Check whether the given real type should use the "fpret" flavor of
708  /// Objective-C message passing on this target.
710  return RealTypeUsesObjCFPRet & (1 << T);
711  }
712 
713  /// Check whether _Complex long double should use the "fp2ret" flavor
714  /// of Objective-C message passing on this target.
716  return ComplexLongDoubleUsesFP2Ret;
717  }
718 
719  /// Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used
720  /// to convert to and from __fp16.
721  /// FIXME: This function should be removed once all targets stop using the
722  /// conversion intrinsics.
723  virtual bool useFP16ConversionIntrinsics() const {
724  return true;
725  }
726 
727  /// Specify if mangling based on address space map should be used or
728  /// not for language specific address spaces
730  return UseAddrSpaceMapMangling;
731  }
732 
733  ///===---- Other target property query methods --------------------------===//
734 
735  /// Appends the target-specific \#define values for this
736  /// target set to the specified buffer.
737  virtual void getTargetDefines(const LangOptions &Opts,
738  MacroBuilder &Builder) const = 0;
739 
740 
741  /// Return information about target-specific builtins for
742  /// the current primary target, and info about which builtins are non-portable
743  /// across the current set of primary and secondary targets.
744  virtual ArrayRef<Builtin::Info> getTargetBuiltins() const = 0;
745 
746  /// The __builtin_clz* and __builtin_ctz* built-in
747  /// functions are specified to have undefined results for zero inputs, but
748  /// on targets that support these operations in a way that provides
749  /// well-defined results for zero without loss of performance, it is a good
750  /// idea to avoid optimizing based on that undef behavior.
751  virtual bool isCLZForZeroUndef() const { return true; }
752 
753  /// Returns the kind of __builtin_va_list type that should be used
754  /// with this target.
755  virtual BuiltinVaListKind getBuiltinVaListKind() const = 0;
756 
757  /// Returns whether or not type \c __builtin_ms_va_list type is
758  /// available on this target.
759  bool hasBuiltinMSVaList() const { return HasBuiltinMSVaList; }
760 
761  /// Returns true for RenderScript.
762  bool isRenderScriptTarget() const { return IsRenderScriptTarget; }
763 
764  /// Returns whether the passed in string is a valid clobber in an
765  /// inline asm statement.
766  ///
767  /// This is used by Sema.
768  bool isValidClobber(StringRef Name) const;
769 
770  /// Returns whether the passed in string is a valid register name
771  /// according to GCC.
772  ///
773  /// This is used by Sema for inline asm statements.
774  virtual bool isValidGCCRegisterName(StringRef Name) const;
775 
776  /// Returns the "normalized" GCC register name.
777  ///
778  /// ReturnCannonical true will return the register name without any additions
779  /// such as "{}" or "%" in it's canonical form, for example:
780  /// ReturnCanonical = true and Name = "rax", will return "ax".
781  StringRef getNormalizedGCCRegisterName(StringRef Name,
782  bool ReturnCanonical = false) const;
783 
784  /// Extracts a register from the passed constraint (if it is a
785  /// single-register constraint) and the asm label expression related to a
786  /// variable in the input or output list of an inline asm statement.
787  ///
788  /// This function is used by Sema in order to diagnose conflicts between
789  /// the clobber list and the input/output lists.
790  virtual StringRef getConstraintRegister(StringRef Constraint,
791  StringRef Expression) const {
792  return "";
793  }
794 
795  struct ConstraintInfo {
796  enum {
797  CI_None = 0x00,
798  CI_AllowsMemory = 0x01,
799  CI_AllowsRegister = 0x02,
800  CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
801  CI_HasMatchingInput = 0x08, // This output operand has a matching input.
802  CI_ImmediateConstant = 0x10, // This operand must be an immediate constant
803  CI_EarlyClobber = 0x20, // "&" output constraint (early clobber).
804  };
805  unsigned Flags;
807  struct {
808  int Min;
809  int Max;
810  } ImmRange;
811  llvm::SmallSet<int, 4> ImmSet;
812 
813  std::string ConstraintStr; // constraint: "=rm"
814  std::string Name; // Operand name: [foo] with no []'s.
815  public:
816  ConstraintInfo(StringRef ConstraintStr, StringRef Name)
817  : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
818  Name(Name.str()) {
819  ImmRange.Min = ImmRange.Max = 0;
820  }
821 
822  const std::string &getConstraintStr() const { return ConstraintStr; }
823  const std::string &getName() const { return Name; }
824  bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
825  bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; }
826  bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
827  bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
828 
829  /// Return true if this output operand has a matching
830  /// (tied) input operand.
831  bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
832 
833  /// Return true if this input operand is a matching
834  /// constraint that ties it to an output operand.
835  ///
836  /// If this returns true then getTiedOperand will indicate which output
837  /// operand this is tied to.
838  bool hasTiedOperand() const { return TiedOperand != -1; }
839  unsigned getTiedOperand() const {
840  assert(hasTiedOperand() && "Has no tied operand!");
841  return (unsigned)TiedOperand;
842  }
843 
845  return (Flags & CI_ImmediateConstant) != 0;
846  }
847  bool isValidAsmImmediate(const llvm::APInt &Value) const {
848  return (Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max)) ||
849  ImmSet.count(Value.getZExtValue()) != 0;
850  }
851 
852  void setIsReadWrite() { Flags |= CI_ReadWrite; }
853  void setEarlyClobber() { Flags |= CI_EarlyClobber; }
854  void setAllowsMemory() { Flags |= CI_AllowsMemory; }
855  void setAllowsRegister() { Flags |= CI_AllowsRegister; }
856  void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
857  void setRequiresImmediate(int Min, int Max) {
858  Flags |= CI_ImmediateConstant;
859  ImmRange.Min = Min;
860  ImmRange.Max = Max;
861  }
863  Flags |= CI_ImmediateConstant;
864  for (int Exact : Exacts)
865  ImmSet.insert(Exact);
866  }
867  void setRequiresImmediate(int Exact) {
868  Flags |= CI_ImmediateConstant;
869  ImmSet.insert(Exact);
870  }
872  Flags |= CI_ImmediateConstant;
873  ImmRange.Min = INT_MIN;
874  ImmRange.Max = INT_MAX;
875  }
876 
877  /// Indicate that this is an input operand that is tied to
878  /// the specified output operand.
879  ///
880  /// Copy over the various constraint information from the output.
881  void setTiedOperand(unsigned N, ConstraintInfo &Output) {
882  Output.setHasMatchingInput();
883  Flags = Output.Flags;
884  TiedOperand = N;
885  // Don't copy Name or constraint string.
886  }
887  };
888 
889  /// Validate register name used for global register variables.
890  ///
891  /// This function returns true if the register passed in RegName can be used
892  /// for global register variables on this target. In addition, it returns
893  /// true in HasSizeMismatch if the size of the register doesn't match the
894  /// variable size passed in RegSize.
895  virtual bool validateGlobalRegisterVariable(StringRef RegName,
896  unsigned RegSize,
897  bool &HasSizeMismatch) const {
898  HasSizeMismatch = false;
899  return true;
900  }
901 
902  // validateOutputConstraint, validateInputConstraint - Checks that
903  // a constraint is valid and provides information about it.
904  // FIXME: These should return a real error instead of just true/false.
905  bool validateOutputConstraint(ConstraintInfo &Info) const;
906  bool validateInputConstraint(MutableArrayRef<ConstraintInfo> OutputConstraints,
907  ConstraintInfo &info) const;
908 
909  virtual bool validateOutputSize(StringRef /*Constraint*/,
910  unsigned /*Size*/) const {
911  return true;
912  }
913 
914  virtual bool validateInputSize(StringRef /*Constraint*/,
915  unsigned /*Size*/) const {
916  return true;
917  }
918  virtual bool
919  validateConstraintModifier(StringRef /*Constraint*/,
920  char /*Modifier*/,
921  unsigned /*Size*/,
922  std::string &/*SuggestedModifier*/) const {
923  return true;
924  }
925  virtual bool
926  validateAsmConstraint(const char *&Name,
927  TargetInfo::ConstraintInfo &info) const = 0;
928 
929  bool resolveSymbolicName(const char *&Name,
930  ArrayRef<ConstraintInfo> OutputConstraints,
931  unsigned &Index) const;
932 
933  // Constraint parm will be left pointing at the last character of
934  // the constraint. In practice, it won't be changed unless the
935  // constraint is longer than one character.
936  virtual std::string convertConstraint(const char *&Constraint) const {
937  // 'p' defaults to 'r', but can be overridden by targets.
938  if (*Constraint == 'p')
939  return std::string("r");
940  return std::string(1, *Constraint);
941  }
942 
943  /// Returns a string of target-specific clobbers, in LLVM format.
944  virtual const char *getClobbers() const = 0;
945 
946  /// Returns true if NaN encoding is IEEE 754-2008.
947  /// Only MIPS allows a different encoding.
948  virtual bool isNan2008() const {
949  return true;
950  }
951 
952  /// Returns the target triple of the primary target.
953  const llvm::Triple &getTriple() const {
954  return Triple;
955  }
956 
957  const llvm::DataLayout &getDataLayout() const {
958  assert(DataLayout && "Uninitialized DataLayout!");
959  return *DataLayout;
960  }
961 
962  struct GCCRegAlias {
963  const char * const Aliases[5];
964  const char * const Register;
965  };
966 
967  struct AddlRegName {
968  const char * const Names[5];
969  const unsigned RegNum;
970  };
971 
972  /// Does this target support "protected" visibility?
973  ///
974  /// Any target which dynamic libraries will naturally support
975  /// something like "default" (meaning that the symbol is visible
976  /// outside this shared object) and "hidden" (meaning that it isn't)
977  /// visibilities, but "protected" is really an ELF-specific concept
978  /// with weird semantics designed around the convenience of dynamic
979  /// linker implementations. Which is not to suggest that there's
980  /// consistent target-independent semantics for "default" visibility
981  /// either; the entire thing is pretty badly mangled.
982  virtual bool hasProtectedVisibility() const { return true; }
983 
984  /// An optional hook that targets can implement to perform semantic
985  /// checking on attribute((section("foo"))) specifiers.
986  ///
987  /// In this case, "foo" is passed in to be checked. If the section
988  /// specifier is invalid, the backend should return a non-empty string
989  /// that indicates the problem.
990  ///
991  /// This hook is a simple quality of implementation feature to catch errors
992  /// and give good diagnostics in cases when the assembler or code generator
993  /// would otherwise reject the section specifier.
994  ///
995  virtual std::string isValidSectionSpecifier(StringRef SR) const {
996  return "";
997  }
998 
999  /// Set forced language options.
1000  ///
1001  /// Apply changes to the target information with respect to certain
1002  /// language options which change the target configuration and adjust
1003  /// the language based on the target options where applicable.
1004  virtual void adjust(LangOptions &Opts);
1005 
1006  /// Adjust target options based on codegen options.
1007  virtual void adjustTargetOptions(const CodeGenOptions &CGOpts,
1008  TargetOptions &TargetOpts) const {}
1009 
1010  /// Initialize the map with the default set of target features for the
1011  /// CPU this should include all legal feature strings on the target.
1012  ///
1013  /// \return False on error (invalid features).
1014  virtual bool initFeatureMap(llvm::StringMap<bool> &Features,
1015  DiagnosticsEngine &Diags, StringRef CPU,
1016  const std::vector<std::string> &FeatureVec) const;
1017 
1018  /// Get the ABI currently in use.
1019  virtual StringRef getABI() const { return StringRef(); }
1020 
1021  /// Get the C++ ABI currently in use.
1023  return TheCXXABI;
1024  }
1025 
1026  /// Target the specified CPU.
1027  ///
1028  /// \return False on error (invalid CPU name).
1029  virtual bool setCPU(const std::string &Name) {
1030  return false;
1031  }
1032 
1033  /// Fill a SmallVectorImpl with the valid values to setCPU.
1034  virtual void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {}
1035 
1036  /// brief Determine whether this TargetInfo supports the given CPU name.
1037  virtual bool isValidCPUName(StringRef Name) const {
1038  return true;
1039  }
1040 
1041  /// Use the specified ABI.
1042  ///
1043  /// \return False on error (invalid ABI name).
1044  virtual bool setABI(const std::string &Name) {
1045  return false;
1046  }
1047 
1048  /// Use the specified unit for FP math.
1049  ///
1050  /// \return False on error (invalid unit name).
1051  virtual bool setFPMath(StringRef Name) {
1052  return false;
1053  }
1054 
1055  /// Enable or disable a specific target feature;
1056  /// the feature name must be valid.
1057  virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,
1058  StringRef Name,
1059  bool Enabled) const {
1060  Features[Name] = Enabled;
1061  }
1062 
1063  /// Determine whether this TargetInfo supports the given feature.
1064  virtual bool isValidFeatureName(StringRef Feature) const {
1065  return true;
1066  }
1067 
1068  /// Perform initialization based on the user configured
1069  /// set of features (e.g., +sse4).
1070  ///
1071  /// The list is guaranteed to have at most one entry per feature.
1072  ///
1073  /// The target may modify the features list, to change which options are
1074  /// passed onwards to the backend.
1075  /// FIXME: This part should be fixed so that we can change handleTargetFeatures
1076  /// to merely a TargetInfo initialization routine.
1077  ///
1078  /// \return False on error.
1079  virtual bool handleTargetFeatures(std::vector<std::string> &Features,
1080  DiagnosticsEngine &Diags) {
1081  return true;
1082  }
1083 
1084  /// Determine whether the given target has the given feature.
1085  virtual bool hasFeature(StringRef Feature) const {
1086  return false;
1087  }
1088 
1089  /// Identify whether this target supports multiversioning of functions,
1090  /// which requires support for cpu_supports and cpu_is functionality.
1092  return getTriple().getArch() == llvm::Triple::x86 ||
1093  getTriple().getArch() == llvm::Triple::x86_64;
1094  }
1095 
1096  /// Identify whether this target supports IFuncs.
1097  bool supportsIFunc() const { return getTriple().isOSBinFormatELF(); }
1098 
1099  // Validate the contents of the __builtin_cpu_supports(const char*)
1100  // argument.
1101  virtual bool validateCpuSupports(StringRef Name) const { return false; }
1102 
1103  // Return the target-specific priority for features/cpus/vendors so
1104  // that they can be properly sorted for checking.
1105  virtual unsigned multiVersionSortPriority(StringRef Name) const {
1106  return 0;
1107  }
1108 
1109  // Validate the contents of the __builtin_cpu_is(const char*)
1110  // argument.
1111  virtual bool validateCpuIs(StringRef Name) const { return false; }
1112 
1113  // Validate a cpu_dispatch/cpu_specific CPU option, which is a different list
1114  // from cpu_is, since it checks via features rather than CPUs directly.
1115  virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const {
1116  return false;
1117  }
1118 
1119  // Get the character to be added for mangling purposes for cpu_specific.
1120  virtual char CPUSpecificManglingCharacter(StringRef Name) const {
1121  llvm_unreachable(
1122  "cpu_specific Multiversioning not implemented on this target");
1123  }
1124 
1125  // Get a list of the features that make up the CPU option for
1126  // cpu_specific/cpu_dispatch so that it can be passed to llvm as optimization
1127  // options.
1129  StringRef Name, llvm::SmallVectorImpl<StringRef> &Features) const {
1130  llvm_unreachable(
1131  "cpu_specific Multiversioning not implemented on this target");
1132  }
1133 
1134  // Returns maximal number of args passed in registers.
1135  unsigned getRegParmMax() const {
1136  assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
1137  return RegParmMax;
1138  }
1139 
1140  /// Whether the target supports thread-local storage.
1141  bool isTLSSupported() const {
1142  return TLSSupported;
1143  }
1144 
1145  /// Return the maximum alignment (in bits) of a TLS variable
1146  ///
1147  /// Gets the maximum alignment (in bits) of a TLS variable on this target.
1148  /// Returns zero if there is no such constraint.
1149  unsigned short getMaxTLSAlign() const {
1150  return MaxTLSAlign;
1151  }
1152 
1153  /// Whether target supports variable-length arrays.
1154  bool isVLASupported() const { return VLASupported; }
1155 
1156  /// Whether the target supports SEH __try.
1157  bool isSEHTrySupported() const {
1158  return getTriple().isOSWindows() &&
1159  (getTriple().getArch() == llvm::Triple::x86 ||
1160  getTriple().getArch() == llvm::Triple::x86_64 ||
1161  getTriple().getArch() == llvm::Triple::aarch64);
1162  }
1163 
1164  /// Return true if {|} are normal characters in the asm string.
1165  ///
1166  /// If this returns false (the default), then {abc|xyz} is syntax
1167  /// that says that when compiling for asm variant #0, "abc" should be
1168  /// generated, but when compiling for asm variant #1, "xyz" should be
1169  /// generated.
1170  bool hasNoAsmVariants() const {
1171  return NoAsmVariants;
1172  }
1173 
1174  /// Return the register number that __builtin_eh_return_regno would
1175  /// return with the specified argument.
1176  /// This corresponds with TargetLowering's getExceptionPointerRegister
1177  /// and getExceptionSelectorRegister in the backend.
1178  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
1179  return -1;
1180  }
1181 
1182  /// Return the section to use for C++ static initialization functions.
1183  virtual const char *getStaticInitSectionSpecifier() const {
1184  return nullptr;
1185  }
1186 
1187  const LangASMap &getAddressSpaceMap() const { return *AddrSpaceMap; }
1188 
1189  /// Map from the address space field in builtin description strings to the
1190  /// language address space.
1191  virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const {
1192  return getLangASFromTargetAS(AS);
1193  }
1194 
1195  /// Map from the address space field in builtin description strings to the
1196  /// language address space.
1197  virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const {
1198  return getLangASFromTargetAS(AS);
1199  }
1200 
1201  /// Return an AST address space which can be used opportunistically
1202  /// for constant global memory. It must be possible to convert pointers into
1203  /// this address space to LangAS::Default. If no such address space exists,
1204  /// this may return None, and such optimizations will be disabled.
1206  return LangAS::Default;
1207  }
1208 
1209  /// Retrieve the name of the platform as it is used in the
1210  /// availability attribute.
1211  StringRef getPlatformName() const { return PlatformName; }
1212 
1213  /// Retrieve the minimum desired version of the platform, to
1214  /// which the program should be compiled.
1215  VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
1216 
1217  bool isBigEndian() const { return BigEndian; }
1218  bool isLittleEndian() const { return !BigEndian; }
1219 
1223  CCMT_NonMember
1224  };
1225 
1226  /// Gets the default calling convention for the given target and
1227  /// declaration context.
1229  // Not all targets will specify an explicit calling convention that we can
1230  // express. This will always do the right thing, even though it's not
1231  // an explicit calling convention.
1232  return CC_C;
1233  }
1234 
1239  };
1240 
1241  /// Determines whether a given calling convention is valid for the
1242  /// target. A calling convention can either be accepted, produce a warning
1243  /// and be substituted with the default calling convention, or (someday)
1244  /// produce an error (such as using thiscall on a non-instance function).
1246  switch (CC) {
1247  default:
1248  return CCCR_Warning;
1249  case CC_C:
1250  return CCCR_OK;
1251  }
1252  }
1253 
1257  CCK_MicrosoftWin64
1258  };
1259 
1260  virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const;
1261 
1262  /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to
1263  /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp.
1264  virtual bool hasSjLjLowering() const {
1265  return false;
1266  }
1267 
1268  /// Check if the target supports CFProtection branch.
1269  virtual bool
1270  checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const;
1271 
1272  /// Check if the target supports CFProtection branch.
1273  virtual bool
1274  checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const;
1275 
1276  /// Whether target allows to overalign ABI-specified preferred alignment
1277  virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
1278 
1279  /// Set supported OpenCL extensions and optional core features.
1280  virtual void setSupportedOpenCLOpts() {}
1281 
1282  /// Set supported OpenCL extensions as written on command line
1283  virtual void setOpenCLExtensionOpts() {
1284  for (const auto &Ext : getTargetOpts().OpenCLExtensionsAsWritten) {
1285  getTargetOpts().SupportedOpenCLOptions.support(Ext);
1286  }
1287  }
1288 
1289  /// Get supported OpenCL extensions and optional core features.
1291  return getTargetOpts().SupportedOpenCLOptions;
1292  }
1293 
1294  /// Get const supported OpenCL extensions and optional core features.
1296  return getTargetOpts().SupportedOpenCLOptions;
1297  }
1298 
1308  };
1309 
1310  /// Get address space for OpenCL type.
1311  virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const;
1312 
1313  /// \returns Target specific vtbl ptr address space.
1314  virtual unsigned getVtblPtrAddressSpace() const {
1315  return 0;
1316  }
1317 
1318  /// \returns If a target requires an address within a target specific address
1319  /// space \p AddressSpace to be converted in order to be used, then return the
1320  /// corresponding target specific DWARF address space.
1321  ///
1322  /// \returns Otherwise return None and no conversion will be emitted in the
1323  /// DWARF.
1324  virtual Optional<unsigned> getDWARFAddressSpace(unsigned AddressSpace) const {
1325  return None;
1326  }
1327 
1328  /// \returns The version of the SDK which was used during the compilation if
1329  /// one was specified, or an empty version otherwise.
1330  const llvm::VersionTuple &getSDKVersion() const {
1331  return getTargetOpts().SDKVersion;
1332  }
1333 
1334  /// Check the target is valid after it is fully initialized.
1335  virtual bool validateTarget(DiagnosticsEngine &Diags) const {
1336  return true;
1337  }
1338 
1339 protected:
1340  virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
1341  return PointerWidth;
1342  }
1343  virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
1344  return PointerAlign;
1345  }
1346  virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
1347  return PtrDiffType;
1348  }
1349  virtual ArrayRef<const char *> getGCCRegNames() const = 0;
1350  virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0;
1352  return None;
1353  }
1354 
1355  private:
1356  // Assert the values for the fractional and integral bits for each fixed point
1357  // type follow the restrictions given in clause 6.2.6.3 of N1169.
1358  void CheckFixedPointBits() const;
1359 };
1360 
1361 } // end namespace clang
1362 
1363 #endif
unsigned getRegParmMax() const
Definition: TargetInfo.h:1135
TargetOptions & getTargetOpts() const
Retrieve the target options.
Definition: TargetInfo.h:152
IntType getInt64Type() const
Definition: TargetInfo.h:292
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of &#39;half&#39;.
Definition: TargetInfo.h:561
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of &#39;float&#39;.
Definition: TargetInfo.h:566
VersionTuple getPlatformMinVersion() const
Retrieve the minimum desired version of the platform, to which the program should be compiled...
Definition: TargetInfo.h:1215
unsigned getLongFractAlign() const
Definition: TargetInfo.h:425
bool hasBuiltinMSVaList() const
Returns whether or not type __builtin_ms_va_list type is available on this target.
Definition: TargetInfo.h:759
unsigned getLongAccumIBits() const
Definition: TargetInfo.h:442
The basic abstraction for the target C++ ABI.
Definition: TargetCXXABI.h:24
unsigned getBoolWidth() const
Return the size of &#39;_Bool&#39; and C++ &#39;bool&#39; for this target, in bits.
Definition: TargetInfo.h:366
unsigned getLongWidth() const
getLongWidth/Align - Return the size of &#39;signed long&#39; and &#39;unsigned long&#39; for this target...
Definition: TargetInfo.h:389
OpenCL supported extensions and optional core features.
Definition: OpenCLOptions.h:23
unsigned getSuitableAlign() const
Return the alignment that is suitable for storing any object with a fundamental alignment requirement...
Definition: TargetInfo.h:526
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
bool isBigEndian() const
Definition: TargetInfo.h:1217
virtual unsigned getVtblPtrAddressSpace() const
Definition: TargetInfo.h:1314
unsigned getMaxVectorAlign() const
Return the maximum vector alignment supported for the given target.
Definition: TargetInfo.h:623
unsigned short MaxVectorAlign
Definition: TargetInfo.h:109
unsigned getLargeArrayAlign() const
Definition: TargetInfo.h:601
unsigned char AccumScale
Definition: TargetInfo.h:102
unsigned getFloat128Align() const
Definition: TargetInfo.h:586
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:953
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
Definition: TargetInfo.h:195
unsigned getLongAlign() const
Definition: TargetInfo.h:390
virtual bool isValidFeatureName(StringRef Feature) const
Determine whether this TargetInfo supports the given feature.
Definition: TargetInfo.h:1064
virtual void setMaxAtomicWidth()
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition: TargetInfo.h:611
unsigned char IntWidth
Definition: TargetInfo.h:70
unsigned char LongLongWidth
Definition: TargetInfo.h:77
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
Definition: TargetInfo.h:530
unsigned getFractWidth() const
getFractWidth/Align - Return the size of &#39;signed _Fract&#39; and &#39;unsigned _Fract&#39; for this target...
Definition: TargetInfo.h:419
unsigned getAccumIBits() const
Definition: TargetInfo.h:437
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
Definition: TargetInfo.h:204
unsigned getCharWidth() const
Definition: TargetInfo.h:371
unsigned char ShortFractWidth
Definition: TargetInfo.h:83
virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const
Determines whether a given calling convention is valid for the target.
Definition: TargetInfo.h:1245
unsigned short SimdDefaultAlign
Definition: TargetInfo.h:111
unsigned getLargeArrayMinWidth() const
Definition: TargetInfo.h:600
llvm::SmallSet< int, 4 > ImmSet
Definition: TargetInfo.h:811
virtual void adjustTargetOptions(const CodeGenOptions &CGOpts, TargetOptions &TargetOpts) const
Adjust target options based on codegen options.
Definition: TargetInfo.h:1007
unsigned getShortAccumIBits() const
Definition: TargetInfo.h:430
void setRequiresImmediate(int Min, int Max)
Definition: TargetInfo.h:857
LangAS getLangASFromTargetAS(unsigned TargetAS)
Definition: AddressSpaces.h:67
const char *const Register
Definition: TargetInfo.h:964
Options for controlling the target.
Definition: TargetOptions.h:27
unsigned getCharAlign() const
Definition: TargetInfo.h:372
unsigned getWCharAlign() const
Definition: TargetInfo.h:548
const llvm::fltSemantics & getHalfFormat() const
Definition: TargetInfo.h:563
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:26
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
Definition: TargetInfo.h:191
virtual bool isCLZForZeroUndef() const
The __builtin_clz* and __builtin_ctz* built-in functions are specified to have undefined results for ...
Definition: TargetInfo.h:751
unsigned char LongDoubleWidth
Definition: TargetInfo.h:74
unsigned char LargeArrayMinWidth
Definition: TargetInfo.h:75
bool supportsIFunc() const
Identify whether this target supports IFuncs.
Definition: TargetInfo.h:1097
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:1057
unsigned getAccumAlign() const
Definition: TargetInfo.h:405
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield...
Definition: TargetInfo.h:252
unsigned getZeroLengthBitfieldBoundary() const
Get the fixed alignment value in bits for a member that follows a zero length bitfield.
Definition: TargetInfo.h:676
unsigned getLongDoubleAlign() const
Definition: TargetInfo.h:578
unsigned char AccumWidth
Definition: TargetInfo.h:81
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
Definition: TargetInfo.h:349
unsigned char MinGlobalAlign
Definition: TargetInfo.h:107
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1022
unsigned getIntAlign() const
Definition: TargetInfo.h:385
IntType getUnsignedPtrDiffType(unsigned AddrSpace) const
Definition: TargetInfo.h:281
unsigned getChar32Width() const
getChar32Width/Align - Return the size of &#39;char32_t&#39; for this target, in bits.
Definition: TargetInfo.h:557
virtual bool validateConstraintModifier(StringRef, char, unsigned, std::string &) const
Definition: TargetInfo.h:919
IntType getChar32Type() const
Definition: TargetInfo.h:291
const char * MCountName
Definition: TargetInfo.h:114
const std::string & getName() const
Definition: TargetInfo.h:823
bool supportsMultiVersioning() const
Identify whether this target supports multiversioning of functions, which requires support for cpu_su...
Definition: TargetInfo.h:1091
virtual bool useFloat128ManglingForLongDouble() const
Return true if the &#39;long double&#39; type should be mangled like __float128.
Definition: TargetInfo.h:593
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with &#39;::operator new(size_t)&#39; is g...
Definition: TargetInfo.h:541
IntType getSizeType() const
Definition: TargetInfo.h:259
unsigned getUnsignedLongAccumIBits() const
Definition: TargetInfo.h:472
bool hasNoAsmVariants() const
Return true if {|} are normal characters in the asm string.
Definition: TargetInfo.h:1170
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:50
virtual void setOpenCLExtensionOpts()
Set supported OpenCL extensions as written on command line.
Definition: TargetInfo.h:1283
unsigned getMaxAtomicPromoteWidth() const
Return the maximum width lock-free atomic operation which will ever be supported for the given target...
Definition: TargetInfo.h:605
virtual bool hasLegalHalfType() const
Determine whether _Float16 is supported on this target.
Definition: TargetInfo.h:516
virtual StringRef getABI() const
Get the ABI currently in use.
Definition: TargetInfo.h:1019
virtual std::string isValidSectionSpecifier(StringRef SR) const
An optional hook that targets can implement to perform semantic checking on attribute((section("foo")...
Definition: TargetInfo.h:995
unsigned char MaxAtomicPromoteWidth
Definition: TargetInfo.h:108
bool hasMatchingInput() const
Return true if this output operand has a matching (tied) input operand.
Definition: TargetInfo.h:831
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:106
const LangASMap & getAddressSpaceMap() const
Definition: TargetInfo.h:1187
unsigned char PointerWidth
Definition: TargetInfo.h:68
unsigned char SSERegParmMax
Definition: TargetInfo.h:117
unsigned char FloatWidth
Definition: TargetInfo.h:72
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:614
virtual bool validateTarget(DiagnosticsEngine &Diags) const
Check the target is valid after it is fully initialized.
Definition: TargetInfo.h:1335
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:149
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:790
unsigned getShortAccumScale() const
getShortAccumScale/IBits - Return the number of fractional/integral bits in a &#39;signed short _Accum&#39; t...
Definition: TargetInfo.h:429
unsigned getShortWidth() const
Return the size of &#39;signed short&#39; and &#39;unsigned short&#39; for this target, in bits.
Definition: TargetInfo.h:376
unsigned getChar16Align() const
Definition: TargetInfo.h:553
unsigned getFractAlign() const
Definition: TargetInfo.h:420
unsigned char DoubleWidth
Definition: TargetInfo.h:73
VersionTuple PlatformMinVersion
Definition: TargetInfo.h:122
unsigned char ShortAccumScale
Definition: TargetInfo.h:101
virtual unsigned getRegisterWidth() const
Return the "preferred" register width on this target.
Definition: TargetInfo.h:638
bool useZeroLengthBitfieldAlignment() const
Check whether zero length bitfields should force alignment of the next member.
Definition: TargetInfo.h:670
unsigned char LongWidth
Definition: TargetInfo.h:76
unsigned ComplexLongDoubleUsesFP2Ret
Definition: TargetInfo.h:126
unsigned getLongLongAlign() const
Definition: TargetInfo.h:395
bool isSEHTrySupported() const
Whether the target supports SEH __try.
Definition: TargetInfo.h:1157
unsigned RealTypeUsesObjCFPRet
Definition: TargetInfo.h:125
bool isLittleEndian() const
Definition: TargetInfo.h:1218
unsigned getAccumScale() const
getAccumScale/IBits - Return the number of fractional/integral bits in a &#39;signed _Accum&#39; type...
Definition: TargetInfo.h:436
Provides definitions for the various language-specific address spaces.
unsigned getLongAccumScale() const
getLongAccumScale/IBits - Return the number of fractional/integral bits in a &#39;signed long _Accum&#39; typ...
Definition: TargetInfo.h:441
return Out str()
unsigned getMinGlobalAlign() const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
Definition: TargetInfo.h:536
StringRef PlatformName
Definition: TargetInfo.h:121
unsigned char LongAccumWidth
Definition: TargetInfo.h:82
bool useExplicitBitFieldAlignment() const
Check whether explicit bitfield alignment attributes should be.
Definition: TargetInfo.h:682
const llvm::fltSemantics & getDoubleFormat() const
Definition: TargetInfo.h:573
const llvm::fltSemantics & getLongDoubleFormat() const
Definition: TargetInfo.h:579
typedef void* __builtin_va_list;
Definition: TargetInfo.h:187
unsigned HasBuiltinMSVaList
Definition: TargetInfo.h:128
void setRequiresImmediate(int Exact)
Definition: TargetInfo.h:867
Exposes information about the current target.
Definition: TargetInfo.h:54
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we&#39;re targeting...
unsigned HasAlignMac68kSupport
Definition: TargetInfo.h:124
const char * getTypeName(ID Id)
getTypeName - Return the name of the type for Id.
Definition: Types.cpp:39
unsigned getShortFractAlign() const
Definition: TargetInfo.h:415
virtual bool hasProtectedVisibility() const
Does this target support "protected" visibility?
Definition: TargetInfo.h:982
IntType getSignedSizeType() const
Definition: TargetInfo.h:260
IntType getUIntPtrType() const
Definition: TargetInfo.h:285
unsigned getIntWidth() const
getIntWidth/Align - Return the size of &#39;signed int&#39; and &#39;unsigned int&#39; for this target, in bits.
Definition: TargetInfo.h:384
bool useObjCFPRetForRealType(RealType T) const
Check whether the given real type should use the "fpret" flavor of Objective-C message passing on thi...
Definition: TargetInfo.h:709
unsigned char LongFractWidth
Definition: TargetInfo.h:85
virtual bool hasSjLjLowering() const
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm...
Definition: TargetInfo.h:1264
unsigned getShortAccumWidth() const
getShortAccumWidth/Align - Return the size of &#39;signed short _Accum&#39; and &#39;unsigned short _Accum&#39; for t...
Definition: TargetInfo.h:399
unsigned getAccumWidth() const
getAccumWidth/Align - Return the size of &#39;signed _Accum&#39; and &#39;unsigned _Accum&#39; for this target...
Definition: TargetInfo.h:404
unsigned getLongAccumWidth() const
getLongAccumWidth/Align - Return the size of &#39;signed long _Accum&#39; and &#39;unsigned long _Accum&#39; for this...
Definition: TargetInfo.h:409
unsigned short getMaxTLSAlign() const
Return the maximum alignment (in bits) of a TLS variable.
Definition: TargetInfo.h:1149
unsigned short NewAlign
Definition: TargetInfo.h:112
IntType getChar16Type() const
Definition: TargetInfo.h:290
virtual void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const
Fill a SmallVectorImpl with the valid values to setCPU.
Definition: TargetInfo.h:1034
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:1079
virtual bool validateCpuSupports(StringRef Name) const
Definition: TargetInfo.h:1101
virtual Optional< unsigned > getDWARFAddressSpace(unsigned AddressSpace) const
Definition: TargetInfo.h:1324
#define INT_MIN
Definition: limits.h:67
unsigned getShortAlign() const
Return the alignment of &#39;signed short&#39; and &#39;unsigned short&#39; for this target.
Definition: TargetInfo.h:380
virtual void getCPUSpecificCPUDispatchFeatures(StringRef Name, llvm::SmallVectorImpl< StringRef > &Features) const
Definition: TargetInfo.h:1128
virtual bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const
Validate register name used for global register variables.
Definition: TargetInfo.h:895
void resetDataLayout(StringRef DL)
Definition: TargetInfo.h:135
bool hasAlignMac68kSupport() const
Check whether this target support &#39;#pragma options align=mac68k&#39;.
Definition: TargetInfo.h:687
unsigned getDoubleAlign() const
Definition: TargetInfo.h:572
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:729
IntType getUIntMaxType() const
Definition: TargetInfo.h:275
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of &#39;double&#39;.
Definition: TargetInfo.h:571
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:236
virtual bool allowsLargerPreferedTypeAlignment() const
Whether target allows to overalign ABI-specified preferred alignment.
Definition: TargetInfo.h:1277
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition: TargetInfo.h:248
unsigned getWCharWidth() const
getWCharWidth/Align - Return the size of &#39;wchar_t&#39; for this target, in bits.
Definition: TargetInfo.h:547
unsigned getLongAccumAlign() const
Definition: TargetInfo.h:410
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:723
const llvm::VersionTuple & getSDKVersion() const
Definition: TargetInfo.h:1330
virtual uint64_t getPointerAlignV(unsigned AddrSpace) const
Definition: TargetInfo.h:1343
IntType getPtrDiffType(unsigned AddrSpace) const
Definition: TargetInfo.h:278
unsigned getIntMaxTWidth() const
Return the size of intmax_t and uintmax_t for this target, in bits.
Definition: TargetInfo.h:630
IntType getSigAtomicType() const
Definition: TargetInfo.h:296
virtual bool setABI(const std::string &Name)
Use the specified ABI.
Definition: TargetInfo.h:1044
virtual bool isNan2008() const
Returns true if NaN encoding is IEEE 754-2008.
Definition: TargetInfo.h:948
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
Definition: TargetInfo.h:1211
const LangASMap * AddrSpaceMap
Definition: TargetInfo.h:119
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
Definition: TargetInfo.h:608
unsigned getShortAccumAlign() const
Definition: TargetInfo.h:400
IntType getWIntType() const
Definition: TargetInfo.h:289
unsigned IsRenderScriptTarget
Definition: TargetInfo.h:130
virtual int getEHDataRegisterNumber(unsigned RegNo) const
Return the register number that __builtin_eh_return_regno would return with the specified argument...
Definition: TargetInfo.h:1178
unsigned getChar16Width() const
getChar16Width/Align - Return the size of &#39;char16_t&#39; for this target, in bits.
Definition: TargetInfo.h:552
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of &#39;signed long long&#39; and &#39;unsigned long long&#39; for this targ...
Definition: TargetInfo.h:394
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space...
Definition: TargetInfo.h:1191
unsigned getUnsignedAccumScale() const
getUnsignedAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned _Accum&#39; ty...
Definition: TargetInfo.h:459
IntType getIntMaxType() const
Definition: TargetInfo.h:274
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of &#39;__float128&#39;.
Definition: TargetInfo.h:585
Defines the clang::TargetOptions class.
unsigned getHalfAlign() const
Definition: TargetInfo.h:562
bool PaddingOnUnsignedFixedPoint
Definition: TargetInfo.h:92
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const
Definition: TargetInfo.h:1340
const llvm::DataLayout & getDataLayout() const
Definition: TargetInfo.h:957
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1351
virtual unsigned getFloatEvalMethod() const
Return the value for the C99 FLT_EVAL_METHOD macro.
Definition: TargetInfo.h:596
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
Definition: TargetInfo.h:200
bool useObjCFP2RetForComplexLongDouble() const
Check whether _Complex long double should use the "fp2ret" flavor of Objective-C message passing on t...
Definition: TargetInfo.h:715
bool useBitFieldTypeAlignment() const
Check whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:664
IntType getUInt64Type() const
Definition: TargetInfo.h:293
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition: TargetInfo.h:245
virtual bool validateCpuIs(StringRef Name) const
Definition: TargetInfo.h:1111
unsigned getUnsignedAccumIBits() const
Definition: TargetInfo.h:462
bool isVLASupported() const
Whether target supports variable-length arrays.
Definition: TargetInfo.h:1154
bool isValidAsmImmediate(const llvm::APInt &Value) const
Definition: TargetInfo.h:847
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of &#39;long double&#39;.
Definition: TargetInfo.h:577
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
Definition: TargetInfo.h:209
unsigned char SuitableAlign
Definition: TargetInfo.h:105
unsigned getUnsignedLongAccumScale() const
getUnsignedLongAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned long _...
Definition: TargetInfo.h:469
Defines various enumerations that describe declaration and type specifiers.
const llvm::fltSemantics & getFloat128Format() const
Definition: TargetInfo.h:587
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition: TargetInfo.h:158
unsigned getUnsignedShortAccumIBits() const
Definition: TargetInfo.h:451
Dataflow Directional Tag Classes.
virtual char CPUSpecificManglingCharacter(StringRef Name) const
Definition: TargetInfo.h:1120
unsigned char BoolWidth
Definition: TargetInfo.h:69
ConstraintInfo(StringRef ConstraintStr, StringRef Name)
Definition: TargetInfo.h:816
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:54
unsigned getLongFractScale() const
getLongFractScale - Return the number of fractional bits in a &#39;signed long _Fract&#39; type...
Definition: TargetInfo.h:488
unsigned char LongAccumScale
Definition: TargetInfo.h:103
unsigned getUnsignedFractScale() const
getUnsignedFractScale - Return the number of fractional bits in a &#39;unsigned _Fract&#39; type...
Definition: TargetInfo.h:499
unsigned UseSignedCharForObjCBool
Whether Objective-C&#39;s built-in boolean type should be signed char.
Definition: TargetInfo.h:230
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand...
Definition: TargetInfo.h:838
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
Definition: TargetInfo.h:522
unsigned getShortFractWidth() const
getShortFractWidth/Align - Return the size of &#39;signed short _Fract&#39; and &#39;unsigned short _Fract&#39; for t...
Definition: TargetInfo.h:414
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
Definition: TargetInfo.h:1085
const std::string & getConstraintStr() const
Definition: TargetInfo.h:822
unsigned getUnsignedShortAccumScale() const
getUnsignedShortAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned short...
Definition: TargetInfo.h:448
unsigned getLongFractWidth() const
getLongFractWidth/Align - Return the size of &#39;signed long _Fract&#39; and &#39;unsigned long _Fract&#39; for this...
Definition: TargetInfo.h:424
virtual llvm::Optional< LangAS > getConstantAddressSpace() const
Return an AST address space which can be used opportunistically for constant global memory...
Definition: TargetInfo.h:1205
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:320
unsigned char ShortAccumWidth
Definition: TargetInfo.h:80
bool useSignedCharForObjCBool() const
Check if the Objective-C built-in boolean type should be signed char.
Definition: TargetInfo.h:655
virtual unsigned multiVersionSortPriority(StringRef Name) const
Definition: TargetInfo.h:1105
unsigned getBoolAlign() const
Return the alignment of &#39;_Bool&#39; and C++ &#39;bool&#39; for this target.
Definition: TargetInfo.h:369
virtual const char * getStaticInitSectionSpecifier() const
Return the section to use for C++ static initialization functions.
Definition: TargetInfo.h:1183
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
virtual bool isValidCPUName(StringRef Name) const
brief Determine whether this TargetInfo supports the given CPU name.
Definition: TargetInfo.h:1037
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition: TargetInfo.h:357
unsigned getShortFractScale() const
getShortFractScale - Return the number of fractional bits in a &#39;signed short _Fract&#39; type...
Definition: TargetInfo.h:480
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition: TargetInfo.h:519
void setRequiresImmediate(llvm::ArrayRef< int > Exacts)
Definition: TargetInfo.h:862
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:182
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
Definition: TargetInfo.h:511
virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const
Gets the default calling convention for the given target and declaration context. ...
Definition: TargetInfo.h:1228
unsigned getUnsignedLongFractScale() const
getUnsignedLongFractScale - Return the number of fractional bits in a &#39;unsigned long _Fract&#39; type...
Definition: TargetInfo.h:505
static IntType getCorrespondingUnsignedType(IntType T)
Definition: TargetInfo.h:299
unsigned getFloatAlign() const
Definition: TargetInfo.h:567
virtual bool setCPU(const std::string &Name)
Target the specified CPU.
Definition: TargetInfo.h:1029
virtual bool validateOutputSize(StringRef, unsigned) const
Definition: TargetInfo.h:909
unsigned getFractScale() const
getFractScale - Return the number of fractional bits in a &#39;signed _Fract&#39; type.
Definition: TargetInfo.h:484
const llvm::fltSemantics & getFloatFormat() const
Definition: TargetInfo.h:568
bool isRenderScriptTarget() const
Returns true for RenderScript.
Definition: TargetInfo.h:762
#define INT_MAX
Definition: limits.h:62
unsigned getUnsignedShortFractScale() const
getUnsignedShortFractScale - Return the number of fractional bits in a &#39;unsigned short _Fract&#39; type...
Definition: TargetInfo.h:492
bool isTLSSupported() const
Whether the target supports thread-local storage.
Definition: TargetInfo.h:1141
IntType getWCharType() const
Definition: TargetInfo.h:288
static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target)
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space...
Definition: TargetInfo.h:1197
TargetCXXABI TheCXXABI
Definition: TargetInfo.h:118
uint64_t getPointerAlign(unsigned AddrSpace) const
Definition: TargetInfo.h:352
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
Definition: TargetInfo.h:627
__DEVICE__ int max(int __a, int __b)
const llvm::fltSemantics * LongDoubleFormat
Definition: TargetInfo.h:115
virtual void setSupportedOpenCLOpts()
Set supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1280
IntType getIntPtrType() const
Definition: TargetInfo.h:284
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
Definition: TargetInfo.h:881
unsigned short MaxTLSAlign
Definition: TargetInfo.h:110
virtual bool validateInputSize(StringRef, unsigned) const
Definition: TargetInfo.h:914
unsigned getChar32Align() const
Definition: TargetInfo.h:558
const OpenCLOptions & getSupportedOpenCLOpts() const
Get const supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1295
virtual bool setFPMath(StringRef Name)
Use the specified unit for FP math.
Definition: TargetInfo.h:1051
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:237
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
Definition: TargetInfo.h:363
unsigned char FractWidth
Definition: TargetInfo.h:84
IntType getProcessIDType() const
Definition: TargetInfo.h:297
std::unique_ptr< llvm::DataLayout > DataLayout
Definition: TargetInfo.h:113
OpenCLOptions & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1290
const char * getMCountName() const
Returns the name of the mcount instrumentation function.
Definition: TargetInfo.h:646
void noSignedCharForObjCBool()
Definition: TargetInfo.h:658
virtual std::string convertConstraint(const char *&Constraint) const
Definition: TargetInfo.h:936
unsigned char HalfWidth
Definition: TargetInfo.h:71
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:256
virtual unsigned getUnwindWordWidth() const
Definition: TargetInfo.h:635
virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const
Definition: TargetInfo.h:1115