Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Basic/TargetInfo.h
Line
Count
Source (jump to first uncovered line)
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
17
#include "clang/Basic/AddressSpaces.h"
18
#include "clang/Basic/CodeGenOptions.h"
19
#include "clang/Basic/LLVM.h"
20
#include "clang/Basic/LangOptions.h"
21
#include "clang/Basic/Specifiers.h"
22
#include "clang/Basic/TargetCXXABI.h"
23
#include "clang/Basic/TargetOptions.h"
24
#include "llvm/ADT/APFloat.h"
25
#include "llvm/ADT/APInt.h"
26
#include "llvm/ADT/ArrayRef.h"
27
#include "llvm/ADT/IntrusiveRefCntPtr.h"
28
#include "llvm/ADT/Optional.h"
29
#include "llvm/ADT/SmallSet.h"
30
#include "llvm/ADT/StringMap.h"
31
#include "llvm/ADT/StringRef.h"
32
#include "llvm/ADT/Triple.h"
33
#include "llvm/Frontend/OpenMP/OMPGridValues.h"
34
#include "llvm/Support/DataTypes.h"
35
#include "llvm/Support/Error.h"
36
#include "llvm/Support/VersionTuple.h"
37
#include <cassert>
38
#include <string>
39
#include <vector>
40
41
namespace llvm {
42
struct fltSemantics;
43
}
44
45
namespace clang {
46
class DiagnosticsEngine;
47
class LangOptions;
48
class CodeGenOptions;
49
class MacroBuilder;
50
51
namespace Builtin { struct Info; }
52
53
enum class FloatModeKind {
54
  NoFloat = 255,
55
  Float = 0,
56
  Double,
57
  LongDouble,
58
  Float128,
59
  Ibm128
60
};
61
62
/// Fields controlling how types are laid out in memory; these may need to
63
/// be copied for targets like AMDGPU that base their ABIs on an auxiliary
64
/// CPU target.
65
struct TransferrableTargetInfo {
66
  unsigned char PointerWidth, PointerAlign;
67
  unsigned char BoolWidth, BoolAlign;
68
  unsigned char IntWidth, IntAlign;
69
  unsigned char HalfWidth, HalfAlign;
70
  unsigned char BFloat16Width, BFloat16Align;
71
  unsigned char FloatWidth, FloatAlign;
72
  unsigned char DoubleWidth, DoubleAlign;
73
  unsigned char LongDoubleWidth, LongDoubleAlign, Float128Align, Ibm128Align;
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.
91
  bool PaddingOnUnsignedFixedPoint;
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;
105
  unsigned char DefaultAlignForAttributeAligned;
106
  unsigned char MinGlobalAlign;
107
108
  unsigned short NewAlign;
109
  unsigned MaxVectorAlign;
110
  unsigned MaxTLSAlign;
111
112
  const llvm::fltSemantics *HalfFormat, *BFloat16Format, *FloatFormat,
113
      *DoubleFormat, *LongDoubleFormat, *Float128Format, *Ibm128Format;
114
115
  ///===---- Target Data Type Query Methods -------------------------------===//
116
  enum IntType {
117
    NoInt = 0,
118
    SignedChar,
119
    UnsignedChar,
120
    SignedShort,
121
    UnsignedShort,
122
    SignedInt,
123
    UnsignedInt,
124
    SignedLong,
125
    UnsignedLong,
126
    SignedLongLong,
127
    UnsignedLongLong
128
  };
129
130
protected:
131
  IntType SizeType, IntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType,
132
      Char16Type, Char32Type, Int64Type, Int16Type, SigAtomicType,
133
      ProcessIDType;
134
135
  /// Whether Objective-C's built-in boolean type should be signed char.
136
  ///
137
  /// Otherwise, when this flag is not set, the normal built-in boolean type is
138
  /// used.
139
  unsigned UseSignedCharForObjCBool : 1;
140
141
  /// Control whether the alignment of bit-field types is respected when laying
142
  /// out structures. If true, then the alignment of the bit-field type will be
143
  /// used to (a) impact the alignment of the containing structure, and (b)
144
  /// ensure that the individual bit-field will not straddle an alignment
145
  /// boundary.
146
  unsigned UseBitFieldTypeAlignment : 1;
147
148
  /// Whether zero length bitfields (e.g., int : 0;) force alignment of
149
  /// the next bitfield.
150
  ///
151
  /// If the alignment of the zero length bitfield is greater than the member
152
  /// that follows it, `bar', `bar' will be aligned as the type of the
153
  /// zero-length bitfield.
154
  unsigned UseZeroLengthBitfieldAlignment : 1;
155
156
  /// Whether zero length bitfield alignment is respected if they are the
157
  /// leading members.
158
  unsigned UseLeadingZeroLengthBitfield : 1;
159
160
  ///  Whether explicit bit field alignment attributes are honored.
161
  unsigned UseExplicitBitFieldAlignment : 1;
162
163
  /// If non-zero, specifies a fixed alignment value for bitfields that follow
164
  /// zero length bitfield, regardless of the zero length bitfield type.
165
  unsigned ZeroLengthBitfieldBoundary;
166
167
  /// If non-zero, specifies a maximum alignment to truncate alignment
168
  /// specified in the aligned attribute of a static variable to this value.
169
  unsigned MaxAlignedAttribute;
170
};
171
172
/// OpenCL type kinds.
173
enum OpenCLTypeKind : uint8_t {
174
  OCLTK_Default,
175
  OCLTK_ClkEvent,
176
  OCLTK_Event,
177
  OCLTK_Image,
178
  OCLTK_Pipe,
179
  OCLTK_Queue,
180
  OCLTK_ReserveID,
181
  OCLTK_Sampler,
182
};
183
184
/// Exposes information about the current target.
185
///
186
class TargetInfo : public virtual TransferrableTargetInfo,
187
                   public RefCountedBase<TargetInfo> {
188
  std::shared_ptr<TargetOptions> TargetOpts;
189
  llvm::Triple Triple;
190
protected:
191
  // Target values set by the ctor of the actual target implementation.  Default
192
  // values are specified by the TargetInfo constructor.
193
  bool BigEndian;
194
  bool TLSSupported;
195
  bool VLASupported;
196
  bool NoAsmVariants;  // True if {|} are normal characters.
197
  bool HasLegalHalfType; // True if the backend supports operations on the half
198
                         // LLVM IR type.
199
  bool HasFloat128;
200
  bool HasFloat16;
201
  bool HasBFloat16;
202
  bool HasIbm128;
203
  bool HasLongDouble;
204
  bool HasFPReturn;
205
  bool HasStrictFP;
206
207
  unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
208
  unsigned short SimdDefaultAlign;
209
  std::string DataLayoutString;
210
  const char *UserLabelPrefix;
211
  const char *MCountName;
212
  unsigned char RegParmMax, SSERegParmMax;
213
  TargetCXXABI TheCXXABI;
214
  const LangASMap *AddrSpaceMap;
215
  unsigned ProgramAddrSpace;
216
217
  mutable StringRef PlatformName;
218
  mutable VersionTuple PlatformMinVersion;
219
220
  unsigned HasAlignMac68kSupport : 1;
221
  unsigned RealTypeUsesObjCFPRet : 3;
222
  unsigned ComplexLongDoubleUsesFP2Ret : 1;
223
224
  unsigned HasBuiltinMSVaList : 1;
225
226
  unsigned IsRenderScriptTarget : 1;
227
228
  unsigned HasAArch64SVETypes : 1;
229
230
  unsigned HasRISCVVTypes : 1;
231
232
  unsigned AllowAMDGPUUnsafeFPAtomics : 1;
233
234
  unsigned ARMCDECoprocMask : 8;
235
236
  unsigned MaxOpenCLWorkGroupSize;
237
238
  // TargetInfo Constructor.  Default initializes all fields.
239
  TargetInfo(const llvm::Triple &T);
240
241
  // UserLabelPrefix must match DL's getGlobalPrefix() when interpreted
242
  // as a DataLayout object.
243
  void resetDataLayout(StringRef DL, const char *UserLabelPrefix = "");
244
245
public:
246
  /// Construct a target for the given options.
247
  ///
248
  /// \param Opts - The options to use to initialize the target. The target may
249
  /// modify the options to canonicalize the target feature information to match
250
  /// what the backend expects.
251
  static TargetInfo *
252
  CreateTargetInfo(DiagnosticsEngine &Diags,
253
                   const std::shared_ptr<TargetOptions> &Opts);
254
255
  virtual ~TargetInfo();
256
257
  /// Retrieve the target options.
258
6.10M
  TargetOptions &getTargetOpts() const {
259
6.10M
    assert(TargetOpts && "Missing target options");
260
0
    return *TargetOpts;
261
6.10M
  }
262
263
  /// The different kinds of __builtin_va_list types defined by
264
  /// the target implementation.
265
  enum BuiltinVaListKind {
266
    /// typedef char* __builtin_va_list;
267
    CharPtrBuiltinVaList = 0,
268
269
    /// typedef void* __builtin_va_list;
270
    VoidPtrBuiltinVaList,
271
272
    /// __builtin_va_list as defined by the AArch64 ABI
273
    /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
274
    AArch64ABIBuiltinVaList,
275
276
    /// __builtin_va_list as defined by the PNaCl ABI:
277
    /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types
278
    PNaClABIBuiltinVaList,
279
280
    /// __builtin_va_list as defined by the Power ABI:
281
    /// https://www.power.org
282
    ///        /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf
283
    PowerABIBuiltinVaList,
284
285
    /// __builtin_va_list as defined by the x86-64 ABI:
286
    /// http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
287
    X86_64ABIBuiltinVaList,
288
289
    /// __builtin_va_list as defined by ARM AAPCS ABI
290
    /// http://infocenter.arm.com
291
    //        /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
292
    AAPCSABIBuiltinVaList,
293
294
    // typedef struct __va_list_tag
295
    //   {
296
    //     long __gpr;
297
    //     long __fpr;
298
    //     void *__overflow_arg_area;
299
    //     void *__reg_save_area;
300
    //   } va_list[1];
301
    SystemZBuiltinVaList,
302
303
    // typedef struct __va_list_tag {
304
    //    void *__current_saved_reg_area_pointer;
305
    //    void *__saved_reg_area_end_pointer;
306
    //    void *__overflow_area_pointer;
307
    //} va_list;
308
    HexagonBuiltinVaList
309
  };
310
311
protected:
312
  /// Specify if mangling based on address space map should be used or
313
  /// not for language specific address spaces
314
  bool UseAddrSpaceMapMangling;
315
316
public:
317
3.11M
  IntType getSizeType() const { return SizeType; }
318
56
  IntType getSignedSizeType() const {
319
56
    switch (SizeType) {
320
0
    case UnsignedShort:
321
0
      return SignedShort;
322
2
    case UnsignedInt:
323
2
      return SignedInt;
324
54
    case UnsignedLong:
325
54
      return SignedLong;
326
0
    case UnsignedLongLong:
327
0
      return SignedLongLong;
328
0
    default:
329
0
      llvm_unreachable("Invalid SizeType");
330
56
    }
331
56
  }
332
439k
  IntType getIntMaxType() const { return IntMaxType; }
333
439k
  IntType getUIntMaxType() const {
334
439k
    return getCorrespondingUnsignedType(IntMaxType);
335
439k
  }
336
398k
  IntType getPtrDiffType(unsigned AddrSpace) const {
337
398k
    return AddrSpace == 0 ? PtrDiffType : 
getPtrDiffTypeV(AddrSpace)0
;
338
398k
  }
339
1.28k
  IntType getUnsignedPtrDiffType(unsigned AddrSpace) const {
340
1.28k
    return getCorrespondingUnsignedType(getPtrDiffType(AddrSpace));
341
1.28k
  }
342
1.59M
  IntType getIntPtrType() const { return IntPtrType; }
343
351k
  IntType getUIntPtrType() const {
344
351k
    return getCorrespondingUnsignedType(IntPtrType);
345
351k
  }
346
551k
  IntType getWCharType() const { return WCharType; }
347
445k
  IntType getWIntType() const { return WIntType; }
348
106k
  IntType getChar16Type() const { return Char16Type; }
349
106k
  IntType getChar32Type() const { return Char32Type; }
350
492k
  IntType getInt64Type() const { return Int64Type; }
351
175k
  IntType getUInt64Type() const {
352
175k
    return getCorrespondingUnsignedType(Int64Type);
353
175k
  }
354
87.8k
  IntType getInt16Type() const { return Int16Type; }
355
87.8k
  IntType getUInt16Type() const {
356
87.8k
    return getCorrespondingUnsignedType(Int16Type);
357
87.8k
  }
358
87.9k
  IntType getSigAtomicType() const { return SigAtomicType; }
359
134
  IntType getProcessIDType() const { return ProcessIDType; }
360
361
1.05M
  static IntType getCorrespondingUnsignedType(IntType T) {
362
1.05M
    switch (T) {
363
0
    case SignedChar:
364
0
      return UnsignedChar;
365
87.8k
    case SignedShort:
366
87.8k
      return UnsignedShort;
367
63.8k
    case SignedInt:
368
63.8k
      return UnsignedInt;
369
591k
    case SignedLong:
370
591k
      return UnsignedLong;
371
312k
    case SignedLongLong:
372
312k
      return UnsignedLongLong;
373
0
    default:
374
0
      llvm_unreachable("Unexpected signed integer type");
375
1.05M
    }
376
1.05M
  }
377
378
  /// In the event this target uses the same number of fractional bits for its
379
  /// unsigned types as it does with its signed counterparts, there will be
380
  /// exactly one bit of padding.
381
  /// Return true if unsigned fixed point types have padding for this target.
382
2.19k
  bool doUnsignedFixedPointTypesHavePadding() const {
383
2.19k
    return PaddingOnUnsignedFixedPoint;
384
2.19k
  }
385
386
  /// Return the width (in bits) of the specified integer type enum.
387
  ///
388
  /// For example, SignedInt -> getIntWidth().
389
  unsigned getTypeWidth(IntType T) const;
390
391
  /// Return integer type with specified width.
392
  virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const;
393
394
  /// Return the smallest integer type with at least the specified width.
395
  virtual IntType getLeastIntTypeByWidth(unsigned BitWidth,
396
                                         bool IsSigned) const;
397
398
  /// Return floating point type with specified width. On PPC, there are
399
  /// three possible types for 128-bit floating point: "PPC double-double",
400
  /// IEEE 754R quad precision, and "long double" (which under the covers
401
  /// is represented as one of those two). At this time, there is no support
402
  /// for an explicit "PPC double-double" type (i.e. __ibm128) so we only
403
  /// need to differentiate between "long double" and IEEE quad precision.
404
  FloatModeKind getRealTypeByWidth(unsigned BitWidth,
405
                                   FloatModeKind ExplicitType) const;
406
407
  /// Return the alignment (in bits) of the specified integer type enum.
408
  ///
409
  /// For example, SignedInt -> getIntAlign().
410
  unsigned getTypeAlign(IntType T) const;
411
412
  /// Returns true if the type is signed; false otherwise.
413
  static bool isTypeSigned(IntType T);
414
415
  /// Return the width of pointers on this target, for the
416
  /// specified address space.
417
1.84M
  uint64_t getPointerWidth(unsigned AddrSpace) const {
418
1.84M
    return AddrSpace == 0 ? 
PointerWidth1.84M
:
getPointerWidthV(AddrSpace)963
;
419
1.84M
  }
420
700k
  uint64_t getPointerAlign(unsigned AddrSpace) const {
421
700k
    return AddrSpace == 0 ? 
PointerAlign700k
:
getPointerAlignV(AddrSpace)824
;
422
700k
  }
423
424
  /// Return the maximum width of pointers on this target.
425
4.64M
  virtual uint64_t getMaxPointerWidth() const {
426
4.64M
    return PointerWidth;
427
4.64M
  }
428
429
  /// Get integer value for null pointer.
430
  /// \param AddrSpace address space of pointee in source language.
431
121k
  virtual uint64_t getNullPointerValue(LangAS AddrSpace) const { return 0; }
432
433
  /// Return the size of '_Bool' and C++ 'bool' for this target, in bits.
434
210k
  unsigned getBoolWidth() const { return BoolWidth; }
435
436
  /// Return the alignment of '_Bool' and C++ 'bool' for this target.
437
123k
  unsigned getBoolAlign() const { return BoolAlign; }
438
439
19.3M
  unsigned getCharWidth() const { return 8; } // FIXME
440
487k
  unsigned getCharAlign() const { return 8; } // FIXME
441
442
  /// Return the size of 'signed short' and 'unsigned short' for this
443
  /// target, in bits.
444
4.50M
  unsigned getShortWidth() const { return 16; } // FIXME
445
446
  /// Return the alignment of 'signed short' and 'unsigned short' for
447
  /// this target.
448
271k
  unsigned getShortAlign() const { return 16; } // FIXME
449
450
  /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
451
  /// this target, in bits.
452
20.4M
  unsigned getIntWidth() const { return IntWidth; }
453
472k
  unsigned getIntAlign() const { return IntAlign; }
454
455
  /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
456
  /// for this target, in bits.
457
10.2M
  unsigned getLongWidth() const { return LongWidth; }
458
204k
  unsigned getLongAlign() const { return LongAlign; }
459
460
  /// getLongLongWidth/Align - Return the size of 'signed long long' and
461
  /// 'unsigned long long' for this target, in bits.
462
2.12M
  unsigned getLongLongWidth() const { return LongLongWidth; }
463
129k
  unsigned getLongLongAlign() const { return LongLongAlign; }
464
465
  /// getShortAccumWidth/Align - Return the size of 'signed short _Accum' and
466
  /// 'unsigned short _Accum' for this target, in bits.
467
148
  unsigned getShortAccumWidth() const { return ShortAccumWidth; }
468
148
  unsigned getShortAccumAlign() const { return ShortAccumAlign; }
469
470
  /// getAccumWidth/Align - Return the size of 'signed _Accum' and
471
  /// 'unsigned _Accum' for this target, in bits.
472
131
  unsigned getAccumWidth() const { return AccumWidth; }
473
131
  unsigned getAccumAlign() const { return AccumAlign; }
474
475
  /// getLongAccumWidth/Align - Return the size of 'signed long _Accum' and
476
  /// 'unsigned long _Accum' for this target, in bits.
477
107
  unsigned getLongAccumWidth() const { return LongAccumWidth; }
478
107
  unsigned getLongAccumAlign() const { return LongAccumAlign; }
479
480
  /// getShortFractWidth/Align - Return the size of 'signed short _Fract' and
481
  /// 'unsigned short _Fract' for this target, in bits.
482
88
  unsigned getShortFractWidth() const { return ShortFractWidth; }
483
88
  unsigned getShortFractAlign() const { return ShortFractAlign; }
484
485
  /// getFractWidth/Align - Return the size of 'signed _Fract' and
486
  /// 'unsigned _Fract' for this target, in bits.
487
124
  unsigned getFractWidth() const { return FractWidth; }
488
124
  unsigned getFractAlign() const { return FractAlign; }
489
490
  /// getLongFractWidth/Align - Return the size of 'signed long _Fract' and
491
  /// 'unsigned long _Fract' for this target, in bits.
492
76
  unsigned getLongFractWidth() const { return LongFractWidth; }
493
76
  unsigned getLongFractAlign() const { return LongFractAlign; }
494
495
  /// getShortAccumScale/IBits - Return the number of fractional/integral bits
496
  /// in a 'signed short _Accum' type.
497
3.48k
  unsigned getShortAccumScale() const { return ShortAccumScale; }
498
814k
  unsigned getShortAccumIBits() const {
499
814k
    return ShortAccumWidth - ShortAccumScale - 1;
500
814k
  }
501
502
  /// getAccumScale/IBits - Return the number of fractional/integral bits
503
  /// in a 'signed _Accum' type.
504
1.13k
  unsigned getAccumScale() const { return AccumScale; }
505
1.08M
  unsigned getAccumIBits() const { return AccumWidth - AccumScale - 1; }
506
507
  /// getLongAccumScale/IBits - Return the number of fractional/integral bits
508
  /// in a 'signed long _Accum' type.
509
264
  unsigned getLongAccumScale() const { return LongAccumScale; }
510
814k
  unsigned getLongAccumIBits() const {
511
814k
    return LongAccumWidth - LongAccumScale - 1;
512
814k
  }
513
514
  /// getUnsignedShortAccumScale/IBits - Return the number of
515
  /// fractional/integral bits in a 'unsigned short _Accum' type.
516
1.35M
  unsigned getUnsignedShortAccumScale() const {
517
1.35M
    return PaddingOnUnsignedFixedPoint ? 
ShortAccumScale812
:
ShortAccumScale + 11.35M
;
518
1.35M
  }
519
814k
  unsigned getUnsignedShortAccumIBits() const {
520
814k
    return PaddingOnUnsignedFixedPoint
521
814k
               ? 
getShortAccumIBits()126
522
814k
               : 
ShortAccumWidth - getUnsignedShortAccumScale()814k
;
523
814k
  }
524
525
  /// getUnsignedAccumScale/IBits - Return the number of fractional/integral
526
  /// bits in a 'unsigned _Accum' type.
527
1.90M
  unsigned getUnsignedAccumScale() const {
528
1.90M
    return PaddingOnUnsignedFixedPoint ? 
AccumScale243
:
AccumScale + 11.90M
;
529
1.90M
  }
530
1.08M
  unsigned getUnsignedAccumIBits() const {
531
1.08M
    return PaddingOnUnsignedFixedPoint ? 
getAccumIBits()168
532
1.08M
                                       : 
AccumWidth - getUnsignedAccumScale()1.08M
;
533
1.08M
  }
534
535
  /// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral
536
  /// bits in a 'unsigned long _Accum' type.
537
1.35M
  unsigned getUnsignedLongAccumScale() const {
538
1.35M
    return PaddingOnUnsignedFixedPoint ? 
LongAccumScale128
:
LongAccumScale + 11.35M
;
539
1.35M
  }
540
814k
  unsigned getUnsignedLongAccumIBits() const {
541
814k
    return PaddingOnUnsignedFixedPoint
542
814k
               ? 
getLongAccumIBits()126
543
814k
               : 
LongAccumWidth - getUnsignedLongAccumScale()814k
;
544
814k
  }
545
546
  /// getShortFractScale - Return the number of fractional bits
547
  /// in a 'signed short _Fract' type.
548
2.17M
  unsigned getShortFractScale() const { return ShortFractWidth - 1; }
549
550
  /// getFractScale - Return the number of fractional bits
551
  /// in a 'signed _Fract' type.
552
2.71M
  unsigned getFractScale() const { return FractWidth - 1; }
553
554
  /// getLongFractScale - Return the number of fractional bits
555
  /// in a 'signed long _Fract' type.
556
2.17M
  unsigned getLongFractScale() const { return LongFractWidth - 1; }
557
558
  /// getUnsignedShortFractScale - Return the number of fractional bits
559
  /// in a 'unsigned short _Fract' type.
560
1.08M
  unsigned getUnsignedShortFractScale() const {
561
1.08M
    return PaddingOnUnsignedFixedPoint ? 
getShortFractScale()148
562
1.08M
                                       : 
getShortFractScale() + 11.08M
;
563
1.08M
  }
564
565
  /// getUnsignedFractScale - Return the number of fractional bits
566
  /// in a 'unsigned _Fract' type.
567
1.35M
  unsigned getUnsignedFractScale() const {
568
1.35M
    return PaddingOnUnsignedFixedPoint ? 
getFractScale()299
:
getFractScale() + 11.35M
;
569
1.35M
  }
570
571
  /// getUnsignedLongFractScale - Return the number of fractional bits
572
  /// in a 'unsigned long _Fract' type.
573
1.08M
  unsigned getUnsignedLongFractScale() const {
574
1.08M
    return PaddingOnUnsignedFixedPoint ? 
getLongFractScale()142
575
1.08M
                                       : 
getLongFractScale() + 11.08M
;
576
1.08M
  }
577
578
  /// Determine whether the __int128 type is supported on this target.
579
66.5k
  virtual bool hasInt128Type() const {
580
66.5k
    return (getPointerWidth(0) >= 64) || 
getTargetOpts().ForceEnableInt12851.6k
;
581
66.5k
  } // FIXME
582
583
  /// Determine whether the _BitInt type is supported on this target. This
584
  /// limitation is put into place for ABI reasons.
585
  /// FIXME: _BitInt is a required type in C23, so there's not much utility in
586
  /// asking whether the target supported it or not; I think this should be
587
  /// removed once backends have been alerted to the type and have had the
588
  /// chance to do implementation work if needed.
589
0
  virtual bool hasBitIntType() const {
590
0
    return false;
591
0
  }
592
593
  /// Determine whether _Float16 is supported on this target.
594
12.5k
  virtual bool hasLegalHalfType() const { return HasLegalHalfType; }
595
596
  /// Determine whether the __float128 type is supported on this target.
597
64.7k
  virtual bool hasFloat128Type() const { return HasFloat128; }
598
599
  /// Determine whether the _Float16 type is supported on this target.
600
99.5k
  virtual bool hasFloat16Type() const { return HasFloat16; }
601
602
  /// Determine whether the _BFloat16 type is supported on this target.
603
2.08k
  virtual bool hasBFloat16Type() const { return HasBFloat16; }
604
605
  /// Determine whether the __ibm128 type is supported on this target.
606
63.5k
  virtual bool hasIbm128Type() const { return HasIbm128; }
607
608
  /// Determine whether the long double type is supported on this target.
609
55.6M
  virtual bool hasLongDoubleType() const { return HasLongDouble; }
610
611
  /// Determine whether return of a floating point value is supported
612
  /// on this target.
613
8.02M
  virtual bool hasFPReturn() const { return HasFPReturn; }
614
615
  /// Determine whether constrained floating point is supported on this target.
616
71.3k
  virtual bool hasStrictFP() const { return HasStrictFP; }
617
618
  /// Return the alignment that is the largest alignment ever used for any
619
  /// scalar/SIMD data type on the target machine you are compiling for
620
  /// (including types with an extended alignment requirement).
621
87.8k
  unsigned getSuitableAlign() const { return SuitableAlign; }
622
623
  /// Return the default alignment for __attribute__((aligned)) on
624
  /// this target, to be used if no alignment value is specified.
625
6.16k
  unsigned getDefaultAlignForAttributeAligned() const {
626
6.16k
    return DefaultAlignForAttributeAligned;
627
6.16k
  }
628
629
  /// getMinGlobalAlign - Return the minimum alignment of a global variable,
630
  /// unless its alignment is explicitly reduced via attributes.
631
288k
  virtual unsigned getMinGlobalAlign (uint64_t) const {
632
288k
    return MinGlobalAlign;
633
288k
  }
634
635
  /// Return the largest alignment for which a suitably-sized allocation with
636
  /// '::operator new(size_t)' or 'malloc' is guaranteed to produce a
637
  /// correctly-aligned pointer.
638
100k
  unsigned getNewAlign() const {
639
100k
    return NewAlign ? 
NewAlign82.4k
:
std::max(LongDoubleAlign, LongLongAlign)17.6k
;
640
100k
  }
641
642
  /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
643
  /// bits.
644
694k
  unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
645
142k
  unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
646
647
  /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
648
  /// bits.
649
116k
  unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
650
115k
  unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
651
652
  /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
653
  /// bits.
654
116k
  unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
655
115k
  unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
656
657
  /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
658
2.93k
  unsigned getHalfWidth() const { return HalfWidth; }
659
2.93k
  unsigned getHalfAlign() const { return HalfAlign; }
660
14.6k
  const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
661
662
  /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
663
98.0k
  unsigned getFloatWidth() const { return FloatWidth; }
664
10.0k
  unsigned getFloatAlign() const { return FloatAlign; }
665
216k
  const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
666
667
  /// getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
668
346
  unsigned getBFloat16Width() const { return BFloat16Width; }
669
346
  unsigned getBFloat16Align() const { return BFloat16Align; }
670
344
  const llvm::fltSemantics &getBFloat16Format() const { return *BFloat16Format; }
671
672
  /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
673
97.5k
  unsigned getDoubleWidth() const { return DoubleWidth; }
674
9.67k
  unsigned getDoubleAlign() const { return DoubleAlign; }
675
242k
  const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
676
677
  /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
678
  /// double'.
679
89.4k
  unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
680
1.55k
  unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
681
125k
  const llvm::fltSemantics &getLongDoubleFormat() const {
682
125k
    return *LongDoubleFormat;
683
125k
  }
684
685
  /// getFloat128Width/Align/Format - Return the size/align/format of
686
  /// '__float128'.
687
32
  unsigned getFloat128Width() const { return 128; }
688
32
  unsigned getFloat128Align() const { return Float128Align; }
689
1.26k
  const llvm::fltSemantics &getFloat128Format() const {
690
1.26k
    return *Float128Format;
691
1.26k
  }
692
693
  /// getIbm128Width/Align/Format - Return the size/align/format of
694
  /// '__ibm128'.
695
7
  unsigned getIbm128Width() const { return 128; }
696
7
  unsigned getIbm128Align() const { return Ibm128Align; }
697
94
  const llvm::fltSemantics &getIbm128Format() const { return *Ibm128Format; }
698
699
  /// Return the mangled code of long double.
700
2
  virtual const char *getLongDoubleMangling() const { return "e"; }
701
702
  /// Return the mangled code of __float128.
703
218
  virtual const char *getFloat128Mangling() const { return "g"; }
704
705
  /// Return the mangled code of __ibm128.
706
0
  virtual const char *getIbm128Mangling() const {
707
0
    llvm_unreachable("ibm128 not implemented on this target");
708
0
  }
709
710
  /// Return the mangled code of bfloat.
711
0
  virtual const char *getBFloat16Mangling() const {
712
0
    llvm_unreachable("bfloat not implemented on this target");
713
0
  }
714
715
  /// Return the value for the C99 FLT_EVAL_METHOD macro.
716
10.0k
  virtual unsigned getFloatEvalMethod() const { return 0; }
717
718
  // getLargeArrayMinWidth/Align - Return the minimum array size that is
719
  // 'large' and its alignment.
720
27.2k
  unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
721
4.81k
  unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
722
723
  /// Return the maximum width lock-free atomic operation which will
724
  /// ever be supported for the given target
725
1.11k
  unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; }
726
  /// Return the maximum width lock-free atomic operation which can be
727
  /// inlined given the supported features of the given target.
728
119k
  unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
729
  /// Set the maximum inline or promote width lock-free atomic operation
730
  /// for the given target.
731
10.1k
  virtual void setMaxAtomicWidth() {}
732
  /// Returns true if the given target supports lock-free atomic
733
  /// operations at the specified width and alignment.
734
  virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits,
735
2.59k
                                uint64_t AlignmentInBits) const {
736
2.59k
    return AtomicSizeInBits <= AlignmentInBits &&
737
2.59k
           
AtomicSizeInBits <= getMaxAtomicInlineWidth()2.38k
&&
738
2.59k
           
(2.17k
AtomicSizeInBits <= getCharWidth()2.17k
||
739
2.17k
            
llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth())1.97k
);
740
2.59k
  }
