Coverage Report

Created: 2019-07-24 05:18

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