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