741
742
  /// Return the maximum vector alignment supported for the given target.
743
28.4k
  unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
744
  /// Return default simd alignment for the given target. Generally, this
745
  /// value is type-specific, but this alignment can be used for most of the
746
  /// types for the given target.
747
376
  unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; }
748
749
3
  unsigned getMaxOpenCLWorkGroupSize() const { return MaxOpenCLWorkGroupSize; }
750
751
  /// Return the alignment (in bits) of the thrown exception object. This is
752
  /// only meaningful for targets that allocate C++ exceptions in a system
753
  /// runtime, such as those using the Itanium C++ ABI.
754
6.02k
  virtual unsigned getExnObjectAlignment() const {
755
    // Itanium says that an _Unwind_Exception has to be "double-word"
756
    // aligned (and thus the end of it is also so-aligned), meaning 16
757
    // bytes.  Of course, that was written for the actual Itanium,
758
    // which is a 64-bit platform.  Classically, the ABI doesn't really
759
    // specify the alignment on other platforms, but in practice
760
    // libUnwind declares the struct with __attribute__((aligned)), so
761
    // we assume that alignment here.  (It's generally 16 bytes, but
762
    // some targets overwrite it.)
763
6.02k
    return getDefaultAlignForAttributeAligned();
764
6.02k
  }
