1 //===--- TargetInfo.cpp - Information about Target machine ----------------===//
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
7 //===----------------------------------------------------------------------===//
9 // This file implements the TargetInfo and TargetInfoImpl interfaces.
11 //===----------------------------------------------------------------------===//
13 #include "clang/Basic/TargetInfo.h"
14 #include "clang/Basic/AddressSpaces.h"
15 #include "clang/Basic/CharInfo.h"
16 #include "clang/Basic/Diagnostic.h"
17 #include "clang/Basic/LangOptions.h"
18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/IR/DataLayout.h"
21 #include "llvm/Support/ErrorHandling.h"
22 #include "llvm/Support/TargetParser.h"
24 using namespace clang;
26 static const LangASMap DefaultAddrSpaceMap = {0};
28 // TargetInfo Constructor.
29 TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) {
30 // Set defaults. Defaults are set for a 32-bit RISC platform, like PPC or
31 // SPARC. These should be overridden by concrete targets as needed.
32 BigEndian = !T.isLittleEndian();
35 NoAsmVariants = false;
36 HasLegalHalfType = false;
39 PointerWidth = PointerAlign = 32;
40 BoolWidth = BoolAlign = 8;
41 IntWidth = IntAlign = 32;
42 LongWidth = LongAlign = 32;
43 LongLongWidth = LongLongAlign = 64;
45 // Fixed point default bit widths
46 ShortAccumWidth = ShortAccumAlign = 16;
47 AccumWidth = AccumAlign = 32;
48 LongAccumWidth = LongAccumAlign = 64;
49 ShortFractWidth = ShortFractAlign = 8;
50 FractWidth = FractAlign = 16;
51 LongFractWidth = LongFractAlign = 32;
53 // Fixed point default integral and fractional bit sizes
54 // We give the _Accum 1 fewer fractional bits than their corresponding _Fract
55 // types by default to have the same number of fractional bits between _Accum
57 PaddingOnUnsignedFixedPoint = false;
63 DefaultAlignForAttributeAligned = 128;
65 // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
66 // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
67 // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
68 // This alignment guarantee also applies to Windows and Android.
69 if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
70 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
72 NewAlign = 0; // Infer from basic type alignment.
82 LargeArrayMinWidth = 0;
84 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
88 SizeType = UnsignedLong;
89 PtrDiffType = SignedLong;
90 IntMaxType = SignedLongLong;
91 IntPtrType = SignedLong;
92 WCharType = SignedInt;
94 Char16Type = UnsignedShort;
95 Char32Type = UnsignedInt;
96 Int64Type = SignedLongLong;
97 SigAtomicType = SignedInt;
98 ProcessIDType = SignedInt;
99 UseSignedCharForObjCBool = true;
100 UseBitFieldTypeAlignment = true;
101 UseZeroLengthBitfieldAlignment = false;
102 UseExplicitBitFieldAlignment = true;
103 ZeroLengthBitfieldBoundary = 0;
104 HalfFormat = &llvm::APFloat::IEEEhalf();
105 FloatFormat = &llvm::APFloat::IEEEsingle();
106 DoubleFormat = &llvm::APFloat::IEEEdouble();
107 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
108 Float128Format = &llvm::APFloat::IEEEquad();
109 MCountName = "mcount";
112 HasAlignMac68kSupport = false;
113 HasBuiltinMSVaList = false;
114 IsRenderScriptTarget = false;
115 HasAArch64SVETypes = false;
117 // Default to no types using fpret.
118 RealTypeUsesObjCFPRet = 0;
120 // Default to not using fp2ret for __Complex long double
121 ComplexLongDoubleUsesFP2Ret = false;
123 // Set the C++ ABI based on the triple.
124 TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
125 ? TargetCXXABI::Microsoft
126 : TargetCXXABI::GenericItanium);
128 // Default to an empty address space map.
129 AddrSpaceMap = &DefaultAddrSpaceMap;
130 UseAddrSpaceMapMangling = false;
132 // Default to an unknown platform name.
133 PlatformName = "unknown";
134 PlatformMinVersion = VersionTuple();
137 // Out of line virtual dtor for TargetInfo.
138 TargetInfo::~TargetInfo() {}
140 void TargetInfo::resetDataLayout(StringRef DL) {
141 DataLayout.reset(new llvm::DataLayout(DL));
145 TargetInfo::checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const {
146 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=branch";
151 TargetInfo::checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const {
152 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=return";
156 /// getTypeName - Return the user string for the specified integer type enum.
157 /// For example, SignedShort -> "short".
158 const char *TargetInfo::getTypeName(IntType T) {
160 default: llvm_unreachable("not an integer!");
161 case SignedChar: return "signed char";
162 case UnsignedChar: return "unsigned char";
163 case SignedShort: return "short";
164 case UnsignedShort: return "unsigned short";
165 case SignedInt: return "int";
166 case UnsignedInt: return "unsigned int";
167 case SignedLong: return "long int";
168 case UnsignedLong: return "long unsigned int";
169 case SignedLongLong: return "long long int";
170 case UnsignedLongLong: return "long long unsigned int";
174 /// getTypeConstantSuffix - Return the constant suffix for the specified
175 /// integer type enum. For example, SignedLong -> "L".
176 const char *TargetInfo::getTypeConstantSuffix(IntType T) const {
178 default: llvm_unreachable("not an integer!");
181 case SignedInt: return "";
182 case SignedLong: return "L";
183 case SignedLongLong: return "LL";
185 if (getCharWidth() < getIntWidth())
189 if (getShortWidth() < getIntWidth())
192 case UnsignedInt: return "U";
193 case UnsignedLong: return "UL";
194 case UnsignedLongLong: return "ULL";
198 /// getTypeFormatModifier - Return the printf format modifier for the
199 /// specified integer type enum. For example, SignedLong -> "l".
201 const char *TargetInfo::getTypeFormatModifier(IntType T) {
203 default: llvm_unreachable("not an integer!");
205 case UnsignedChar: return "hh";
207 case UnsignedShort: return "h";
209 case UnsignedInt: return "";
211 case UnsignedLong: return "l";
213 case UnsignedLongLong: return "ll";
217 /// getTypeWidth - Return the width (in bits) of the specified integer type
218 /// enum. For example, SignedInt -> getIntWidth().
219 unsigned TargetInfo::getTypeWidth(IntType T) const {
221 default: llvm_unreachable("not an integer!");
223 case UnsignedChar: return getCharWidth();
225 case UnsignedShort: return getShortWidth();
227 case UnsignedInt: return getIntWidth();
229 case UnsignedLong: return getLongWidth();
231 case UnsignedLongLong: return getLongLongWidth();
235 TargetInfo::IntType TargetInfo::getIntTypeByWidth(
236 unsigned BitWidth, bool IsSigned) const {
237 if (getCharWidth() == BitWidth)
238 return IsSigned ? SignedChar : UnsignedChar;
239 if (getShortWidth() == BitWidth)
240 return IsSigned ? SignedShort : UnsignedShort;
241 if (getIntWidth() == BitWidth)
242 return IsSigned ? SignedInt : UnsignedInt;
243 if (getLongWidth() == BitWidth)
244 return IsSigned ? SignedLong : UnsignedLong;
245 if (getLongLongWidth() == BitWidth)
246 return IsSigned ? SignedLongLong : UnsignedLongLong;
250 TargetInfo::IntType TargetInfo::getLeastIntTypeByWidth(unsigned BitWidth,
251 bool IsSigned) const {
252 if (getCharWidth() >= BitWidth)
253 return IsSigned ? SignedChar : UnsignedChar;
254 if (getShortWidth() >= BitWidth)
255 return IsSigned ? SignedShort : UnsignedShort;
256 if (getIntWidth() >= BitWidth)
257 return IsSigned ? SignedInt : UnsignedInt;
258 if (getLongWidth() >= BitWidth)
259 return IsSigned ? SignedLong : UnsignedLong;
260 if (getLongLongWidth() >= BitWidth)
261 return IsSigned ? SignedLongLong : UnsignedLongLong;
265 TargetInfo::RealType TargetInfo::getRealTypeByWidth(unsigned BitWidth) const {
266 if (getFloatWidth() == BitWidth)
268 if (getDoubleWidth() == BitWidth)
273 if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended())
277 if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
278 &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
280 if (hasFloat128Type())
288 /// getTypeAlign - Return the alignment (in bits) of the specified integer type
289 /// enum. For example, SignedInt -> getIntAlign().
290 unsigned TargetInfo::getTypeAlign(IntType T) const {
292 default: llvm_unreachable("not an integer!");
294 case UnsignedChar: return getCharAlign();
296 case UnsignedShort: return getShortAlign();
298 case UnsignedInt: return getIntAlign();
300 case UnsignedLong: return getLongAlign();
302 case UnsignedLongLong: return getLongLongAlign();
306 /// isTypeSigned - Return whether an integer types is signed. Returns true if
307 /// the type is signed; false otherwise.
308 bool TargetInfo::isTypeSigned(IntType T) {
310 default: llvm_unreachable("not an integer!");
321 case UnsignedLongLong:
326 /// adjust - Set forced language options.
327 /// Apply changes to the target information with respect to certain
328 /// language options which change the target configuration and adjust
329 /// the language based on the target options where applicable.
330 void TargetInfo::adjust(LangOptions &Opts) {
331 if (Opts.NoBitFieldTypeAlign)
332 UseBitFieldTypeAlignment = false;
334 switch (Opts.WCharSize) {
335 default: llvm_unreachable("invalid wchar_t width");
337 case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
338 case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
339 case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
342 if (Opts.AlignDouble) {
343 DoubleAlign = LongLongAlign = 64;
344 LongDoubleAlign = 64;
348 // OpenCL C requires specific widths for types, irrespective of
349 // what these normally are for the target.
350 // We also define long long and long double here, although the
351 // OpenCL standard only mentions these as "reserved".
352 IntWidth = IntAlign = 32;
353 LongWidth = LongAlign = 64;
354 LongLongWidth = LongLongAlign = 128;
355 HalfWidth = HalfAlign = 16;
356 FloatWidth = FloatAlign = 32;
358 // Embedded 32-bit targets (OpenCL EP) might have double C type
359 // defined as float. Let's not override this as it might lead
360 // to generating illegal code that uses 64bit doubles.
361 if (DoubleWidth != FloatWidth) {
362 DoubleWidth = DoubleAlign = 64;
363 DoubleFormat = &llvm::APFloat::IEEEdouble();
365 LongDoubleWidth = LongDoubleAlign = 128;
367 unsigned MaxPointerWidth = getMaxPointerWidth();
368 assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
369 bool Is32BitArch = MaxPointerWidth == 32;
370 SizeType = Is32BitArch ? UnsignedInt : UnsignedLong;
371 PtrDiffType = Is32BitArch ? SignedInt : SignedLong;
372 IntPtrType = Is32BitArch ? SignedInt : SignedLong;
374 IntMaxType = SignedLongLong;
375 Int64Type = SignedLong;
377 HalfFormat = &llvm::APFloat::IEEEhalf();
378 FloatFormat = &llvm::APFloat::IEEEsingle();
379 LongDoubleFormat = &llvm::APFloat::IEEEquad();
382 if (Opts.LongDoubleSize) {
383 if (Opts.LongDoubleSize == DoubleWidth) {
384 LongDoubleWidth = DoubleWidth;
385 LongDoubleAlign = DoubleAlign;
386 LongDoubleFormat = DoubleFormat;
387 } else if (Opts.LongDoubleSize == 128) {
388 LongDoubleWidth = LongDoubleAlign = 128;
389 LongDoubleFormat = &llvm::APFloat::IEEEquad();
393 if (Opts.NewAlignOverride)
394 NewAlign = Opts.NewAlignOverride * getCharWidth();
396 // Each unsigned fixed point type has the same number of fractional bits as
397 // its corresponding signed type.
398 PaddingOnUnsignedFixedPoint |= Opts.PaddingOnUnsignedFixedPoint;
399 CheckFixedPointBits();
402 bool TargetInfo::initFeatureMap(
403 llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
404 const std::vector<std::string> &FeatureVec) const {
405 for (const auto &F : FeatureVec) {
407 // Apply the feature via the target.
408 bool Enabled = Name[0] == '+';
409 setFeatureEnabled(Features, Name.substr(1), Enabled);
414 TargetInfo::CallingConvKind
415 TargetInfo::getCallingConvKind(bool ClangABICompat4) const {
416 if (getCXXABI() != TargetCXXABI::Microsoft &&
417 (ClangABICompat4 || getTriple().getOS() == llvm::Triple::PS4))
418 return CCK_ClangABI4OrPS4;
422 LangAS TargetInfo::getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const {
426 return LangAS::opencl_global;
429 return LangAS::opencl_constant;
432 return LangAS::Default;
436 //===----------------------------------------------------------------------===//
439 static StringRef removeGCCRegisterPrefix(StringRef Name) {
440 if (Name[0] == '%' || Name[0] == '#')
441 Name = Name.substr(1);
446 /// isValidClobber - Returns whether the passed in string is
447 /// a valid clobber in an inline asm statement. This is used by
449 bool TargetInfo::isValidClobber(StringRef Name) const {
450 return (isValidGCCRegisterName(Name) ||
451 Name == "memory" || Name == "cc");
454 /// isValidGCCRegisterName - Returns whether the passed in string
455 /// is a valid register name according to GCC. This is used by Sema for
456 /// inline asm statements.
457 bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
461 // Get rid of any register prefix.
462 Name = removeGCCRegisterPrefix(Name);
466 ArrayRef<const char *> Names = getGCCRegNames();
468 // If we have a number it maps to an entry in the register name array.
469 if (isDigit(Name[0])) {
471 if (!Name.getAsInteger(0, n))
472 return n < Names.size();
475 // Check register names.
476 if (llvm::is_contained(Names, Name))
479 // Check any additional names that we have.
480 for (const AddlRegName &ARN : getGCCAddlRegNames())
481 for (const char *AN : ARN.Names) {
484 // Make sure the register that the additional name is for is within
485 // the bounds of the register names from above.
486 if (AN == Name && ARN.RegNum < Names.size())
490 // Now check aliases.
491 for (const GCCRegAlias &GRA : getGCCRegAliases())
492 for (const char *A : GRA.Aliases) {
502 StringRef TargetInfo::getNormalizedGCCRegisterName(StringRef Name,
503 bool ReturnCanonical) const {
504 assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
506 // Get rid of any register prefix.
507 Name = removeGCCRegisterPrefix(Name);
509 ArrayRef<const char *> Names = getGCCRegNames();
511 // First, check if we have a number.
512 if (isDigit(Name[0])) {
514 if (!Name.getAsInteger(0, n)) {
515 assert(n < Names.size() && "Out of bounds register number!");
520 // Check any additional names that we have.
521 for (const AddlRegName &ARN : getGCCAddlRegNames())
522 for (const char *AN : ARN.Names) {
525 // Make sure the register that the additional name is for is within
526 // the bounds of the register names from above.
527 if (AN == Name && ARN.RegNum < Names.size())
528 return ReturnCanonical ? Names[ARN.RegNum] : Name;
531 // Now check aliases.
532 for (const GCCRegAlias &RA : getGCCRegAliases())
533 for (const char *A : RA.Aliases) {
543 bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
544 const char *Name = Info.getConstraintStr().c_str();
545 // An output constraint must start with '=' or '+'
546 if (*Name != '=' && *Name != '+')
550 Info.setIsReadWrite();
556 if (!validateAsmConstraint(Name, Info)) {
557 // FIXME: We temporarily return false
558 // so we can add more constraints as we hit it.
559 // Eventually, an unknown constraint should just be treated as 'g'.
563 case '&': // early clobber.
564 Info.setEarlyClobber();
566 case '%': // commutative.
567 // FIXME: Check that there is a another register after this one.
569 case 'r': // general register.
570 Info.setAllowsRegister();
572 case 'm': // memory operand.
573 case 'o': // offsetable memory operand.
574 case 'V': // non-offsetable memory operand.
575 case '<': // autodecrement memory operand.
576 case '>': // autoincrement memory operand.
577 Info.setAllowsMemory();
579 case 'g': // general register, memory operand or immediate integer.
580 case 'X': // any operand.
581 Info.setAllowsRegister();
582 Info.setAllowsMemory();
584 case ',': // multiple alternative constraint. Pass it.
585 // Handle additional optional '=' or '+' modifiers.
586 if (Name[1] == '=' || Name[1] == '+')
589 case '#': // Ignore as constraint.
590 while (Name[1] && Name[1] != ',')
593 case '?': // Disparage slightly code.
594 case '!': // Disparage severely.
595 case '*': // Ignore for choosing register preferences.
596 case 'i': // Ignore i,n,E,F as output constraints (match from the other
607 // Early clobber with a read-write constraint which doesn't permit registers
609 if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister())
612 // If a constraint allows neither memory nor register operands it contains
613 // only modifiers. Reject it.
614 return Info.allowsMemory() || Info.allowsRegister();
617 bool TargetInfo::resolveSymbolicName(const char *&Name,
618 ArrayRef<ConstraintInfo> OutputConstraints,
619 unsigned &Index) const {
620 assert(*Name == '[' && "Symbolic name did not start with '['");
622 const char *Start = Name;
623 while (*Name && *Name != ']')
631 std::string SymbolicName(Start, Name - Start);
633 for (Index = 0; Index != OutputConstraints.size(); ++Index)
634 if (SymbolicName == OutputConstraints[Index].getName())
640 bool TargetInfo::validateInputConstraint(
641 MutableArrayRef<ConstraintInfo> OutputConstraints,
642 ConstraintInfo &Info) const {
643 const char *Name = Info.ConstraintStr.c_str();
651 // Check if we have a matching constraint
652 if (*Name >= '0' && *Name <= '9') {
653 const char *DigitStart = Name;
654 while (Name[1] >= '0' && Name[1] <= '9')
656 const char *DigitEnd = Name;
658 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
659 .getAsInteger(10, i))
662 // Check if matching constraint is out of bounds.
663 if (i >= OutputConstraints.size()) return false;
665 // A number must refer to an output only operand.
666 if (OutputConstraints[i].isReadWrite())
669 // If the constraint is already tied, it must be tied to the
670 // same operand referenced to by the number.
671 if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
674 // The constraint should have the same info as the respective
675 // output constraint.
676 Info.setTiedOperand(i, OutputConstraints[i]);
677 } else if (!validateAsmConstraint(Name, Info)) {
678 // FIXME: This error return is in place temporarily so we can
679 // add more constraints as we hit it. Eventually, an unknown
680 // constraint should just be treated as 'g'.
686 if (!resolveSymbolicName(Name, OutputConstraints, Index))
689 // If the constraint is already tied, it must be tied to the
690 // same operand referenced to by the number.
691 if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
694 // A number must refer to an output only operand.
695 if (OutputConstraints[Index].isReadWrite())
698 Info.setTiedOperand(Index, OutputConstraints[Index]);
701 case '%': // commutative
702 // FIXME: Fail if % is used with the last operand.
704 case 'i': // immediate integer.
706 case 'n': // immediate integer with a known value.
707 Info.setRequiresImmediate();
709 case 'I': // Various constant constraints with target-specific meanings.
717 if (!validateAsmConstraint(Name, Info))
720 case 'r': // general register.
721 Info.setAllowsRegister();
723 case 'm': // memory operand.
724 case 'o': // offsettable memory operand.
725 case 'V': // non-offsettable memory operand.
726 case '<': // autodecrement memory operand.
727 case '>': // autoincrement memory operand.
728 Info.setAllowsMemory();
730 case 'g': // general register, memory operand or immediate integer.
731 case 'X': // any operand.
732 Info.setAllowsRegister();
733 Info.setAllowsMemory();
735 case 'E': // immediate floating point.
736 case 'F': // immediate floating point.
737 case 'p': // address operand.
739 case ',': // multiple alternative constraint. Ignore comma.
741 case '#': // Ignore as constraint.
742 while (Name[1] && Name[1] != ',')
745 case '?': // Disparage slightly code.
746 case '!': // Disparage severely.
747 case '*': // Ignore for choosing register preferences.
757 void TargetInfo::CheckFixedPointBits() const {
758 // Check that the number of fractional and integral bits (and maybe sign) can
759 // fit into the bits given for a fixed point type.
760 assert(ShortAccumScale + getShortAccumIBits() + 1 <= ShortAccumWidth);
761 assert(AccumScale + getAccumIBits() + 1 <= AccumWidth);
762 assert(LongAccumScale + getLongAccumIBits() + 1 <= LongAccumWidth);
763 assert(getUnsignedShortAccumScale() + getUnsignedShortAccumIBits() <=
765 assert(getUnsignedAccumScale() + getUnsignedAccumIBits() <= AccumWidth);
766 assert(getUnsignedLongAccumScale() + getUnsignedLongAccumIBits() <=
769 assert(getShortFractScale() + 1 <= ShortFractWidth);
770 assert(getFractScale() + 1 <= FractWidth);
771 assert(getLongFractScale() + 1 <= LongFractWidth);
772 assert(getUnsignedShortFractScale() <= ShortFractWidth);
773 assert(getUnsignedFractScale() <= FractWidth);
774 assert(getUnsignedLongFractScale() <= LongFractWidth);
776 // Each unsigned fract type has either the same number of fractional bits
777 // as, or one more fractional bit than, its corresponding signed fract type.
778 assert(getShortFractScale() == getUnsignedShortFractScale() ||
779 getShortFractScale() == getUnsignedShortFractScale() - 1);
780 assert(getFractScale() == getUnsignedFractScale() ||
781 getFractScale() == getUnsignedFractScale() - 1);
782 assert(getLongFractScale() == getUnsignedLongFractScale() ||
783 getLongFractScale() == getUnsignedLongFractScale() - 1);
785 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
786 // fractional bits is nondecreasing for each of the following sets of
787 // fixed-point types:
788 // - signed fract types
789 // - unsigned fract types
790 // - signed accum types
791 // - unsigned accum types.
792 assert(getLongFractScale() >= getFractScale() &&
793 getFractScale() >= getShortFractScale());
794 assert(getUnsignedLongFractScale() >= getUnsignedFractScale() &&
795 getUnsignedFractScale() >= getUnsignedShortFractScale());
796 assert(LongAccumScale >= AccumScale && AccumScale >= ShortAccumScale);
797 assert(getUnsignedLongAccumScale() >= getUnsignedAccumScale() &&
798 getUnsignedAccumScale() >= getUnsignedShortAccumScale());
800 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
801 // integral bits is nondecreasing for each of the following sets of
802 // fixed-point types:
803 // - signed accum types
804 // - unsigned accum types
805 assert(getLongAccumIBits() >= getAccumIBits() &&
806 getAccumIBits() >= getShortAccumIBits());
807 assert(getUnsignedLongAccumIBits() >= getUnsignedAccumIBits() &&
808 getUnsignedAccumIBits() >= getUnsignedShortAccumIBits());
810 // Each signed accum type has at least as many integral bits as its
811 // corresponding unsigned accum type.
812 assert(getShortAccumIBits() >= getUnsignedShortAccumIBits());
813 assert(getAccumIBits() >= getUnsignedAccumIBits());
814 assert(getLongAccumIBits() >= getUnsignedLongAccumIBits());
817 void TargetInfo::copyAuxTarget(const TargetInfo *Aux) {
818 auto *Target = static_cast<TransferrableTargetInfo*>(this);
819 auto *Src = static_cast<const TransferrableTargetInfo*>(Aux);