Coverage Report

Created: 2020-02-18 08:44

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/X86.h
Line
Count
Source (jump to first uncovered line)
1
//===--- X86.h - Declare X86 target feature support -------------*- 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
// This file declares X86 TargetInfo objects.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
14
#define LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
15
16
#include "OSTargets.h"
17
#include "clang/Basic/TargetInfo.h"
18
#include "clang/Basic/TargetOptions.h"
19
#include "llvm/ADT/Triple.h"
20
#include "llvm/Support/Compiler.h"
21
22
namespace clang {
23
namespace targets {
24
25
static const unsigned X86AddrSpaceMap[] = {
26
    0,   // Default
27
    0,   // opencl_global
28
    0,   // opencl_local
29
    0,   // opencl_constant
30
    0,   // opencl_private
31
    0,   // opencl_generic
32
    0,   // cuda_device
33
    0,   // cuda_constant
34
    0,   // cuda_shared
35
    270, // ptr32_sptr
36
    271, // ptr32_uptr
37
    272  // ptr64
38
};
39
40
// X86 target abstract base class; x86-32 and x86-64 are very close, so
41
// most of the implementation can be shared.
42
class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
43
44
  enum X86SSEEnum {
45
    NoSSE,
46
    SSE1,
47
    SSE2,
48
    SSE3,
49
    SSSE3,
50
    SSE41,
51
    SSE42,
52
    AVX,
53
    AVX2,
54
    AVX512F
55
  } SSELevel = NoSSE;
56
  enum MMX3DNowEnum {
57
    NoMMX3DNow,
58
    MMX,
59
    AMD3DNow,
60
    AMD3DNowAthlon
61
  } MMX3DNowLevel = NoMMX3DNow;
62
  enum XOPEnum { NoXOP, SSE4A, FMA4, XOP } XOPLevel = NoXOP;
63
  enum AddrSpace { ptr32_sptr = 270, ptr32_uptr = 271, ptr64 = 272 };
64
65
  bool HasAES = false;
66
  bool HasVAES = false;
67
  bool HasPCLMUL = false;
68
  bool HasVPCLMULQDQ = false;
69
  bool HasGFNI = false;
70
  bool HasLZCNT = false;
71
  bool HasRDRND = false;
72
  bool HasFSGSBASE = false;
73
  bool HasBMI = false;
74
  bool HasBMI2 = false;
75
  bool HasPOPCNT = false;
76
  bool HasRTM = false;
77
  bool HasPRFCHW = false;
78
  bool HasRDSEED = false;
79
  bool HasADX = false;
80
  bool HasTBM = false;
81
  bool HasLWP = false;
82
  bool HasFMA = false;
83
  bool HasF16C = false;
84
  bool HasAVX512CD = false;
85
  bool HasAVX512VPOPCNTDQ = false;
86
  bool HasAVX512VNNI = false;
87
  bool HasAVX512BF16 = false;
88
  bool HasAVX512ER = false;
89
  bool HasAVX512PF = false;
90
  bool HasAVX512DQ = false;
91
  bool HasAVX512BITALG = false;
92
  bool HasAVX512BW = false;
93
  bool HasAVX512VL = false;
94
  bool HasAVX512VBMI = false;
95
  bool HasAVX512VBMI2 = false;
96
  bool HasAVX512IFMA = false;
97
  bool HasAVX512VP2INTERSECT = false;
98
  bool HasSHA = false;
99
  bool HasSHSTK = false;
100
  bool HasSGX = false;
101
  bool HasCX8 = false;
102
  bool HasCX16 = false;
103
  bool HasFXSR = false;
104
  bool HasXSAVE = false;
105
  bool HasXSAVEOPT = false;
106
  bool HasXSAVEC = false;
107
  bool HasXSAVES = false;
108
  bool HasMWAITX = false;
109
  bool HasCLZERO = false;
110
  bool HasCLDEMOTE = false;
111
  bool HasPCONFIG = false;
112
  bool HasPKU = false;
113
  bool HasCLFLUSHOPT = false;
114
  bool HasCLWB = false;
115
  bool HasMOVBE = false;
116
  bool HasPREFETCHWT1 = false;
117
  bool HasRDPID = false;
118
  bool HasRetpolineExternalThunk = false;
119
  bool HasLAHFSAHF = false;
120
  bool HasWBNOINVD = false;
121
  bool HasWAITPKG = false;
122
  bool HasMOVDIRI = false;
123
  bool HasMOVDIR64B = false;
124
  bool HasPTWRITE = false;
125
  bool HasINVPCID = false;
126
  bool HasENQCMD = false;
127
128
protected:
129
  /// Enumeration of all of the X86 CPUs supported by Clang.
130
  ///
131
  /// Each enumeration represents a particular CPU supported by Clang. These
132
  /// loosely correspond to the options passed to '-march' or '-mtune' flags.
133
  enum CPUKind {
134
    CK_Generic,
135
#define PROC(ENUM, STRING, IS64BIT) CK_##ENUM,
136
#include "clang/Basic/X86Target.def"
137
  } CPU = CK_Generic;
138
139
  bool checkCPUKind(CPUKind Kind) const;
140
141
  CPUKind getCPUKind(StringRef CPU) const;
142
143
  enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
144
145
public:
146
  X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
147
60.3k
      : TargetInfo(Triple) {
148
60.3k
    LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
149
60.3k
    AddrSpaceMap = &X86AddrSpaceMap;
150
60.3k
  }
151
152
101k
  const char *getLongDoubleMangling() const override {
153
101k
    return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? 
"g"14
:
"e"101k
;
154
101k
  }
155
156
53.2k
  unsigned getFloatEvalMethod() const override {
157
53.2k
    // X87 evaluates with 80 bits "long double" precision.
158
53.2k
    return SSELevel == NoSSE ? 
23.63k
:
049.5k
;
159
53.2k
  }
160
161
  ArrayRef<const char *> getGCCRegNames() const override;
162
163
2.12k
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
164
2.12k
    return None;
165
2.12k
  }
166
167
  ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
168
169
2
  bool isSPRegName(StringRef RegName) const override {
170
2
    return RegName.equals("esp") || RegName.equals("rsp");
171
2
  }
172
173
  bool validateCpuSupports(StringRef Name) const override;
174
175
  bool validateCpuIs(StringRef Name) const override;
176
177
  bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
178
179
  char CPUSpecificManglingCharacter(StringRef Name) const override;
180
181
  void getCPUSpecificCPUDispatchFeatures(
182
      StringRef Name,
183
      llvm::SmallVectorImpl<StringRef> &Features) const override;
184
185
  bool validateAsmConstraint(const char *&Name,
186
                             TargetInfo::ConstraintInfo &info) const override;
187
188
  bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
189
30
                                      bool &HasSizeMismatch) const override {
190
30
    // esp and ebp are the only 32-bit registers the x86 backend can currently
191
30
    // handle.
192
30
    if (RegName.equals("esp") || 
RegName.equals("ebp")1
) {
193
29
      // Check that the register size is 32-bit.
194
29
      HasSizeMismatch = RegSize != 32;
195
29
      return true;
196
29
    }
197
1
198
1
    return false;
199
1
  }
