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 HasSERIALIZE = false;
145 bool HasTSXLDTRK = false;
146 bool HasUSERMSR = false;
147 bool HasUINTR = false;
148 bool HasCRC32 = false;
149 bool HasX87 = false;
150 bool HasEGPR = false;
151 bool HasPush2Pop2 = false;
152 bool HasPPX = false;
153 bool HasNDD = false;
154 bool HasCCMP = false;
155 bool HasNF = false;
156 bool HasCF = false;
157 bool HasZU = false;
158 bool HasJMPABS = false;
159 bool HasInlineAsmUseGPR32 = false;
160 bool HasBranchHint = false;
161
162protected:
163 llvm::X86::CPUKind CPU = llvm::X86::CK_None;
164
165 enum FPMathKind { FP_Default, FP_SSE, FP_387 } FPMath = FP_Default;
166
167public:
168 X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
169 : TargetInfo(Triple) {
171 BFloat16Format = &llvm::APFloat::BFloat();
172 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
174 HasStrictFP = true;
175 HasUnalignedAccess = true;
176
177 bool IsWinCOFF =
178 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
179 if (IsWinCOFF)
181 }
182
183 const char *getLongDoubleMangling() const override {
184 return LongDoubleFormat == &llvm::APFloat::IEEEquad() ? "g" : "e";
185 }
186
188 // X87 evaluates with 80 bits "long double" precision.
189 return SSELevel == NoSSE ? LangOptions::FPEvalMethodKind::FEM_Extended
191 }
192
193 // EvalMethod `source` is not supported for targets with `NoSSE` feature.
194 bool supportSourceEvalMethod() const override { return SSELevel > NoSSE; }
195
196 ArrayRef<const char *> getGCCRegNames() const override;
197
199 return {};
200 }
201
202 ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override;
203
204 bool isSPRegName(StringRef RegName) const override {
205 return RegName == "esp" || RegName == "rsp";
206 }
207
208 bool supportsCpuSupports() const override { return true; }
209 bool supportsCpuIs() const override { return true; }
210 bool supportsCpuInit() const override { return true; }
211
212 bool validateCpuSupports(StringRef FeatureStr) const override;
213
214 bool validateCpuIs(StringRef FeatureStr) const override;
215
216 bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
217
218 char CPUSpecificManglingCharacter(StringRef Name) const override;
219
220 void getCPUSpecificCPUDispatchFeatures(
221 StringRef Name,
222 llvm::SmallVectorImpl<StringRef> &Features) const override;
223
224 std::optional<unsigned> getCPUCacheLineSize() const override;
225
226 bool validateAsmConstraint(const char *&Name,
227 TargetInfo::ConstraintInfo &info) const override;
228
229 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
230 bool &HasSizeMismatch) const override {
231 // esp and ebp are the only 32-bit registers the x86 backend can currently
232 // handle.
233 if (RegName == "esp" || RegName == "ebp") {
234 // Check that the register size is 32-bit.
235 HasSizeMismatch = RegSize != 32;
236 return true;
237 }
238 if (RegName.ends_with("di")) {
239 if (getTargetOpts().FeatureMap.lookup("reserve-edi")) {
240 if (RegName == "edi") {
241 HasSizeMismatch = RegSize != 32;
242 } else if (RegName == "di") {
243 HasSizeMismatch = RegSize != 16;
244 }
245 return true;
246 }
247 }
248
249 return false;
250 }
251
252 bool validateLocalRegisterVariable(StringRef RegName) const override {
253 return !llvm::is_contained(
254 {"argp", "flags", "fpcr", "fpsr", "dirflag", "frame"}, RegName);
255 }
256
257 bool validateOutputSize(const llvm::StringMap<bool> &FeatureMap,
258 StringRef Constraint, unsigned Size) const override;
259
260 bool validateInputSize(const llvm::StringMap<bool> &FeatureMap,
261 StringRef Constraint, unsigned Size) const override;
262
263 bool
265 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
266 return true;
268 };
269
270 bool
272 if (CPU == llvm::X86::CK_None || CPU >= llvm::X86::CK_PentiumPro)
273 return true;
275 };
276
277 virtual bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
278 StringRef Constraint, unsigned Size) const;
279
280 std::string convertConstraint(const char *&Constraint) const override;
281 std::string_view getClobbers() const override {
282 return "~{dirflag},~{fpsr},~{flags}";
283 }
284
285 StringRef getConstraintRegister(StringRef Constraint,
286 StringRef Expression) const override {
287 StringRef::iterator I, E;
288 for (I = Constraint.begin(), E = Constraint.end(); I != E; ++I) {
289 if (isalpha(*I) || *I == '@')
290 break;
291 }
292 if (I == E)
293 return "";
294 switch (*I) {
295 // For the register constraints, return the matching register name
296 case 'a':
297 return "ax";
298 case 'b':
299 return "bx";
300 case 'c':
301 return "cx";
302 case 'd':
303 return "dx";
304 case 'S':
305 return "si";
306 case 'D':
307 return "di";
308 // In case the constraint is 'r' we need to return Expression
309 case 'r':
310 return Expression;
311 // Double letters Y<x> constraints
312 case 'Y':
313 if ((++I != E) && ((*I == '0') || (*I == 'z')))
314 return "xmm0";
315 break;
316 default:
317 break;
318 }
319 return "";
320 }
321
322 void getTargetDefines(const LangOptions &Opts,
323 MacroBuilder &Builder) const override;
324
325 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
326 bool Enabled) const final;
327
328 bool
329 initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
330 StringRef CPU,
331 const std::vector<std::string> &FeaturesVec) const override;
332
333 bool isValidFeatureName(StringRef Name) const override;
334
335 bool hasFeature(StringRef Feature) const final;
336
337 bool handleTargetFeatures(std::vector<std::string> &Features,
338 DiagnosticsEngine &Diags) override;
339
340 StringRef getABI() const override {
341 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX512F)
342 return "avx512";
343 if (getTriple().getArch() == llvm::Triple::x86_64 && SSELevel >= AVX)
344 return "avx";
345 if (getTriple().getArch() == llvm::Triple::x86 && !HasMMX)
346 return "no-mmx";
347 return "";
348 }
349
350 bool supportsTargetAttributeTune() const override {
351 return true;
352 }
353
354 bool isValidCPUName(StringRef Name) const override {
355 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
356 return llvm::X86::parseArchX86(Name, Only64Bit) != llvm::X86::CK_None;
357 }
358
359 bool isValidTuneCPUName(StringRef Name) const override {
360 if (Name == "generic")
361 return true;
362
363 // Allow 32-bit only CPUs regardless of 64-bit mode unlike isValidCPUName.
364 // NOTE: gcc rejects 32-bit mtune CPUs in 64-bit mode. But being lenient
365 // since mtune was ignored by clang for so long.
366 return llvm::X86::parseTuneCPU(Name) != llvm::X86::CK_None;
367 }
368
369 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
370 void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values) const override;
371
372 bool setCPU(StringRef Name) override {
373 bool Only64Bit = getTriple().getArch() != llvm::Triple::x86;
374 CPU = llvm::X86::parseArchX86(Name, Only64Bit);
375 return CPU != llvm::X86::CK_None;
376 }
377
378 llvm::APInt getFMVPriority(ArrayRef<StringRef> Features) const override;
379
380 bool setFPMath(StringRef Name) override;
381
382 bool supportsExtendIntArgs() const override {
383 return getTriple().getArch() != llvm::Triple::x86;
384 }
385
387 // Most of the non-ARM calling conventions are i386 conventions.
388 switch (CC) {
389 case CC_X86ThisCall:
390 case CC_X86FastCall:
391 case CC_X86StdCall:
392 case CC_X86VectorCall:
393 case CC_X86RegCall:
394 case CC_C:
395 case CC_PreserveMost:
396 case CC_Swift:
397 case CC_X86Pascal:
398 case CC_IntelOclBicc:
399 return CCCR_OK;
400 case CC_SwiftAsync:
401 return CCCR_Error;
402 case CC_DeviceKernel:
403 return IsOpenCL ? CCCR_OK : CCCR_Warning;
404 default:
405 return CCCR_Warning;
406 }
407 }
408
409 bool checkArithmeticFenceSupported() const override { return true; }
410
412 return CC_C;
413 }
414
415 bool hasSjLjLowering() const override { return true; }
416
418
419 uint64_t getPointerWidthV(LangAS AS) const override {
420 unsigned TargetAddrSpace = getTargetAddressSpace(AS);
421 if (TargetAddrSpace == ptr32_sptr || TargetAddrSpace == ptr32_uptr)
422 return 32;
423 if (TargetAddrSpace == ptr64)
424 return 64;
425 return PointerWidth;
426 }
427
428 uint64_t getPointerAlignV(LangAS AddrSpace) const override {
429 return getPointerWidthV(AddrSpace);
430 }
432 const TargetInfo *Aux) override {
433 TargetInfo::adjust(Diags, Opts, Aux);
434 IsOpenCL = Opts.OpenCL;
435 }
436
437private:
438 bool IsOpenCL = false;
439};
440
441// X86-32 generic target
442class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
443public:
444 X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
445 : X86TargetInfo(Triple, Opts) {
447 LongDoubleWidth = 96;
448 LongDoubleAlign = 32;
449 SuitableAlign = 128;
454 RegParmMax = 3;
455
456 // Use fpret for all types.
460
461 // x86-32 has atomics up to 8 bytes
464 }
465
469
470 int getEHDataRegisterNumber(unsigned RegNo) const override {
471 if (RegNo == 0)
472 return 0;
473 if (RegNo == 1)
474 return 2;
475 return -1;
476 }
477
478 bool validateOperandSize(const llvm::StringMap<bool> &FeatureMap,
479 StringRef Constraint, unsigned Size) const override {
480 switch (Constraint[0]) {
481 default:
482 break;
483 case 'R':
484 case 'q':
485 case 'Q':
486 case 'a':
487 case 'b':
488 case 'c':
489 case 'd':
490 case 'S':
491 case 'D':
492 return Size <= 32;
493 case 'A':
494 return Size <= 64;
495 }
496
497 return X86TargetInfo::validateOperandSize(FeatureMap, Constraint, Size);
498 }
499
500 void setMaxAtomicWidth() override {
501 if (hasFeature("cx8"))
503 }
504
505 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
506
507 bool hasBitIntType() const override { return true; }
508 size_t getMaxBitIntWidth() const override {
509 return llvm::IntegerType::MAX_INT_BITS;
510 }
511};
512
513class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
514 : public NetBSDTargetInfo<X86_32TargetInfo> {
515public:
516 NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
517 : NetBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
518};
519
520class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
521 : public OpenBSDTargetInfo<X86_32TargetInfo> {
522public:
523 OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
524 : OpenBSDTargetInfo<X86_32TargetInfo>(Triple, Opts) {
528 }
529};
530
531class LLVM_LIBRARY_VISIBILITY AppleMachOI386TargetInfo
532 : public AppleMachOTargetInfo<X86_32TargetInfo> {
533public:
534 AppleMachOI386TargetInfo(const llvm::Triple &Triple,
535 const TargetOptions &Opts)
536 : AppleMachOTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
537};
538
539class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
540 : public DarwinTargetInfo<X86_32TargetInfo> {
541public:
542 DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
543 : DarwinTargetInfo<X86_32TargetInfo>(Triple, Opts) {
544 LongDoubleWidth = 128;
545 LongDoubleAlign = 128;
546 SuitableAlign = 128;
547 MaxVectorAlign = 256;
548 // The watchOS simulator uses the builtin bool type for Objective-C.
549 llvm::Triple T = llvm::Triple(Triple);
550 if (T.isWatchOS())
556 }
557
558 bool handleTargetFeatures(std::vector<std::string> &Features,
559 DiagnosticsEngine &Diags) override {
561 Diags))
562 return false;
563 // We now know the features we have: we can decide how to align vectors.
565 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
566 return true;
567 }
568};
569
570// x86-32 Windows target
571class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
572 : public WindowsTargetInfo<X86_32TargetInfo> {
573public:
574 WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
575 : WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
577 bool IsWinCOFF =
578 getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
579 bool IsMSVC = getTriple().isWindowsMSVCEnvironment();
580 std::string Layout = IsWinCOFF ? "e-m:x" : "e-m:e";
581 Layout += "-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-";
582 Layout += IsMSVC ? "f80:128" : "f80:32";
583 Layout += "-n8:16:32-a:0:32-S32";
584 if (IsWinCOFF)
585 UserLabelPrefix = "_";
587 }
588};
589
590// x86-32 Windows Visual Studio target
591class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32TargetInfo
592 : public WindowsX86_32TargetInfo {
593public:
594 MicrosoftX86_32TargetInfo(const llvm::Triple &Triple,
595 const TargetOptions &Opts)
596 : WindowsX86_32TargetInfo(Triple, Opts) {
598 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
599 }
600
602 MacroBuilder &Builder) const override {
604 // The value of the following reflects processor type.
605 // 300=386, 400=486, 500=Pentium, 600=Blend (default)
606 // We lost the original triple, so we use the default.
607 Builder.defineMacro("_M_IX86", "600");
608 }
609};
610
611// x86-32 MinGW target
612class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
613 : public WindowsX86_32TargetInfo {
614public:
615 MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
616 : WindowsX86_32TargetInfo(Triple, Opts) {
617 HasFloat128 = true;
618 }
619
621 MacroBuilder &Builder) const override {
623 Builder.defineMacro("_X86_");
624 }
625};
626
627// x86-32 Cygwin target
628class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
629public:
630 CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
631 : X86_32TargetInfo(Triple, Opts) {
634 this->UseMicrosoftManglingForC = true;
636 UserLabelPrefix = "_";
638 }
639
641 MacroBuilder &Builder) const override {
643 Builder.defineMacro("_X86_");
644 Builder.defineMacro("__CYGWIN__");
645 Builder.defineMacro("__CYGWIN32__");
646 addCygMingDefines(Opts, Builder);
647 DefineStd(Builder, "unix", Opts);
648 if (Opts.CPlusPlus)
649 Builder.defineMacro("_GNU_SOURCE");
650 }
651};
652
653// x86-32 Haiku target
654class LLVM_LIBRARY_VISIBILITY HaikuX86_32TargetInfo
655 : public HaikuTargetInfo<X86_32TargetInfo> {
656public:
657 HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
658 : HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {}
659
661 MacroBuilder &Builder) const override {
663 Builder.defineMacro("__INTEL__");
664 }
665};
666
667// X86-32 MCU target
668class LLVM_LIBRARY_VISIBILITY MCUX86_32TargetInfo : public X86_32TargetInfo {
669public:
670 MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
671 : X86_32TargetInfo(Triple, Opts) {
672 LongDoubleWidth = 64;
674 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
677 }
678
680 // On MCU we support only C calling convention.
681 return CC == CC_C ? CCCR_OK : CCCR_Warning;
682 }
683
685 MacroBuilder &Builder) const override {
687 Builder.defineMacro("__iamcu");
688 Builder.defineMacro("__iamcu__");
689 }
690
691 bool allowsLargerPreferedTypeAlignment() const override { return false; }
692};
693
694// x86-32 RTEMS target
695class LLVM_LIBRARY_VISIBILITY RTEMSX86_32TargetInfo : public X86_32TargetInfo {
696public:
697 RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
698 : X86_32TargetInfo(Triple, Opts) {
702 }
703
705 MacroBuilder &Builder) const override {
707 Builder.defineMacro("__INTEL__");
708 Builder.defineMacro("__rtems__");
709 }
710};
711
712// x86-64 generic target
713class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
714public:
715 X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
716 : X86TargetInfo(Triple, Opts) {
717 const bool IsX32 = getTriple().isX32();
718 LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
719 LongDoubleWidth = 128;
720 LongDoubleAlign = 128;
721 LargeArrayMinWidth = 128;
722 LargeArrayAlign = 128;
723 SuitableAlign = 128;
725 PtrDiffType = IsX32 ? SignedInt : SignedLong;
726 IntPtrType = IsX32 ? SignedInt : SignedLong;
729 RegParmMax = 6;
730
732
733 // Use fpret only for long double.
735
736 // Use fp2ret for _Complex long double.
738
739 // Make __builtin_ms_va_list available.
740 HasBuiltinMSVaList = true;
741
742 // x86-64 has atomics up to 16 bytes.
745 }
746
750
751 int getEHDataRegisterNumber(unsigned RegNo) const override {
752 if (RegNo == 0)
753 return 0;
754 if (RegNo == 1)
755 return 1;
756 return -1;
757 }
758
760 switch (CC) {
761 case CC_C:
762 case CC_Swift:
763 case CC_SwiftAsync:
764 case CC_X86VectorCall:
765 case CC_IntelOclBicc:
766 case CC_Win64:
767 case CC_PreserveMost:
768 case CC_PreserveAll:
769 case CC_PreserveNone:
770 case CC_X86RegCall:
771 return CCCR_OK;
772 case CC_DeviceKernel:
773 return IsOpenCL ? CCCR_OK : CCCR_Warning;
774 default:
775 return CCCR_Warning;
776 }
777 }
778
780 return CC_C;
781 }
782
783 // for x32 we need it here explicitly
784 bool hasInt128Type() const override { return true; }
785
786 unsigned getUnwindWordWidth() const override { return 64; }
787
788 unsigned getRegisterWidth() const override { return 64; }
789
790 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
791 bool &HasSizeMismatch) const override {
792 // rsp and rbp are the only 64-bit registers the x86 backend can currently
793 // handle.
794 if (RegName == "rsp" || RegName == "rbp") {
795 // Check that the register size is 64-bit.
796 HasSizeMismatch = RegSize != 64;
797 return true;
798 }
799
800 // -ffixed-r8 through -ffixed-r31 are lowered to reserve-r8 through
801 // reserve-r31 target features, so canonicalize subregister spellings
802 // like r15d/r15w/r15b back to the corresponding 64-bit register first.
803 StringRef Reg64 = RegName;
804 if (Reg64.back() == 'd' || Reg64.back() == 'w' || Reg64.back() == 'b') {
805 Reg64 = Reg64.substr(0, Reg64.size() - 1);
806 }
807 if (getTargetOpts().FeatureMap.lookup(("reserve-" + Reg64).str())) {
808 switch (RegName.back()) {
809 case 'd':
810 HasSizeMismatch = RegSize != 32;
811 break;
812 case 'w':
813 HasSizeMismatch = RegSize != 16;
814 break;
815 case 'b':
816 HasSizeMismatch = RegSize != 8;
817 break;
818 default:
819 HasSizeMismatch = RegSize != 64;
820 }
821 return true;
822 }
823
824 // Check if the register is a 32-bit register the backend can handle.
825 return X86TargetInfo::validateGlobalRegisterVariable(RegName, RegSize,
826 HasSizeMismatch);
827 }
828 void setMaxAtomicWidth() override {
829 if (hasFeature("cx16"))
831 }
832
833 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
834
835 bool hasBitIntType() const override { return true; }
836 size_t getMaxBitIntWidth() const override {
837 return llvm::IntegerType::MAX_INT_BITS;
838 }
839
841 const TargetInfo *Aux) override {
842 TargetInfo::adjust(Diags, Opts, Aux);
843 IsOpenCL = Opts.OpenCL;
844 }
845
846private:
847 bool IsOpenCL = false;
848};
849
850// x86-64 UEFI target
851class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
852 : public UEFITargetInfo<X86_64TargetInfo> {
853public:
854 UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
855 : UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
856 // The UEFI spec does not mandate specific C++ ABI, integer widths, or
857 // alignment. We are setting these defaults to match the Windows target as
858 // it is the only way to build EFI applications with Clang/LLVM today. We
859 // intend to offer flexibility by supporting choices that are not default in
860 // Windows target in the future.
861 this->TheCXXABI.set(TargetCXXABI::Microsoft);
862 LongWidth = LongAlign = 32;
865 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
873 this->resetDataLayout();
874 }
875
879
881 switch (CC) {
882 case CC_C:
883 case CC_Win64:
884 case CC_X86_64SysV:
885 return CCCR_OK;
886 default:
887 return CCCR_Warning;
888 }
889 }
890
892 getCallingConvKind(bool ClangABICompat4) const override {
893 return CCK_MicrosoftWin64;
894 }
895};
896
897// x86-64 Windows target
898class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
899 : public WindowsTargetInfo<X86_64TargetInfo> {
900public:
911
915
917 switch (CC) {
918 case CC_X86StdCall:
919 case CC_X86ThisCall:
920 case CC_X86FastCall:
921 return CCCR_Ignore;
922 case CC_C:
923 case CC_X86VectorCall:
924 case CC_IntelOclBicc:
925 case CC_PreserveMost:
926 case CC_PreserveAll:
927 case CC_PreserveNone:
928 case CC_X86_64SysV:
929 case CC_Swift:
930 case CC_SwiftAsync:
931 case CC_X86RegCall:
932 case CC_DeviceKernel:
933 return CCCR_OK;
934 default:
935 return CCCR_Warning;
936 }
937 }
938};
939
940// x86-64 Windows Visual Studio target
941class LLVM_LIBRARY_VISIBILITY MicrosoftX86_64TargetInfo
942 : public WindowsX86_64TargetInfo {
943public:
944 MicrosoftX86_64TargetInfo(const llvm::Triple &Triple,
945 const TargetOptions &Opts)
946 : WindowsX86_64TargetInfo(Triple, Opts) {
948 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
950 LargeArrayAlign = 0;
951 }
952
954 MacroBuilder &Builder) const override {
956 Builder.defineMacro("_M_X64", "100");
957 Builder.defineMacro("_M_AMD64", "100");
958 }
959
961 getCallingConvKind(bool ClangABICompat4) const override {
962 return CCK_MicrosoftWin64;
963 }
964
965 unsigned getMinGlobalAlign(uint64_t TypeSize,
966 bool HasNonWeakDef) const override;
967
968 void adjust(DiagnosticsEngine &Diags, LangOptions &Opts,
969 const TargetInfo *Aux) override;
970
971private:
972 // Whether to apply the MSVC size-based global-alignment scheme. Disabled by
973 // -fclang-abi-compat<=22 to restore prior x86_64-windows-msvc behavior.
974 bool UseMSVCCompatGlobalAlign = true;
975};
976
977// x86-64 MinGW target
978class LLVM_LIBRARY_VISIBILITY MinGWX86_64TargetInfo
979 : public WindowsX86_64TargetInfo {
980public:
981 MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
982 : WindowsX86_64TargetInfo(Triple, Opts) {
983 // Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
984 // with x86 FP ops. Weird.
986 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
987 HasFloat128 = true;
988 }
989};
990
991// x86-64 Cygwin target
992class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
993public:
994 CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
995 : X86_64TargetInfo(Triple, Opts) {
998 this->UseMicrosoftManglingForC = true;
999 }
1000
1002 MacroBuilder &Builder) const override {
1004 Builder.defineMacro("__x86_64__");
1005 Builder.defineMacro("__CYGWIN__");
1006 Builder.defineMacro("__CYGWIN64__");
1007 addCygMingDefines(Opts, Builder);
1008 DefineStd(Builder, "unix", Opts);
1009 if (Opts.CPlusPlus)
1010 Builder.defineMacro("_GNU_SOURCE");
1011 }
1012
1014 switch (CC) {
1015 case CC_X86StdCall:
1016 case CC_X86ThisCall:
1017 case CC_X86FastCall:
1018 return CCCR_Ignore;
1019 case CC_C:
1020 case CC_X86VectorCall:
1021 case CC_IntelOclBicc:
1022 case CC_PreserveMost:
1023 case CC_PreserveAll:
1024 case CC_PreserveNone:
1025 case CC_X86_64SysV:
1026 case CC_Swift:
1027 case CC_SwiftAsync:
1028 case CC_X86RegCall:
1029 case CC_DeviceKernel:
1030 return CCCR_OK;
1031 default:
1032 return CCCR_Warning;
1033 }
1034 }
1035
1039};
1040
1041class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
1042 : public DarwinTargetInfo<X86_64TargetInfo> {
1043public:
1044 DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1045 : DarwinTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1047 // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
1048 llvm::Triple T = llvm::Triple(Triple);
1049 if (T.isiOS())
1052 }
1053
1054 bool handleTargetFeatures(std::vector<std::string> &Features,
1055 DiagnosticsEngine &Diags) override {
1057 Diags))
1058 return false;
1059 // We now know the features we have: we can decide how to align vectors.
1061 hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
1062 return true;
1063 }
1064};
1065
1066class LLVM_LIBRARY_VISIBILITY OpenBSDX86_64TargetInfo
1067 : public OpenBSDTargetInfo<X86_64TargetInfo> {
1068public:
1069 OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1070 : OpenBSDTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1073 }
1074};
1075
1076// x86_32 Android target
1077class LLVM_LIBRARY_VISIBILITY AndroidX86_32TargetInfo
1078 : public LinuxTargetInfo<X86_32TargetInfo> {
1079public:
1080 AndroidX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1081 : LinuxTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1082 SuitableAlign = 32;
1083 LongDoubleWidth = 64;
1084 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1085 }
1086};
1087
1088// x86_64 Android target
1089class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo
1090 : public LinuxTargetInfo<X86_64TargetInfo> {
1091public:
1092 AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1093 : LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1094 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1095 }
1096};
1097
1098// x86_32 OHOS target
1099class LLVM_LIBRARY_VISIBILITY OHOSX86_32TargetInfo
1100 : public OHOSTargetInfo<X86_32TargetInfo> {
1101public:
1102 OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1103 : OHOSTargetInfo<X86_32TargetInfo>(Triple, Opts) {
1104 SuitableAlign = 32;
1105 LongDoubleWidth = 64;
1106 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
1107 }
1108};
1109
1110// x86_64 OHOS target
1111class LLVM_LIBRARY_VISIBILITY OHOSX86_64TargetInfo
1112 : public OHOSTargetInfo<X86_64TargetInfo> {
1113public:
1114 OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
1115 : OHOSTargetInfo<X86_64TargetInfo>(Triple, Opts) {
1116 LongDoubleFormat = &llvm::APFloat::IEEEquad();
1117 }
1118};
1119} // namespace targets
1120} // namespace clang
1121#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: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: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:1080
AndroidX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1092
AppleMachOI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:534
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:640
CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:630
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:1036
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:1001
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:1013
CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:994
DarwinI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:542
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:558
DarwinTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:85
DarwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1044
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:1054
HaikuTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:326
HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:657
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:660
LinuxTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:414
MCUX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:670
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition X86.h:691
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:684
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:679
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:601
MicrosoftX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:594
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:953
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:961
MicrosoftX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:944
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:620
MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:615
MinGWX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:981
NetBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:516
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:1102
OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1114
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
Definition OSTargets.h:30
OpenBSDI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:523
OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:531
OpenBSDX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:1069
RTEMSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:697
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition X86.h:704
UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:892
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:854
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:876
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:880
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
Definition X86.h:892
WindowsTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition OSTargets.h:913
WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:574
WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:901
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:912
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:916
bool isSPRegName(StringRef RegName) const override
Definition X86.h:204
bool isValidTuneCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name for tuning.
Definition X86.h:359
bool supportsCpuSupports() const override
Definition X86.h:208
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
Definition X86.h:354
X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition X86.h:168
bool supportsExtendIntArgs() const override
Whether the option -fextend-arguments={32,64} is supported on the target.
Definition X86.h:382
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:411
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm....
Definition X86.h:415
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:386
bool supportsCpuIs() const override
Definition X86.h:209
bool supportsCpuInit() const override
Definition X86.h:210
bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection branch.
Definition X86.h:271
bool setCPU(StringRef Name) override
Target the specified CPU.
Definition X86.h:372
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:285
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition X86.h:281
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:252
bool supportSourceEvalMethod() const override
Definition X86.h:194
bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection return.
Definition X86.h:264
LangOptions::FPEvalMethodKind getFPEvalMethod() const override
Return the value for the C99 FLT_EVAL_METHOD macro.
Definition X86.h:187
uint64_t getPointerWidthV(LangAS AS) const override
Definition X86.h:419
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
Definition X86.h:417
bool supportsTargetAttributeTune() const override
Determine whether this TargetInfo supports tune in target attribute.
Definition X86.h:350
const char * getLongDoubleMangling() const override
Return the mangled code of long double.
Definition X86.h:183
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:409
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:431
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:229
StringRef getABI() const override
Get the ABI currently in use.
Definition X86.h:340
llvm::X86::CPUKind CPU
Definition X86.h:163
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition X86.h:198
uint64_t getPointerAlignV(LangAS AddrSpace) const override
Definition X86.h:428
X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:444
size_t getMaxBitIntWidth() const override
Definition X86.h:508
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:500
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:470
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:507
bool validateOperandSize(const llvm::StringMap< bool > &FeatureMap, StringRef Constraint, unsigned Size) const override
Definition X86.h:478
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:466
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
Definition X86.h:790
bool hasInt128Type() const override
Determine whether the __int128 type is supported on this target.
Definition X86.h:784
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition X86.h:759
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target.
Definition X86.h:779
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition X86.h:835
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition X86.h:751
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
Definition X86.h:828
size_t getMaxBitIntWidth() const override
Definition X86.h:836
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition X86.h:747
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition X86.h:715
unsigned getUnwindWordWidth() const override
Definition X86.h:786
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition X86.h:840
unsigned getRegisterWidth() const override
Return the "preferred" register width on this target.
Definition X86.h:788
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.
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: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