1//===-- SFrame.cpp -----------------------------------------------*- 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#include "llvm/BinaryFormat/SFrame.h"
10#include "llvm/ADT/Enum.h"
11
12using namespace llvm;
13
14EnumStrings<sframe::Version> sframe::getVersions() {
15 constexpr EnumStringDef<Version> VersionDefs[] = {
16#define HANDLE_SFRAME_VERSION(CODE, NAME) {{#NAME}, sframe::Version::NAME},
17#include "llvm/BinaryFormat/SFrameConstants.def"
18 };
19 static constexpr auto Versions = BUILD_ENUM_STRINGS(VersionDefs);
20 return EnumStrings(Versions);
21}
22
23EnumStrings<sframe::Flags> sframe::getFlags() {
24 constexpr EnumStringDef<sframe::Flags> FlagDefs[] = {
25#define HANDLE_SFRAME_FLAG(CODE, NAME) {{#NAME}, sframe::Flags::NAME},
26#include "llvm/BinaryFormat/SFrameConstants.def"
27 };
28 static constexpr auto Flags = BUILD_ENUM_STRINGS(FlagDefs);
29 return EnumStrings(Flags);
30}
31
32EnumStrings<sframe::ABI> sframe::getABIs() {
33 constexpr EnumStringDef<sframe::ABI> ABIDefs[] = {
34#define HANDLE_SFRAME_ABI(CODE, NAME) {{#NAME}, sframe::ABI::NAME},
35#include "llvm/BinaryFormat/SFrameConstants.def"
36 };
37 static constexpr auto ABIs = BUILD_ENUM_STRINGS(ABIDefs);
38 return EnumStrings(ABIs);
39}
40
41EnumStrings<sframe::FREType> sframe::getFRETypes() {
42 constexpr EnumStringDef<sframe::FREType> FRETypeDefs[] = {
43#define HANDLE_SFRAME_FRE_TYPE(CODE, NAME) {{#NAME}, sframe::FREType::NAME},
44#include "llvm/BinaryFormat/SFrameConstants.def"
45 };
46 static constexpr auto FRETypes = BUILD_ENUM_STRINGS(FRETypeDefs);
47 return EnumStrings(FRETypes);
48}
49
50EnumStrings<sframe::FDEType> sframe::getFDETypes() {
51 constexpr EnumStringDef<sframe::FDEType> FDETypeDefs[] = {
52#define HANDLE_SFRAME_FDE_TYPE(CODE, NAME) {{#NAME}, sframe::FDEType::NAME},
53#include "llvm/BinaryFormat/SFrameConstants.def"
54 };
55 static constexpr auto FDETypes = BUILD_ENUM_STRINGS(FDETypeDefs);
56 return EnumStrings(FDETypes);
57}
58
59EnumStrings<sframe::AArch64PAuthKey> sframe::getAArch64PAuthKeys() {
60 constexpr EnumStringDef<sframe::AArch64PAuthKey> AArch64PAuthKeyDefs[] = {
61#define HANDLE_SFRAME_AARCH64_PAUTH_KEY(CODE, NAME) \
62 {{#NAME}, sframe::AArch64PAuthKey::NAME},
63#include "llvm/BinaryFormat/SFrameConstants.def"
64 };
65 static constexpr auto AArch64PAuthKeys =
66 BUILD_ENUM_STRINGS(AArch64PAuthKeyDefs);
67 return EnumStrings(AArch64PAuthKeys);
68}
69
70EnumStrings<sframe::FREOffset> sframe::getFREOffsets() {
71 constexpr EnumStringDef<sframe::FREOffset> FREOffsetDefs[] = {
72#define HANDLE_SFRAME_FRE_OFFSET(CODE, NAME) {{#NAME}, sframe::FREOffset::NAME},
73#include "llvm/BinaryFormat/SFrameConstants.def"
74 };
75 static constexpr auto FREOffsets = BUILD_ENUM_STRINGS(FREOffsetDefs);
76 return EnumStrings(FREOffsets);
77}
78
79EnumStrings<sframe::BaseReg> sframe::getBaseRegisters() {
80 constexpr EnumStringDef<sframe::BaseReg> BaseRegDefs[] = {
81 {.Names: {"FP"}, .Value: sframe::BaseReg::FP},
82 {.Names: {"SP"}, .Value: sframe::BaseReg::SP},
83 };
84 static constexpr auto BaseRegs = BUILD_ENUM_STRINGS(BaseRegDefs);
85 return EnumStrings(BaseRegs);
86}
87