200
201
  bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
202
                          StringRef Constraint, unsigned Size) const override;
203
204
  bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
205
                         StringRef Constraint, unsigned Size) const override;
206
207
  virtual bool
208
0
  checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override {
209
0
    return true;
210
0
  };
211
212
  virtual bool
213
1
  checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override {
214
1
    return true;
215
1
  };
216
217
  virtual bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
218
                                   StringRef Constraint, unsigned Size) const;
219
220
  std::string convertConstraint(const char *&Constraint) const override;
221
671
  const char *getClobbers() const override {
222
671
    return "~{dirflag},~{fpsr},~{flags}";
223
671
  }
224
225
  StringRef getConstraintRegister(StringRef Constraint,
226
8.95k
                                  StringRef Expression) const override {
227
8.95k
    StringRef::iterator I, E;
228
13.6k
    for (I = Constraint.begin(), E = Constraint.end(); I != E; 
++I4.73k
) {
229
13.5k
      if (isalpha(*I) || 
*I == '@'4.76k
)
230
8.85k
        break;
231
13.5k
    }
232
8.95k
    if (I == E)
233
107
      return "";
234
8.85k
    switch (*I) {
235
0
    // For the register constraints, return the matching register name
236
1.91k
    case 'a':
237
1.91k
      return "ax";
238
1.75k
    case 'b':
239
1.75k
      return "bx";
240
1.89k
    case 'c':
241
1.89k
      return "cx";
242
1.79k
    case 'd':
243
1.79k
      return "dx";
244
48
    case 'S':
245
48
      return "si";
246
77
    case 'D':
247
77
      return "di";
248
0
    // In case the constraint is 'r' we need to return Expression
249
741
    case 'r':
250
741
      return Expression;
251
0
    // Double letters Y<x> constraints
252
20
    case 'Y':
253
20
      if ((++I != E) && ((*I == '0') || 
(*I == 'z')19
))
254
2
        return "xmm0";
255
18
      break;
256
604
    default:
257
604
      break;
258
622
    }
259
622
    return "";
260
622
  }
261
262
4.25M
  bool useFP16ConversionIntrinsics() const override {
263
4.25M
    return false;
264
4.25M
  }
265
266
  void getTargetDefines(const LangOptions &Opts,
267
                        MacroBuilder &Builder) const override;
268
269
  static void setSSELevel(llvm::StringMap<bool> &Features, X86SSEEnum Level,
270
                          bool Enabled);
271
272
  static void setMMXLevel(llvm::StringMap<bool> &Features, MMX3DNowEnum Level,
273
                          bool Enabled);
274
275
  static void setXOPLevel(llvm::StringMap<bool> &Features, XOPEnum Level,
276
                          bool Enabled);
277
278
  void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
279
306k
                         bool Enabled) const override {
280
306k
    setFeatureEnabledImpl(Features, Name, Enabled);
281
306k
  }
282
283
  // This exists purely to cut down on the number of virtual calls in
284
  // initFeatureMap which calls this repeatedly.
285
  static void setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
286
                                    StringRef Name, bool Enabled);
287
288
  bool
289
  initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
290
                 StringRef CPU,
291
                 const std::vector<std::string> &FeaturesVec) const override;
292
293
  bool isValidFeatureName(StringRef Name) const override;
294
295
  bool hasFeature(StringRef Feature) const override;
296
297
  bool handleTargetFeatures(std::vector<std::string> &Features,
298
                            DiagnosticsEngine &Diags) override;
299
300
19.6k
  StringRef getABI() const override {
301
19.6k
    if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
302
70
      return "avx512";
303
19.6k
    if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
304
50
      return "avx";
305
19.5k
    if (getTriple().getArch() == llvm::Triple::x86 &&
306
19.5k
        
MMX3DNowLevel == NoMMX3DNow0
)
307
0
      return "no-mmx";
308
19.5k
    return "";
309
19.5k
  }
310
311
362
  bool isValidCPUName(StringRef Name) const override {
312
362
    return checkCPUKind(getCPUKind(Name));
313
362
  }
314
315
  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
316
317
20.0k
  bool setCPU(const std::string &Name) override {
318
20.0k
    return checkCPUKind(CPU = getCPUKind(Name));
319
20.0k
  }
320
321
  unsigned multiVersionSortPriority(StringRef Name) const override;
322
323
  bool setFPMath(StringRef Name) override;
324
325
863
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
326
863
    // Most of the non-ARM calling conventions are i386 conventions.
327
863
    switch (CC) {
328
853
    case CC_X86ThisCall:
329
853
    case CC_X86FastCall:
330
853
    case CC_X86StdCall:
331
853
    case CC_X86VectorCall:
332
853
    case CC_X86RegCall:
333
853
    case CC_C:
334
853
    case CC_PreserveMost:
335
853
    case CC_Swift:
336
853
    case CC_X86Pascal:
337
853
    case CC_IntelOclBicc:
338
853
    case CC_OpenCLKernel:
339
853
      return CCCR_OK;
340
853
    default:
341
10
      return CCCR_Warning;
342
863
    }
