clang 22.0.0git
X86.h
Go to the documentation of this file.
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"
20#include "llvm/Support/Compiler.h"
21#include "llvm/TargetParser/Triple.h"
22#include "llvm/TargetParser/X86TargetParser.h"
23#include <optional>
24
25namespace clang {
26namespace targets {
27
28static const unsigned X86AddrSpaceMap[] = {
29 0, // Default
30 0, // opencl_global
31 0, // opencl_local
32 0, // opencl_constant
33 0, // opencl_private
34 0, // opencl_generic
35 0, // opencl_global_device
36 0, // opencl_global_host
37 0, // cuda_device
38 0, // cuda_constant
39 0, // cuda_shared
40 0, // sycl_global
41 0, // sycl_global_device
42 0, // sycl_global_host
43 0, // sycl_local
44 0, // sycl_private
45 270, // ptr32_sptr
46 271, // ptr32_uptr
47 272, // ptr64
48 0, // hlsl_groupshared
49 0, // hlsl_constant
50 0, // hlsl_private
51 0, // hlsl_device
52 0, // hlsl_input
53 // Wasm address space values for this target are dummy values,
54 // as it is only enabled for Wasm targets.
55 20, // wasm_funcref
56};
57
58// X86 target abstract base class; x86-32 and x86-64 are very close, so
59// most of the implementation can be shared.
60class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
61
62 enum X86SSEEnum {
63 NoSSE,
64 SSE1,
65 SSE2,
66 SSE3,
67 SSSE3,
68 SSE41,
69 SSE42,
70 AVX,
71 AVX2,
72 AVX512F
73 } SSELevel = NoSSE;
74 bool HasMMX = false;
75 enum XOPEnum { NoXOP, SSE4A, FMA4, XOP } XOPLevel = NoXOP;
76 enum AddrSpace { ptr32_sptr = 270, ptr32_uptr = 271, ptr64 = 272 };
77
78 bool HasAES = false;
79 bool HasVAES = false;
80 bool HasPCLMUL = false;
81 bool HasVPCLMULQDQ = false;
82 bool HasGFNI = false;
83 bool HasLZCNT = false;
84 bool HasRDRND = false;
85 bool HasFSGSBASE = false;
86 bool HasBMI = false;
87 bool HasBMI2 = false;
88 bool HasPOPCNT = false;
89 bool HasRTM = false;
90 bool HasPRFCHW = false;
91 bool HasRDSEED = false;
92 bool HasADX = false;
93 bool HasTBM = false;
94 bool HasLWP = false;
95 bool HasFMA = false;
96 bool HasF16C = false;
97 bool HasAVX10_1 = false;
98 bool HasAVX10_2 = false;
99 bool HasAVX512CD = false;
100 bool HasAVX512VPOPCNTDQ = false;
101 bool HasAVX512VNNI = false;
102 bool HasAVX512FP16 = false;
103 bool HasAVX512BF16 = false;
104 bool HasAVX512DQ = false;
105 bool HasAVX512BITALG = false;
106 bool HasAVX512BW = false;
107 bool HasAVX512VL = false;
108 bool HasAVX512VBMI = false;
109 bool HasAVX512VBMI2 = false;
110 bool HasAVXIFMA = false;
111 bool HasAVX512IFMA = false;
112 bool HasAVX512VP2INTERSECT = false;
113 bool HasSHA = false;
114 bool HasSHA512 = false;
115 bool HasSHSTK = false;
116 bool HasSM3 = false;
117 bool HasSGX = false;
118 bool HasSM4 = false;
119 bool HasCX8 = false;
120 bool HasCX16 = false;
121 bool HasFXSR = false;
122 bool HasXSAVE = false;
123 bool HasXSAVEOPT = false;
124 bool HasXSAVEC = false;
125 bool HasXSAVES = false;
126 bool HasMWAITX = false;
127 bool HasCLZERO = false;
128 bool HasCLDEMOTE = false;
129 bool HasPCONFIG = false;
130 bool HasPKU = false;
131 bool HasCLFLUSHOPT = false;
132 bool HasCLWB = false;
133 bool HasMOVBE = false;
134 bool HasMOVRS = false;
135 bool HasPREFETCHI = false;
136 bool HasRDPID = false;
137 bool HasRDPRU = false;
138 bool HasRetpolineExternalThunk = false;
139 bool HasLAHFSAHF = false;
140 bool HasWBNOINVD = false;
141 bool HasWAITPKG = false;
142 bool HasMOVDIRI = false;
143 bool HasMOVDIR64B = false;
144 bool HasPTWRITE = false;
145 bool HasINVPCID = false;
146 bool HasENQCMD = false;
147 bool HasAVXVNNIINT16 = false;
148 bool HasAMXFP16 = false;
149 bool HasCMPCCXADD = false;
150 bool HasRAOINT = false;
151 bool HasAVXVNNIINT8 = false;
152 bool HasAVXNECONVERT = false;
153 bool HasKL = false; // For key locker
154 bool HasWIDEKL = false; // For wide key locker
155 bool HasHRESET = false;
156 bool HasAVXVNNI = false;
157 bool HasAMXTILE = false;
158 bool HasAMXINT8 = false;
159 bool HasAMXBF16 = false;
160 bool HasAMXCOMPLEX = false;
161 bool HasAMXFP8 = false;
162 bool HasAMXMOVRS = false;
163 bool HasAMXAVX512 = false;
164 bool HasAMXTF32 = false;
165 bool HasSERIALIZE = false;
166 bool HasTSXLDTRK = false;
167 bool HasUSERMSR = false;
168 bool HasUINTR = false;
169 bool HasCRC32 = false;
170 bool HasX87 = false;
171 bool HasEGPR = false;
172 bool HasPush2Pop2 = false;
173 bool HasPPX = false;
174 bool HasNDD = false;
175 bool HasCCMP = false;
176 bool HasNF = false;
177 bool HasCF = false;
178 bool HasZU = false;
179 bool HasInlineAsmUseGPR32 = false;
180 bool HasBranchHint = false;
181
182protected:
183 llvm::X86::CPUKind CPU = llvm::X86::CK_None;
184
185 enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
186
187public:
188 X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
189 : TargetInfo(Triple) {
191 BFloat16Format = &llvm::APFloat::BFloat();
192 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
194 HasStrictFP = true;
195 HasUnalignedAccess = true;
196
197 bool IsWinCOFF =
198 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
199 if (IsWinCOFF)
201 }
202
203 const char *getLongDoubleMangling() const override {
204 return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? "g" : "e";
205 }
206
208 // X87 evaluates with 80 bits "long double" precision.
209 return SSELevel == NoSSE ? LangOptions::FPEvalMethodKind::FEM_Extended
211 }
212
213 // EvalMethod `source` is not supported for targets with `NoSSE` feature.
214 bool supportSourceEvalMethod() const override { return SSELevel > NoSSE; }
215
216 ArrayRef<const char *> getGCCRegNames() const override;
217
219 return {};
220 }
221
222 ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
223
224 bool isSPRegName(StringRef RegName) const override {
225 return RegName == "esp" || RegName == "rsp";
226 }
227
228 bool supportsCpuSupports() const override { return true; }
229 bool supportsCpuIs() const override { return true; }
230 bool supportsCpuInit() const override { return true; }
231
232 bool validateCpuSupports(StringRef FeatureStr) const override;
233
234 bool validateCpuIs(StringRef FeatureStr) const override;
235
236 bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
237
238 char CPUSpecificManglingCharacter(StringRef Name) const override;
239
240 void getCPUSpecificCPUDispatchFeatures(
241 StringRef Name,
242 llvm::SmallVectorImpl<StringRef> &Features) const override;
243
244 std::optional<unsigned> getCPUCacheLineSize() const override;
245
246 bool validateAsmConstraint(const char *&Name,
247 TargetInfo::ConstraintInfo &info) const override;
248
249 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
250 bool &HasSizeMismatch) const override {
251 // esp and ebp are the only 32-bit registers the x86 backend can currently
252 // handle.
253 if (RegName == "esp" || RegName == "ebp") {
254 // Check that the register size is 32-bit.
255 HasSizeMismatch = RegSize != 32;
256 return true;
257 }
258
259 return false;
260 }
261
262 bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
263 StringRef Constraint, unsigned Size) const override;
264
265 bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
266 StringRef Constraint, unsigned Size) const override;
267
268 bool
270 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
271 return true;
273 };
274
275 bool
277 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
278 return true;
280 };
281
282 virtual bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
283 StringRef Constraint, unsigned Size) const;
284
285 std::string convertConstraint(const char *&Constraint) const override;
286 std::string_view getClobbers() const override {
287 return "~{dirflag},~{fpsr},~{flags}";
288 }
289
290 StringRef getConstraintRegister(StringRef Constraint,
291 StringRef Expression) const override {
292 StringRef::iterator I, E;
293 for (I = Constraint.begin(), E = Constraint.end(); I != E; ++I) {
294 if (isalpha(*I) || *I == '@')
295 break;
296 }
297 if (I == E)
298 return "";
299 switch (*I) {
300 // For the register constraints, return the matching register name
301 case 'a':
302 return "ax";
303 case 'b':
304 return "bx";
305 case 'c':
306 return "cx";
307 case 'd':
308 return "dx";
309 case 'S':
310 return "si";
311 case 'D':
312 return "di";
313 // In case the constraint is 'r' we need to return Expression
314 case 'r':
315 return Expression;
316 // Double letters Y<x> constraints
317 case 'Y':
318 if ((++I != E) && ((*I == '0') || (*I == 'z')))
319 return "xmm0";
320 break;
321 default:
322 break;
323 }
324 return "";
325 }
326
327 bool useFP16ConversionIntrinsics() const override {
328 return false;
329 }
330
331 void getTargetDefines(const LangOptions &Opts,
332 MacroBuilder &Builder) const override;
333
334 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
335 bool Enabled) const final;
336
337 bool
338 initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
339 StringRef CPU,
340 const std::vector<std::string> &FeaturesVec) const override;
341
342 bool isValidFeatureName(StringRef Name) const override;
343
344 bool hasFeature(StringRef Feature) const final;
345
346 bool handleTargetFeatures(std::vector<std::string> &Features,
347 DiagnosticsEngine &Diags) override;
348
349 StringRef getABI() const override {
350 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
351 return "avx512";
352 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
353 return "avx";
354 if (getTriple().getArch() == llvm::Triple::x86 && !HasMMX)
355 return "no-mmx";
356 return "";
357 }
358
359 bool supportsTargetAttributeTune() const override {
360 return true;
361 }
362
363 bool isValidCPUName(StringRef Name) const override {
364 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
365 return llvm::X86::parseArchX86(Name, Only64Bit) != llvm::X86::CK_None;
366 }
367
368 bool isValidTuneCPUName(StringRef Name) const override {
369 if (Name == "generic")
370 return true;
371
372 // Allow 32-bit only CPUs regardless of 64-bit mode unlike isValidCPUName.
373 // NOTE: gcc rejects 32-bit mtune CPUs in 64-bit mode. But being lenient
374 // since mtune was ignored by clang for so long.
375 return llvm::X86::parseTuneCPU(Name) != llvm::X86::CK_None;
376 }
377
378 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
379 void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values) const override;
380
381 bool setCPU(const std::string &Name) override {
382 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
383 CPU = llvm::X86::parseArchX86(Name, Only64Bit);
384 return CPU != llvm::X86::CK_None;
385 }
386
387 llvm::APInt getFMVPriority(ArrayRef<StringRef> Features) const override;
388
389 bool setFPMath(StringRef Name) override;
390
391 bool supportsExtendIntArgs() const override {
392 return getTriple().getArch() != llvm::Triple::x86;
393 }
394
396 // Most of the non-ARM calling conventions are i386 conventions.
397 switch (CC) {
398 case CC_X86ThisCall:
399 case CC_X86FastCall:
400 case CC_X86StdCall:
401 case CC_X86VectorCall:
402 case CC_X86RegCall:
403 case CC_C:
404 case CC_PreserveMost:
405 case CC_Swift:
406 case CC_X86Pascal:
407 case CC_IntelOclBicc:
408 return CCCR_OK;
409 case CC_SwiftAsync:
410 return CCCR_Error;
411 case CC_DeviceKernel:
412 return IsOpenCL ? CCCR_OK : CCCR_Warning;
413 default:
414 return CCCR_Warning;
415 }
416 }
417
418 bool checkArithmeticFenceSupported() const override { return true; }
419
421 return CC_C;
422 }
423
424 bool hasSjLjLowering() const override { return true; }
425
427
428 uint64_t getPointerWidthV(LangAS AS) const override {
429 unsigned TargetAddrSpace = getTargetAddressSpace(AS);
430 if (TargetAddrSpace == ptr32_sptr || TargetAddrSpace == ptr32_uptr)
431 return 32;
432 if (TargetAddrSpace == ptr64)
433 return 64;
434 return PointerWidth;
435 }
436
437 uint64_t getPointerAlignV(LangAS AddrSpace) const override {
438 return getPointerWidthV(AddrSpace);
439 }
441 const TargetInfo *Aux) override {
442 TargetInfo::adjust(Diags, Opts, Aux);
443 IsOpenCL = Opts.OpenCL;
444 }
445
446private:
447 bool IsOpenCL = false;
448};
449
450// X86-32 generic target
451class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
452public:
453 X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
454 : X86TargetInfo(Triple, Opts) {
456 LongDoubleWidth = 96;
457 LongDoubleAlign = 32;
458 SuitableAlign = 128;
459 resetDataLayout(Triple.isOSBinFormatMachO()
460 ? "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:"
461 "128-f64:32:64-f80:32-n8:16:32-S128"
462 : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:"
463 "128-f64:32:64-f80:32-n8:16:32-S128",
464 Triple.isOSBinFormatMachO() ? "_" : "");
468 RegParmMax = 3;
469
470 // Use fpret for all types.
474
475 // x86-32 has atomics up to 8 bytes
478 }
479
483
484 int getEHDataRegisterNumber(unsigned RegNo) const override {
485 if (RegNo == 0)
486 return 0;
487 if (RegNo == 1)
488 return 2;
489 return -1;
490 }
491
492 bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
493 StringRef Constraint, unsigned Size) const override {
494 switch (Constraint[0]) {
495 default:
496 break;
497 case 'R':
498 case 'q':
499 case 'Q':
500 case 'a':
501 case 'b':
502 case 'c':
503 case 'd':
504 case 'S':
505 case 'D':
506 return Size <= 32;
507 case 'A':
508 return Size <= 64;
509 }
510
511 return X86TargetInfo::validateOperandSize(FeatureMap, Constraint, Size);
512 }
513
514 void setMaxAtomicWidth() override {
515 if (hasFeature("cx8"))
517 }
518
519 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
520
521 bool hasBitIntType() const override { return true; }
522 size_t getMaxBitIntWidth() const override {
523 return llvm::IntegerType::MAX_INT_BITS;
524 }
525};
526
527class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
528 : public NetBSDTargetInfo<X86_32TargetInfo> {
529public:
530 NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
531 : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
532};
533
534class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
535 : public OpenBSDTargetInfo<X86_32TargetInfo> {
536public:
537 OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
538 : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
542 }
543};
544
545class LLVM_LIBRARY_VISIBILITY AppleMachOI386TargetInfo
546 : public AppleMachOTargetInfo<X86_32TargetInfo> {
547public:
548 AppleMachOI386TargetInfo(const llvm::Triple &Triple,
549 const TargetOptions &Opts)
550 : AppleMachOTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
551};
552
553class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
554 : public DarwinTargetInfo<X86_32TargetInfo> {
555public:
556 DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
557 : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
558 LongDoubleWidth = 128;
559 LongDoubleAlign = 128;
560 SuitableAlign = 128;
561 MaxVectorAlign = 256;
562 // The watchOS simulator uses the builtin bool type for Objective-C.
563 llvm::Triple T = llvm::Triple(Triple);
564 if (T.isWatchOS())
566 SizeType = UnsignedLong;
568 resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-"
569 "f64:32:64-f80:128-n8:16:32-S128",
570 "_");
572 }
573
574 bool handleTargetFeatures(std::vector<std::string> &Features,
575 DiagnosticsEngine &Diags) override {
577 Diags))
578 return false;
579 // We now know the features we have: we can decide how to align vectors.
581 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
582 return true;
583 }
584};
585
586// x86-32 Windows target
587class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
588 : public WindowsTargetInfo<X86_32TargetInfo> {
589public:
590 WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
591 : WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
593 bool IsWinCOFF =
594 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
595 bool IsMSVC = getTriple().isWindowsMSVCEnvironment();
596 std::string Layout = IsWinCOFF ? "e-m:x" : "e-m:e";
597 Layout += "-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-";
598 Layout += IsMSVC ? "f80:128" : "f80:32";
599 Layout += "-n8:16:32-a:0:32-S32";
600 resetDataLayout(Layout, IsWinCOFF ? "_" : "");
601 }
602};
603
604// x86-32 Windows Visual Studio target
605class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32TargetInfo
606 : public WindowsX86_32TargetInfo {
607public:
608 MicrosoftX86_32TargetInfo(const llvm::Triple &Triple,
609 const TargetOptions &Opts)
610 : WindowsX86_32TargetInfo(Triple, Opts) {
612 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
613 }
614
616 MacroBuilder &Builder) const override {
618 // The value of the following reflects processor type.
619 // 300=386, 400=486, 500=Pentium, 600=Blend (default)
620 // We lost the original triple, so we use the default.
621 Builder.defineMacro("_M_IX86", "600");
622 }
623};
624
625// x86-32 MinGW target
626class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
627 : public WindowsX86_32TargetInfo {
628public:
629 MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
630 : WindowsX86_32TargetInfo(Triple, Opts) {
631 HasFloat128 = true;
632 }
633
635 MacroBuilder &Builder) const override {
637 Builder.defineMacro("_X86_");
638 }
639};
640
641// x86-32 Cygwin target
642class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
643public:
644 CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
645 : X86_32TargetInfo(Triple, Opts) {
648 this->UseMicrosoftManglingForC = true;
650 resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-"
651 "i128:128-f80:32-n8:16:32-a:0:32-S32",
652 "_");
653 }
654
656 MacroBuilder &Builder) const override {
658 Builder.defineMacro("_X86_");
659 Builder.defineMacro("__CYGWIN__");
660 Builder.defineMacro("__CYGWIN32__");
661 addCygMingDefines(Opts, Builder);
662 DefineStd(Builder, "unix", Opts);
663 if (Opts.CPlusPlus)
664 Builder.defineMacro("_GNU_SOURCE");
665 }
666};
667
668// x86-32 Haiku target
669class LLVM_LIBRARY_VISIBILITY HaikuX86_32TargetInfo
670 : public HaikuTargetInfo<X86_32TargetInfo> {
671public:
672 HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
673 : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
674
676 MacroBuilder &Builder) const override {
678 Builder.defineMacro("__INTEL__");
679 }
680};
681
682// X86-32 MCU target
683class LLVM_LIBRARY_VISIBILITY MCUX86_32TargetInfo : public X86_32TargetInfo {
684public:
685 MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
686 : X86_32TargetInfo(Triple, Opts) {
687 LongDoubleWidth = 64;
689 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
690 resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-"
691 "f64:32-f128:32-n8:16:32-a:0:32-S32");
693 }
694
696 // On MCU we support only C calling convention.
697 return CC == CC_C ? CCCR_OK : CCCR_Warning;
698 }
699
701 MacroBuilder &Builder) const override {
703 Builder.defineMacro("__iamcu");
704 Builder.defineMacro("__iamcu__");
705 }
706
707 bool allowsLargerPreferedTypeAlignment() const override { return false; }
708};
709
710// x86-32 RTEMS target
711class LLVM_LIBRARY_VISIBILITY RTEMSX86_32TargetInfo : public X86_32TargetInfo {
712public:
713 RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
714 : X86_32TargetInfo(Triple, Opts) {
718 }
719
721 MacroBuilder &Builder) const override {
723 Builder.defineMacro("__INTEL__");
724 Builder.defineMacro("__rtems__");
725 }
726};
727
728// x86-64 generic target
729class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
730public:
731 X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
732 : X86TargetInfo(Triple, Opts) {
733 const bool IsX32 = getTriple().isX32();
734 bool IsWinCOFF =
735 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
736 LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
737 LongDoubleWidth = 128;
738 LongDoubleAlign = 128;
739 LargeArrayMinWidth = 128;
740 LargeArrayAlign = 128;
741 SuitableAlign = 128;
743 PtrDiffType = IsX32 ? SignedInt : SignedLong;
744 IntPtrType = IsX32 ? SignedInt : SignedLong;
747 RegParmMax = 6;
748
749 // Pointers are 32-bit in x32.
750 resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-"
751 "i64:64-i128:128-f80:128-n8:16:32:64-S128"
752 : IsWinCOFF ? "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:"
753 "64-i128:128-f80:128-n8:16:32:64-S128"
754 : "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:"
755 "64-i128:128-f80:128-n8:16:32:64-S128");
756
757 // Use fpret only for long double.
759
760 // Use fp2ret for _Complex long double.
762
763 // Make __builtin_ms_va_list available.
764 HasBuiltinMSVaList = true;
765
766 // x86-64 has atomics up to 16 bytes.
769 }
770
774
775 int getEHDataRegisterNumber(unsigned RegNo) const override {
776 if (RegNo == 0)
777 return 0;
778 if (RegNo == 1)
779 return 1;
780 return -1;
781 }
782
784 switch (CC) {
785 case CC_C:
786 case CC_Swift:
787 case CC_SwiftAsync:
788 case CC_X86VectorCall:
789 case CC_IntelOclBicc:
790 case CC_Win64:
791 case CC_PreserveMost:
792 case CC_PreserveAll:
793 case CC_PreserveNone:
794 case CC_X86RegCall:
795 return CCCR_OK;
796 case CC_DeviceKernel:
797 return IsOpenCL ? CCCR_OK : CCCR_Warning;
798 default:
799 return CCCR_Warning;
800 }
801 }
802
804 return CC_C;
805 }
806
807 // for x32 we need it here explicitly
808 bool hasInt128Type() const override { return true; }
809
810 unsigned getUnwindWordWidth() const override { return 64; }
811
812 unsigned getRegisterWidth() const override { return 64; }
813
814 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
815 bool &HasSizeMismatch) const override {
816 // rsp and rbp are the only 64-bit registers the x86 backend can currently
817 // handle.
818 if (RegName == "rsp" || RegName == "rbp") {
819 // Check that the register size is 64-bit.
820 HasSizeMismatch = RegSize != 64;
821 return true;
822 }
823
824 // Check if the register is a 32-bit register the backend can handle.
825 return X86TargetInfo::validateGlobalRegisterVariable(RegName, RegSize,
826 HasSizeMismatch);
827 }
828 void setMaxAtomicWidth() override {
829 if (hasFeature("cx16"))
831 }
832
833 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
834
835 bool hasBitIntType() const override { return true; }
836 size_t getMaxBitIntWidth() const override {
837 return llvm::IntegerType::MAX_INT_BITS;
838 }
839
841 const TargetInfo *Aux) override {
842 TargetInfo::adjust(Diags, Opts, Aux);
843 IsOpenCL = Opts.OpenCL;
844 }
845
846private:
847 bool IsOpenCL = false;
848};
849
850// x86-64 UEFI target
851class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
852 : public UEFITargetInfo<X86_64TargetInfo> {
853public:
854 UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
855 : UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
856 // The UEFI spec does not mandate specific C++ ABI, integer widths, or
857 // alignment. We are setting these defaults to match the Windows target as
858 // it is the only way to build EFI applications with Clang/LLVM today. We
859 // intend to offer flexibility by supporting choices that are not default in
860 // Windows target in the future.
861 this->TheCXXABI.set(TargetCXXABI::Microsoft);
862 LongWidth = LongAlign = 32;
865 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
873 this->resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-"
874 "i64:64-i128:128-f80:128-n8:16:32:64-S128");
875 }
876
880
882 switch (CC) {
883 case CC_C:
884 case CC_Win64:
885 case CC_X86_64SysV:
886 return CCCR_OK;
887 default:
888 return CCCR_Warning;
889 }
890 }
891
893 getCallingConvKind(bool ClangABICompat4) const override {
894 return CCK_MicrosoftWin64;
895 }
896};
897
898// x86-64 Windows target
899class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
900 : public WindowsTargetInfo<X86_64TargetInfo> {
901public:
912
916
918 switch (CC) {
919 case CC_X86StdCall:
920 case CC_X86ThisCall:
921 case CC_X86FastCall:
922 return CCCR_Ignore;
923 case CC_C:
924 case CC_X86VectorCall:
925 case CC_IntelOclBicc:
926 case CC_PreserveMost:
927 case CC_PreserveAll:
928 case CC_PreserveNone:
929 case CC_X86_64SysV:
930 case CC_Swift:
931 case CC_SwiftAsync:
932 case CC_X86RegCall:
933 case CC_DeviceKernel:
934 return CCCR_OK;
935 default:
936 return CCCR_Warning;
937 }
938 }
939};
940
941// x86-64 Windows Visual Studio target
942class LLVM_LIBRARY_VISIBILITY MicrosoftX86_64TargetInfo
943 : public WindowsX86_64TargetInfo {
944public:
945 MicrosoftX86_64TargetInfo(const llvm::Triple &Triple,
946 const TargetOptions &Opts)
947 : WindowsX86_64TargetInfo(Triple, Opts) {
949 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
950 }
951
953 MacroBuilder &Builder) const override {
955 Builder.defineMacro("_M_X64", "100");
956 Builder.defineMacro("_M_AMD64", "100");
957 }
958
960 getCallingConvKind(bool ClangABICompat4) const override {
961 return CCK_MicrosoftWin64;
962 }
963};
964
965// x86-64 MinGW target
966class LLVM_LIBRARY_VISIBILITY MinGWX86_64TargetInfo
967 : public WindowsX86_64TargetInfo {
968public:
969 MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
970 : WindowsX86_64TargetInfo(Triple, Opts) {
971 // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
972 // with x86 FP ops. Weird.
974 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
975 HasFloat128 = true;
976 }
977};
978
979// x86-64 Cygwin target
980class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
981public:
982 CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
983 : X86_64TargetInfo(Triple, Opts) {
986 this->UseMicrosoftManglingForC = true;
987 }
988
990 MacroBuilder &Builder) const override {
992 Builder.defineMacro("__x86_64__");
993 Builder.defineMacro("__CYGWIN__");
994 Builder.defineMacro("__CYGWIN64__");
995 addCygMingDefines(Opts, Builder);
996 DefineStd(Builder, "unix", Opts);
997 if (Opts.CPlusPlus)
998 Builder.defineMacro("_GNU_SOURCE");
999 }
1000
1002 switch (CC) {
1003 case CC_X86StdCall:
1004 case CC_X86ThisCall:
1005 case CC_X86FastCall:
1006 return CCCR_Ignore;
1007 case CC_C:
1008 case CC_X86VectorCall:
1009 case CC_IntelOclBicc:
1010 case CC_PreserveMost:
1011 case CC_PreserveAll:
1012 case CC_PreserveNone:
1013 case CC_X86_64SysV:
1014 case CC_Swift:
1015 case CC_SwiftAsync:
1016 case CC_X86RegCall:
1017 case CC_DeviceKernel:
1018 return CCCR_OK;
1019 default:
1020 return CCCR_Warning;
1021 }
1022 }
1023
1027};
1028
1029class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
1030 : public DarwinTargetInfo<X86_64TargetInfo> {
1031public:
1032 DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1033 : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1035 // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
1036 llvm::Triple T = llvm::Triple(Triple);
1037 if (T.isiOS())
1039 resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
1040 "f80:128-n8:16:32:64-S128",
1041 "_");
1042 }
1043
1044 bool handleTargetFeatures(std::vector<std::string> &Features,
1045 DiagnosticsEngine &Diags) override {
1047 Diags))
1048 return false;
1049 // We now know the features we have: we can decide how to align vectors.
1051 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
1052 return true;
1053 }
1054};
1055
1056class LLVM_LIBRARY_VISIBILITY OpenBSDX86_64TargetInfo
1057 : public OpenBSDTargetInfo<X86_64TargetInfo> {
1058public:
1059 OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1060 : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1063 }
1064};
1065
1066// x86_32 Android target
1067class LLVM_LIBRARY_VISIBILITY AndroidX86_32TargetInfo
1068 : public LinuxTargetInfo<X86_32TargetInfo> {
1069public:
1070 AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1071 : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1072 SuitableAlign = 32;
1073 LongDoubleWidth = 64;
1074 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1075 }
1076};
1077
1078// x86_64 Android target
1079class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo
1080 : public LinuxTargetInfo<X86_64TargetInfo> {
1081public:
1082 AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1083 : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1084 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1085 }
1086};
1087
1088// x86_32 OHOS target
1089class LLVM_LIBRARY_VISIBILITY OHOSX86_32TargetInfo
1090 : public OHOSTargetInfo<X86_32TargetInfo> {
1091public:
1092 OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1093 : OHOSTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1094 SuitableAlign = 32;
1095 LongDoubleWidth = 64;
1096 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1097 }
1098};
1099
1100// x86_64 OHOS target
1101class LLVM_LIBRARY_VISIBILITY OHOSX86_64TargetInfo
1102 : public OHOSTargetInfo<X86_64TargetInfo> {
1103public:
1104 OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1105 : OHOSTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1106 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1107 }
1108};
1109} // namespace targets
1110} // namespace clang
1111#endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
static llvm::APInt getFMVPriority(const TargetInfo &TI, const CodeGenFunction::FMVResolverOption &RO)
static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target)
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Definition Module.cpp:95
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:232
FPEvalMethodKind
Possible float expression evaluation method choices.
@ FEM_Extended
Use extended type for fp arithmetic.
@ FEM_Source
Use the declared type for fp arithmetic.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetInfo(const llvm::Triple &T)
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection return.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
const LangASMap * AddrSpaceMap
Definition TargetInfo.h:259
void resetDataLayout(StringRef DL, const char *UserLabelPrefix="")
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition TargetInfo.h:331
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
Definition TargetInfo.h:333
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
Definition TargetInfo.h:349
unsigned char RegParmMax
Definition TargetInfo.h:256
bool UseMicrosoftManglingForC
Definition TargetInfo.h:258
virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const =0
===-— Other target property query methods -----------------------—===//
unsigned HasUnalignedAccess
Definition TargetInfo.h:284
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux)
Set forced language options.
unsigned char MaxAtomicPromoteWidth
Definition TargetInfo.h:252
unsigned RealTypeUsesObjCFPRetMask
Definition TargetInfo.h:267
virtual void supportAllOpenCLOpts(bool V=true)
unsigned ComplexLongDoubleUsesFP2Ret
Definition TargetInfo.h:269
unsigned getTargetAddressSpace(LangAS AS) const
unsigned HasAlignMac68kSupport
Definition TargetInfo.h:265
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
unsigned char MaxAtomicInlineWidth
Definition TargetInfo.h:252
TargetCXXABI TheCXXABI
Definition TargetInfo.h:257
unsigned HasBuiltinMSVaList
Definition TargetInfo.h:272
Options for controlling the target.
AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1070
AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1082
AppleMachOI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:548
AppleMachOTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:54
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:655
CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:644
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:1024
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:989
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:1001
CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:982
DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:556
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
Definition X86.h:574
DarwinTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:78
DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1032
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
Definition X86.h:1044
HaikuTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:298
HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:672
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:675
LinuxTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:384
MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:685
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition X86.h:707
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:700
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:695
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:615
MicrosoftX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:608
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:952
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:960
MicrosoftX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:945
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:634
MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:629
MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:969
NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:530
NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:465
OHOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:1042
OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1092
OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1104
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
Definition OSTargets.h:30
OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:537
OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:499
OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1059
RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:713
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:720
UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:861
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:854
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:877
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:881
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:893
WindowsTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:882
WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:590
WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:902
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:913
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:917
bool isSPRegName(StringRef RegName) const override
Definition X86.h:224
bool isValidTuneCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name for tuning.
Definition X86.h:368
bool supportsCpuSupports() const override
Definition X86.h:228
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
Definition X86.h:363
bool setCPU(const std::string &Name) override
Target the specified CPU.
Definition X86.h:381
X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition X86.h:188
bool supportsExtendIntArgs() const override
Whether the option -fextend-arguments={32,64} is supported on the target.
Definition X86.h:391
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:420
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Definition X86.h:327
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm....
Definition X86.h:424
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:395
bool supportsCpuIs() const override
Definition X86.h:229
bool supportsCpuInit() const override
Definition X86.h:230
bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection branch.
Definition X86.h:276
StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const override
Extracts a register from the passed constraint (if it is a single-register constraint) and the asm la...
Definition X86.h:290
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition X86.h:286
bool supportSourceEvalMethod() const override
Definition X86.h:214
bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection return.
Definition X86.h:269
LangOptions::FPEvalMethodKind getFPEvalMethod() const override
Return the value for the C99 FLT_EVAL_METHOD macro.
Definition X86.h:207
uint64_t getPointerWidthV(LangAS AS) const override
Definition X86.h:428
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
Definition X86.h:426
bool supportsTargetAttributeTune() const override
Determine whether this TargetInfo supports tune in target attribute.
Definition X86.h:359
const char * getLongDoubleMangling() const override
Return the mangled code of long double.
Definition X86.h:203
virtual bool validateOperandSize(const llvm::StringMap< bool > &FeatureMap, StringRef Constraint, unsigned Size) const
Definition X86.cpp:1677
bool checkArithmeticFenceSupported() const override
Controls if __arithmetic_fence is supported in the targeted backend.
Definition X86.h:418
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:440
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:249
StringRef getABI() const override
Get the ABI currently in use.
Definition X86.h:349
llvm::X86::CPUKind CPU
Definition X86.h:183
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition X86.h:218
uint64_t getPointerAlignV(LangAS AddrSpace) const override
Definition X86.h:437
X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:453
size_t getMaxBitIntWidth() const override
Definition X86.h:522
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:514
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:484
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:521
bool validateOperandSize(const llvm::StringMap< bool > &FeatureMap, StringRef Constraint, unsigned Size) const override
Definition X86.h:492
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:480
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:814
bool hasInt128Type() const override
Determine whether the __int128 type is supported on this target.
Definition X86.h:808
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:783
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:803
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:835
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:775
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:828
size_t getMaxBitIntWidth() const override
Definition X86.h:836
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:771
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:731
unsigned getUnwindWordWidth() const override
Definition X86.h:810
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:840
unsigned getRegisterWidth() const override
Return the "preferred" register width on this target.
Definition X86.h:812
Defines the clang::TargetInfo interface.
static const unsigned X86AddrSpaceMap[]
Definition X86.h:28
LLVM_LIBRARY_VISIBILITY void addCygMingDefines(const clang::LangOptions &Opts, clang::MacroBuilder &Builder)
Definition Targets.cpp:82
LLVM_LIBRARY_VISIBILITY void DefineStd(clang::MacroBuilder &Builder, llvm::StringRef MacroName, const clang::LangOptions &Opts)
Define a macro name and standard variants.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
LangAS
Defines the address space values used by the address space qualifier of QualType.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition Specifiers.h:278
@ CC_X86Pascal
Definition Specifiers.h:284
@ CC_Swift
Definition Specifiers.h:293
@ CC_IntelOclBicc
Definition Specifiers.h:290
@ CC_PreserveMost
Definition Specifiers.h:295
@ CC_Win64
Definition Specifiers.h:285
@ CC_X86ThisCall
Definition Specifiers.h:282
@ CC_DeviceKernel
Definition Specifiers.h:292
@ CC_PreserveNone
Definition Specifiers.h:300
@ CC_SwiftAsync
Definition Specifiers.h:294
@ CC_X86RegCall
Definition Specifiers.h:287
@ CC_X86VectorCall
Definition Specifiers.h:283
@ CC_X86StdCall
Definition Specifiers.h:280
@ CC_X86_64SysV
Definition Specifiers.h:286
@ CC_PreserveAll
Definition Specifiers.h:296
@ CC_X86FastCall
Definition Specifiers.h:281
const llvm::fltSemantics * LongDoubleFormat
Definition TargetInfo.h:143
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
Definition TargetInfo.h:170
const llvm::fltSemantics * BFloat16Format
Definition TargetInfo.h:142
unsigned char DefaultAlignForAttributeAligned
Definition TargetInfo.h:134