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