343
863
  }
344
345
391k
  CallingConv getDefaultCallingConv() const override {
346
391k
    return CC_C;
347
391k
  }
348
349
8
  bool hasSjLjLowering() const override { return true; }
350
351
60.2k
  void setSupportedOpenCLOpts() override {
352
60.2k
    getSupportedOpenCLOpts().supportAll();
353
60.2k
  }
354
355
248
  uint64_t getPointerWidthV(unsigned AddrSpace) const override {
356
248
    if (AddrSpace == ptr32_sptr || 
AddrSpace == ptr32_uptr242
)
357
14
      return 32;
358
234
    if (AddrSpace == ptr64)
359
4
      return 64;
360
230
    return PointerWidth;
361
230
  }
362
363
124
  uint64_t getPointerAlignV(unsigned AddrSpace) const override {
364
124
    return getPointerWidthV(AddrSpace);
365
124
  }
366
};
367
368
// X86-32 generic target
369
class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
370
public:
371
  X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
372
5.96k
      : X86TargetInfo(Triple, Opts) {
373
5.96k
    DoubleAlign = LongLongAlign = 32;
374
5.96k
    LongDoubleWidth = 96;
375
5.96k
    LongDoubleAlign = 32;
376
5.96k
    SuitableAlign = 128;
377
5.96k
    resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
378
5.96k
                    "f80:32-n8:16:32-S128");
379
5.96k
    SizeType = UnsignedInt;
380
5.96k
    PtrDiffType = SignedInt;
381
5.96k
    IntPtrType = SignedInt;
382
5.96k
    RegParmMax = 3;
383
5.96k
384
5.96k
    // Use fpret for all types.
385
5.96k
    RealTypeUsesObjCFPRet =
386
5.96k
        ((1 << TargetInfo::Float) | (1 << TargetInfo::Double) |
387
5.96k
         (1 << TargetInfo::LongDouble));
388
5.96k
389
5.96k
    // x86-32 has atomics up to 8 bytes
390
5.96k
    MaxAtomicPromoteWidth = 64;
391
5.96k
    MaxAtomicInlineWidth = 32;
392
5.96k
  }
clang::targets::X86_32TargetInfo::X86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
372
1.41k
      : X86TargetInfo(Triple, Opts) {
373
1.41k
    DoubleAlign = LongLongAlign = 32;
374
1.41k
    LongDoubleWidth = 96;
375
1.41k
    LongDoubleAlign = 32;
376
1.41k
    SuitableAlign = 128;
377
1.41k
    resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
378
1.41k
                    "f80:32-n8:16:32-S128");
379
1.41k
    SizeType = UnsignedInt;
380
1.41k
    PtrDiffType = SignedInt;
381
1.41k
    IntPtrType = SignedInt;
382
1.41k
    RegParmMax = 3;
383
1.41k
384
1.41k
    // Use fpret for all types.
385
1.41k
    RealTypeUsesObjCFPRet =
386
1.41k
        ((1 << TargetInfo::Float) | (1 << TargetInfo::Double) |
387
1.41k
         (1 << TargetInfo::LongDouble));
388
1.41k
389
1.41k
    // x86-32 has atomics up to 8 bytes
390
1.41k
    MaxAtomicPromoteWidth = 64;
391
1.41k
    MaxAtomicInlineWidth = 32;
392
1.41k
  }
clang::targets::X86_32TargetInfo::X86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
372
4.54k
      : X86TargetInfo(Triple, Opts) {
373
4.54k
    DoubleAlign = LongLongAlign = 32;
374
4.54k
    LongDoubleWidth = 96;
375
4.54k
    LongDoubleAlign = 32;
376
4.54k
    SuitableAlign = 128;
377
4.54k
    resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
378
4.54k
                    "f80:32-n8:16:32-S128");
379
4.54k
    SizeType = UnsignedInt;
380
4.54k
    PtrDiffType = SignedInt;
381
4.54k
    IntPtrType = SignedInt;
382
4.54k
    RegParmMax = 3;
383
4.54k
384
4.54k
    // Use fpret for all types.
385
4.54k
    RealTypeUsesObjCFPRet =
386
4.54k
        ((1 << TargetInfo::Float) | (1 << TargetInfo::Double) |
387
4.54k
         (1 << TargetInfo::LongDouble));
388
4.54k
389
4.54k
    // x86-32 has atomics up to 8 bytes
390
4.54k
    MaxAtomicPromoteWidth = 64;
391
4.54k
    MaxAtomicInlineWidth = 32;
392
4.54k
  }
393
394
5.68k
  BuiltinVaListKind getBuiltinVaListKind() const override {
395
5.68k
    return TargetInfo::CharPtrBuiltinVaList;
396
5.68k
  }
397
398
2
  int getEHDataRegisterNumber(unsigned RegNo) const override {
399
2
    if (RegNo == 0)
400
2
      return 0;
401
0
    if (RegNo == 1)
402
0
      return 2;
403
0
    return -1;
404
0
  }
405
406
  bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
407
2.12k
                           StringRef Constraint, unsigned Size) const override {
408
2.12k
    switch (Constraint[0]) {
409
646
    default:
410
646
      break;
411
1.47k
    case 'R':
412
1.47k
    case 'q':
413
1.47k
    case 'Q':
414
1.47k
    case 'a':
415
1.47k
    case 'b':
416
1.47k
    case 'c':
417
1.47k
    case 'd':
418
1.47k
    case 'S':
419
1.47k
    case 'D':
420
1.47k
      return Size <= 32;
421
1.47k
    case 'A':
422
6
      return Size <= 64;
423
646
    }
424
646
425
646
    return X86TargetInfo::validateOperandSize(FeatureMap, Constraint, Size);
426
646
  }
427
428
5.93k
  void setMaxAtomicWidth() override {
429
5.93k
    if (hasFeature("cx8"))
430
5.91k
      MaxAtomicInlineWidth = 64;
431
5.93k
  }
