Files
archived-llvm/include/llvm/TextAPI/MachO/Architecture.h
Juergen Ributzka 6eb1d7bc94 [TextAPI] Prefix all architecture enums to fix the build on i386.
Summary: This changes the Architecture enum to use a prefix (AK_) to prevent the
preprocessor from replacing i386 with 1 when building llvm/clang for i386.

Reviewers: steven_wu, lhames, mstorsjo

Reviewed By: mstorsjo

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60241

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357733 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-04 22:56:50 +00:00

48 lines
1.6 KiB
C++

//===- llvm/TextAPI/MachO/Architecture.h - Architecture ---------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Defines the architecture enum and helper methods.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TEXTAPI_MACHO_ARCHITECTURE_H
#define LLVM_TEXTAPI_MACHO_ARCHITECTURE_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace MachO {
/// Defines the architecture slices that are supported by Text-based Stub files.
enum Architecture : uint8_t {
#define ARCHINFO(Arch, Type, SubType) AK_##Arch,
#include "llvm/TextAPI/MachO/Architecture.def"
#undef ARCHINFO
AK_unknown, // this has to go last.
};
/// Convert a CPU Type and Subtype pair to an architecture slice.
Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType);
/// Convert a name to an architecture slice.
Architecture getArchitectureFromName(StringRef Name);
/// Convert an architecture slice to a string.
StringRef getArchitectureName(Architecture Arch);
/// Convert an architecture slice to a CPU Type and Subtype pair.
std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);
raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);
} // end namespace MachO.
} // end namespace llvm.
#endif // LLVM_TEXTAPI_MACHO_ARCHITECTURE_H