xref: /openbsd-src/gnu/llvm/llvm/include/llvm/TextAPI/Architecture.h (revision d415bd752c734aee168c4ee86ff32e8cc249eb16)
173471bf0Spatrick //===- llvm/TextAPI/Architecture.h - Architecture ---------------*- C++ -*-===//
273471bf0Spatrick //
373471bf0Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
473471bf0Spatrick // See https://llvm.org/LICENSE.txt for license information.
573471bf0Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
673471bf0Spatrick //
773471bf0Spatrick //===----------------------------------------------------------------------===//
873471bf0Spatrick //
973471bf0Spatrick // Defines the architecture enum and helper methods.
1073471bf0Spatrick //
1173471bf0Spatrick //===----------------------------------------------------------------------===//
1273471bf0Spatrick 
13*d415bd75Srobert #ifndef LLVM_TEXTAPI_ARCHITECTURE_H
14*d415bd75Srobert #define LLVM_TEXTAPI_ARCHITECTURE_H
1573471bf0Spatrick 
1673471bf0Spatrick #include <cstdint>
1773471bf0Spatrick #include <utility>
1873471bf0Spatrick 
1973471bf0Spatrick namespace llvm {
2073471bf0Spatrick class raw_ostream;
2173471bf0Spatrick class StringRef;
2273471bf0Spatrick class Triple;
2373471bf0Spatrick 
2473471bf0Spatrick namespace MachO {
2573471bf0Spatrick 
2673471bf0Spatrick /// Defines the architecture slices that are supported by Text-based Stub files.
2773471bf0Spatrick enum Architecture : uint8_t {
2873471bf0Spatrick #define ARCHINFO(Arch, Type, SubType, NumBits) AK_##Arch,
2973471bf0Spatrick #include "llvm/TextAPI/Architecture.def"
3073471bf0Spatrick #undef ARCHINFO
3173471bf0Spatrick   AK_unknown, // this has to go last.
3273471bf0Spatrick };
3373471bf0Spatrick 
3473471bf0Spatrick /// Convert a CPU Type and Subtype pair to an architecture slice.
3573471bf0Spatrick Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
3673471bf0Spatrick 
3773471bf0Spatrick /// Convert a name to an architecture slice.
3873471bf0Spatrick Architecture getArchitectureFromName(StringRef Name);
3973471bf0Spatrick 
4073471bf0Spatrick /// Convert an architecture slice to a string.
4173471bf0Spatrick StringRef getArchitectureName(Architecture Arch);
4273471bf0Spatrick 
4373471bf0Spatrick /// Convert an architecture slice to a CPU Type and Subtype pair.
4473471bf0Spatrick std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
4573471bf0Spatrick 
4673471bf0Spatrick /// Convert a target to an architecture slice.
4773471bf0Spatrick Architecture mapToArchitecture(const llvm::Triple &Target);
4873471bf0Spatrick 
4973471bf0Spatrick /// Check if architecture is 64 bit.
5073471bf0Spatrick bool is64Bit(Architecture);
5173471bf0Spatrick 
5273471bf0Spatrick raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
5373471bf0Spatrick 
5473471bf0Spatrick } // end namespace MachO.
5573471bf0Spatrick } // end namespace llvm.
5673471bf0Spatrick 
57*d415bd75Srobert #endif // LLVM_TEXTAPI_ARCHITECTURE_H
58