432
433
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
434
};
435
436
class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
437
    : public NetBSDTargetInfo<X86_32TargetInfo> {
438
public:
439
  NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
440
7
      : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
clang::targets::NetBSDI386TargetInfo::NetBSDI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
440
7
      : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
Unexecuted instantiation: clang::targets::NetBSDI386TargetInfo::NetBSDI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
441
442
7
  unsigned getFloatEvalMethod() const override {
443
7
    unsigned Major, Minor, Micro;
444
7
    getTriple().getOSVersion(Major, Minor, Micro);
445
7
    // New NetBSD uses the default rounding mode.
446
7
    if (Major >= 7 || (Major == 6 && 
Minor == 992
&&
Micro >= 260
) || Major == 0)
447
5
      return X86_32TargetInfo::getFloatEvalMethod();
448
2
    // NetBSD before 6.99.26 defaults to "double" rounding.
449
2
    return 1;
450
2
  }
451
};
452
453
class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
454
    : public OpenBSDTargetInfo<X86_32TargetInfo> {
455
public:
456
  OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
457
4
      : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
458
4
    SizeType = UnsignedLong;
459
4
    IntPtrType = SignedLong;
460
4
    PtrDiffType = SignedLong;
461
4
  }
clang::targets::OpenBSDI386TargetInfo::OpenBSDI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
457
4
      : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
458
4
    SizeType = UnsignedLong;
459
4
    IntPtrType = SignedLong;
460
4
    PtrDiffType = SignedLong;
461
4
  }
Unexecuted instantiation: clang::targets::OpenBSDI386TargetInfo::OpenBSDI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
462
};
463
464
class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
465
    : public DarwinTargetInfo<X86_32TargetInfo> {
466
public:
467
  DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
468
375
      : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
469
375
    LongDoubleWidth = 128;
470
375
    LongDoubleAlign = 128;
471
375
    SuitableAlign = 128;
472
375
    MaxVectorAlign = 256;
473
375
    // The watchOS simulator uses the builtin bool type for Objective-C.
474
375
    llvm::Triple T = llvm::Triple(Triple);
475
375
    if (T.isWatchOS())
476
15
      UseSignedCharForObjCBool = false;
477
375
    SizeType = UnsignedLong;
478
375
    IntPtrType = SignedLong;
479
375
    resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
480
375
                    "f80:128-n8:16:32-S128");
481
375
    HasAlignMac68kSupport = true;
482
375
  }
clang::targets::DarwinI386TargetInfo::DarwinI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
468
375
      : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
469
375
    LongDoubleWidth = 128;
470
375
    LongDoubleAlign = 128;
471
375
    SuitableAlign = 128;
472
375
    MaxVectorAlign = 256;
473
375
    // The watchOS simulator uses the builtin bool type for Objective-C.
474
375
    llvm::Triple T = llvm::Triple(Triple);
475
375
    if (T.isWatchOS())
476
15
      UseSignedCharForObjCBool = false;
477
375
    SizeType = UnsignedLong;
478
375
    IntPtrType = SignedLong;
479
375
    resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
480
375
                    "f80:128-n8:16:32-S128");
481
375
    HasAlignMac68kSupport = true;
482
375
  }
Unexecuted instantiation: clang::targets::DarwinI386TargetInfo::DarwinI386TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
483
484
  bool handleTargetFeatures(std::vector<std::string> &Features,
485
373
                            DiagnosticsEngine &Diags) override {
486
373
    if (!DarwinTargetInfo<X86_32TargetInfo>::handleTargetFeatures(Features,
487
373
                                                                  Diags))
488
0
      return false;
489
373
    // We now know the features we have: we can decide how to align vectors.
490
373
    MaxVectorAlign =
491
373
        hasFeature("avx512f") ? 
5121
:
hasFeature("avx") 372
?
2562
:
128370
;
492
373
    return true;
493
373
  }
494
};
495
496
// x86-32 Windows target
497
class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
498
    : public WindowsTargetInfo<X86_32TargetInfo> {
499
public:
500
  WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
501
605
      : WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
502
605
    DoubleAlign = LongLongAlign = 64;
503
605
    bool IsWinCOFF =
504
605
        getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
505
605
    resetDataLayout(IsWinCOFF ? "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:"
506
603
                                "64-i64:64-f80:32-n8:16:32-a:0:32-S32"
507
605
                              : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:"
508
2
                                "64-i64:64-f80:32-n8:16:32-a:0:32-S32");
509
605
  }
510
};
511
512
// x86-32 Windows Visual Studio target
513
class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32TargetInfo
514
    : public WindowsX86_32TargetInfo {
515
public:
516
  MicrosoftX86_32TargetInfo(const llvm::Triple &Triple,
517
                            const TargetOptions &Opts)
518
495
      : WindowsX86_32TargetInfo(Triple, Opts) {
519
495
    LongDoubleWidth = LongDoubleAlign = 64;
520
495
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
521
495
  }
clang::targets::MicrosoftX86_32TargetInfo::MicrosoftX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
518
495
      : WindowsX86_32TargetInfo(Triple, Opts) {
519
495
    LongDoubleWidth = LongDoubleAlign = 64;
520
495
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
521
495
  }
Unexecuted instantiation: clang::targets::MicrosoftX86_32TargetInfo::MicrosoftX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
522
523
  void getTargetDefines(const LangOptions &Opts,
524
490
                        MacroBuilder &Builder) const override {
525
490
    WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
526
490
    // The value of the following reflects processor type.
527
490
    // 300=386, 400=486, 500=Pentium, 600=Blend (default)
528
490
    // We lost the original triple, so we use the default.
529
490
    Builder.defineMacro("_M_IX86", "600");
530
490
  }
531
};
532
533
// x86-32 MinGW target
534
class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
535
    : public WindowsX86_32TargetInfo {
536
public:
537
  MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
538
110
      : WindowsX86_32TargetInfo(Triple, Opts) {
539
110
    HasFloat128 = true;
540
110
  }
clang::targets::MinGWX86_32TargetInfo::MinGWX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
538
110
      : WindowsX86_32TargetInfo(Triple, Opts) {
539
110
    HasFloat128 = true;
540
110
  }
Unexecuted instantiation: clang::targets::MinGWX86_32TargetInfo::MinGWX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
541
542
  void getTargetDefines(const LangOptions &Opts,
543
110
                        MacroBuilder &Builder) const override {
544
110
    WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
545
110
    Builder.defineMacro("_X86_");
546
110
  }
547
};
548
549
// x86-32 Cygwin target
550
class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
551
public:
552
  CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