765
766
  /// Return the size of intmax_t and uintmax_t for this target, in bits.
767
6.44M
  unsigned getIntMaxTWidth() const {
768
6.44M
    return getTypeWidth(IntMaxType);
769
6.44M
  }
770
771
  /// Return the address space for functions for the given target.
772
68.4k
  unsigned getProgramAddressSpace() const { return ProgramAddrSpace; }
773
774
  // Return the size of unwind_word for this target.
775
11
  virtual unsigned getUnwindWordWidth() const { return getPointerWidth(0); }
776
777
  /// Return the "preferred" register width on this target.
778
0
  virtual unsigned getRegisterWidth() const {
779
    // Currently we assume the register width on the target matches the pointer
780
    // width, we can introduce a new variable for this if/when some target wants
781
    // it.
782
0
    return PointerWidth;
783
0
  }
784
785
  /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro,
786
  /// which is the prefix given to user symbols by default.
787
  ///
788
  /// On most platforms this is "", but it is "_" on some.
789
96.9k
  const char *getUserLabelPrefix() const { return UserLabelPrefix; }
790
791
  /// Returns the name of the mcount instrumentation function.
792
113
  const char *getMCountName() const {
793
113
    return MCountName;
794
113
  }
795
796
  /// Check if the Objective-C built-in boolean type should be signed
