Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===// | 1 //===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 #ifndef LLVM_ADT_TRIPLE_H | 10 #ifndef LLVM_ADT_TRIPLE_H |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 | 214 |
| 215 /// getArch - Get the parsed architecture type of this triple. | 215 /// getArch - Get the parsed architecture type of this triple. |
| 216 ArchType getArch() const { return Arch; } | 216 ArchType getArch() const { return Arch; } |
| 217 | 217 |
| 218 /// getSubArch - get the parsed subarchitecture type for this triple. | 218 /// getSubArch - get the parsed subarchitecture type for this triple. |
| 219 SubArchType getSubArch() const { return SubArch; } | 219 SubArchType getSubArch() const { return SubArch; } |
| 220 | 220 |
| 221 /// getVendor - Get the parsed vendor type of this triple. | 221 /// getVendor - Get the parsed vendor type of this triple. |
| 222 VendorType getVendor() const { return Vendor; } | 222 VendorType getVendor() const { return Vendor; } |
| 223 | 223 |
| 224 // @LOCALMOD-BEGIN -- hardcode NaCl for NaCl builds, to help | |
| 225 // prune OS-specific code that is litered all over and not | |
| 226 // cleanly separated. | |
| 227 #if defined(__native_client__) | |
| 228 OSType getOS() const { return NaCl; } | |
| 229 ObjectFormatType getObjectFormat() const { return ELF; } | |
| 230 #else | |
| 224 /// getOS - Get the parsed operating system type of this triple. | 231 /// getOS - Get the parsed operating system type of this triple. |
| 225 OSType getOS() const { return OS; } | 232 OSType getOS() const { return OS; } |
| 226 | 233 |
| 234 /// getFormat - Get the object format for this triple. | |
| 235 ObjectFormatType getObjectFormat() const { return ObjectFormat; } | |
| 236 #endif | |
| 237 // @LOCALMOD-END | |
| 238 | |
| 239 /// getEnvironment - Get the parsed environment type of this triple. | |
| 240 EnvironmentType getEnvironment() const { return Environment; } | |
|
JF
2015/02/24 17:25:47
Move LOCALMOD marker.
jvoung (off chromium)
2015/02/24 18:49:10
Wow, well spotted ;-)
Apparently, this isn't a lo
JF
2015/02/24 19:34:05
I think Jim calls this "pulling a Jan" ;-)
Jim Stichnoth
2015/02/25 17:26:03
Ah, so Jan pulled a Jim, and then JF pulled a Jan.
| |
| 241 | |
| 227 /// hasEnvironment - Does this triple have the optional environment | 242 /// hasEnvironment - Does this triple have the optional environment |
| 228 /// (fourth) component? | 243 /// (fourth) component? |
| 229 bool hasEnvironment() const { | 244 bool hasEnvironment() const { |
| 230 return getEnvironmentName() != ""; | 245 return getEnvironmentName() != ""; |
| 231 } | 246 } |
| 232 | 247 |
| 233 /// getEnvironment - Get the parsed environment type of this triple. | |
| 234 EnvironmentType getEnvironment() const { return Environment; } | |
| 235 | |
| 236 /// getFormat - Get the object format for this triple. | |
| 237 ObjectFormatType getObjectFormat() const { return ObjectFormat; } | |
| 238 | |
| 239 /// getOSVersion - Parse the version number from the OS name component of the | 248 /// getOSVersion - Parse the version number from the OS name component of the |
| 240 /// triple, if present. | 249 /// triple, if present. |
| 241 /// | 250 /// |
| 242 /// For example, "fooos1.2.3" would return (1, 2, 3). | 251 /// For example, "fooos1.2.3" would return (1, 2, 3). |
| 243 /// | 252 /// |
| 244 /// If an entry is not defined, it will be returned as 0. | 253 /// If an entry is not defined, it will be returned as 0. |
| 245 void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const; | 254 void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const; |
| 246 | 255 |
| 247 /// getOSMajorVersion - Return just the major version number, this is | 256 /// getOSMajorVersion - Return just the major version number, this is |
| 248 /// specialized because it is a common query. | 257 /// specialized because it is a common query. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 | 350 |
| 342 // If this is OS X, expect a sane version number. | 351 // If this is OS X, expect a sane version number. |
| 343 if (getOS() == Triple::MacOSX) | 352 if (getOS() == Triple::MacOSX) |
| 344 return isOSVersionLT(Major, Minor, Micro); | 353 return isOSVersionLT(Major, Minor, Micro); |
| 345 | 354 |
| 346 // Otherwise, compare to the "Darwin" number. | 355 // Otherwise, compare to the "Darwin" number. |
| 347 assert(Major == 10 && "Unexpected major version"); | 356 assert(Major == 10 && "Unexpected major version"); |
| 348 return isOSVersionLT(Minor + 4, Micro, 0); | 357 return isOSVersionLT(Minor + 4, Micro, 0); |
| 349 } | 358 } |
| 350 | 359 |
| 360 // @LOCALMOD-BEGIN: Hardcode OS predicates to help prune code | |
| 361 // that is OS-specific, but not cleanly separated. | |
| 362 // Perhaps this would be cleaner if Triple.h was partly Table-gen'ed. | |
| 363 #if defined(__native_client__) | |
| 364 bool isMacOSX() const { return false; } | |
| 365 bool isiOS() const { return false; } | |
| 366 bool isOSDarwin() const { return false; } | |
| 367 bool isOSNetBSD() const { return false; } | |
| 368 bool isOSOpenBSD() const { return false; } | |
| 369 bool isOSFreeBSD() const { return false; } | |
| 370 bool isOSSolaris() const { return false; } | |
| 371 bool isOSBitrig() const { return false; } | |
| 372 bool isWindowsMSVCEnvironment() const { return false; } | |
| 373 bool isKnownWindowsMSVCEnvironment() const { return false; } | |
| 374 bool isWindowsItaniumEnvironment() const { return false; } | |
| 375 bool isWindowsCygwinEnvironment() const { return false; } | |
| 376 bool isWindowsGNUEnvironment() const { return false; } | |
| 377 bool isOSCygMing() const { return false; } | |
| 378 bool isOSMSVCRT() const { return false; } | |
| 379 bool isOSWindows() const { return false; } | |
| 380 bool isOSNaCl() const { return true; } | |
| 381 bool isOSLinux() const { return false; } | |
| 382 bool isOSBinFormatELF() const { return true; } | |
| 383 bool isOSBinFormatCOFF() const { return false; } | |
| 384 bool isOSBinFormatMachO() const { return false; } | |
| 385 #else | |
| 351 /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both | 386 /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both |
| 352 /// "darwin" and "osx" as OS X triples. | 387 /// "darwin" and "osx" as OS X triples. |
| 353 bool isMacOSX() const { | 388 bool isMacOSX() const { |
| 354 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX; | 389 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX; |
| 355 } | 390 } |
| 356 | 391 |
| 357 /// Is this an iOS triple. | 392 /// Is this an iOS triple. |
| 358 bool isiOS() const { | 393 bool isiOS() const { |
| 359 return getOS() == Triple::IOS; | 394 return getOS() == Triple::IOS; |
| 360 } | 395 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 | 474 |
| 440 /// \brief Tests whether the OS uses the COFF binary format. | 475 /// \brief Tests whether the OS uses the COFF binary format. |
| 441 bool isOSBinFormatCOFF() const { | 476 bool isOSBinFormatCOFF() const { |
| 442 return getObjectFormat() == Triple::COFF; | 477 return getObjectFormat() == Triple::COFF; |
| 443 } | 478 } |
| 444 | 479 |
| 445 /// \brief Tests whether the environment is MachO. | 480 /// \brief Tests whether the environment is MachO. |
| 446 bool isOSBinFormatMachO() const { | 481 bool isOSBinFormatMachO() const { |
| 447 return getObjectFormat() == Triple::MachO; | 482 return getObjectFormat() == Triple::MachO; |
| 448 } | 483 } |
| 484 #endif | |
| 485 // @LOCALMOD-END | |
| 449 | 486 |
| 450 /// @} | 487 /// @} |
| 451 /// @name Mutators | 488 /// @name Mutators |
| 452 /// @{ | 489 /// @{ |
| 453 | 490 |
| 454 /// setArch - Set the architecture (first) component of the triple | 491 /// setArch - Set the architecture (first) component of the triple |
| 455 /// to a known type. | 492 /// to a known type. |
| 456 void setArch(ArchType Kind); | 493 void setArch(ArchType Kind); |
| 457 | 494 |
| 458 /// setVendor - Set the vendor (second) component of the triple to a | 495 /// setVendor - Set the vendor (second) component of the triple to a |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 /// architecture name (e.g., "x86"). | 589 /// architecture name (e.g., "x86"). |
| 553 static ArchType getArchTypeForLLVMName(StringRef Str); | 590 static ArchType getArchTypeForLLVMName(StringRef Str); |
| 554 | 591 |
| 555 /// @} | 592 /// @} |
| 556 }; | 593 }; |
| 557 | 594 |
| 558 } // End llvm namespace | 595 } // End llvm namespace |
| 559 | 596 |
| 560 | 597 |
| 561 #endif | 598 #endif |
| OLD | NEW |