553
11
      : X86_32TargetInfo(Triple, Opts) {
554
11
    this->WCharType = TargetInfo::UnsignedShort;
555
11
    DoubleAlign = LongLongAlign = 64;
556
11
    resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:"
557
11
                    "32-n8:16:32-a:0:32-S32");
558
11
  }
clang::targets::CygwinX86_32TargetInfo::CygwinX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
553
11
      : X86_32TargetInfo(Triple, Opts) {
554
11
    this->WCharType = TargetInfo::UnsignedShort;
555
11
    DoubleAlign = LongLongAlign = 64;
556
11
    resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:"
557
11
                    "32-n8:16:32-a:0:32-S32");
558
11
  }
Unexecuted instantiation: clang::targets::CygwinX86_32TargetInfo::CygwinX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
559
560
  void getTargetDefines(const LangOptions &Opts,
561
11
                        MacroBuilder &Builder) const override {
562
11
    X86_32TargetInfo::getTargetDefines(Opts, Builder);
563
11
    Builder.defineMacro("_X86_");
564
11
    Builder.defineMacro("__CYGWIN__");
565
11
    Builder.defineMacro("__CYGWIN32__");
566
11
    addCygMingDefines(Opts, Builder);
567
11
    DefineStd(Builder, "unix", Opts);
568
11
    if (Opts.CPlusPlus)
569
5
      Builder.defineMacro("_GNU_SOURCE");
570
11
  }
571
};
572
573
// x86-32 Haiku target
574
class LLVM_LIBRARY_VISIBILITY HaikuX86_32TargetInfo
575
    : public HaikuTargetInfo<X86_32TargetInfo> {
576
public:
577
  HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
578
3
      : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
clang::targets::HaikuX86_32TargetInfo::HaikuX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
578
3
      : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
Unexecuted instantiation: clang::targets::HaikuX86_32TargetInfo::HaikuX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
579
580
  void getTargetDefines(const LangOptions &Opts,
581
3
                        MacroBuilder &Builder) const override {
582
3
    HaikuTargetInfo<X86_32TargetInfo>::getTargetDefines(Opts, Builder);
583
3
    Builder.defineMacro("__INTEL__");
584
3
  }
585
};
586
587
// X86-32 MCU target
588
class LLVM_LIBRARY_VISIBILITY MCUX86_32TargetInfo : public X86_32TargetInfo {
589
public:
590
  MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
591
6
      : X86_32TargetInfo(Triple, Opts) {
592
6
    LongDoubleWidth = 64;
593
6
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
594
6
    resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-f64:"
595
6
                    "32-f128:32-n8:16:32-a:0:32-S32");
596
6
    WIntType = UnsignedInt;
597
6
  }
clang::targets::MCUX86_32TargetInfo::MCUX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
591
6
      : X86_32TargetInfo(Triple, Opts) {
592
6
    LongDoubleWidth = 64;
593
6
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
594
6
    resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-f64:"
595
6
                    "32-f128:32-n8:16:32-a:0:32-S32");
596
6
    WIntType = UnsignedInt;
597
6
  }
Unexecuted instantiation: clang::targets::MCUX86_32TargetInfo::MCUX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
598
599
17
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
600
17
    // On MCU we support only C calling convention.
601
17
    return CC == CC_C ? 
CCCR_OK4
:
CCCR_Warning13
;
602
17
  }
603
604
  void getTargetDefines(const LangOptions &Opts,
605
6
                        MacroBuilder &Builder) const override {
606
6
    X86_32TargetInfo::getTargetDefines(Opts, Builder);
607
6
    Builder.defineMacro("__iamcu");
608
6
    Builder.defineMacro("__iamcu__");
609
6
  }
610
611
61
  bool allowsLargerPreferedTypeAlignment() const override { return false; }
612
};
613
614
// x86-32 RTEMS target
615
class LLVM_LIBRARY_VISIBILITY RTEMSX86_32TargetInfo : public X86_32TargetInfo {
616
public:
617
  RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
618
0
      : X86_32TargetInfo(Triple, Opts) {
619
0
    SizeType = UnsignedLong;
620
0
    IntPtrType = SignedLong;
621
0
    PtrDiffType = SignedLong;
622
0
  }
Unexecuted instantiation: clang::targets::RTEMSX86_32TargetInfo::RTEMSX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Unexecuted instantiation: clang::targets::RTEMSX86_32TargetInfo::RTEMSX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
623
624
  void getTargetDefines(const LangOptions &Opts,
625
0
                        MacroBuilder &Builder) const override {
626
0
    X86_32TargetInfo::getTargetDefines(Opts, Builder);
627
0
    Builder.defineMacro("__INTEL__");
628
0
    Builder.defineMacro("__rtems__");
629
0
  }
630
};
631
632
// x86-64 generic target
633
class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
634
public:
635
  X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