797
  /// char.
798
  ///
799
  /// Otherwise, if this returns false, the normal built-in boolean type
800
  /// should also be used for Objective-C.
801
181k
  bool useSignedCharForObjCBool() const {
802
181k
    return UseSignedCharForObjCBool;
803
181k
  }
804
164
  void noSignedCharForObjCBool() {
805
164
    UseSignedCharForObjCBool = false;
806
164
  }
807
808
  /// Check whether the alignment of bit-field types is respected
809
  /// when laying out structures.
810
19.3k
  bool useBitFieldTypeAlignment() const {
811
19.3k
    return UseBitFieldTypeAlignment;
812
19.3k
  }
813
814
  /// Check whether zero length bitfields should force alignment of
815
  /// the next member.
816
19.4k
  bool useZeroLengthBitfieldAlignment() const {
817
19.4k
    return UseZeroLengthBitfieldAlignment;
818
19.4k
  }
819
820
  /// Check whether zero length bitfield alignment is respected if they are
821
  /// leading members.
822
22
  bool useLeadingZeroLengthBitfield() const {
823
22
    return UseLeadingZeroLengthBitfield;
824
22
  }
825
826
  /// Get the fixed alignment value in bits for a member that follows
827
  /// a zero length bitfield.
828
142
  unsigned getZeroLengthBitfieldBoundary() const {
829
142
    return ZeroLengthBitfieldBoundary;
830
142
  }
