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