636
54.3k
      : X86TargetInfo(Triple, Opts) {
637
54.3k
    const bool IsX32 = getTriple().getEnvironment() == llvm::Triple::GNUX32;
638
54.3k
    bool IsWinCOFF =
639
54.3k
        getTriple().isOSWindows() && 
getTriple().isOSBinFormatCOFF()527
;
640
54.3k
    LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 
3210
:
6454.3k
;
641
54.3k
    LongDoubleWidth = 128;
642
54.3k
    LongDoubleAlign = 128;
643
54.3k
    LargeArrayMinWidth = 128;
644
54.3k
    LargeArrayAlign = 128;
645
54.3k
    SuitableAlign = 128;
646
54.3k
    SizeType = IsX32 ? 
UnsignedInt10
:
UnsignedLong54.3k
;
647
54.3k
    PtrDiffType = IsX32 ? 
SignedInt10
:
SignedLong54.3k
;
648
54.3k
    IntPtrType = IsX32 ? 
SignedInt10
:
SignedLong54.3k
;
649
54.3k
    IntMaxType = IsX32 ? 
SignedLongLong10
:
SignedLong54.3k
;
650
54.3k
    Int64Type = IsX32 ? 
SignedLongLong10
:
SignedLong54.3k
;
651
54.3k
    RegParmMax = 6;
652
54.3k
653
54.3k
    // Pointers are 32-bit in x32.
654
54.3k
    resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-"
655
10
                            "i64:64-f80:128-n8:16:32:64-S128"
656
54.3k
                          : 
IsWinCOFF 54.3k
? "e-m:w-p270:32:32-p271:32:32-p272:64:"
657
523
                                        "64-i64:64-f80:128-n8:16:32:64-S128"
658
54.3k
                                      : "e-m:e-p270:32:32-p271:32:32-p272:64:"
659
53.8k
                                        "64-i64:64-f80:128-n8:16:32:64-S128");
660
54.3k
661
54.3k
    // Use fpret only for long double.
662
54.3k
    RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);
663
54.3k
664
54.3k
    // Use fp2ret for _Complex long double.
665
54.3k
    ComplexLongDoubleUsesFP2Ret = true;
666
54.3k
667
54.3k
    // Make __builtin_ms_va_list available.
668
54.3k
    HasBuiltinMSVaList = true;
669
54.3k
670
54.3k
    // x86-64 has atomics up to 16 bytes.
671
54.3k
    MaxAtomicPromoteWidth = 128;
672
54.3k
    MaxAtomicInlineWidth = 64;
673
54.3k
  }
clang::targets::X86_64TargetInfo::X86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
636
53.4k
      : X86TargetInfo(Triple, Opts) {
637
53.4k
    const bool IsX32 = getTriple().getEnvironment() == llvm::Triple::GNUX32;
638
53.4k
    bool IsWinCOFF =
639
53.4k
        getTriple().isOSWindows() && 
getTriple().isOSBinFormatCOFF()527
;
640
53.4k
    LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 
328
:
6453.4k
;
641
53.4k
    LongDoubleWidth = 128;
642
53.4k
    LongDoubleAlign = 128;
643
53.4k
    LargeArrayMinWidth = 128;
644
53.4k
    LargeArrayAlign = 128;
645
53.4k
    SuitableAlign = 128;
646
53.4k
    SizeType = IsX32 ? 
UnsignedInt8
:
UnsignedLong53.4k
;
647
53.4k
    PtrDiffType = IsX32 ? 
SignedInt8
:
SignedLong53.4k
;
648
53.4k
    IntPtrType = IsX32 ? 
SignedInt8
:
SignedLong53.4k
;
649
53.4k
    IntMaxType = IsX32 ? 
SignedLongLong8
:
SignedLong53.4k
;
650
53.4k
    Int64Type = IsX32 ? 
SignedLongLong8
:
SignedLong53.4k
;
651
53.4k
    RegParmMax = 6;
652
53.4k
653
53.4k
    // Pointers are 32-bit in x32.
654
53.4k
    resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-"
655
8
                            "i64:64-f80:128-n8:16:32:64-S128"
656
53.4k
                          : 
IsWinCOFF 53.4k
? "e-m:w-p270:32:32-p271:32:32-p272:64:"
657
523
                                        "64-i64:64-f80:128-n8:16:32:64-S128"
658
53.4k
                                      : "e-m:e-p270:32:32-p271:32:32-p272:64:"
659
52.9k
                                        "64-i64:64-f80:128-n8:16:32:64-S128");
660
53.4k
661
53.4k
    // Use fpret only for long double.
662
53.4k
    RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);
663
53.4k
664
53.4k
    // Use fp2ret for _Complex long double.
665
53.4k
    ComplexLongDoubleUsesFP2Ret = true;
666
53.4k
667
53.4k
    // Make __builtin_ms_va_list available.
668
53.4k
    HasBuiltinMSVaList = true;
669
53.4k
670
53.4k
    // x86-64 has atomics up to 16 bytes.
671
53.4k
    MaxAtomicPromoteWidth = 128;
672
53.4k
    MaxAtomicInlineWidth = 64;
673
53.4k
  }
clang::targets::X86_64TargetInfo::X86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
636
872
      : X86TargetInfo(Triple, Opts) {
637
872
    const bool IsX32 = getTriple().getEnvironment() == llvm::Triple::GNUX32;
638
872
    bool IsWinCOFF =
639
872
        getTriple().isOSWindows() && 
getTriple().isOSBinFormatCOFF()0
;
640
872
    LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 
322
:
64870
;
641
872
    LongDoubleWidth = 128;
642
872
    LongDoubleAlign = 128;
643
872
    LargeArrayMinWidth = 128;
644
872
    LargeArrayAlign = 128;
645
872
    SuitableAlign = 128;
646
872
    SizeType = IsX32 ? 
UnsignedInt2
:
UnsignedLong870
;
647
872
    PtrDiffType = IsX32 ? 
SignedInt2
:
SignedLong870
;
648
872
    IntPtrType = IsX32 ? 
SignedInt2
:
SignedLong870
;
649
872
    IntMaxType = IsX32 ? 
SignedLongLong2
:
SignedLong870
;
650
872
    Int64Type = IsX32 ? 
SignedLongLong2
:
SignedLong870
;
651
872
    RegParmMax = 6;
652
872
653
872
    // Pointers are 32-bit in x32.
654
872
    resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-"
655
2
                            "i64:64-f80:128-n8:16:32:64-S128"
656
872
                          : 
IsWinCOFF 870
? "e-m:w-p270:32:32-p271:32:32-p272:64:"
657
0
                                        "64-i64:64-f80:128-n8:16:32:64-S128"
658
870
                                      : "e-m:e-p270:32:32-p271:32:32-p272:64:"
659
870
                                        "64-i64:64-f80:128-n8:16:32:64-S128");
