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