831
832
  /// Get the maximum alignment in bits for a static variable with
833
  /// aligned attribute.
834
1.98M
  unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
835
836
  /// Check whether explicit bitfield alignment attributes should be
837
  //  honored, as in "__attribute__((aligned(2))) int b : 1;".
838
322
  bool useExplicitBitFieldAlignment() const {
839
322
    return UseExplicitBitFieldAlignment;
840
322
  }
841
842
  /// Check whether this target support '\#pragma options align=mac68k'.
843
9
  bool hasAlignMac68kSupport() const {
844
9
    return HasAlignMac68kSupport;
845
9
  }
846
847
  /// Return the user string for the specified integer type enum.
848
  ///
849
  /// For example, SignedShort -> "short".
850
  static const char *getTypeName(IntType T);
851
852
  /// Return the constant suffix for the specified integer type enum.
853
  ///
854
  /// For example, SignedLong -> "L".
855
  const char *getTypeConstantSuffix(IntType T) const;
856
857
  /// Return the printf format modifier for the specified
858
  /// integer type enum.
859
  ///
860
  /// For example, SignedLong -> "l".
861
  static const char *getTypeFormatModifier(IntType T);
862
863
  /// Check whether the given real type should use the "fpret" flavor of
864
  /// Objective-C message passing on this target.
865
65
  bool useObjCFPRetForRealType(FloatModeKind T) const {
866
65
    return RealTypeUsesObjCFPRet & (1 << (int)T);
867
65
  }
868
869
  /// Check whether _Complex long double should use the "fp2ret" flavor
870
  /// of Objective-C message passing on this target.
871
2
  bool useObjCFP2RetForComplexLongDouble() const {
872
2
    return ComplexLongDoubleUsesFP2Ret;
873
2
  }
874
875
  /// Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used
876
  /// to convert to and from __fp16.
877
  /// FIXME: This function should be removed once all targets stop using the
878
  /// conversion intrinsics.
879
183k
  virtual bool useFP16ConversionIntrinsics() const {
880
183k
    return true;
881
183k
  }
882
883
  /// Specify if mangling based on address space map should be used or
884
  /// not for language specific address spaces
885
93.6k
  bool useAddressSpaceMapMangling() const {
886
93.6k
    return UseAddrSpaceMapMangling;
887
93.6k
  }
888
889
  ///===---- Other target property query methods --------------------------===//
890
891
  /// Appends the target-specific \#define values for this
892
  /// target set to the specified buffer.
893
  virtual void getTargetDefines(const LangOptions &Opts,
894
                                MacroBuilder &Builder) const = 0;
895
896
897
  /// Return information about target-specific builtins for
898
  /// the current primary target, and info about which builtins are non-portable
899
  /// across the current set of primary and secondary targets.
900
  virtual ArrayRef<Builtin::Info> getTargetBuiltins() const = 0;
901
902
  /// Returns target-specific min and max values VScale_Range.
903
  virtual Optional<std::pair<unsigned, unsigned>>
904
271k
  getVScaleRange(const LangOptions &LangOpts) const {
905
271k
    return None;
906
271k
  }
907
  /// The __builtin_clz* and __builtin_ctz* built-in
908
  /// functions are specified to have undefined results for zero inputs, but
909
  /// on targets that support these operations in a way that provides
910
  /// well-defined results for zero without loss of performance, it is a good
911
  /// idea to avoid optimizing based on that undef behavior.
912
69
  virtual bool isCLZForZeroUndef() const { return true; }
913
914
  /// Returns the kind of __builtin_va_list type that should be used
915
  /// with this target.
916
  virtual BuiltinVaListKind getBuiltinVaListKind() const = 0;
917
918
  /// Returns whether or not type \c __builtin_ms_va_list type is
919
  /// available on this target.
920
86.4k
  bool hasBuiltinMSVaList() const { return HasBuiltinMSVaList; }
921
922
  /// Returns true for RenderScript.
923
795
  bool isRenderScriptTarget() const { return IsRenderScriptTarget; }
924
925
  /// Returns whether or not the AArch64 SVE built-in types are
926
  /// available on this target.
927
1.54M
  bool hasAArch64SVETypes() const { return HasAArch64SVETypes; }
928
929
  /// Returns whether or not the RISC-V V built-in types are
930
  /// available on this target.
931
179k
  bool hasRISCVVTypes() const { return HasRISCVVTypes; }
932
933
  /// Returns whether or not the AMDGPU unsafe floating point atomics are
934
  /// allowed.
935
1.04k
  bool allowAMDGPUUnsafeFPAtomics() const { return AllowAMDGPUUnsafeFPAtomics; }
936
937
  /// For ARM targets returns a mask defining which coprocessors are configured
938
  /// as Custom Datapath.
939
1.42k
  uint32_t getARMCDECoprocMask() const { return ARMCDECoprocMask; }
940
941
  /// Returns whether the passed in string is a valid clobber in an
942
  /// inline asm statement.
943
  ///
944
  /// This is used by Sema.
945
  bool isValidClobber(StringRef Name) const;
946
947
  /// Returns whether the passed in string is a valid register name
948
  /// according to GCC.
949
  ///
950
  /// This is used by Sema for inline asm statements.
951
  virtual bool isValidGCCRegisterName(StringRef Name) const;
952
953
  /// Returns the "normalized" GCC register name.
954
  ///
955
  /// ReturnCannonical true will return the register name without any additions
956
  /// such as "{}" or "%" in it's canonical form, for example:
957
  /// ReturnCanonical = true and Name = "rax", will return "ax".
958
  StringRef getNormalizedGCCRegisterName(StringRef Name,
959
                                         bool ReturnCanonical = false) const;
960
961
0
  virtual bool isSPRegName(StringRef) const { return false; }
962
963
  /// Extracts a register from the passed constraint (if it is a
964
  /// single-register constraint) and the asm label expression related to a
965
  /// variable in the input or output list of an inline asm statement.
966
  ///
967
  /// This function is used by Sema in order to diagnose conflicts between
968
  /// the clobber list and the input/output lists.
969
  virtual StringRef getConstraintRegister(StringRef Constraint,
970
2.96k
                                          StringRef Expression) const {
971
2.96k
    return "";
972
2.96k
  }
973
974
  struct ConstraintInfo {
975
    enum {
976
      CI_None = 0x00,
977
      CI_AllowsMemory = 0x01,
978
      CI_AllowsRegister = 0x02,
979
      CI_ReadWrite = 0x04,         // "+r" output constraint (read and write).
980
      CI_HasMatchingInput = 0x08,  // This output operand has a matching input.
981
      CI_ImmediateConstant = 0x10, // This operand must be an immediate constant
982
      CI_EarlyClobber = 0x20,      // "&" output constraint (early clobber).
983
    };
984
    unsigned Flags;
985
    int TiedOperand;
986
    struct {
987
      int Min;
988
      int Max;
989
      bool isConstrained;
990
    } ImmRange;
991
    llvm::SmallSet<int, 4> ImmSet;
992
993
    std::string ConstraintStr;  // constraint: "=rm"
994
    std::string Name;           // Operand name: [foo] with no []'s.
995
  public:
996
    ConstraintInfo(StringRef ConstraintStr, StringRef Name)
997
        : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
998
18.6k
          Name(Name.str()) {
999
18.6k
      ImmRange.Min = ImmRange.Max = 0;
1000
18.6k
      ImmRange.isConstrained = false;
1001
18.6k
    }
1002
1003
23.8k
    const std::string &getConstraintStr() const { return ConstraintStr; }
1004
182
    const std::string &getName() const { return Name; }
1005
1.61k
    bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
1006
9.60k
    bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; }
1007
21.9k
    bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
1008
36.2k
    bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
1009
1010
    /// Return true if this output operand has a matching
1011
    /// (tied) input operand.
1012
1.08k
    bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
1013
1014
    /// Return true if this input operand is a matching
1015
    /// constraint that ties it to an output operand.
1016
    ///
1017
    /// If this returns true then getTiedOperand will indicate which output
1018
    /// operand this is tied to.
1019
10.7k
    bool hasTiedOperand() const { return TiedOperand != -1; }