660
872
661
872
    // Use fpret only for long double.
662
872
    RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);
663
872
664
872
    // Use fp2ret for _Complex long double.
665
872
    ComplexLongDoubleUsesFP2Ret = true;
666
872
667
872
    // Make __builtin_ms_va_list available.
668
872
    HasBuiltinMSVaList = true;
669
872
670
872
    // x86-64 has atomics up to 16 bytes.
671
872
    MaxAtomicPromoteWidth = 128;
672
872
    MaxAtomicInlineWidth = 64;
673
872
  }
674
675
43.4k
  BuiltinVaListKind getBuiltinVaListKind() const override {
676
43.4k
    return TargetInfo::X86_64ABIBuiltinVaList;
677
43.4k
  }
678
679
0
  int getEHDataRegisterNumber(unsigned RegNo) const override {
680
0
    if (RegNo == 0)
681
0
      return 0;
682
0
    if (RegNo == 1)
683
0
      return 1;
684
0
    return -1;
685
0
  }
686
687
523
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
688
523
    switch (CC) {
689
479
    case CC_C:
690
479
    case CC_Swift:
691
479
    case CC_X86VectorCall:
692
479
    case CC_IntelOclBicc:
693
479
    case CC_Win64:
694
479
    case CC_PreserveMost:
695
479
    case CC_PreserveAll:
696
479
    case CC_X86RegCall:
697
479
    case CC_OpenCLKernel:
698
479
      return CCCR_OK;
699
479
    default:
700
44
      return CCCR_Warning;
701
523
    }
702
523
  }
703
704
7.67M
  CallingConv getDefaultCallingConv() const override {
705
7.67M
    return CC_C;
706
7.67M
  }
707
708
  // for x32 we need it here explicitly
709
248k
  bool hasInt128Type() const override { return true; }
710
711
7
  unsigned getUnwindWordWidth() const override { return 64; }
712
713
1
  unsigned getRegisterWidth() const override { return 64; }
714
715
  bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
716
27
                                      bool &HasSizeMismatch) const override {
717
27
    // rsp and rbp are the only 64-bit registers the x86 backend can currently
718
27
    // handle.
719
27
    if (RegName.equals("rsp") || 
RegName.equals("rbp")24
) {
720
3
      // Check that the register size is 64-bit.
721
3
      HasSizeMismatch = RegSize != 64;
722
3
      return true;
723
3
    }
724
24
725
24
    // Check if the register is a 32-bit register the backend can handle.
726
24
    return X86TargetInfo::validateGlobalRegisterVariable(RegName, RegSize,
727
24
                                                         HasSizeMismatch);
728
24
  }
729
730
54.2k
  void setMaxAtomicWidth() override {
731
54.2k
    if (hasFeature("cx16"))
732
17.4k
      MaxAtomicInlineWidth = 128;
733
54.2k
  }
734
735
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
736
};
737
738
// x86-64 Windows target
739
class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
740
    : public WindowsTargetInfo<X86_64TargetInfo> {
741
public:
742
  WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
743
521
      : WindowsTargetInfo<X86_64TargetInfo>(Triple, Opts) {
744
521
    LongWidth = LongAlign = 32;
745
521
    DoubleAlign = LongLongAlign = 64;
746
521
    IntMaxType = SignedLongLong;
747
521
    Int64Type = SignedLongLong;
748
521
    SizeType = UnsignedLongLong;
749
521
    PtrDiffType = SignedLongLong;
750
521
    IntPtrType = SignedLongLong;
751
521
  }
752
753
519
  BuiltinVaListKind getBuiltinVaListKind() const override {
754
519
    return TargetInfo::CharPtrBuiltinVaList;
755
519
  }
756
757
303
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
758
303
    switch (CC) {
759
79
    case CC_X86StdCall:
760
79
    case CC_X86ThisCall:
761
79
    case CC_X86FastCall:
762
79
      return CCCR_Ignore;
763
224
    case CC_C:
764
224
    case CC_X86VectorCall:
765
224
    case CC_IntelOclBicc:
766
224
    case CC_PreserveMost:
767
224
    case CC_PreserveAll:
768
224
    case CC_X86_64SysV:
769
224
    case CC_Swift:
770
224
    case CC_X86RegCall:
771
224
    case CC_OpenCLKernel:
772
224
      return CCCR_OK;
773
224
    default:
774
0
      return CCCR_Warning;
775
303
    }
776
303
  }
777
};
778
779
// x86-64 Windows Visual Studio target
780
class LLVM_LIBRARY_VISIBILITY MicrosoftX86_64TargetInfo
781
    : public WindowsX86_64TargetInfo {
782
public:
783
  MicrosoftX86_64TargetInfo(const llvm::Triple &Triple,
784
                            const TargetOptions &Opts)
785
472
      : WindowsX86_64TargetInfo(Triple, Opts) {
786
472
    LongDoubleWidth = LongDoubleAlign = 64;
787
472
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
788
472
  }
clang::targets::MicrosoftX86_64TargetInfo::MicrosoftX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
785
472
      : WindowsX86_64TargetInfo(Triple, Opts) {
786
472
    LongDoubleWidth = LongDoubleAlign = 64;
787
472
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
788
472
  }
Unexecuted instantiation: clang::targets::MicrosoftX86_64TargetInfo::MicrosoftX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
789
790
  void getTargetDefines(const LangOptions &Opts,
791
469
                        MacroBuilder &Builder) const override {
792
469
    WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
793
469
    Builder.defineMacro("_M_X64", "100");
794
469
    Builder.defineMacro("_M_AMD64", "100");
795
469
  }
796
797
  TargetInfo::CallingConvKind
798
2.96k
  getCallingConvKind(bool ClangABICompat4) const override {
799
2.96k
    return CCK_MicrosoftWin64;
800
2.96k
  }
801
};
802
803
// x86-64 MinGW target
804
class LLVM_LIBRARY_VISIBILITY MinGWX86_64TargetInfo
805
    : public WindowsX86_64TargetInfo {
806
public:
807
  MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
808
49
      : WindowsX86_64TargetInfo(Triple, Opts) {
809
49
    // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
810
49
    // with x86 FP ops. Weird.
811
49
    LongDoubleWidth = LongDoubleAlign = 128;
812
49
    LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
813
49
    HasFloat128 = true;
814
49
  }
clang::targets::MinGWX86_64TargetInfo::MinGWX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
808
49
      : WindowsX86_64TargetInfo(Triple, Opts) {
809
49
    // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
810
49
    // with x86 FP ops. Weird.
811
49
    LongDoubleWidth = LongDoubleAlign = 128;
812
49
    LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
813
49
    HasFloat128 = true;
814
49
  }
Unexecuted instantiation: clang::targets::MinGWX86_64TargetInfo::MinGWX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
815
};
816
817
// x86-64 Cygwin target
818
class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
819
public:
820
  CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
