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