blob: 055baeb0c0f0c9cd243284a6433e86d07bc6e0e2 [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===- llvm/TextAPI/MachO/Architecture.h - Architecture ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Defines the architecture enum and helper methods.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_H
14#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_H
15
16#include "llvm/ADT/StringRef.h"
17#include "llvm/Support/raw_ostream.h"
18
19namespace llvm {
20namespace MachO {
21
22/// Defines the architecture slices that are supported by Text-based Stub files.
23enum Architecture : uint8_t {
24#define ARCHINFO(Arch, Type, SubType) AK_##Arch,
25#include "llvm/TextAPI/MachO/Architecture.def"
26#undef ARCHINFO
27 AK_unknown, // this has to go last.
28};
29
30/// Convert a CPU Type and Subtype pair to an architecture slice.
31Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
32
33/// Convert a name to an architecture slice.
34Architecture getArchitectureFromName(StringRef Name);
35
36/// Convert an architecture slice to a string.
37StringRef getArchitectureName(Architecture Arch);
38
39/// Convert an architecture slice to a CPU Type and Subtype pair.
40std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
41
42raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
43
44} // end namespace MachO.
45} // end namespace llvm.
46
47#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_H