1020
321
    unsigned getTiedOperand() const {
1021
321
      assert(hasTiedOperand() && "Has no tied operand!");
1022
0
      return (unsigned)TiedOperand;
1023
321
    }
1024
1025
8.70k
    bool requiresImmediateConstant() const {
1026
8.70k
      return (Flags & CI_ImmediateConstant) != 0;
1027
8.70k
    }
1028
215
    bool isValidAsmImmediate(const llvm::APInt &Value) const {
1029
215
      if (!ImmSet.empty())
1030
26
        return Value.isSignedIntN(32) && 
ImmSet.contains(Value.getZExtValue())24
;
1031
189
      return !ImmRange.isConstrained ||
1032
189
             
(122
Value.sge(ImmRange.Min)122
&&
Value.sle(ImmRange.Max)95
);
1033
215
    }
1034
1035
780
    void setIsReadWrite() { Flags |= CI_ReadWrite; }
1036
36
    void setEarlyClobber() { Flags |= CI_EarlyClobber; }
1037
1.72k
    void setAllowsMemory() { Flags |= CI_AllowsMemory; }
1038
17.7k
    void setAllowsRegister() { Flags |= CI_AllowsRegister; }
1039
287
    void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
1040
168
    void setRequiresImmediate(int Min, int Max) {
1041
168
      Flags |= CI_ImmediateConstant;
1042
168
      ImmRange.Min = Min;
1043
168
      ImmRange.Max = Max;
1044
168
      ImmRange.isConstrained = true;
1045
168
    }
1046
30
    void setRequiresImmediate(llvm::ArrayRef<int> Exacts) {
1047
30
      Flags |= CI_ImmediateConstant;
1048
30
      for (int Exact : Exacts)
1049
90
        ImmSet.insert(Exact);
1050
30
    }
1051
8
    void setRequiresImmediate(int Exact) {
1052
8
      Flags |= CI_ImmediateConstant;
1053
8
      ImmSet.insert(Exact);
1054
8
    }
1055
131
    void setRequiresImmediate() {
1056
131
      Flags |= CI_ImmediateConstant;
1057
131
    }
1058
1059
    /// Indicate that this is an input operand that is tied to
1060
    /// the specified output operand.
1061
    ///
1062
    /// Copy over the various constraint information from the output.
1063
287
    void setTiedOperand(unsigned N, ConstraintInfo &Output) {
1064
287
      Output.setHasMatchingInput();
1065
287
      Flags = Output.Flags;
1066
287
      TiedOperand = N;
1067
      // Don't copy Name or constraint string.
1068
287
    }
1069
  };
1070
1071
  /// Validate register name used for global register variables.
1072
  ///
1073
  /// This function returns true if the register passed in RegName can be used
1074
  /// for global register variables on this target. In addition, it returns
1075
  /// true in HasSizeMismatch if the size of the register doesn't match the
1076
  /// variable size passed in RegSize.
1077
  virtual bool validateGlobalRegisterVariable(StringRef RegName,
1078
                                              unsigned RegSize,
1079
4
                                              bool &HasSizeMismatch) const {
1080
4
    HasSizeMismatch = false;
1081
4
    return true;
1082
4
  }
1083
1084
  // validateOutputConstraint, validateInputConstraint - Checks that
1085
  // a constraint is valid and provides information about it.
1086
  // FIXME: These should return a real error instead of just true/false.
1087
  bool validateOutputConstraint(ConstraintInfo &Info) const;
1088
  bool validateInputConstraint(MutableArrayRef<ConstraintInfo> OutputConstraints,
1089
                               ConstraintInfo &info) const;
1090
1091
  virtual bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
1092
                                  StringRef /*Constraint*/,
1093
1.25k
                                  unsigned /*Size*/) const {
1094
1.25k
    return true;
1095
1.25k
  }
1096
1097
  virtual bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
1098
                                 StringRef /*Constraint*/,
1099
2.50k
                                 unsigned /*Size*/) const {
1100
2.50k
    return true;
1101
2.50k
  }
1102
  virtual bool
1103
  validateConstraintModifier(StringRef /*Constraint*/,
1104
                             char /*Modifier*/,
1105
                             unsigned /*Size*/,
1106
5.35k
                             std::string &/*SuggestedModifier*/) const {
1107
5.35k
    return true;
1108
5.35k
  }
1109
  virtual bool
1110
  validateAsmConstraint(const char *&Name,
1111
                        TargetInfo::ConstraintInfo &info) const = 0;
1112
1113
  bool resolveSymbolicName(const char *&Name,
1114
                           ArrayRef<ConstraintInfo> OutputConstraints,
1115
                           unsigned &Index) const;
1116
1117
  // Constraint parm will be left pointing at the last character of
1118
  // the constraint.  In practice, it won't be changed unless the
1119
  // constraint is longer than one character.
1120
1.20k
  virtual std::string convertConstraint(const char *&Constraint) const {
1121
    // 'p' defaults to 'r', but can be overridden by targets.
1122
1.20k
    if (*Constraint == 'p')
1123
15
      return std::string("r");
1124
1.18k
    return std::string(1, *Constraint);
1125
1.20k
  }
1126
1127
  /// Replace some escaped characters with another string based on
1128
  /// target-specific rules
1129
8.87k
  virtual llvm::Optional<std::string> handleAsmEscapedChar(char C) const {
1130
8.87k
    return llvm::None;
1131
8.87k
  }
1132
1133
  /// Returns a string of target-specific clobbers, in LLVM format.
1134
  virtual const char *getClobbers() const = 0;
1135
1136
  /// Returns true if NaN encoding is IEEE 754-2008.
1137
  /// Only MIPS allows a different encoding.
1138
2.95k
  virtual bool isNan2008() const {
1139
2.95k
    return true;
1140
2.95k
  }
1141
1142
  /// Returns the target triple of the primary target.
1143
338M
  const llvm::Triple &getTriple() const {
1144
338M
    return Triple;
1145
338M
  }
1146
1147
  /// Returns the target ID if supported.
1148
0
  virtual llvm::Optional<std::string> getTargetID() const { return llvm::None; }
1149
1150
64.5k
  const char *getDataLayoutString() const {
1151
64.5k
    assert(!DataLayoutString.empty() && "Uninitialized DataLayout!");
1152
0
    return DataLayoutString.c_str();
1153
64.5k
  }
1154
1155
  struct GCCRegAlias {
1156
    const char * const Aliases[5];
1157
    const char * const Register;
1158
  };
1159
1160
  struct AddlRegName {
1161
    const char * const Names[5];
1162
    const unsigned RegNum;
1163
  };
1164
1165
  /// Does this target support "protected" visibility?
1166
  ///
1167
  /// Any target which dynamic libraries will naturally support
1168
  /// something like "default" (meaning that the symbol is visible
1169
  /// outside this shared object) and "hidden" (meaning that it isn't)
1170
  /// visibilities, but "protected" is really an ELF-specific concept
1171
  /// with weird semantics designed around the convenience of dynamic
1172
  /// linker implementations.  Which is not to suggest that there's
1173
  /// consistent target-independent semantics for "default" visibility
1174
  /// either; the entire thing is pretty badly mangled.
1175
41
  virtual bool hasProtectedVisibility() const { return true; }
1176
1177
  /// Does this target aim for semantic compatibility with
1178
  /// Microsoft C++ code using dllimport/export attributes?
1179
1.76M
  virtual bool shouldDLLImportComdatSymbols() const {
1180
1.76M
    return getTriple().isWindowsMSVCEnvironment() ||
1181
1.76M
           
getTriple().isWindowsItaniumEnvironment()1.73M
||
getTriple().isPS4CPU()1.72M
;
1182
1.76M
  }
1183
1184
  // Does this target have PS4 specific dllimport/export handling?
1185
9.08k
  virtual bool hasPS4DLLImportExport() const {
1186
9.08k
    return getTriple().isPS4CPU() ||
1187
           // Windows Itanium support allows for testing the SCEI flavour of
1188
           // dllimport/export handling on a Windows system.
1189
9.08k
           
(9.03k
getTriple().isWindowsItaniumEnvironment()9.03k
&&
1190
9.03k
            
getTriple().getVendor() == llvm::Triple::SCEI422
);
1191
9.08k
  }
1192
1193
  /// Set forced language options.
1194
  ///
1195
  /// Apply changes to the target information with respect to certain
1196
  /// language options which change the target configuration and adjust
1197
  /// the language based on the target options where applicable.
1198
  virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts);
1199
1200
  /// Adjust target options based on codegen options.
1201
  virtual void adjustTargetOptions(const CodeGenOptions &CGOpts,
1202
70.9k
                                   TargetOptions &TargetOpts) const {}
1203
1204
  /// Initialize the map with the default set of target features for the
1205
  /// CPU this should include all legal feature strings on the target.
1206
  ///
1207
  /// \return False on error (invalid features).
