Coverage Report

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