Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.3 KiB

  1. //===- llvm/Support/Host.h - Host machine characteristics --------*- C++ -*-===//
  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. // Methods for querying the nature of the host machine.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_SUPPORT_HOST_H
  14. #define LLVM_SUPPORT_HOST_H
  15. #include "llvm/ADT/StringMap.h"
  16. #if defined(__linux__)
  17. #include <endian.h>
  18. #else
  19. #ifndef LLVM_ON_WIN32
  20. #include <machine/endian.h>
  21. #endif
  22. #endif
  23. #include <string>
  24. namespace llvm {
  25. namespace sys {
  26. #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
  27. static const bool IsBigEndianHost = true;
  28. #else
  29. static const bool IsBigEndianHost = false;
  30. #endif
  31. static const bool IsLittleEndianHost = !IsBigEndianHost;
  32. /// getDefaultTargetTriple() - Return the default target triple the compiler
  33. /// has been configured to produce code for.
  34. ///
  35. /// The target triple is a string in the format of:
  36. /// CPU_TYPE-VENDOR-OPERATING_SYSTEM
  37. /// or
  38. /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
  39. std::string getDefaultTargetTriple();
  40. /// getProcessTriple() - Return an appropriate target triple for generating
  41. /// code to be loaded into the current process, e.g. when using the JIT.
  42. std::string getProcessTriple();
  43. /// getHostCPUName - Get the LLVM name for the host CPU. The particular format
  44. /// of the name is target dependent, and suitable for passing as -mcpu to the
  45. /// target which matches the host.
  46. ///
  47. /// \return - The host CPU name, or empty if the CPU could not be determined.
  48. std::string getHostCPUName();
  49. /// getHostCPUFeatures - Get the LLVM names for the host CPU features.
  50. /// The particular format of the names are target dependent, and suitable for
  51. /// passing as -mattr to the target which matches the host.
  52. ///
  53. /// \param Features - A string mapping feature names to either
  54. /// true (if enabled) or false (if disabled). This routine makes no guarantees
  55. /// about exactly which features may appear in this map, except that they are
  56. /// all valid LLVM feature names.
  57. ///
  58. /// \return - True on success.
  59. bool getHostCPUFeatures(StringMap<bool> &Features);
  60. }
  61. }
  62. #endif