1208
  virtual bool initFeatureMap(llvm::StringMap<bool> &Features,
1209
                              DiagnosticsEngine &Diags, StringRef CPU,
1210
                              const std::vector<std::string> &FeatureVec) const;
1211
1212
  /// Get the ABI currently in use.
1213
660
  virtual StringRef getABI() const { return StringRef(); }
1214
1215
  /// Get the C++ ABI currently in use.
1216
20.9M
  TargetCXXABI getCXXABI() const {
1217
20.9M
    return TheCXXABI;
1218
20.9M
  }
1219
1220
  /// Target the specified CPU.
1221
  ///
1222
  /// \return  False on error (invalid CPU name).
1223
0
  virtual bool setCPU(const std::string &Name) {
1224
0
    return false;
1225
0
  }
1226
1227
  /// Fill a SmallVectorImpl with the valid values to setCPU.
1228
0
  virtual void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {}
1229
1230
  /// Fill a SmallVectorImpl with the valid values for tuning CPU.
1231
1
  virtual void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values) const {
1232
1
    fillValidCPUList(Values);
1233
1
  }
1234
1235
  /// brief Determine whether this TargetInfo supports the given CPU name.
1236
0
  virtual bool isValidCPUName(StringRef Name) const {
1237
0
    return true;
1238
0
  }
1239
1240
  /// brief Determine whether this TargetInfo supports the given CPU name for
1241
  // tuning.
1242
1
  virtual bool isValidTuneCPUName(StringRef Name) const {
1243
1
    return isValidCPUName(Name);
1244
1
  }
1245
1246
  /// brief Determine whether this TargetInfo supports tune in target attribute.
1247
556
  virtual bool supportsTargetAttributeTune() const {
1248
556
    return false;
1249
556
  }
1250
1251
  /// Use the specified ABI.
1252
  ///
1253
  /// \return False on error (invalid ABI name).
1254
0
  virtual bool setABI(const std::string &Name) {
1255
0
    return false;
1256
0
  }
1257
1258
  /// Use the specified unit for FP math.
1259
  ///
1260
  /// \return False on error (invalid unit name).
1261
0
  virtual bool setFPMath(StringRef Name) {
1262
0
    return false;
1263
0
  }
1264
1265
  /// Check if target has a given feature enabled
1266
  virtual bool hasFeatureEnabled(const llvm::StringMap<bool> &Features,
1267
32.1k
                                 StringRef Name) const {
1268
32.1k
    return Features.lookup(Name);
1269
32.1k
  }
1270
1271
  /// Enable or disable a specific target feature;
1272
  /// the feature name must be valid.
1273
  virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,
1274
                                 StringRef Name,
1275
33.5k
                                 bool Enabled) const {
1276
33.5k
    Features[Name] = Enabled;
1277
33.5k
  }
1278
1279
  /// Determine whether this TargetInfo supports the given feature.
1280
521
  virtual bool isValidFeatureName(StringRef Feature) const {
1281
521
    return true;
1282
521
  }
1283
1284
  struct BranchProtectionInfo {
1285
    LangOptions::SignReturnAddressScopeKind SignReturnAddr =
1286
        LangOptions::SignReturnAddressScopeKind::None;
1287
    LangOptions::SignReturnAddressKeyKind SignKey =
1288
        LangOptions::SignReturnAddressKeyKind::AKey;
1289
    bool BranchTargetEnforcement = false;
1290
  };
1291
1292
  /// Determine if this TargetInfo supports the given branch protection
1293
  /// specification
1294
  virtual bool validateBranchProtection(StringRef Spec,
1295
                                        BranchProtectionInfo &BPI,
1296
1
                                        StringRef &Err) const {
1297
1
    Err = "";
1298
1
    return false;
1299
1
  }
1300
1301
  /// Perform initialization based on the user configured
1302
  /// set of features (e.g., +sse4).
1303
  ///
1304
  /// The list is guaranteed to have at most one entry per feature.
1305
  ///
1306
  /// The target may modify the features list, to change which options are
1307
  /// passed onwards to the backend.
1308
  /// FIXME: This part should be fixed so that we can change handleTargetFeatures
1309
  /// to merely a TargetInfo initialization routine.
1310
  ///
1311
  /// \return  False on error.
1312
  virtual bool handleTargetFeatures(std::vector<std::string> &Features,
1313
688
                                    DiagnosticsEngine &Diags) {
1314
688
    return true;
1315
688
  }
1316
1317
  /// Determine whether the given target has the given feature.
1318
184
  virtual bool hasFeature(StringRef Feature) const {
1319
184
    return false;
1320
184
  }
1321
1322
  /// Identify whether this target supports multiversioning of functions,
1323
  /// which requires support for cpu_supports and cpu_is functionality.
1324
512
  bool supportsMultiVersioning() const { return getTriple().isX86(); }
1325
1326
  /// Identify whether this target supports IFuncs.
1327
641
  bool supportsIFunc() const { return getTriple().isOSBinFormatELF(); }
1328
1329
  // Validate the contents of the __builtin_cpu_supports(const char*)
1330
  // argument.
1331
0
  virtual bool validateCpuSupports(StringRef Name) const { return false; }
1332
1333
  // Return the target-specific priority for features/cpus/vendors so
1334
  // that they can be properly sorted for checking.
1335
0
  virtual unsigned multiVersionSortPriority(StringRef Name) const {
1336
0
    return 0;
1337
0
  }
1338
1339
  // Validate the contents of the __builtin_cpu_is(const char*)
1340
  // argument.
1341
0
  virtual bool validateCpuIs(StringRef Name) const { return false; }
1342
1343
  // Validate a cpu_dispatch/cpu_specific CPU option, which is a different list
1344
  // from cpu_is, since it checks via features rather than CPUs directly.
1345
0
  virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const {
1346
0
    return false;
1347
0
  }
1348
1349
  // Get the character to be added for mangling purposes for cpu_specific.
1350
0
  virtual char CPUSpecificManglingCharacter(StringRef Name) const {
1351
0
    llvm_unreachable(
1352
0
        "cpu_specific Multiversioning not implemented on this target");
1353
0
  }
1354
1355
  // Get a list of the features that make up the CPU option for
1356
  // cpu_specific/cpu_dispatch so that it can be passed to llvm as optimization
1357
  // options.
1358
  virtual void getCPUSpecificCPUDispatchFeatures(
1359
0
      StringRef Name, llvm::SmallVectorImpl<StringRef> &Features) const {
1360
0
    llvm_unreachable(
1361
0
        "cpu_specific Multiversioning not implemented on this target");
1362
0
  }
1363
1364
  // Get the cache line size of a given cpu. This method switches over
1365
  // the given cpu and returns "None" if the CPU is not found.
1366
0
  virtual Optional<unsigned> getCPUCacheLineSize() const { return None; }
1367
1368
  // Returns maximal number of args passed in registers.
1369
148
  unsigned getRegParmMax() const {
1370
148
    assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
1371
0
    return RegParmMax;
1372
148
  }
1373
1374
  /// Whether the target supports thread-local storage.
1375
3.67M
  bool isTLSSupported() const {
1376
3.67M
    return TLSSupported;
1377
3.67M
  }
1378
1379
  /// Return the maximum alignment (in bits) of a TLS variable
1380
  ///
1381
  /// Gets the maximum alignment (in bits) of a TLS variable on this target.
1382
  /// Returns zero if there is no such constraint.
1383
2.47M
  unsigned getMaxTLSAlign() const { return MaxTLSAlign; }
1384
1385
  /// Whether target supports variable-length arrays.
1386
5.25k
  bool isVLASupported() const { return VLASupported; }
1387
1388
  /// Whether the target supports SEH __try.
1389
280
  bool isSEHTrySupported() const {
1390
280
    return getTriple().isOSWindows() &&
1391
280
           (getTriple().isX86() ||
1392
280
            
getTriple().getArch() == llvm::Triple::aarch6425
);
1393
280
  }
1394
1395
  /// Return true if {|} are normal characters in the asm string.
1396
  ///
1397
  /// If this returns false (the default), then {abc|xyz} is syntax
1398
  /// that says that when compiling for asm variant #0, "abc" should be
1399
  /// generated, but when compiling for asm variant #1, "xyz" should be
1400
  /// generated.
1401
6.09k
  bool hasNoAsmVariants() const {
1402
6.09k
    return NoAsmVariants;
1403
6.09k
  }
1404
1405
  /// Return the register number that __builtin_eh_return_regno would
1406
  /// return with the specified argument.
1407
  /// This corresponds with TargetLowering's getExceptionPointerRegister
1408
  /// and getExceptionSelectorRegister in the backend.
1409
0
  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
1410
0
    return -1;
1411
0
  }
1412
1413
  /// Return the section to use for C++ static initialization functions.
