Architecture.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/TextAPI/Architecture.h - Architecture ---------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Defines the architecture enum and helper methods.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_TEXTAPI_ARCHITECTURE_H
  18. #define LLVM_TEXTAPI_ARCHITECTURE_H
  19. #include <cstdint>
  20. #include <utility>
  21. namespace llvm {
  22. class raw_ostream;
  23. class StringRef;
  24. class Triple;
  25. namespace MachO {
  26. /// Defines the architecture slices that are supported by Text-based Stub files.
  27. enum Architecture : uint8_t {
  28. #define ARCHINFO(Arch, Type, SubType, NumBits) AK_##Arch,
  29. #include "llvm/TextAPI/Architecture.def"
  30. #undef ARCHINFO
  31. AK_unknown, // this has to go last.
  32. };
  33. /// Convert a CPU Type and Subtype pair to an architecture slice.
  34. Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
  35. /// Convert a name to an architecture slice.
  36. Architecture getArchitectureFromName(StringRef Name);
  37. /// Convert an architecture slice to a string.
  38. StringRef getArchitectureName(Architecture Arch);
  39. /// Convert an architecture slice to a CPU Type and Subtype pair.
  40. std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
  41. /// Convert a target to an architecture slice.
  42. Architecture mapToArchitecture(const llvm::Triple &Target);
  43. /// Check if architecture is 64 bit.
  44. bool is64Bit(Architecture);
  45. raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
  46. } // end namespace MachO.
  47. } // end namespace llvm.
  48. #endif // LLVM_TEXTAPI_ARCHITECTURE_H
  49. #ifdef __GNUC__
  50. #pragma GCC diagnostic pop
  51. #endif