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