Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: include/llvm/ADT/Triple.h

Issue 7730004: add llvm configure flags to enable/disable target OSes/Envs Base URL: https://llvm.org/svn/llvm-project/llvm/trunk/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « configure ('k') | lib/MC/MCObjectFileInfo.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return LHS[1] < Minor; 247 return LHS[1] < Minor;
248 if (LHS[2] != Micro) 248 if (LHS[2] != Micro)
249 return LHS[1] < Micro; 249 return LHS[1] < Micro;
250 250
251 return false; 251 return false;
252 } 252 }
253 253
254 /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both 254 /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
255 /// "darwin" and "osx" as OS X triples. 255 /// "darwin" and "osx" as OS X triples.
256 bool isMacOSX() const { 256 bool isMacOSX() const {
257 #if defined(LLVM_ENABLED_TARGET_OS_MACOSX) || \
258 defined(LLVM_ENABLED_TARGET_OS_DARWIN)
257 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX; 259 return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
260 #else
261 return false;
262 #endif
258 } 263 }
259 264
260 /// isOSDarwin - Is this a "Darwin" OS (OS X or iOS). 265 /// isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
261 bool isOSDarwin() const { 266 bool isOSDarwin() const {
267 #if defined(LLVM_ENABLED_TARGET_OS_MACOSX) || \
268 defined(LLVM_ENABLED_TARGET_OS_DARWIN) || \
269 defined(LLVM_ENABLED_TARGET_OS_IOS)
262 return isMacOSX() || getOS() == Triple::IOS; 270 return isMacOSX() || getOS() == Triple::IOS;
271 #else
272 return false;
273 #endif
263 } 274 }
264 275
265 /// isOSWindows - Is this a "Windows" OS. 276 /// isOSWindows - Is this a "Windows" OS.
266 bool isOSWindows() const { 277 bool isOSWindows() const {
278 #if defined(LLVM_ENABLED_TARGET_OS_WIN32) || \
279 defined(LLVM_ENABLED_TARGET_OS_CYGWIN) || \
280 defined(LLVM_ENABLED_TARGET_OS_MINGW32)
267 return getOS() == Triple::Win32 || getOS() == Triple::Cygwin || 281 return getOS() == Triple::Win32 || getOS() == Triple::Cygwin ||
268 getOS() == Triple::MinGW32; 282 getOS() == Triple::MinGW32;
283 #else
284 return false;
285 #endif
286 }
287
288 /// isOSAuroraUX - Is getOS() == AuroraUX.
289 bool isOSAuroraUX() const {
290 #if defined(LLVM_ENABLED_TARGET_OS_AURORAUX)
291 return getOS() == Triple::AuroraUX;
292 #else
293 return false;
294 #endif
295 }
296
297 /// isOSCygwin - Is getOS() == Cygwin.
298 bool isOSCygwin() const {
299 #if defined(LLVM_ENABLED_TARGET_OS_CYGWIN)
300 return getOS() == Triple::Cygwin;
301 #else
302 return false;
303 #endif
304 }
305
306 /// isOSDragonFly - Is getOS() == DragonFly.
307 bool isOSDragonFly() const {
308 #if defined(LLVM_ENABLED_TARGET_OS_DRAGONFLY)
309 return getOS() == Triple::DragonFly;
310 #else
311 return false;
312 #endif
313 }
314
315 /// isOSFreeBSD - Is getOS() == FreeBSD.
316 bool isOSFreeBSD() const {
317 #if defined(LLVM_ENABLED_TARGET_OS_FREEBSD)
318 return getOS() == Triple::FreeBSD;
319 #else
320 return false;
321 #endif
322 }
323
324 /// isOSIOS - Is getOS() == IOS
325 bool isOSIOS() const {
326 #if defined(LLVM_ENABLED_TARGET_OS_IOS)
327 return getOS() == Triple::IOS;
328 #else
329 return false;
330 #endif
331 }
332
333 /// isOSLinux - Is getOS() == Linux.
334 bool isOSLinux() const {
335 #if defined(LLVM_ENABLED_TARGET_OS_LINUX)
336 return getOS() == Triple::Linux;
337 #else
338 return false;
339 #endif
340 }
341
342 /// isOSLv2 - Is getOS() == Lv2.
343 bool isOSLv2() const {
344 #if defined(LLVM_ENABLED_TARGET_OS_LV2)
345 return getOS() == Triple::Lv2;
346 #else
347 return false;
348 #endif
349 }
350
351 /// isOSMinGW32 - Is getOS() == MinGW32.
352 bool isOSMinGW32() const {
353 #if defined(LLVM_ENABLED_TARGET_OS_MINGW32)
354 return getOS() == Triple::MinGW32;
355 #else
356 return false;
357 #endif
358 }
359
360 /// isOSNetBSD - Is getOS() == NetBSD.
361 bool isOSNetBSD() const {
362 #if defined(LLVM_ENABLED_TARGET_OS_NETBSD)
363 return getOS() == Triple::NetBSD;
364 #else
365 return false;
366 #endif
367 }
368
369 /// isOSOpenBSD - Is getOS() == OpenBSD.
370 bool isOSOpenBSD() const {
371 #if defined(LLVM_ENABLED_TARGET_OS_OPENBSD)
372 return getOS() == Triple::OpenBSD;
373 #else
374 return false;
375 #endif
376 }
377
378 /// isOSPsp - Is getOS() == Psp.
379 bool isOSPsp() const {
380 #if defined(LLVM_ENABLED_TARGET_OS_PSP)
381 return getOS() == Triple::Psp;
382 #else
383 return false;
384 #endif
385 }
386
387 /// isOSSolaris - Is getOS() == Solaris.
388 bool isOSSolaris() const {
389 #if defined(LLVM_ENABLED_TARGET_OS_SOLARIS)
390 return getOS() == Triple::Solaris;
391 #else
392 return false;
393 #endif
394 }
395
396 /// isOSWin32 - Is getOS() == Win32.
397 bool isOSWin32() const {
398 #if defined(LLVM_ENABLED_TARGET_OS_WIN32)
399 return getOS() == Triple::Win32;
400 #else
401 return false;
402 #endif
403 }
404
405 /// isOSHaiku - Is getOS() == Haiku.
406 bool isOSHaiku() const {
407 #if defined(LLVM_ENABLED_TARGET_OS_HAIKU)
408 return getOS() == Triple::Haiku;
409 #else
410 return false;
411 #endif
412 }
413
414 /// isOSMinix - Is getOS() == Minix.
415 bool isOSMinix() const {
416 #if defined(LLVM_ENABLED_TARGET_OS_MINIX)
417 return getOS() == Triple::Minix;
418 #else
419 return false;
420 #endif
421 }
422
423 /// isOSRTEMS - Is getOS() == RTEMS.
424 bool isOSRTEMS() const {
425 #if defined(LLVM_ENABLED_TARGET_OS_RTEMS)
426 return getOS() == Triple::RTEMS;
427 #else
428 return false;
429 #endif
430 }
431
432 /// isOSNativeClient - Is getOS() == NativeClient.
433 bool isOSNativeClient() const {
434 #if defined(LLVM_ENABLED_TARGET_OS_NATIVECLIENT)
435 return getOS() == Triple::NativeClient;
436 #else
437 return false;
438 #endif
269 } 439 }
270 440
271 /// isMacOSXVersionLT - Comparison function for checking OS X version 441 /// isMacOSXVersionLT - Comparison function for checking OS X version
272 /// compatibility, which handles supporting skewed version numbering schemes 442 /// compatibility, which handles supporting skewed version numbering schemes
273 /// used by the "darwin" triples. 443 /// used by the "darwin" triples.
274 unsigned isMacOSXVersionLT(unsigned Major, unsigned Minor = 0, 444 unsigned isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
275 unsigned Micro = 0) const { 445 unsigned Micro = 0) const {
276 assert(isMacOSX() && "Not an OS X triple!"); 446 assert(isMacOSX() && "Not an OS X triple!");
277 447
278 // If this is OS X, expect a sane version number. 448 // If this is OS X, expect a sane version number.
279 if (getOS() == Triple::MacOSX) 449 if (getOS() == Triple::MacOSX)
280 return isOSVersionLT(Major, Minor, Micro); 450 return isOSVersionLT(Major, Minor, Micro);
281 451
282 // Otherwise, compare to the "Darwin" number. 452 // Otherwise, compare to the "Darwin" number.
283 assert(Major == 10 && "Unexpected major version"); 453 assert(Major == 10 && "Unexpected major version");
284 return isOSVersionLT(Minor + 4, Micro, 0); 454 return isOSVersionLT(Minor + 4, Micro, 0);
285 } 455 }
286 456
457 /// isEnvironmentEABI - Is getEnvironment() == EABI.
458 bool isEnvironmentEABI() const {
459 #if defined(LLVM_ENABLED_TARGET_ENV_EABI)
460 return getEnvironment() == Triple::EABI;
461 #else
462 return false;
463 #endif
464 }
465
466 /// isEnvironmentGNUEABI - Is getEnvironment() == GNUEABI.
467 bool isEnvironmentGNUEABI() const {
468 #if defined(LLVM_ENABLED_TARGET_ENV_GNUEABI)
469 return getEnvironment() == Triple::GNUEABI;
470 #else
471 return false;
472 #endif
473 }
474
475 /// isEnvironmentGNU - Is getEnvironment() == GNU.
476 bool isEnvironmentGNU() const {
477 #if defined(LLVM_ENABLED_TARGET_ENV_GNU)
478 return getEnvironment() == Triple::GNU;
479 #else
480 return false;
481 #endif
482 }
483
484 /// isEnvironmentMachO - Is getEnvironment() == MachO.
485 bool isEnvironmentMachO() const {
486 #if defined(LLVM_ENABLED_TARGET_ENV_MACHO)
487 return getEnvironment() == Triple::MachO;
488 #else
489 return false;
490 #endif
491 }
492
287 /// @} 493 /// @}
288 /// @name Mutators 494 /// @name Mutators
289 /// @{ 495 /// @{
290 496
291 /// setArch - Set the architecture (first) component of the triple 497 /// setArch - Set the architecture (first) component of the triple
292 /// to a known type. 498 /// to a known type.
293 void setArch(ArchType Kind); 499 void setArch(ArchType Kind);
294 500
295 /// setVendor - Set the vendor (second) component of the triple to a 501 /// setVendor - Set the vendor (second) component of the triple to a
296 /// known type. 502 /// known type.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 /// arch(3)). 578 /// arch(3)).
373 static ArchType getArchTypeForDarwinArchName(StringRef Str); 579 static ArchType getArchTypeForDarwinArchName(StringRef Str);
374 580
375 /// @} 581 /// @}
376 }; 582 };
377 583
378 } // End llvm namespace 584 } // End llvm namespace
379 585
380 586
381 #endif 587 #endif
OLDNEW
« no previous file with comments | « configure ('k') | lib/MC/MCObjectFileInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698