1 //===--- TargetInfo.cpp - Information about Target machine ----------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements the TargetInfo and TargetInfoImpl interfaces. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "clang/Basic/TargetInfo.h" 15 #include "clang/Basic/AddressSpaces.h" 16 #include "clang/Basic/CharInfo.h" 17 #include "clang/Basic/Diagnostic.h" 18 #include "clang/Basic/LangOptions.h" 19 #include "llvm/ADT/APFloat.h" 20 #include "llvm/ADT/STLExtras.h" 21 #include "llvm/Support/ErrorHandling.h" 22 #include "llvm/Support/TargetParser.h" 23 #include <cstdlib> 24 using namespace clang; 25 26 static const LangASMap DefaultAddrSpaceMap = {0}; 27 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(); 33 TLSSupported = true; 34 VLASupported = true; 35 NoAsmVariants = false; 36 HasLegalHalfType = false; 37 HasFloat128 = false; 38 PointerWidth = PointerAlign = 32; 39 BoolWidth = BoolAlign = 8; 40 IntWidth = IntAlign = 32; 41 LongWidth = LongAlign = 32; 42 LongLongWidth = LongLongAlign = 64; 43 ShortAccumWidth = ShortAccumAlign = 16; 44 AccumWidth = AccumAlign = 32; 45 LongAccumWidth = LongAccumAlign = 64; 46 SuitableAlign = 64; 47 DefaultAlignForAttributeAligned = 128; 48 MinGlobalAlign = 0; 49 // From the glibc documentation, on GNU systems, malloc guarantees 16-byte 50 // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See 51 // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html 52 if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment()) 53 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0; 54 else 55 NewAlign = 0; // Infer from basic type alignment. 56 HalfWidth = 16; 57 HalfAlign = 16; 58 FloatWidth = 32; 59 FloatAlign = 32; 60 DoubleWidth = 64; 61 DoubleAlign = 64; 62 LongDoubleWidth = 64; 63 LongDoubleAlign = 64; 64 Float128Align = 128; 65 LargeArrayMinWidth = 0; 66 LargeArrayAlign = 0; 67 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0; 68 MaxVectorAlign = 0; 69 MaxTLSAlign = 0; 70 SimdDefaultAlign = 0; 71 SizeType = UnsignedLong; 72 PtrDiffType = SignedLong; 73 IntMaxType = SignedLongLong; 74 IntPtrType = SignedLong; 75 WCharType = SignedInt; 76 WIntType = SignedInt; 77 Char16Type = UnsignedShort; 78 Char32Type = UnsignedInt; 79 Int64Type = SignedLongLong; 80 SigAtomicType = SignedInt; 81 ProcessIDType = SignedInt; 82 UseSignedCharForObjCBool = true; 83 UseBitFieldTypeAlignment = true; 84 UseZeroLengthBitfieldAlignment = false; 85 UseExplicitBitFieldAlignment = true; 86 ZeroLengthBitfieldBoundary = 0; 87 HalfFormat = &llvm::APFloat::IEEEhalf(); 88 FloatFormat = &llvm::APFloat::IEEEsingle(); 89 DoubleFormat = &llvm::APFloat::IEEEdouble(); 90 LongDoubleFormat = &llvm::APFloat::IEEEdouble(); 91 Float128Format = &llvm::APFloat::IEEEquad(); 92 MCountName = "mcount"; 93 RegParmMax = 0; 94 SSERegParmMax = 0; 95 HasAlignMac68kSupport = false; 96 HasBuiltinMSVaList = false; 97 IsRenderScriptTarget = false; 98 99 // Default to no types using fpret. 100 RealTypeUsesObjCFPRet = 0; 101 102 // Default to not using fp2ret for __Complex long double 103 ComplexLongDoubleUsesFP2Ret = false; 104 105 // Set the C++ ABI based on the triple. 106 TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment() 107 ? TargetCXXABI::Microsoft 108 : TargetCXXABI::GenericItanium); 109 110 // Default to an empty address space map. 111 AddrSpaceMap = &DefaultAddrSpaceMap; 112 UseAddrSpaceMapMangling = false; 113 114 // Default to an unknown platform name. 115 PlatformName = "unknown"; 116 PlatformMinVersion = VersionTuple(); 117 } 118 119 // Out of line virtual dtor for TargetInfo. 120 TargetInfo::~TargetInfo() {} 121 122 bool 123 TargetInfo::checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const { 124 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=branch"; 125 return false; 126 } 127 128 bool 129 TargetInfo::checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const { 130 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=return"; 131 return false; 132 } 133 134 /// getTypeName - Return the user string for the specified integer type enum. 135 /// For example, SignedShort -> "short". 136 const char *TargetInfo::getTypeName(IntType T) { 137 switch (T) { 138 default: llvm_unreachable("not an integer!"); 139 case SignedChar: return "signed char"; 140 case UnsignedChar: return "unsigned char"; 141 case SignedShort: return "short"; 142 case UnsignedShort: return "unsigned short"; 143 case SignedInt: return "int"; 144 case UnsignedInt: return "unsigned int"; 145 case SignedLong: return "long int"; 146 case UnsignedLong: return "long unsigned int"; 147 case SignedLongLong: return "long long int"; 148 case UnsignedLongLong: return "long long unsigned int"; 149 } 150 } 151 152 /// getTypeConstantSuffix - Return the constant suffix for the specified 153 /// integer type enum. For example, SignedLong -> "L". 154 const char *TargetInfo::getTypeConstantSuffix(IntType T) const { 155 switch (T) { 156 default: llvm_unreachable("not an integer!"); 157 case SignedChar: 158 case SignedShort: 159 case SignedInt: return ""; 160 case SignedLong: return "L"; 161 case SignedLongLong: return "LL"; 162 case UnsignedChar: 163 if (getCharWidth() < getIntWidth()) 164 return ""; 165 LLVM_FALLTHROUGH; 166 case UnsignedShort: 167 if (getShortWidth() < getIntWidth()) 168 return ""; 169 LLVM_FALLTHROUGH; 170 case UnsignedInt: return "U"; 171 case UnsignedLong: return "UL"; 172 case UnsignedLongLong: return "ULL"; 173 } 174 } 175 176 /// getTypeFormatModifier - Return the printf format modifier for the 177 /// specified integer type enum. For example, SignedLong -> "l". 178 179 const char *TargetInfo::getTypeFormatModifier(IntType T) { 180 switch (T) { 181 default: llvm_unreachable("not an integer!"); 182 case SignedChar: 183 case UnsignedChar: return "hh"; 184 case SignedShort: 185 case UnsignedShort: return "h"; 186 case SignedInt: 187 case UnsignedInt: return ""; 188 case SignedLong: 189 case UnsignedLong: return "l"; 190 case SignedLongLong: 191 case UnsignedLongLong: return "ll"; 192 } 193 } 194 195 /// getTypeWidth - Return the width (in bits) of the specified integer type 196 /// enum. For example, SignedInt -> getIntWidth(). 197 unsigned TargetInfo::getTypeWidth(IntType T) const { 198 switch (T) { 199 default: llvm_unreachable("not an integer!"); 200 case SignedChar: 201 case UnsignedChar: return getCharWidth(); 202 case SignedShort: 203 case UnsignedShort: return getShortWidth(); 204 case SignedInt: 205 case UnsignedInt: return getIntWidth(); 206 case SignedLong: 207 case UnsignedLong: return getLongWidth(); 208 case SignedLongLong: 209 case UnsignedLongLong: return getLongLongWidth(); 210 }; 211 } 212 213 TargetInfo::IntType TargetInfo::getIntTypeByWidth( 214 unsigned BitWidth, bool IsSigned) const { 215 if (getCharWidth() == BitWidth) 216 return IsSigned ? SignedChar : UnsignedChar; 217 if (getShortWidth() == BitWidth) 218 return IsSigned ? SignedShort : UnsignedShort; 219 if (getIntWidth() == BitWidth) 220 return IsSigned ? SignedInt : UnsignedInt; 221 if (getLongWidth() == BitWidth) 222 return IsSigned ? SignedLong : UnsignedLong; 223 if (getLongLongWidth() == BitWidth) 224 return IsSigned ? SignedLongLong : UnsignedLongLong; 225 return NoInt; 226 } 227 228 TargetInfo::IntType TargetInfo::getLeastIntTypeByWidth(unsigned BitWidth, 229 bool IsSigned) const { 230 if (getCharWidth() >= BitWidth) 231 return IsSigned ? SignedChar : UnsignedChar; 232 if (getShortWidth() >= BitWidth) 233 return IsSigned ? SignedShort : UnsignedShort; 234 if (getIntWidth() >= BitWidth) 235 return IsSigned ? SignedInt : UnsignedInt; 236 if (getLongWidth() >= BitWidth) 237 return IsSigned ? SignedLong : UnsignedLong; 238 if (getLongLongWidth() >= BitWidth) 239 return IsSigned ? SignedLongLong : UnsignedLongLong; 240 return NoInt; 241 } 242 243 TargetInfo::RealType TargetInfo::getRealTypeByWidth(unsigned BitWidth) const { 244 if (getFloatWidth() == BitWidth) 245 return Float; 246 if (getDoubleWidth() == BitWidth) 247 return Double; 248 249 switch (BitWidth) { 250 case 96: 251 if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended()) 252 return LongDouble; 253 break; 254 case 128: 255 if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() || 256 &getLongDoubleFormat() == &llvm::APFloat::IEEEquad()) 257 return LongDouble; 258 if (hasFloat128Type()) 259 return Float128; 260 break; 261 } 262 263 return NoFloat; 264 } 265 266 /// getTypeAlign - Return the alignment (in bits) of the specified integer type 267 /// enum. For example, SignedInt -> getIntAlign(). 268 unsigned TargetInfo::getTypeAlign(IntType T) const { 269 switch (T) { 270 default: llvm_unreachable("not an integer!"); 271 case SignedChar: 272 case UnsignedChar: return getCharAlign(); 273 case SignedShort: 274 case UnsignedShort: return getShortAlign(); 275 case SignedInt: 276 case UnsignedInt: return getIntAlign(); 277 case SignedLong: 278 case UnsignedLong: return getLongAlign(); 279 case SignedLongLong: 280 case UnsignedLongLong: return getLongLongAlign(); 281 }; 282 } 283 284 /// isTypeSigned - Return whether an integer types is signed. Returns true if 285 /// the type is signed; false otherwise. 286 bool TargetInfo::isTypeSigned(IntType T) { 287 switch (T) { 288 default: llvm_unreachable("not an integer!"); 289 case SignedChar: 290 case SignedShort: 291 case SignedInt: 292 case SignedLong: 293 case SignedLongLong: 294 return true; 295 case UnsignedChar: 296 case UnsignedShort: 297 case UnsignedInt: 298 case UnsignedLong: 299 case UnsignedLongLong: 300 return false; 301 }; 302 } 303 304 /// adjust - Set forced language options. 305 /// Apply changes to the target information with respect to certain 306 /// language options which change the target configuration and adjust 307 /// the language based on the target options where applicable. 308 void TargetInfo::adjust(LangOptions &Opts) { 309 if (Opts.NoBitFieldTypeAlign) 310 UseBitFieldTypeAlignment = false; 311 312 switch (Opts.WCharSize) { 313 default: llvm_unreachable("invalid wchar_t width"); 314 case 0: break; 315 case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break; 316 case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break; 317 case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break; 318 } 319 320 if (Opts.AlignDouble) { 321 DoubleAlign = LongLongAlign = 64; 322 LongDoubleAlign = 64; 323 } 324 325 if (Opts.OpenCL) { 326 // OpenCL C requires specific widths for types, irrespective of 327 // what these normally are for the target. 328 // We also define long long and long double here, although the 329 // OpenCL standard only mentions these as "reserved". 330 IntWidth = IntAlign = 32; 331 LongWidth = LongAlign = 64; 332 LongLongWidth = LongLongAlign = 128; 333 HalfWidth = HalfAlign = 16; 334 FloatWidth = FloatAlign = 32; 335 336 // Embedded 32-bit targets (OpenCL EP) might have double C type 337 // defined as float. Let's not override this as it might lead 338 // to generating illegal code that uses 64bit doubles. 339 if (DoubleWidth != FloatWidth) { 340 DoubleWidth = DoubleAlign = 64; 341 DoubleFormat = &llvm::APFloat::IEEEdouble(); 342 } 343 LongDoubleWidth = LongDoubleAlign = 128; 344 345 unsigned MaxPointerWidth = getMaxPointerWidth(); 346 assert(MaxPointerWidth == 32 || MaxPointerWidth == 64); 347 bool Is32BitArch = MaxPointerWidth == 32; 348 SizeType = Is32BitArch ? UnsignedInt : UnsignedLong; 349 PtrDiffType = Is32BitArch ? SignedInt : SignedLong; 350 IntPtrType = Is32BitArch ? SignedInt : SignedLong; 351 352 IntMaxType = SignedLongLong; 353 Int64Type = SignedLong; 354 355 HalfFormat = &llvm::APFloat::IEEEhalf(); 356 FloatFormat = &llvm::APFloat::IEEEsingle(); 357 LongDoubleFormat = &llvm::APFloat::IEEEquad(); 358 } 359 360 if (Opts.NewAlignOverride) 361 NewAlign = Opts.NewAlignOverride * getCharWidth(); 362 } 363 364 bool TargetInfo::initFeatureMap( 365 llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU, 366 const std::vector<std::string> &FeatureVec) const { 367 for (const auto &F : FeatureVec) { 368 StringRef Name = F; 369 // Apply the feature via the target. 370 bool Enabled = Name[0] == '+'; 371 setFeatureEnabled(Features, Name.substr(1), Enabled); 372 } 373 return true; 374 } 375 376 TargetInfo::CallingConvKind 377 TargetInfo::getCallingConvKind(bool ClangABICompat4) const { 378 if (getCXXABI() != TargetCXXABI::Microsoft && 379 (ClangABICompat4 || getTriple().getOS() == llvm::Triple::PS4)) 380 return CCK_ClangABI4OrPS4; 381 return CCK_Default; 382 } 383 384 LangAS TargetInfo::getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const { 385 switch (TK) { 386 case OCLTK_Image: 387 case OCLTK_Pipe: 388 return LangAS::opencl_global; 389 390 case OCLTK_Sampler: 391 return LangAS::opencl_constant; 392 393 default: 394 return LangAS::Default; 395 } 396 } 397 398 //===----------------------------------------------------------------------===// 399 400 401 static StringRef removeGCCRegisterPrefix(StringRef Name) { 402 if (Name[0] == '%' || Name[0] == '#') 403 Name = Name.substr(1); 404 405 return Name; 406 } 407 408 /// isValidClobber - Returns whether the passed in string is 409 /// a valid clobber in an inline asm statement. This is used by 410 /// Sema. 411 bool TargetInfo::isValidClobber(StringRef Name) const { 412 return (isValidGCCRegisterName(Name) || 413 Name == "memory" || Name == "cc"); 414 } 415 416 /// isValidGCCRegisterName - Returns whether the passed in string 417 /// is a valid register name according to GCC. This is used by Sema for 418 /// inline asm statements. 419 bool TargetInfo::isValidGCCRegisterName(StringRef Name) const { 420 if (Name.empty()) 421 return false; 422 423 // Get rid of any register prefix. 424 Name = removeGCCRegisterPrefix(Name); 425 if (Name.empty()) 426 return false; 427 428 ArrayRef<const char *> Names = getGCCRegNames(); 429 430 // If we have a number it maps to an entry in the register name array. 431 if (isDigit(Name[0])) { 432 unsigned n; 433 if (!Name.getAsInteger(0, n)) 434 return n < Names.size(); 435 } 436 437 // Check register names. 438 if (std::find(Names.begin(), Names.end(), Name) != Names.end()) 439 return true; 440 441 // Check any additional names that we have. 442 for (const AddlRegName &ARN : getGCCAddlRegNames()) 443 for (const char *AN : ARN.Names) { 444 if (!AN) 445 break; 446 // Make sure the register that the additional name is for is within 447 // the bounds of the register names from above. 448 if (AN == Name && ARN.RegNum < Names.size()) 449 return true; 450 } 451 452 // Now check aliases. 453 for (const GCCRegAlias &GRA : getGCCRegAliases()) 454 for (const char *A : GRA.Aliases) { 455 if (!A) 456 break; 457 if (A == Name) 458 return true; 459 } 460 461 return false; 462 } 463 464 StringRef TargetInfo::getNormalizedGCCRegisterName(StringRef Name, 465 bool ReturnCanonical) const { 466 assert(isValidGCCRegisterName(Name) && "Invalid register passed in"); 467 468 // Get rid of any register prefix. 469 Name = removeGCCRegisterPrefix(Name); 470 471 ArrayRef<const char *> Names = getGCCRegNames(); 472 473 // First, check if we have a number. 474 if (isDigit(Name[0])) { 475 unsigned n; 476 if (!Name.getAsInteger(0, n)) { 477 assert(n < Names.size() && "Out of bounds register number!"); 478 return Names[n]; 479 } 480 } 481 482 // Check any additional names that we have. 483 for (const AddlRegName &ARN : getGCCAddlRegNames()) 484 for (const char *AN : ARN.Names) { 485 if (!AN) 486 break; 487 // Make sure the register that the additional name is for is within 488 // the bounds of the register names from above. 489 if (AN == Name && ARN.RegNum < Names.size()) 490 return ReturnCanonical ? Names[ARN.RegNum] : Name; 491 } 492 493 // Now check aliases. 494 for (const GCCRegAlias &RA : getGCCRegAliases()) 495 for (const char *A : RA.Aliases) { 496 if (!A) 497 break; 498 if (A == Name) 499 return RA.Register; 500 } 501 502 return Name; 503 } 504 505 bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { 506 const char *Name = Info.getConstraintStr().c_str(); 507 // An output constraint must start with '=' or '+' 508 if (*Name != '=' && *Name != '+') 509 return false; 510 511 if (*Name == '+') 512 Info.setIsReadWrite(); 513 514 Name++; 515 while (*Name) { 516 switch (*Name) { 517 default: 518 if (!validateAsmConstraint(Name, Info)) { 519 // FIXME: We temporarily return false 520 // so we can add more constraints as we hit it. 521 // Eventually, an unknown constraint should just be treated as 'g'. 522 return false; 523 } 524 break; 525 case '&': // early clobber. 526 Info.setEarlyClobber(); 527 break; 528 case '%': // commutative. 529 // FIXME: Check that there is a another register after this one. 530 break; 531 case 'r': // general register. 532 Info.setAllowsRegister(); 533 break; 534 case 'm': // memory operand. 535 case 'o': // offsetable memory operand. 536 case 'V': // non-offsetable memory operand. 537 case '<': // autodecrement memory operand. 538 case '>': // autoincrement memory operand. 539 Info.setAllowsMemory(); 540 break; 541 case 'g': // general register, memory operand or immediate integer. 542 case 'X': // any operand. 543 Info.setAllowsRegister(); 544 Info.setAllowsMemory(); 545 break; 546 case ',': // multiple alternative constraint. Pass it. 547 // Handle additional optional '=' or '+' modifiers. 548 if (Name[1] == '=' || Name[1] == '+') 549 Name++; 550 break; 551 case '#': // Ignore as constraint. 552 while (Name[1] && Name[1] != ',') 553 Name++; 554 break; 555 case '?': // Disparage slightly code. 556 case '!': // Disparage severely. 557 case '*': // Ignore for choosing register preferences. 558 case 'i': // Ignore i,n,E,F as output constraints (match from the other 559 // chars) 560 case 'n': 561 case 'E': 562 case 'F': 563 break; // Pass them. 564 } 565 566 Name++; 567 } 568 569 // Early clobber with a read-write constraint which doesn't permit registers 570 // is invalid. 571 if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister()) 572 return false; 573 574 // If a constraint allows neither memory nor register operands it contains 575 // only modifiers. Reject it. 576 return Info.allowsMemory() || Info.allowsRegister(); 577 } 578 579 bool TargetInfo::resolveSymbolicName(const char *&Name, 580 ArrayRef<ConstraintInfo> OutputConstraints, 581 unsigned &Index) const { 582 assert(*Name == '[' && "Symbolic name did not start with '['"); 583 Name++; 584 const char *Start = Name; 585 while (*Name && *Name != ']') 586 Name++; 587 588 if (!*Name) { 589 // Missing ']' 590 return false; 591 } 592 593 std::string SymbolicName(Start, Name - Start); 594 595 for (Index = 0; Index != OutputConstraints.size(); ++Index) 596 if (SymbolicName == OutputConstraints[Index].getName()) 597 return true; 598 599 return false; 600 } 601 602 bool TargetInfo::validateInputConstraint( 603 MutableArrayRef<ConstraintInfo> OutputConstraints, 604 ConstraintInfo &Info) const { 605 const char *Name = Info.ConstraintStr.c_str(); 606 607 if (!*Name) 608 return false; 609 610 while (*Name) { 611 switch (*Name) { 612 default: 613 // Check if we have a matching constraint 614 if (*Name >= '0' && *Name <= '9') { 615 const char *DigitStart = Name; 616 while (Name[1] >= '0' && Name[1] <= '9') 617 Name++; 618 const char *DigitEnd = Name; 619 unsigned i; 620 if (StringRef(DigitStart, DigitEnd - DigitStart + 1) 621 .getAsInteger(10, i)) 622 return false; 623 624 // Check if matching constraint is out of bounds. 625 if (i >= OutputConstraints.size()) return false; 626 627 // A number must refer to an output only operand. 628 if (OutputConstraints[i].isReadWrite()) 629 return false; 630 631 // If the constraint is already tied, it must be tied to the 632 // same operand referenced to by the number. 633 if (Info.hasTiedOperand() && Info.getTiedOperand() != i) 634 return false; 635 636 // The constraint should have the same info as the respective 637 // output constraint. 638 Info.setTiedOperand(i, OutputConstraints[i]); 639 } else if (!validateAsmConstraint(Name, Info)) { 640 // FIXME: This error return is in place temporarily so we can 641 // add more constraints as we hit it. Eventually, an unknown 642 // constraint should just be treated as 'g'. 643 return false; 644 } 645 break; 646 case '[': { 647 unsigned Index = 0; 648 if (!resolveSymbolicName(Name, OutputConstraints, Index)) 649 return false; 650 651 // If the constraint is already tied, it must be tied to the 652 // same operand referenced to by the number. 653 if (Info.hasTiedOperand() && Info.getTiedOperand() != Index) 654 return false; 655 656 // A number must refer to an output only operand. 657 if (OutputConstraints[Index].isReadWrite()) 658 return false; 659 660 Info.setTiedOperand(Index, OutputConstraints[Index]); 661 break; 662 } 663 case '%': // commutative 664 // FIXME: Fail if % is used with the last operand. 665 break; 666 case 'i': // immediate integer. 667 case 'n': // immediate integer with a known value. 668 break; 669 case 'I': // Various constant constraints with target-specific meanings. 670 case 'J': 671 case 'K': 672 case 'L': 673 case 'M': 674 case 'N': 675 case 'O': 676 case 'P': 677 if (!validateAsmConstraint(Name, Info)) 678 return false; 679 break; 680 case 'r': // general register. 681 Info.setAllowsRegister(); 682 break; 683 case 'm': // memory operand. 684 case 'o': // offsettable memory operand. 685 case 'V': // non-offsettable memory operand. 686 case '<': // autodecrement memory operand. 687 case '>': // autoincrement memory operand. 688 Info.setAllowsMemory(); 689 break; 690 case 'g': // general register, memory operand or immediate integer. 691 case 'X': // any operand. 692 Info.setAllowsRegister(); 693 Info.setAllowsMemory(); 694 break; 695 case 'E': // immediate floating point. 696 case 'F': // immediate floating point. 697 case 'p': // address operand. 698 break; 699 case ',': // multiple alternative constraint. Ignore comma. 700 break; 701 case '#': // Ignore as constraint. 702 while (Name[1] && Name[1] != ',') 703 Name++; 704 break; 705 case '?': // Disparage slightly code. 706 case '!': // Disparage severely. 707 case '*': // Ignore for choosing register preferences. 708 break; // Pass them. 709 } 710 711 Name++; 712 } 713 714 return true; 715 } 716