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