clang 24.0.0git
TargetInfo.cpp
Go to the documentation of this file.
1//===--- TargetInfo.cpp - Information about Target machine ----------------===//
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 implements the TargetInfo interface.
10//
11//===----------------------------------------------------------------------===//
12
19#include "llvm/ADT/APFloat.h"
20#include "llvm/ADT/STLExtras.h"
21#include "llvm/ADT/StringExtras.h"
22#include "llvm/IR/DerivedTypes.h"
23#include "llvm/Support/ErrorHandling.h"
24#include "llvm/TargetParser/TargetParser.h"
25#include "llvm/TargetParser/Triple.h"
26#include <cstdlib>
27using namespace clang;
28
30// The fake address space map must have a distinct entry for each
31// language-specific address space.
62
63// TargetInfo Constructor.
64TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
65 // Set defaults. Defaults are set for a 32-bit RISC platform, like PPC or
66 // SPARC. These should be overridden by concrete targets as needed.
67 HasMustTail = true;
68 BigEndian = !T.isLittleEndian();
69 TLSSupported = true;
70 VLASupported = true;
71 NoAsmVariants = false;
72 HasFastHalfType = false;
73 HalfArgsAndReturns = false;
74 HasFloat128 = false;
75 HasIbm128 = false;
76 HasFloat16 = false;
77 HasBFloat16 = false;
78 HasFullBFloat16 = false;
79 HasLongDouble = true;
80 HasFPReturn = true;
81 HasStrictFP = false;
83 BoolWidth = BoolAlign = 8;
85 IntWidth = IntAlign = 32;
86 LongWidth = LongAlign = 32;
88 Int128Align = 128;
89
90 // Fixed point default bit widths
97
98 // Fixed point default integral and fractional bit sizes
99 // We give the _Accum 1 fewer fractional bits than their corresponding _Fract
100 // types by default to have the same number of fractional bits between _Accum
101 // and _Fract types.
103 ShortAccumScale = 7;
104 AccumScale = 15;
105 LongAccumScale = 31;
106
107 SuitableAlign = 64;
109 MinGlobalAlign = 0;
110 // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
111 // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
112 // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
113 // This alignment guarantee also applies to Windows and Android. On Darwin
114 // and OpenBSD, the alignment is 16 bytes on both 64-bit and 32-bit systems.
115 if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid() ||
116 T.isOHOSFamily())
117 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
118 else if (T.isOSDarwin() || T.isOSOpenBSD())
119 NewAlign = 128;
120 else
121 NewAlign = 0; // Infer from basic type alignment.
122 HalfWidth = 16;
123 HalfAlign = 16;
124 FloatWidth = 32;
125 FloatAlign = 32;
126 DoubleWidth = 64;
127 DoubleAlign = 64;
128 LongDoubleWidth = 64;
129 LongDoubleAlign = 64;
130 Float128Align = 128;
131 Ibm128Align = 128;
133 LargeArrayAlign = 0;
135 MaxVectorAlign = 0;
136 MaxTLSAlign = 0;
158 HalfFormat = &llvm::APFloat::IEEEhalf();
159 FloatFormat = &llvm::APFloat::IEEEsingle();
160 DoubleFormat = &llvm::APFloat::IEEEdouble();
161 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
162 Float128Format = &llvm::APFloat::IEEEquad();
163 Ibm128Format = &llvm::APFloat::PPCDoubleDouble();
164 MCountName = "mcount";
165 UserLabelPrefix = Triple.isOSBinFormatMachO() ? "_" : "";
166 RegParmMax = 0;
167 SSERegParmMax = 0;
168 HasAlignMac68kSupport = false;
169 HasBuiltinMSVaList = false;
170 HasBuiltinZOSVaList = false;
171 HasAArch64ACLETypes = false;
172 HasRISCVVTypes = false;
173 HasAMDGPUTypes = false;
175 HasUnalignedAccess = false;
177
178 // Default to no types using fpret.
180
181 // Default to not using fp2ret for __Complex long double
183
184 // Set the C++ ABI based on the triple.
185 TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment() || Triple.isUEFI()
186 ? TargetCXXABI::Microsoft
187 : TargetCXXABI::GenericItanium);
188
189 HasMicrosoftRecordLayout = TheCXXABI.isMicrosoft();
190
191 // Default to an empty address space map.
194
195 // Default to an unknown platform name.
196 PlatformName = "unknown";
197 PlatformMinVersion = VersionTuple();
198
200
201 MaxBitIntWidth.reset();
202}
203
204// Out of line virtual dtor for TargetInfo.
206
208 // Consider -fexperimental-max-bitint-width= first.
209 if (MaxBitIntWidth)
210 return std::min<size_t>(*MaxBitIntWidth, llvm::IntegerType::MAX_INT_BITS);
211
212 // FIXME: this value should be llvm::IntegerType::MAX_INT_BITS, which is
213 // maximum bit width that LLVM claims its IR can support. However, most
214 // backends currently have a bug where they only support float to int
215 // conversion (and vice versa) on types that are <= 128 bits and crash
216 // otherwise. We're setting the max supported value to 128 to be
217 // conservative.
218 return 128;
219}
220
221void TargetInfo::resetDataLayout(StringRef DL) { DataLayoutString = DL.str(); }
222
224 DataLayoutString = Triple.computeDataLayout(getABI());
225}
226
227bool
229 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=branch";
230 return false;
231}
232
234 // if this hook is called, the target should override it to return a
235 // non-default scheme
236 llvm::report_fatal_error("not implemented");
237}
238
240 const CFBranchLabelSchemeKind Scheme, DiagnosticsEngine &Diags) const {
242 Diags.Report(diag::err_opt_not_valid_on_target)
243 << (Twine("mcf-branch-label-scheme=") +
245 .str();
246 return false;
247}
248
249bool
251 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=return";
252 return false;
253}
254
255/// getTypeName - Return the user string for the specified integer type enum.
256/// For example, SignedShort -> "short".
258 switch (T) {
259 default: llvm_unreachable("not an integer!");
260 case SignedChar: return "signed char";
261 case UnsignedChar: return "unsigned char";
262 case SignedShort: return "short";
263 case UnsignedShort: return "unsigned short";
264 case SignedInt: return "int";
265 case UnsignedInt: return "unsigned int";
266 case SignedLong: return "long int";
267 case UnsignedLong: return "long unsigned int";
268 case SignedLongLong: return "long long int";
269 case UnsignedLongLong: return "long long unsigned int";
270 }
271}
272
273/// getTypeConstantSuffix - Return the constant suffix for the specified
274/// integer type enum. For example, SignedLong -> "L".
276 switch (T) {
277 default: llvm_unreachable("not an integer!");
278 case SignedChar:
279 case SignedShort:
280 case SignedInt: return "";
281 case SignedLong: return "L";
282 case SignedLongLong: return "LL";
283 case UnsignedChar:
284 if (getCharWidth() < getIntWidth())
285 return "";
286 [[fallthrough]];
287 case UnsignedShort:
288 if (getShortWidth() < getIntWidth())
289 return "";
290 [[fallthrough]];
291 case UnsignedInt: return "U";
292 case UnsignedLong: return "UL";
293 case UnsignedLongLong: return "ULL";
294 }
295}
296
297/// getTypeFormatModifier - Return the printf format modifier for the
298/// specified integer type enum. For example, SignedLong -> "l".
299
301 switch (T) {
302 default: llvm_unreachable("not an integer!");
303 case SignedChar:
304 case UnsignedChar: return "hh";
305 case SignedShort:
306 case UnsignedShort: return "h";
307 case SignedInt:
308 case UnsignedInt: return "";
309 case SignedLong:
310 case UnsignedLong: return "l";
311 case SignedLongLong:
312 case UnsignedLongLong: return "ll";
313 }
314}
315
316/// getTypeWidth - Return the width (in bits) of the specified integer type
317/// enum. For example, SignedInt -> getIntWidth().
319 switch (T) {
320 default: llvm_unreachable("not an integer!");
321 case SignedChar:
322 case UnsignedChar: return getCharWidth();
323 case SignedShort:
324 case UnsignedShort: return getShortWidth();
325 case SignedInt:
326 case UnsignedInt: return getIntWidth();
327 case SignedLong:
328 case UnsignedLong: return getLongWidth();
329 case SignedLongLong:
330 case UnsignedLongLong: return getLongLongWidth();
331 };
332}
333
335 unsigned BitWidth, bool IsSigned) const {
336 if (getCharWidth() == BitWidth)
337 return IsSigned ? SignedChar : UnsignedChar;
338 if (getShortWidth() == BitWidth)
339 return IsSigned ? SignedShort : UnsignedShort;
340 if (getIntWidth() == BitWidth)
341 return IsSigned ? SignedInt : UnsignedInt;
342 if (getLongWidth() == BitWidth)
343 return IsSigned ? SignedLong : UnsignedLong;
344 if (getLongLongWidth() == BitWidth)
345 return IsSigned ? SignedLongLong : UnsignedLongLong;
346 return NoInt;
347}
348
350 bool IsSigned) const {
351 if (getCharWidth() >= BitWidth)
352 return IsSigned ? SignedChar : UnsignedChar;
353 if (getShortWidth() >= BitWidth)
354 return IsSigned ? SignedShort : UnsignedShort;
355 if (getIntWidth() >= BitWidth)
356 return IsSigned ? SignedInt : UnsignedInt;
357 if (getLongWidth() >= BitWidth)
358 return IsSigned ? SignedLong : UnsignedLong;
359 if (getLongLongWidth() >= BitWidth)
360 return IsSigned ? SignedLongLong : UnsignedLongLong;
361 return NoInt;
362}
363
365 FloatModeKind ExplicitType) const {
366 if (getHalfWidth() == BitWidth)
367 return FloatModeKind::Half;
368 if (getFloatWidth() == BitWidth)
370 if (getDoubleWidth() == BitWidth)
372
373 switch (BitWidth) {
374 case 96:
375 if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended())
377 break;
378 case 128:
379 // The caller explicitly asked for an IEEE compliant type but we still
380 // have to check if the target supports it.
381 if (ExplicitType == FloatModeKind::Float128)
384 if (ExplicitType == FloatModeKind::Ibm128)
387 if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
388 &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
390 if (hasFloat128Type())
392 break;
393 }
394
396}
397
398/// getTypeAlign - Return the alignment (in bits) of the specified integer type
399/// enum. For example, SignedInt -> getIntAlign().
401 switch (T) {
402 default: llvm_unreachable("not an integer!");
403 case SignedChar:
404 case UnsignedChar: return getCharAlign();
405 case SignedShort:
406 case UnsignedShort: return getShortAlign();
407 case SignedInt:
408 case UnsignedInt: return getIntAlign();
409 case SignedLong:
410 case UnsignedLong: return getLongAlign();
411 case SignedLongLong:
412 case UnsignedLongLong: return getLongLongAlign();
413 };
414}
415
416/// isTypeSigned - Return whether an integer types is signed. Returns true if
417/// the type is signed; false otherwise.
419 switch (T) {
420 default: llvm_unreachable("not an integer!");
421 case SignedChar:
422 case SignedShort:
423 case SignedInt:
424 case SignedLong:
425 case SignedLongLong:
426 return true;
427 case UnsignedChar:
428 case UnsignedShort:
429 case UnsignedInt:
430 case UnsignedLong:
431 case UnsignedLongLong:
432 return false;
433 };
434}
435
436/// adjust - Set forced language options.
437/// Apply changes to the target information with respect to certain
438/// language options which change the target configuration and adjust
439/// the language based on the target options where applicable.
441 const TargetInfo *Aux) {
442 if (Opts.NoBitFieldTypeAlign)
444
445 switch (Opts.WCharSize) {
446 default: llvm_unreachable("invalid wchar_t width");
447 case 0: break;
448 case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
449 case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
450 case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
451 }
452
453 if (Opts.AlignDouble) {
455 LongDoubleAlign = 64;
456 }
457
458 // HLSL explicitly defines the sizes and formats of some data types, and we
459 // need to conform to those regardless of what architecture you are targeting.
460 if (Opts.HLSL) {
461 BoolWidth = BoolAlign = 32;
462 LongWidth = LongAlign = 64;
463 if (!Opts.NativeHalfType) {
464 HalfFormat = &llvm::APFloat::IEEEsingle();
465 HalfWidth = HalfAlign = 32;
466 }
467 }
468
469 if (Opts.OpenCL) {
470 // OpenCL C requires specific widths for types, irrespective of
471 // what these normally are for the target.
472 // We also define long long and long double here, although the
473 // OpenCL standard only mentions these as "reserved".
474 ShortWidth = ShortAlign = 16;
475 IntWidth = IntAlign = 32;
476 LongWidth = LongAlign = 64;
478 HalfWidth = HalfAlign = 16;
479 FloatWidth = FloatAlign = 32;
480
481 // Embedded 32-bit targets (OpenCL EP) might have double C type
482 // defined as float. Let's not override this as it might lead
483 // to generating illegal code that uses 64bit doubles.
484 if (DoubleWidth != FloatWidth) {
486 DoubleFormat = &llvm::APFloat::IEEEdouble();
487 }
489
490 unsigned MaxPointerWidth = getMaxPointerWidth();
491 assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
492 bool Is32BitArch = MaxPointerWidth == 32;
493 SizeType = Is32BitArch ? UnsignedInt : UnsignedLong;
494 PtrDiffType = Is32BitArch ? SignedInt : SignedLong;
495 IntPtrType = Is32BitArch ? SignedInt : SignedLong;
496
499
500 HalfFormat = &llvm::APFloat::IEEEhalf();
501 FloatFormat = &llvm::APFloat::IEEEsingle();
502 LongDoubleFormat = &llvm::APFloat::IEEEquad();
503
504 // OpenCL C v3.0 s6.7.5 - The generic address space requires support for
505 // OpenCL C 2.0 or OpenCL C 3.0 with the __opencl_c_generic_address_space
506 // feature
507 // OpenCL C v3.0 s6.2.1 - OpenCL pipes require support of OpenCL C 2.0
508 // or later and __opencl_c_pipes feature
509 // FIXME: These language options are also defined in setLangDefaults()
510 // for OpenCL C 2.0 but with no access to target capabilities. Target
511 // should be immutable once created and thus these language options need
512 // to be defined only once.
513 if (Opts.getOpenCLCompatibleVersion() >= 300) {
514 const auto &OpenCLFeaturesMap = getSupportedOpenCLOpts();
515 Opts.OpenCLGenericAddressSpace = hasFeatureEnabled(
516 OpenCLFeaturesMap, "__opencl_c_generic_address_space");
517 Opts.OpenCLPipes =
518 hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_pipes");
519 Opts.Blocks =
520 hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_device_enqueue");
521 }
522 }
523
524 if (Opts.DoubleSize) {
525 if (Opts.DoubleSize == 32) {
526 DoubleWidth = 32;
527 LongDoubleWidth = 32;
528 DoubleFormat = &llvm::APFloat::IEEEsingle();
529 LongDoubleFormat = &llvm::APFloat::IEEEsingle();
530 } else if (Opts.DoubleSize == 64) {
531 DoubleWidth = 64;
532 LongDoubleWidth = 64;
533 DoubleFormat = &llvm::APFloat::IEEEdouble();
534 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
535 }
536 }
537
538 if (Opts.LongDoubleSize) {
539 if (Opts.LongDoubleSize == DoubleWidth) {
543 } else if (Opts.LongDoubleSize == 128) {
545 LongDoubleFormat = &llvm::APFloat::IEEEquad();
546 } else if (Opts.LongDoubleSize == 80) {
547 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
548 if (getTriple().isWindowsMSVCEnvironment()) {
549 LongDoubleWidth = 128;
550 LongDoubleAlign = 128;
551 } else { // Linux
552 if (getTriple().getArch() == llvm::Triple::x86) {
553 LongDoubleWidth = 96;
554 LongDoubleAlign = 32;
555 } else {
556 LongDoubleWidth = 128;
557 LongDoubleAlign = 128;
558 }
559 }
560 }
561 }
562
563 if (Opts.NewAlignOverride)
564 NewAlign = Opts.NewAlignOverride * getCharWidth();
565
566 // Each unsigned fixed point type has the same number of fractional bits as
567 // its corresponding signed type.
568 PaddingOnUnsignedFixedPoint |= Opts.PaddingOnUnsignedFixedPoint;
569 CheckFixedPointBits();
570
571 if (Opts.ProtectParens && !checkArithmeticFenceSupported()) {
572 Diags.Report(diag::err_opt_not_valid_on_target) << "-fprotect-parens";
573 Opts.ProtectParens = false;
574 }
575
576 if (Opts.MaxBitIntWidth)
577 MaxBitIntWidth = static_cast<unsigned>(Opts.MaxBitIntWidth);
578
579 if (Opts.FakeAddressSpaceMap)
581
582 // Check if it's CUDA device compilation; ensure layout consistency with host.
583 if (Opts.CUDA && Opts.CUDAIsDevice && Aux && !HasMicrosoftRecordLayout)
585}
586
588 llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
589 const std::vector<std::string> &FeatureVec) const {
590 for (StringRef Name : FeatureVec) {
591 if (Name.empty())
592 continue;
593 // Apply the feature via the target.
594 if (Name[0] != '+' && Name[0] != '-')
595 Diags.Report(diag::warn_fe_backend_invalid_feature_flag) << Name;
596 else
597 setFeatureEnabled(Features, Name.substr(1), Name[0] == '+');
598 }
599 return true;
600}
601
604 if (Features == "default")
605 return Ret;
606 SmallVector<StringRef, 1> AttrFeatures;
607 Features.split(AttrFeatures, ",");
608
609 // Grab the various features and prepend a "+" to turn on the feature to
610 // the backend and add them to our existing set of features.
611 for (auto &Feature : AttrFeatures) {
612 // Go ahead and trim whitespace rather than either erroring or
613 // accepting it weirdly.
614 Feature = Feature.trim();
615
616 // TODO: Support the fpmath option. It will require checking
617 // overall feature validity for the function with the rest of the
618 // attributes on the function.
619 if (Feature.starts_with("fpmath="))
620 continue;
621
622 if (Feature.starts_with("branch-protection=")) {
623 Ret.BranchProtection = Feature.split('=').second.trim();
624 continue;
625 }
626
627 // While we're here iterating check for a different target cpu.
628 if (Feature.starts_with("arch=")) {
629 if (!Ret.CPU.empty())
630 Ret.Duplicate = "arch=";
631 else
632 Ret.CPU = Feature.split("=").second.trim();
633 } else if (Feature.starts_with("tune=")) {
634 if (!Ret.Tune.empty())
635 Ret.Duplicate = "tune=";
636 else
637 Ret.Tune = Feature.split("=").second.trim();
638 } else if (Feature.starts_with("no-"))
639 Ret.Features.push_back("-" + Feature.split("-").second.str());
640 else
641 Ret.Features.push_back("+" + Feature.str());
642 }
643 return Ret;
644}
645
647TargetInfo::getCallingConvKind(bool ClangABICompat4) const {
648 if (getCXXABI() != TargetCXXABI::Microsoft &&
649 (ClangABICompat4 || getTriple().isPS4()))
650 return CCK_ClangABI4OrPS4;
651 return CCK_Default;
652}
653
657
659 const LangOptions &LangOpts) const {
660 if (getCXXABI() == TargetCXXABI::Microsoft &&
661 !LangOpts.isCompatibleWith(LangOptions::ClangABI::Ver21))
662 return true;
663 return false;
664}
665
667 if (getCXXABI() == TargetCXXABI::Microsoft &&
668 !LangOpts.isCompatibleWith(LangOptions::ClangABI::Ver21))
669 return true;
670 return false;
671}
672
674 return !LangOpts.isCompatibleWith(LangOptions::ClangABI::Ver15);
675}
676
678 auto &Opts = getSupportedOpenCLOpts();
679 if (!hasFeatureEnabled(Opts, "cl_khr_fp64") ||
680 !hasFeatureEnabled(Opts, "__opencl_c_fp64")) {
681 setFeatureEnabled(Opts, "__opencl_c_ext_fp64_global_atomic_add", false);
682 setFeatureEnabled(Opts, "__opencl_c_ext_fp64_local_atomic_add", false);
683 setFeatureEnabled(Opts, "__opencl_c_ext_fp64_global_atomic_min_max", false);
684 setFeatureEnabled(Opts, "__opencl_c_ext_fp64_local_atomic_min_max", false);
685 }
686}
687
689 switch (TK) {
690 case OCLTK_Image:
691 case OCLTK_Pipe:
693
694 case OCLTK_Sampler:
696
697 default:
698 return LangAS::Default;
699 }
700}
701
702//===----------------------------------------------------------------------===//
703
704
705static StringRef removeGCCRegisterPrefix(StringRef Name) {
706 if (Name[0] == '%' || Name[0] == '#')
707 Name = Name.substr(1);
708
709 return Name;
710}
711
712/// isValidClobber - Returns whether the passed in string is
713/// a valid clobber in an inline asm statement. This is used by
714/// Sema.
715bool TargetInfo::isValidClobber(StringRef Name) const {
716 return (isValidGCCRegisterName(Name) || Name == "memory" || Name == "cc" ||
717 Name == "unwind");
718}
719
720/// isValidGCCRegisterName - Returns whether the passed in string
721/// is a valid register name according to GCC. This is used by Sema for
722/// inline asm statements.
723bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
724 if (Name.empty())
725 return false;
726
727 // Get rid of any register prefix.
728 Name = removeGCCRegisterPrefix(Name);
729 if (Name.empty())
730 return false;
731
733
734 // If we have a number it maps to an entry in the register name array.
735 if (isDigit(Name[0])) {
736 unsigned n;
737 if (!Name.getAsInteger(0, n))
738 return n < Names.size();
739 }
740
741 // Check register names.
742 if (llvm::is_contained(Names, Name))
743 return true;
744
745 // Check any additional names that we have.
746 for (const AddlRegName &ARN : getGCCAddlRegNames())
747 for (const char *AN : ARN.Names) {
748 if (!AN)
749 break;
750 // Make sure the register that the additional name is for is within
751 // the bounds of the register names from above.
752 if (AN == Name && ARN.RegNum < Names.size())
753 return true;
754 }
755
756 // Now check aliases.
757 for (const GCCRegAlias &GRA : getGCCRegAliases())
758 for (const char *A : GRA.Aliases) {
759 if (!A)
760 break;
761 if (A == Name)
762 return true;
763 }
764
765 return false;
766}
767
769 bool ReturnCanonical) const {
770 assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
771
772 // Get rid of any register prefix.
773 Name = removeGCCRegisterPrefix(Name);
774
776
777 // First, check if we have a number.
778 if (isDigit(Name[0])) {
779 unsigned n;
780 if (!Name.getAsInteger(0, n)) {
781 assert(n < Names.size() && "Out of bounds register number!");
782 return Names[n];
783 }
784 }
785
786 // Check any additional names that we have.
787 for (const AddlRegName &ARN : getGCCAddlRegNames())
788 for (const char *AN : ARN.Names) {
789 if (!AN)
790 break;
791 // Make sure the register that the additional name is for is within
792 // the bounds of the register names from above.
793 if (AN == Name && ARN.RegNum < Names.size())
794 return ReturnCanonical ? Names[ARN.RegNum] : Name;
795 }
796
797 // Now check aliases.
798 for (const GCCRegAlias &RA : getGCCRegAliases())
799 for (const char *A : RA.Aliases) {
800 if (!A)
801 break;
802 if (A == Name)
803 return RA.Register;
804 }
805
806 return Name;
807}
808
810 const char *Name = Info.getConstraintStr().c_str();
811 // An output constraint must start with '=' or '+'
812 if (*Name != '=' && *Name != '+')
813 return false;
814
815 if (*Name == '+')
816 Info.setIsReadWrite();
817
818 Name++;
819 while (*Name) {
820 switch (*Name) {
821 default:
822 if (!validateAsmConstraint(Name, Info)) {
823 // FIXME: We temporarily return false
824 // so we can add more constraints as we hit it.
825 // Eventually, an unknown constraint should just be treated as 'g'.
826 return false;
827 }
828 break;
829 case '&': // early clobber.
830 Info.setEarlyClobber();
831 break;
832 case '%': // commutative.
833 // FIXME: Check that there is a another register after this one.
834 break;
835 case 'r': // general register.
836 Info.setAllowsRegister();
837 break;
838 case 'm': // memory operand.
839 case 'o': // offsetable memory operand.
840 case 'V': // non-offsetable memory operand.
841 case '<': // autodecrement memory operand.
842 case '>': // autoincrement memory operand.
843 Info.setAllowsMemory();
844 break;
845 case 'g': // general register, memory operand or immediate integer.
846 case 'X': // any operand.
847 Info.setAllowsRegister();
848 Info.setAllowsMemory();
849 break;
850 case ',': // multiple alternative constraint. Pass it.
851 // Handle additional optional '=' or '+' modifiers.
852 if (Name[1] == '=' || Name[1] == '+')
853 Name++;
854 break;
855 case '#': // Ignore as constraint.
856 while (Name[1] && Name[1] != ',')
857 Name++;
858 break;
859 case '?': // Disparage slightly code.
860 case '!': // Disparage severely.
861 case '*': // Ignore for choosing register preferences.
862 case 'i': // Ignore i,n,E,F as output constraints (match from the other
863 // chars)
864 case 'n':
865 case 'E':
866 case 'F':
867 break; // Pass them.
868 }
869
870 Name++;
871 }
872
873 // Early clobber with a read-write constraint which doesn't permit registers
874 // is invalid.
875 if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister())
876 return false;
877
878 // If a constraint allows neither memory nor register operands it contains
879 // only modifiers. Reject it.
880 return Info.allowsMemory() || Info.allowsRegister();
881}
882
883bool TargetInfo::resolveSymbolicName(const char *&Name,
884 ArrayRef<ConstraintInfo> OutputConstraints,
885 unsigned &Index) const {
886 assert(*Name == '[' && "Symbolic name did not start with '['");
887 Name++;
888 const char *Start = Name;
889 while (*Name && *Name != ']')
890 Name++;
891
892 if (!*Name) {
893 // Missing ']'
894 return false;
895 }
896
897 std::string SymbolicName(Start, Name - Start);
898
899 for (Index = 0; Index != OutputConstraints.size(); ++Index)
900 if (SymbolicName == OutputConstraints[Index].getName())
901 return true;
902
903 return false;
904}
905
907 MutableArrayRef<ConstraintInfo> OutputConstraints,
908 ConstraintInfo &Info) const {
909 const char *Name = Info.ConstraintStr.c_str();
910
911 if (!*Name)
912 return false;
913
914 while (*Name) {
915 switch (*Name) {
916 default:
917 // Check if we have a matching constraint
918 if (*Name >= '0' && *Name <= '9') {
919 const char *DigitStart = Name;
920 while (Name[1] >= '0' && Name[1] <= '9')
921 Name++;
922 const char *DigitEnd = Name;
923 unsigned i;
924 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
925 .getAsInteger(10, i))
926 return false;
927
928 // Check if matching constraint is out of bounds.
929 if (i >= OutputConstraints.size()) return false;
930
931 // A number must refer to an output only operand.
932 if (OutputConstraints[i].isReadWrite())
933 return false;
934
935 // If the constraint is already tied, it must be tied to the
936 // same operand referenced to by the number.
937 if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
938 return false;
939
940 // The constraint should have the same info as the respective
941 // output constraint.
942 Info.setTiedOperand(i, OutputConstraints[i]);
943 } else if (!validateAsmConstraint(Name, Info)) {
944 // FIXME: This error return is in place temporarily so we can
945 // add more constraints as we hit it. Eventually, an unknown
946 // constraint should just be treated as 'g'.
947 return false;
948 }
949 break;
950 case '[': {
951 unsigned Index = 0;
952 if (!resolveSymbolicName(Name, OutputConstraints, Index))
953 return false;
954
955 // If the constraint is already tied, it must be tied to the
956 // same operand referenced to by the number.
957 if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
958 return false;
959
960 // A number must refer to an output only operand.
961 if (OutputConstraints[Index].isReadWrite())
962 return false;
963
964 Info.setTiedOperand(Index, OutputConstraints[Index]);
965 break;
966 }
967 case '%': // commutative
968 // FIXME: Fail if % is used with the last operand.
969 break;
970 case 'i': // immediate integer.
971 break;
972 case 'n': // immediate integer with a known value.
974 break;
975 case 'I': // Various constant constraints with target-specific meanings.
976 case 'J':
977 case 'K':
978 case 'L':
979 case 'M':
980 case 'N':
981 case 'O':
982 case 'P':
983 if (!validateAsmConstraint(Name, Info))
984 return false;
985 break;
986 case 'r': // general register.
987 Info.setAllowsRegister();
988 break;
989 case 'm': // memory operand.
990 case 'o': // offsettable memory operand.
991 case 'V': // non-offsettable memory operand.
992 case '<': // autodecrement memory operand.
993 case '>': // autoincrement memory operand.
994 Info.setAllowsMemory();
995 break;
996 case 'g': // general register, memory operand or immediate integer.
997 case 'X': // any operand.
998 Info.setAllowsRegister();
999 Info.setAllowsMemory();
1000 break;
1001 case 'E': // immediate floating point.
1002 case 'F': // immediate floating point.
1003 case 'p': // address operand.
1004 break;
1005 case ',': // multiple alternative constraint. Ignore comma.
1006 break;
1007 case '#': // Ignore as constraint.
1008 while (Name[1] && Name[1] != ',')
1009 Name++;
1010 break;
1011 case '?': // Disparage slightly code.
1012 case '!': // Disparage severely.
1013 case '*': // Ignore for choosing register preferences.
1014 break; // Pass them.
1015 }
1016
1017 Name++;
1018 }
1019
1020 return true;
1021}
1022
1023bool TargetInfo::validatePointerAuthKey(const llvm::APSInt &value) const {
1024 return false;
1025}
1026
1027void TargetInfo::CheckFixedPointBits() const {
1028 // Check that the number of fractional and integral bits (and maybe sign) can
1029 // fit into the bits given for a fixed point type.
1031 assert(AccumScale + getAccumIBits() + 1 <= AccumWidth);
1038
1039 assert(getShortFractScale() + 1 <= ShortFractWidth);
1040 assert(getFractScale() + 1 <= FractWidth);
1041 assert(getLongFractScale() + 1 <= LongFractWidth);
1043 assert(getUnsignedFractScale() <= FractWidth);
1045
1046 // Each unsigned fract type has either the same number of fractional bits
1047 // as, or one more fractional bit than, its corresponding signed fract type.
1050 assert(getFractScale() == getUnsignedFractScale() ||
1054
1055 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
1056 // fractional bits is nondecreasing for each of the following sets of
1057 // fixed-point types:
1058 // - signed fract types
1059 // - unsigned fract types
1060 // - signed accum types
1061 // - unsigned accum types.
1062 assert(getLongFractScale() >= getFractScale() &&
1069
1070 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
1071 // integral bits is nondecreasing for each of the following sets of
1072 // fixed-point types:
1073 // - signed accum types
1074 // - unsigned accum types
1075 assert(getLongAccumIBits() >= getAccumIBits() &&
1079
1080 // Each signed accum type has at least as many integral bits as its
1081 // corresponding unsigned accum type.
1083 assert(getAccumIBits() >= getUnsignedAccumIBits());
1085}
1086
1088 auto *Target = static_cast<TransferrableTargetInfo*>(this);
1089 auto *Src = static_cast<const TransferrableTargetInfo*>(Aux);
1090 *Target = *Src;
1091}
1092
1093std::string
1095 SmallVectorImpl<ConstraintInfo> *OutCons) const {
1096 std::string Result;
1097
1098 // Stop at '\0' to match the old behavior.
1099 Constraint = Constraint.split('\0').first;
1100
1101 for (const char *I = Constraint.begin(), *E = Constraint.end(); I < E; I++) {
1102 switch (*I) {
1103 default:
1105 break;
1106 // Ignore these
1107 case '*':
1108 case '?':
1109 case '!':
1110 case '=': // Will see this and the following in mult-alt constraints.
1111 case '+':
1112 break;
1113 case '#': // Ignore the rest of the constraint alternative.
1114 while (I + 1 != E && I[1] != ',')
1115 I++;
1116 break;
1117 case '&':
1118 case '%':
1119 Result += *I;
1120 while (I + 1 != E && I[1] == *I)
1121 I++;
1122 break;
1123 case ',':
1124 Result += "|";
1125 break;
1126 case 'g':
1127 Result += "imr";
1128 break;
1129 case '[': {
1130 assert(OutCons &&
1131 "Must pass output names to constraints with a symbolic name");
1132 unsigned Index;
1133 bool ResolveResult = resolveSymbolicName(I, *OutCons, Index);
1134 assert(ResolveResult && "Could not resolve symbolic name");
1135 (void)ResolveResult;
1136 Result += llvm::utostr(Index);
1137 break;
1138 }
1139 }
1140 }
1141 return Result;
1142}
1143
1144unsigned clang::Microsoft64BitMinGlobalAlign(uint64_t TypeSize) {
1145 // MSVC does size based alignment for arm64 based on alignment section in
1146 // below document. Replicate that to keep alignment consistent with object
1147 // files compiled by MSVC.
1148 // https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
1149 // The same is done for x64, but not documented.
1150
1151 if (TypeSize >= 512) // TypeSize >= 64 bytes
1152 return 128; // align type at least 16 bytes
1153 if (TypeSize >= 64) // TypeSize >= 8 bytes
1154 return 64; // align type at least 8 bytes
1155 if (TypeSize >= 16) // TypeSize >= 2 bytes
1156 return 32; // align type at least 4 bytes
1157
1158 return 0;
1159}
Provides definitions for the various language-specific address spaces.
Defines the Diagnostic-related interfaces.
static StringRef removeGCCRegisterPrefix(StringRef Name)
static constexpr LangASMap DefaultAddrSpaceMap
static constexpr LangASMap FakeAddrSpaceMap
Defines the clang::LangOptions interface.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:234
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
The type of a lookup table which maps from language-specific address spaces to target-specific ones.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isCompatibleWith(ClangABI Version) const
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
virtual bool validatePointerAuthKey(const llvm::APSInt &value) const
Determine whether the given pointer-authentication key is valid.
unsigned getUnsignedLongFractScale() const
getUnsignedLongFractScale - Return the number of fractional bits in a 'unsigned long _Fract' type.
Definition TargetInfo.h:676
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
virtual ~TargetInfo()
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
void copyAuxTarget(const TargetInfo *Aux)
Copy type and layout related info.
TargetInfo(const llvm::Triple &T)
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection return.
unsigned getShortWidth() const
getShortWidth/Align - Return the size of 'signed short' and 'unsigned short' for this target,...
Definition TargetInfo.h:531
unsigned getUnsignedAccumScale() const
getUnsignedAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned _Accum' ty...
Definition TargetInfo.h:630
unsigned getIntAlign() const
Definition TargetInfo.h:537
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
unsigned getUnsignedAccumIBits() const
Definition TargetInfo.h:633
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
const LangASMap * AddrSpaceMap
Definition TargetInfo.h:259
const char * UserLabelPrefix
Definition TargetInfo.h:254
bool HasMicrosoftRecordLayout
Definition TargetInfo.h:300
unsigned getUnsignedFractScale() const
getUnsignedFractScale - Return the number of fractional bits in a 'unsigned _Fract' type.
Definition TargetInfo.h:670
virtual bool checkCFBranchLabelSchemeSupported(const CFBranchLabelSchemeKind Scheme, DiagnosticsEngine &Diags) const
unsigned getLongAlign() const
Definition TargetInfo.h:542
unsigned HasAMDGPUTypes
Definition TargetInfo.h:290
virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
unsigned getLongLongAlign() const
Definition TargetInfo.h:547
virtual bool hasFeatureEnabled(const llvm::StringMap< bool > &Features, StringRef Name) const
Check if target has a given feature enabled.
virtual CFBranchLabelSchemeKind getDefaultCFBranchLabelScheme() const
Get the target default CFBranchLabelScheme scheme.
unsigned char RegParmMax
Definition TargetInfo.h:256
virtual ArrayRef< const char * > getGCCRegNames() const =0
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
virtual bool emitVectorDeletingDtors(const LangOptions &) const
Controls whether to emit MSVC vector deleting destructors.
unsigned getLongFractScale() const
getLongFractScale - Return the number of fractional bits in a 'signed long _Fract' type.
Definition TargetInfo.h:659
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
std::optional< unsigned > MaxBitIntWidth
Definition TargetInfo.h:296
virtual void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const
Enable or disable a specific target feature; the feature name must be valid.
unsigned getAccumIBits() const
Definition TargetInfo.h:608
virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const
std::string simplifyConstraint(StringRef Constraint, SmallVectorImpl< ConstraintInfo > *OutCons=nullptr) const
VersionTuple PlatformMinVersion
Definition TargetInfo.h:262
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target,...
Definition TargetInfo.h:536
const char * MCountName
Definition TargetInfo.h:255
unsigned getShortAccumIBits() const
Definition TargetInfo.h:601
unsigned HasBuiltinZOSVaList
Definition TargetInfo.h:275
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
Definition TargetInfo.h:785
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
unsigned getLongAccumIBits() const
Definition TargetInfo.h:613
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
Definition TargetInfo.h:780
unsigned char SSERegParmMax
Definition TargetInfo.h:256
unsigned HasUnalignedAccess
Definition TargetInfo.h:287
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux)
Set forced language options.
unsigned char MaxAtomicPromoteWidth
Definition TargetInfo.h:252
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
unsigned getCharAlign() const
Definition TargetInfo.h:527
unsigned RealTypeUsesObjCFPRetMask
Definition TargetInfo.h:267
unsigned MaxOpenCLWorkGroupSize
Definition TargetInfo.h:294
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
Definition TargetInfo.h:546
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
llvm::StringMap< bool > & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.
StringRef PlatformName
Definition TargetInfo.h:261
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition TargetInfo.h:391
void resetDataLayout()
Set the data layout based on current triple and ABI.
virtual void setDependentOpenCLOpts()
Set features that depend on other features.
unsigned ComplexLongDoubleUsesFP2Ret
Definition TargetInfo.h:269
virtual bool hasIbm128Type() const
Determine whether the __ibm128 type is supported on this target.
Definition TargetInfo.h:726
unsigned getUnsignedShortAccumIBits() const
Definition TargetInfo.h:622
std::string DataLayoutString
Definition TargetInfo.h:253
unsigned getUnsignedLongAccumScale() const
getUnsignedLongAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned long _...
Definition TargetInfo.h:640
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition TargetInfo.h:711
unsigned getUnsignedLongAccumIBits() const
Definition TargetInfo.h:643
unsigned getUnsignedShortFractScale() const
getUnsignedShortFractScale - Return the number of fractional bits in a 'unsigned short _Fract' type.
Definition TargetInfo.h:663
unsigned HasAlignMac68kSupport
Definition TargetInfo.h:265
const llvm::fltSemantics & getLongDoubleFormat() const
Definition TargetInfo.h:803
bool validateOutputConstraint(ConstraintInfo &Info) const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
Definition TargetInfo.h:795
virtual bool checkArithmeticFenceSupported() const
Controls if __arithmetic_fence is supported in the targeted backend.
virtual StringRef getABI() const
Get the ABI currently in use.
virtual size_t getMaxBitIntWidth() const
unsigned HasAArch64ACLETypes
Definition TargetInfo.h:278
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
unsigned getCharWidth() const
Definition TargetInfo.h:526
unsigned HasRISCVVTypes
Definition TargetInfo.h:281
virtual ParsedTargetAttr parseTargetAttr(StringRef Str) const
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
Definition TargetInfo.h:541
unsigned getFractScale() const
getFractScale - Return the number of fractional bits in a 'signed _Fract' type.
Definition TargetInfo.h:655
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
virtual std::string convertConstraint(const char *&Constraint) const
unsigned char MaxAtomicInlineWidth
Definition TargetInfo.h:252
unsigned AllowAMDGPUUnsafeFPAtomics
Definition TargetInfo.h:284
unsigned getShortFractScale() const
getShortFractScale - Return the number of fractional bits in a 'signed short _Fract' type.
Definition TargetInfo.h:651
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition TargetInfo.h:505
TargetCXXABI TheCXXABI
Definition TargetInfo.h:257
unsigned ARMCDECoprocMask
Definition TargetInfo.h:292
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
unsigned getUnsignedShortAccumScale() const
getUnsignedShortAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned short...
Definition TargetInfo.h:619
unsigned HasBuiltinMSVaList
Definition TargetInfo.h:272
virtual VTableUniquenessKind getVTableUniqueness() const
Returns whether the target's ABI guarantees that a class's vtable has a unique address program-wide.
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
unsigned getShortAlign() const
Definition TargetInfo.h:532
virtual bool callGlobalDeleteInDeletingDtor(const LangOptions &) const
Controls whether global operator delete is called by the deleting destructor or at the point where de...
virtual bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Defines the clang::TargetInfo interface.
Top level wrappers for InstallAPI frontend operations.
VTableUniquenessKind
A target's ABI policy for whether a class's vtable can be assumed to have a unique address program-wi...
@ AlwaysUnique
Every vtable has a single address program-wide.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
OpenCLTypeKind
OpenCL type kinds.
Definition TargetInfo.h:212
@ OCLTK_Image
Definition TargetInfo.h:216
@ OCLTK_Sampler
Definition TargetInfo.h:220
@ OCLTK_Pipe
Definition TargetInfo.h:217
unsigned Microsoft64BitMinGlobalAlign(uint64_t TypeSize)
@ Result
The result type of a method or function.
Definition TypeBase.h:906
const FunctionProtoType * T
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
Definition CharInfo.h:114
LangAS
Defines the address space values used by the address space qualifier of QualType.
static const char * getCFBranchLabelSchemeFlagVal(const CFBranchLabelSchemeKind Scheme)
FloatModeKind
Definition TargetInfo.h:74
Contains information gathered from parsing the contents of TargetAttr.
Definition TargetInfo.h:59
const std::string & getConstraintStr() const
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand.
void setRequiresImmediate(int Min, int Max)
Fields controlling how types are laid out in memory; these may need to be copied for targets like AMD...
Definition TargetInfo.h:88
const llvm::fltSemantics * DoubleFormat
Definition TargetInfo.h:143
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition TargetInfo.h:187
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition TargetInfo.h:196
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition TargetInfo.h:146
const llvm::fltSemantics * LongDoubleFormat
Definition TargetInfo.h:143
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield,...
Definition TargetInfo.h:200
const llvm::fltSemantics * Float128Format
Definition TargetInfo.h:143
unsigned LargestOverSizedBitfieldContainer
The largest container size which should be used for an over-sized bitfield, in bits.
Definition TargetInfo.h:204
unsigned UseLeadingZeroLengthBitfield
Whether zero length bitfield alignment is respected if they are the leading members.
Definition TargetInfo.h:192
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition TargetInfo.h:178
unsigned MaxAlignedAttribute
If non-zero, specifies a maximum alignment to truncate alignment specified in the aligned attribute o...
Definition TargetInfo.h:208
const llvm::fltSemantics * Ibm128Format
Definition TargetInfo.h:143
const llvm::fltSemantics * FloatFormat
Definition TargetInfo.h:142
const llvm::fltSemantics * HalfFormat
Definition TargetInfo.h:142
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
Definition TargetInfo.h:170
unsigned char DefaultAlignForAttributeAligned
Definition TargetInfo.h:133