1414
8.05k
  virtual const char *getStaticInitSectionSpecifier() const {
1415
8.05k
    return nullptr;
1416
8.05k
  }
1417
1418
93.5k
  const LangASMap &getAddressSpaceMap() const { return *AddrSpaceMap; }
1419
1420
  /// Map from the address space field in builtin description strings to the
1421
  /// language address space.
1422
0
  virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const {
1423
0
    return getLangASFromTargetAS(AS);
1424
0
  }
1425
1426
  /// Map from the address space field in builtin description strings to the
1427
  /// language address space.
1428
0
  virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const {
1429
0
    return getLangASFromTargetAS(AS);
1430
0
  }
1431
1432
  /// Return an AST address space which can be used opportunistically
1433
  /// for constant global memory. It must be possible to convert pointers into
1434
  /// this address space to LangAS::Default. If no such address space exists,
1435
  /// this may return None, and such optimizations will be disabled.
1436
147k
  virtual llvm::Optional<LangAS> getConstantAddressSpace() const {
1437
147k
    return LangAS::Default;
1438
147k
  }
1439
1440
  // access target-specific GPU grid values that must be consistent between
1441
  // host RTL (plugin), deviceRTL and clang.
1442
0
  virtual const llvm::omp::GV &getGridValue() const {
1443
0
    llvm_unreachable("getGridValue not implemented on this target");
1444
0
  }
1445
1446
  /// Retrieve the name of the platform as it is used in the
1447
  /// availability attribute.
1448
4.60M
  StringRef getPlatformName() const { return PlatformName; }
1449
1450
  /// Retrieve the minimum desired version of the platform, to
1451
  /// which the program should be compiled.
1452
4.23M
  VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
1453
1454
142k
  bool isBigEndian() const { return BigEndian; }
1455
949
  bool isLittleEndian() const { return !BigEndian; }
1456
1457
  /// Whether the option -fextend-arguments={32,64} is supported on the target.
1458
31
  virtual bool supportsExtendIntArgs() const { return false; }
1459
1460
  /// Controls if __arithmetic_fence is supported in the targeted backend.
1461
3
  virtual bool checkArithmeticFenceSupported() const { return false; }
1462
1463
  /// Gets the default calling convention for the given target and
1464
  /// declaration context.
1465
23.8M
  virtual CallingConv getDefaultCallingConv() const {
1466
    // Not all targets will specify an explicit calling convention that we can
1467
    // express.  This will always do the right thing, even though it's not
1468
    // an explicit calling convention.
1469
23.8M
    return CC_C;
1470
23.8M
  }
1471
1472
  enum CallingConvCheckResult {
1473
    CCCR_OK,
1474
    CCCR_Warning,
1475
    CCCR_Ignore,
1476
    CCCR_Error,
1477
  };
1478
1479
  /// Determines whether a given calling convention is valid for the
1480
  /// target. A calling convention can either be accepted, produce a warning
1481
  /// and be substituted with the default calling convention, or (someday)
1482
  /// produce an error (such as using thiscall on a non-instance function).
1483
208
  virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
1484
208
    switch (CC) {
1485
208
      default:
1486
208
        return CCCR_Warning;
1487
0
      case CC_C:
1488
0
        return CCCR_OK;
1489
208
    }
1490
208
  }
1491
1492
  enum CallingConvKind {
1493
    CCK_Default,
1494
    CCK_ClangABI4OrPS4,
1495
    CCK_MicrosoftWin64
1496
  };
1497
1498
  virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const;
1499
1500
  /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to
1501
  /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp.
1502
8
  virtual bool hasSjLjLowering() const {
1503
8
    return false;
1504
8
  }
1505
1506
  /// Check if the target supports CFProtection branch.
1507
  virtual bool
1508
  checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const;
1509
1510
  /// Check if the target supports CFProtection branch.
1511
  virtual bool
1512
  checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const;
1513
1514
  /// Whether target allows to overalign ABI-specified preferred alignment
1515
2.08M
  virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
1516
1517
  /// Whether target defaults to the `power` alignment rules of AIX.
1518
1.69M
  virtual bool defaultsToAIXPowerAlignment() const { return false; }
1519
1520
  /// Set supported OpenCL extensions and optional core features.
1521
9.52k
  virtual void setSupportedOpenCLOpts() {}
1522
1523
86.0k
  virtual void supportAllOpenCLOpts(bool V = true) {
1524
86.0k
#define OPENCLEXTNAME(Ext)                                                     \
1525
3.61M
  setFeatureEnabled(getTargetOpts().OpenCLFeaturesMap, #Ext, V);
1526
86.0k
#include "clang/Basic/OpenCLExtensions.def"
1527
86.0k
  }
1528
1529
  /// Set supported OpenCL extensions as written on command line
1530
96.0k
  virtual void setCommandLineOpenCLOpts() {
1531
96.0k
    for (const auto &Ext : getTargetOpts().OpenCLExtensionsAsWritten) {
1532
233
      bool IsPrefixed = (Ext[0] == '+' || 
Ext[0] == '-'101
);
1533
233
      std::string Name = IsPrefixed ? Ext.substr(1) : 
Ext0
;
1534
233
      bool V = IsPrefixed ? Ext[0] == '+' : 
true0
;
1535
1536
233
      if (Name == "all") {
1537
19
        supportAllOpenCLOpts(V);
1538
19
        continue;
1539
19
      }
1540
1541
214
      getTargetOpts().OpenCLFeaturesMap[Name] = V;
1542
214
    }
1543
96.0k
  }
1544
1545
  /// Get supported OpenCL extensions and optional core features.
1546
709
  llvm::StringMap<bool> &getSupportedOpenCLOpts() {
1547
709
    return getTargetOpts().OpenCLFeaturesMap;
1548
709
  }
1549
1550
  /// Get const supported OpenCL extensions and optional core features.
1551
2.14k
  const llvm::StringMap<bool> &getSupportedOpenCLOpts() const {
1552
2.14k
    return getTargetOpts().OpenCLFeaturesMap;
1553
2.14k
  }
1554
1555
  /// Get address space for OpenCL type.
1556
  virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const;
1557
1558
  /// \returns Target specific vtbl ptr address space.
1559
226
  virtual unsigned getVtblPtrAddressSpace() const {
1560
226
    return 0;
1561
226
  }
1562
1563
  /// \returns If a target requires an address within a target specific address
1564
  /// space \p AddressSpace to be converted in order to be used, then return the
1565
  /// corresponding target specific DWARF address space.
1566
  ///
1567
  /// \returns Otherwise return None and no conversion will be emitted in the
1568
  /// DWARF.
1569
523k
  virtual Optional<unsigned> getDWARFAddressSpace(unsigned AddressSpace) const {
1570
523k
    return None;
1571
523k
  }
1572
1573
  /// \returns The version of the SDK which was used during the compilation if
1574
  /// one was specified, or an empty version otherwise.
1575
36.3k
  const llvm::VersionTuple &getSDKVersion() const {
1576
36.3k
    return getTargetOpts().SDKVersion;
1577
36.3k
  }
1578
1579
  /// Check the target is valid after it is fully initialized.
1580
95.7k
  virtual bool validateTarget(DiagnosticsEngine &Diags) const {
1581
95.7k
    return true;
1582
95.7k
  }
1583
1584
  /// Check that OpenCL target has valid options setting based on OpenCL
1585
  /// version.
1586
  virtual bool validateOpenCLTarget(const LangOptions &Opts,
1587
                                    DiagnosticsEngine &Diags) const;
1588
1589
99
  virtual void setAuxTarget(const TargetInfo *Aux) {}
1590
1591
  /// Whether target allows debuginfo types for decl only variables/functions.
1592
993k
  virtual bool allowDebugInfoForExternalRef() const { return false; }
1593
1594
protected:
1595
  /// Copy type and layout related info.
1596
  void copyAuxTarget(const TargetInfo *Aux);
1597
441
  virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
1598
441
    return PointerWidth;
1599
441
  }
1600
363
  virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
1601
363
    return PointerAlign;
1602
363
  }
1603
0
  virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
1604
0
    return PtrDiffType;
1605
0
  }
1606
  virtual ArrayRef<const char *> getGCCRegNames() const = 0;
1607
  virtual ArrayRef<GCCRegAlias> getGCCRegAliases() const = 0;
1608
2.37k
  virtual ArrayRef<AddlRegName> getGCCAddlRegNames() const {
1609
2.37k
    return None;
1610
2.37k
  }
1611
1612
 private:
1613
  // Assert the values for the fractional and integral bits for each fixed point
1614
  // type follow the restrictions given in clause 6.2.6.3 of N1169.
1615
  void CheckFixedPointBits() const;
1616
};
1617
1618
}  // end namespace clang
1619
1620
#endif