821
3
      : X86_64TargetInfo(Triple, Opts) {
822
3
    this->WCharType = TargetInfo::UnsignedShort;
823
3
    TLSSupported = false;
824
3
  }
clang::targets::CygwinX86_64TargetInfo::CygwinX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
821
3
      : X86_64TargetInfo(Triple, Opts) {
822
3
    this->WCharType = TargetInfo::UnsignedShort;
823
3
    TLSSupported = false;
824
3
  }
Unexecuted instantiation: clang::targets::CygwinX86_64TargetInfo::CygwinX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
825
826
  void getTargetDefines(const LangOptions &Opts,
827
3
                        MacroBuilder &Builder) const override {
828
3
    X86_64TargetInfo::getTargetDefines(Opts, Builder);
829
3
    Builder.defineMacro("__x86_64__");
830
3
    Builder.defineMacro("__CYGWIN__");
831
3
    Builder.defineMacro("__CYGWIN64__");
832
3
    addCygMingDefines(Opts, Builder);
833
3
    DefineStd(Builder, "unix", Opts);
834
3
    if (Opts.CPlusPlus)
835
0
      Builder.defineMacro("_GNU_SOURCE");
836
3
  }
837
};
838
839
class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
840
    : public DarwinTargetInfo<X86_64TargetInfo> {
841
public:
842
  DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
843
51.3k
      : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
844
51.3k
    Int64Type = SignedLongLong;
845
51.3k
    // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
846
51.3k
    llvm::Triple T = llvm::Triple(Triple);
847
51.3k
    if (T.isiOS())
848
47
      UseSignedCharForObjCBool = false;
849
51.3k
    resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:"
850
51.3k
                    "16:32:64-S128");
851
51.3k
  }
clang::targets::DarwinX86_64TargetInfo::DarwinX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
843
51.3k
      : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
844
51.3k
    Int64Type = SignedLongLong;
845
51.3k
    // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
846
51.3k
    llvm::Triple T = llvm::Triple(Triple);
847
51.3k
    if (T.isiOS())
848
47
      UseSignedCharForObjCBool = false;
849
51.3k
    resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:"
850
51.3k
                    "16:32:64-S128");
851
51.3k
  }
Unexecuted instantiation: clang::targets::DarwinX86_64TargetInfo::DarwinX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
852
853
  bool handleTargetFeatures(std::vector<std::string> &Features,
854
51.3k
                            DiagnosticsEngine &Diags) override {
855
51.3k
    if (!DarwinTargetInfo<X86_64TargetInfo>::handleTargetFeatures(Features,
856
51.3k
                                                                  Diags))
857
0
      return false;
858
51.3k
    // We now know the features we have: we can decide how to align vectors.
859
51.3k
    MaxVectorAlign =
860
51.3k
        hasFeature("avx512f") ? 
51243
:
hasFeature("avx") 51.2k
?
25625
:
12851.2k
;
861
51.3k
    return true;
862
51.3k
  }
863
};
864
865
class LLVM_LIBRARY_VISIBILITY OpenBSDX86_64TargetInfo
866
    : public OpenBSDTargetInfo<X86_64TargetInfo> {
867
public:
868
  OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
869
3
      : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
870
3
    IntMaxType = SignedLongLong;
871
3
    Int64Type = SignedLongLong;
872
3
  }
clang::targets::OpenBSDX86_64TargetInfo::OpenBSDX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
869
3
      : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
870
3
    IntMaxType = SignedLongLong;
871
3
    Int64Type = SignedLongLong;
872
3
  }
Unexecuted instantiation: clang::targets::OpenBSDX86_64TargetInfo::OpenBSDX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
873
};
874
875
// x86_32 Android target
876
class LLVM_LIBRARY_VISIBILITY AndroidX86_32TargetInfo
877
    : public LinuxTargetInfo<X86_32TargetInfo> {
878
public:
879
  AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
880
3
      : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
881
3
    SuitableAlign = 32;
882
3
    LongDoubleWidth = 64;
883
3
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
884
3
  }
clang::targets::AndroidX86_32TargetInfo::AndroidX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
880
3
      : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
881
3
    SuitableAlign = 32;
882
3
    LongDoubleWidth = 64;
883
3
    LongDoubleFormat = &llvm::APFloat::IEEEdouble();
884
3
  }
Unexecuted instantiation: clang::targets::AndroidX86_32TargetInfo::AndroidX86_32TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
885
};
886
887
// x86_64 Android target
888
class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo
889
    : public LinuxTargetInfo<X86_64TargetInfo> {
890
public:
891
  AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
892
5
      : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
893
5
    LongDoubleFormat = &llvm::APFloat::IEEEquad();
894
5
  }
clang::targets::AndroidX86_64TargetInfo::AndroidX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
892
5
      : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
893
5
    LongDoubleFormat = &llvm::APFloat::IEEEquad();
894
5
  }
Unexecuted instantiation: clang::targets::AndroidX86_64TargetInfo::AndroidX86_64TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
895
};
896
} // namespace targets
897
} // namespace clang
898
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H