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;
811  } ImmRange;
812  llvm::SmallSet<int, 4> ImmSet;
813 
814  std::string ConstraintStr; // constraint: "=rm"
815  std::string Name; // Operand name: [foo] with no []'s.
816  public:
817  ConstraintInfo(StringRef ConstraintStr, StringRef Name)
818  : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
819  Name(Name.str()) {
820  ImmRange.Min = ImmRange.Max = 0;
821  ImmRange.isConstrained = false;
822  }
823 
824  const std::string &getConstraintStr() const { return ConstraintStr; }
825  const std::string &getName() const { return Name; }
826  bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
827  bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; }
828  bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
829  bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
830 
831  /// Return true if this output operand has a matching
832  /// (tied) input operand.
833  bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
834 
835  /// Return true if this input operand is a matching
836  /// constraint that ties it to an output operand.
837  ///
838  /// If this returns true then getTiedOperand will indicate which output
839  /// operand this is tied to.
840  bool hasTiedOperand() const { return TiedOperand != -1; }
841  unsigned getTiedOperand() const {
842  assert(hasTiedOperand() && "Has no tied operand!");
843  return (unsigned)TiedOperand;
844  }
845 
847  return (Flags & CI_ImmediateConstant) != 0;
848  }
849  bool isValidAsmImmediate(const llvm::APInt &Value) const {
850  if (!ImmSet.empty())
851  return ImmSet.count(Value.getZExtValue()) != 0;
852  return !ImmRange.isConstrained || (Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max));
853  }
854 
855  void setIsReadWrite() { Flags |= CI_ReadWrite; }
856  void setEarlyClobber() { Flags |= CI_EarlyClobber; }
857  void setAllowsMemory() { Flags |= CI_AllowsMemory; }
858  void setAllowsRegister() { Flags |= CI_AllowsRegister; }
859  void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
860  void setRequiresImmediate(int Min, int Max) {
861  Flags |= CI_ImmediateConstant;
862  ImmRange.Min = Min;
863  ImmRange.Max = Max;
864  ImmRange.isConstrained = true;
865  }
867  Flags |= CI_ImmediateConstant;
868  for (int Exact : Exacts)
869  ImmSet.insert(Exact);
870  }
871  void setRequiresImmediate(int Exact) {
872  Flags |= CI_ImmediateConstant;
873  ImmSet.insert(Exact);
874  }
876  Flags |= CI_ImmediateConstant;
877  }
878 
879  /// Indicate that this is an input operand that is tied to
880  /// the specified output operand.
881  ///
882  /// Copy over the various constraint information from the output.
883  void setTiedOperand(unsigned N, ConstraintInfo &Output) {
884  Output.setHasMatchingInput();
885  Flags = Output.Flags;
886  TiedOperand = N;
887  // Don't copy Name or constraint string.
888  }
889  };
890 
891  /// Validate register name used for global register variables.
892  ///
893  /// This function returns true if the register passed in RegName can be used
894  /// for global register variables on this target. In addition, it returns
895  /// true in HasSizeMismatch if the size of the register doesn't match the
896  /// variable size passed in RegSize.
897  virtual bool validateGlobalRegisterVariable(StringRef RegName,
898  unsigned RegSize,
899  bool &HasSizeMismatch) const {
900  HasSizeMismatch = false;
901  return true;
902  }
903 
904  // validateOutputConstraint, validateInputConstraint - Checks that
905  // a constraint is valid and provides information about it.
906  // FIXME: These should return a real error instead of just true/false.
907  bool validateOutputConstraint(ConstraintInfo &Info) const;
908  bool validateInputConstraint(MutableArrayRef<ConstraintInfo> OutputConstraints,
909  ConstraintInfo &info) const;
910 
911  virtual bool validateOutputSize(StringRef /*Constraint*/,
912  unsigned /*Size*/) const {
913  return true;
914  }
915 
916  virtual bool validateInputSize(StringRef /*Constraint*/,
917  unsigned /*Size*/) const {
918  return true;
919  }
920  virtual bool
921  validateConstraintModifier(StringRef /*Constraint*/,
922  char /*Modifier*/,
923  unsigned /*Size*/,
924  std::string &/*SuggestedModifier*/) const {
925  return true;
926  }
927  virtual bool
928  validateAsmConstraint(const char *&Name,
929  TargetInfo::ConstraintInfo &info) const = 0;
930 
931  bool resolveSymbolicName(const char *&Name,
932  ArrayRef<ConstraintInfo> OutputConstraints,
933  unsigned &Index) const;
934 
935  // Constraint parm will be left pointing at the last character of
936  // the constraint. In practice, it won't be changed unless the
937  // constraint is longer than one character.
938  virtual std::string convertConstraint(const char *&Constraint) const {
939  // 'p' defaults to 'r', but can be overridden by targets.
940  if (*Constraint == 'p')
941  return std::string("r");
942  return std::string(1, *Constraint);
943  }
944 
945  /// Returns a string of target-specific clobbers, in LLVM format.
946  virtual const char *getClobbers() const = 0;
947 
948  /// Returns true if NaN encoding is IEEE 754-2008.
949  /// Only MIPS allows a different encoding.
950  virtual bool isNan2008() const {
951  return true;
952  }
953 
954  /// Returns the target triple of the primary target.
955  const llvm::Triple &getTriple() const {
956  return Triple;
957  }
958 
959  const llvm::DataLayout &getDataLayout() const {
960  assert(DataLayout && "Uninitialized DataLayout!");
961  return *DataLayout;
962  }
963 
964  struct GCCRegAlias {
965  const char * const Aliases[5];
966  const char * const Register;
967  };
968 
969  struct AddlRegName {
970  const char * const Names[5];
971  const unsigned RegNum;
972  };
973 
974  /// Does this target support "protected" visibility?
975  ///
976  /// Any target which dynamic libraries will naturally support
977  /// something like "default" (meaning that the symbol is visible
978  /// outside this shared object) and "hidden" (meaning that it isn't)
979  /// visibilities, but "protected" is really an ELF-specific concept
980  /// with weird semantics designed around the convenience of dynamic
981  /// linker implementations. Which is not to suggest that there's
982  /// consistent target-independent semantics for "default" visibility
983  /// either; the entire thing is pretty badly mangled.
984  virtual bool hasProtectedVisibility() const { return true; }
985 
986  /// An optional hook that targets can implement to perform semantic
987  /// checking on attribute((section("foo"))) specifiers.
988  ///
989  /// In this case, "foo" is passed in to be checked. If the section
990  /// specifier is invalid, the backend should return a non-empty string
991  /// that indicates the problem.
992  ///
993  /// This hook is a simple quality of implementation feature to catch errors
994  /// and give good diagnostics in cases when the assembler or code generator
995  /// would otherwise reject the section specifier.
996  ///
997  virtual std::string isValidSectionSpecifier(StringRef SR) const {
998  return "";
999  }
1000 
1001  /// Set forced language options.
1002  ///
1003  /// Apply changes to the target information with respect to certain
1004  /// language options which change the target configuration and adjust
1005  /// the language based on the target options where applicable.
1006  virtual void adjust(LangOptions &Opts);
1007 
1008  /// Adjust target options based on codegen options.
1009  virtual void adjustTargetOptions(const CodeGenOptions &CGOpts,
1010  TargetOptions &TargetOpts) const {}
1011 
1012  /// Initialize the map with the default set of target features for the
1013  /// CPU this should include all legal feature strings on the target.
1014  ///
1015  /// \return False on error (invalid features).
1016  virtual bool initFeatureMap(llvm::StringMap<bool> &Features,
1017  DiagnosticsEngine &Diags, StringRef CPU,
1018  const std::vector<std::string> &FeatureVec) const;
1019 
1020  /// Get the ABI currently in use.
1021  virtual StringRef getABI() const { return StringRef(); }
1022 
1023  /// Get the C++ ABI currently in use.
1025  return TheCXXABI;
1026  }
1027 
1028  /// Target the specified CPU.
1029  ///
1030  /// \return False on error (invalid CPU name).
1031  virtual bool setCPU(const std::string &Name) {
1032  return false;
1033  }
1034 
1035  /// Fill a SmallVectorImpl with the valid values to setCPU.
1036  virtual void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {}
1037 
1038  /// brief Determine whether this TargetInfo supports the given CPU name.
1039  virtual bool isValidCPUName(StringRef Name) const {
1040  return true;
1041  }
1042 
1043  /// Use the specified ABI.
1044  ///
1045  /// \return False on error (invalid ABI name).
1046  virtual bool setABI(const std::string &Name) {
1047  return false;
1048  }
1049 
1050  /// Use the specified unit for FP math.
1051  ///
1052  /// \return False on error (invalid unit name).
1053  virtual bool setFPMath(StringRef Name) {
1054  return false;
1055  }
1056 
1057  /// Enable or disable a specific target feature;
1058  /// the feature name must be valid.
1059  virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,
1060  StringRef Name,
1061  bool Enabled) const {
1062  Features[Name] = Enabled;
1063  }
1064 
1065  /// Determine whether this TargetInfo supports the given feature.
1066  virtual bool isValidFeatureName(StringRef Feature) const {
1067  return true;
1068  }
1069 
1070  /// Perform initialization based on the user configured
1071  /// set of features (e.g., +sse4).
1072  ///
1073  /// The list is guaranteed to have at most one entry per feature.
1074  ///
1075  /// The target may modify the features list, to change which options are
1076  /// passed onwards to the backend.
1077  /// FIXME: This part should be fixed so that we can change handleTargetFeatures
1078  /// to merely a TargetInfo initialization routine.
1079  ///
1080  /// \return False on error.
1081  virtual bool handleTargetFeatures(std::vector<std::string> &Features,
1082  DiagnosticsEngine &Diags) {
1083  return true;
1084  }
1085 
1086  /// Determine whether the given target has the given feature.
1087  virtual bool hasFeature(StringRef Feature) const {
1088  return false;
1089  }
1090 
1091  /// Identify whether this target supports multiversioning of functions,
1092  /// which requires support for cpu_supports and cpu_is functionality.
1094  return getTriple().getArch() == llvm::Triple::x86 ||
1095  getTriple().getArch() == llvm::Triple::x86_64;
1096  }
1097 
1098  /// Identify whether this target supports IFuncs.
1099  bool supportsIFunc() const { return getTriple().isOSBinFormatELF(); }
1100 
1101  // Validate the contents of the __builtin_cpu_supports(const char*)
1102  // argument.
1103  virtual bool validateCpuSupports(StringRef Name) const { return false; }
1104 
1105  // Return the target-specific priority for features/cpus/vendors so
1106  // that they can be properly sorted for checking.
1107  virtual unsigned multiVersionSortPriority(StringRef Name) const {
1108  return 0;
1109  }
1110 
1111  // Validate the contents of the __builtin_cpu_is(const char*)
1112  // argument.
1113  virtual bool validateCpuIs(StringRef Name) const { return false; }
1114 
1115  // Validate a cpu_dispatch/cpu_specific CPU option, which is a different list
1116  // from cpu_is, since it checks via features rather than CPUs directly.
1117  virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const {
1118  return false;
1119  }
1120 
1121  // Get the character to be added for mangling purposes for cpu_specific.
1122  virtual char CPUSpecificManglingCharacter(StringRef Name) const {
1123  llvm_unreachable(
1124  "cpu_specific Multiversioning not implemented on this target");
1125  }
1126 
1127  // Get a list of the features that make up the CPU option for
1128  // cpu_specific/cpu_dispatch so that it can be passed to llvm as optimization
1129  // options.
1131  StringRef Name, llvm::SmallVectorImpl<StringRef> &Features) const {
1132  llvm_unreachable(
1133  "cpu_specific Multiversioning not implemented on this target");
1134  }
1135 
1136  // Returns maximal number of args passed in registers.
1137  unsigned getRegParmMax() const {
1138  assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
1139  return RegParmMax;
1140  }
1141 
1142  /// Whether the target supports thread-local storage.
1143  bool isTLSSupported() const {
1144  return TLSSupported;
1145  }
1146 
1147  /// Return the maximum alignment (in bits) of a TLS variable
1148  ///
1149  /// Gets the maximum alignment (in bits) of a TLS variable on this target.
1150  /// Returns zero if there is no such constraint.
1151  unsigned short getMaxTLSAlign() const {
1152  return MaxTLSAlign;
1153  }
1154 
1155  /// Whether target supports variable-length arrays.
1156  bool isVLASupported() const { return VLASupported; }
1157 
1158  /// Whether the target supports SEH __try.
1159  bool isSEHTrySupported() const {
1160  return getTriple().isOSWindows() &&
1161  (getTriple().getArch() == llvm::Triple::x86 ||
1162  getTriple().getArch() == llvm::Triple::x86_64 ||
1163  getTriple().getArch() == llvm::Triple::aarch64);
1164  }
1165 
1166  /// Return true if {|} are normal characters in the asm string.
1167  ///
1168  /// If this returns false (the default), then {abc|xyz} is syntax
1169  /// that says that when compiling for asm variant #0, "abc" should be
1170  /// generated, but when compiling for asm variant #1, "xyz" should be
1171  /// generated.
1172  bool hasNoAsmVariants() const {
1173  return NoAsmVariants;
1174  }
1175 
1176  /// Return the register number that __builtin_eh_return_regno would
1177  /// return with the specified argument.
1178  /// This corresponds with TargetLowering's getExceptionPointerRegister
1179  /// and getExceptionSelectorRegister in the backend.
1180  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
1181  return -1;
1182  }
1183 
1184  /// Return the section to use for C++ static initialization functions.
1185  virtual const char *getStaticInitSectionSpecifier() const {
1186  return nullptr;
1187  }
1188 
1189  const LangASMap &getAddressSpaceMap() const { return *AddrSpaceMap; }
1190 
1191  /// Map from the address space field in builtin description strings to the
1192  /// language address space.
1193  virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const {
1194  return getLangASFromTargetAS(AS);
1195  }
1196 
1197  /// Map from the address space field in builtin description strings to the
1198  /// language address space.
1199  virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const {
1200  return getLangASFromTargetAS(AS);
1201  }
1202 
1203  /// Return an AST address space which can be used opportunistically
1204  /// for constant global memory. It must be possible to convert pointers into
1205  /// this address space to LangAS::Default. If no such address space exists,
1206  /// this may return None, and such optimizations will be disabled.
1208  return LangAS::Default;
1209  }
1210 
1211  /// Retrieve the name of the platform as it is used in the
1212  /// availability attribute.
1213  StringRef getPlatformName() const { return PlatformName; }
1214 
1215  /// Retrieve the minimum desired version of the platform, to
1216  /// which the program should be compiled.
1217  VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
1218 
1219  bool isBigEndian() const { return BigEndian; }
1220  bool isLittleEndian() const { return !BigEndian; }
1221 
1225  CCMT_NonMember
1226  };
1227 
1228  /// Gets the default calling convention for the given target and
1229  /// declaration context.
1231  // Not all targets will specify an explicit calling convention that we can
1232  // express. This will always do the right thing, even though it's not
1233  // an explicit calling convention.
1234  return CC_C;
1235  }
1236 
1241  };
1242 
1243  /// Determines whether a given calling convention is valid for the
1244  /// target. A calling convention can either be accepted, produce a warning
1245  /// and be substituted with the default calling convention, or (someday)
1246  /// produce an error (such as using thiscall on a non-instance function).
1248  switch (CC) {
1249  default:
1250  return CCCR_Warning;
1251  case CC_C:
1252  return CCCR_OK;
1253  }
1254  }
1255 
1259  CCK_MicrosoftWin64
1260  };
1261 
1262  virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const;
1263 
1264  /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to
1265  /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp.
1266  virtual bool hasSjLjLowering() const {
1267  return false;
1268  }
1269 
1270  /// Check if the target supports CFProtection branch.
1271  virtual bool
1272  checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const;
1273 
1274  /// Check if the target supports CFProtection branch.
1275  virtual bool
1276  checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const;
1277 
1278  /// Whether target allows to overalign ABI-specified preferred alignment
1279  virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
1280 
1281  /// Set supported OpenCL extensions and optional core features.
1282  virtual void setSupportedOpenCLOpts() {}
1283 
1284  /// Set supported OpenCL extensions as written on command line
1285  virtual void setOpenCLExtensionOpts() {
1286  for (const auto &Ext : getTargetOpts().OpenCLExtensionsAsWritten) {
1287  getTargetOpts().SupportedOpenCLOptions.support(Ext);
1288  }
1289  }
1290 
1291  /// Get supported OpenCL extensions and optional core features.
1293  return getTargetOpts().SupportedOpenCLOptions;
1294  }
1295 
1296  /// Get const supported OpenCL extensions and optional core features.
1298  return getTargetOpts().SupportedOpenCLOptions;
1299  }
1300 
1310  };
1311 
1312  /// Get address space for OpenCL type.
1313  virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const;
1314 
1315  /// \returns Target specific vtbl ptr address space.
1316  virtual unsigned getVtblPtrAddressSpace() const {
1317  return 0;
1318  }
1319 
1320  /// \returns If a target requires an address within a target specific address
1321  /// space \p AddressSpace to be converted in order to be used, then return the
1322  /// corresponding target specific DWARF address space.
1323  ///
1324  /// \returns Otherwise return None and no conversion will be emitted in the
1325  /// DWARF.
1326  virtual Optional<unsigned> getDWARFAddressSpace(unsigned AddressSpace) const {
1327  return None;
1328  }
1329 
1330  /// \returns The version of the SDK which was used during the compilation if
1331  /// one was specified, or an empty version otherwise.
1332  const llvm::VersionTuple &getSDKVersion() const {
1333  return getTargetOpts().SDKVersion;
1334  }
1335 
1336  /// Check the target is valid after it is fully initialized.
1337  virtual bool validateTarget(DiagnosticsEngine &Diags) const {
1338  return true;
1339  }
1340 
1341 protected:
1342  virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
1343  return PointerWidth;
1344  }
1345  virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
1346  return PointerAlign;
1347  }
1348  virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
1349  return PtrDiffType;
1350  }
1351  virtual ArrayRef<const char *> getGCCRegNames() const = 0;
1352  virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0;
1354  return None;
1355  }
1356 
1357  private:
1358  // Assert the values for the fractional and integral bits for each fixed point
1359  // type follow the restrictions given in clause 6.2.6.3 of N1169.
1360  void CheckFixedPointBits() const;
1361 };
1362 
1363 } // end namespace clang
1364 
1365 #endif
unsigned getRegParmMax() const
Definition: TargetInfo.h:1137
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:1217
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:24
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:1219
virtual unsigned getVtblPtrAddressSpace() const
Definition: TargetInfo.h:1316
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:955
__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:1066
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:1247
unsigned short SimdDefaultAlign
Definition: TargetInfo.h:111
unsigned getLargeArrayMinWidth() const
Definition: TargetInfo.h:600
llvm::SmallSet< int, 4 > ImmSet
Definition: TargetInfo.h:812
virtual void adjustTargetOptions(const CodeGenOptions &CGOpts, TargetOptions &TargetOpts) const
Adjust target options based on codegen options.
Definition: TargetInfo.h:1009
unsigned getShortAccumIBits() const
Definition: TargetInfo.h:430
void setRequiresImmediate(int Min, int Max)
Definition: TargetInfo.h:860
LangAS getLangASFromTargetAS(unsigned TargetAS)
Definition: AddressSpaces.h:67
const char *const Register
Definition: TargetInfo.h:966
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:1099
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:1059
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:1024
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:921
IntType getChar32Type() const
Definition: TargetInfo.h:291
const char * MCountName
Definition: TargetInfo.h:114
const std::string & getName() const
Definition: TargetInfo.h:825
bool supportsMultiVersioning() const
Identify whether this target supports multiversioning of functions, which requires support for cpu_su...
Definition: TargetInfo.h:1093
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:1172
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:1285
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:1021
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:997
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:833
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:106
const LangASMap & getAddressSpaceMap() const
Definition: TargetInfo.h:1189
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:1337
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:1159
unsigned RealTypeUsesObjCFPRet
Definition: TargetInfo.h:125
bool isLittleEndian() const
Definition: TargetInfo.h:1220
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:871
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:984
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:1266
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:1151
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:1036
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:1081
virtual bool validateCpuSupports(StringRef Name) const
Definition: TargetInfo.h:1103
virtual Optional< unsigned > getDWARFAddressSpace(unsigned AddressSpace) const
Definition: TargetInfo.h:1326
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:1130
virtual bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const
Validate register name used for global register variables.
Definition: TargetInfo.h:897
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:1279
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:1332
virtual uint64_t getPointerAlignV(unsigned AddrSpace) const
Definition: TargetInfo.h:1345
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:1046
virtual bool isNan2008() const
Returns true if NaN encoding is IEEE 754-2008.
Definition: TargetInfo.h:950
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
Definition: TargetInfo.h:1213
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:1180
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:1193
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:1342
const llvm::DataLayout & getDataLayout() const
Definition: TargetInfo.h:959
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1353
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:1113
unsigned getUnsignedAccumIBits() const
Definition: TargetInfo.h:462
bool isVLASupported() const
Whether target supports variable-length arrays.
Definition: TargetInfo.h:1156
bool isValidAsmImmediate(const llvm::APInt &Value) const
Definition: TargetInfo.h:849
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:1122
unsigned char BoolWidth
Definition: TargetInfo.h:69
ConstraintInfo(StringRef ConstraintStr, StringRef Name)
Definition: TargetInfo.h:817
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:840
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:1087
const std::string & getConstraintStr() const
Definition: TargetInfo.h:824
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:1207
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:1107
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:1185
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:1039
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:866
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:1230
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:1031
virtual bool validateOutputSize(StringRef, unsigned) const
Definition: TargetInfo.h:911
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
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:1143
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:1199
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:1282
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:883
unsigned short MaxTLSAlign
Definition: TargetInfo.h:110
virtual bool validateInputSize(StringRef, unsigned) const
Definition: TargetInfo.h:916
unsigned getChar32Align() const
Definition: TargetInfo.h:558
const OpenCLOptions & getSupportedOpenCLOpts() const
Get const supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1297
virtual bool setFPMath(StringRef Name)
Use the specified unit for FP math.
Definition: TargetInfo.h:1053
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:1292
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:938
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:1117