xref: /llvm-project/llvm/include/llvm/Support/AArch64BuildAttributes.h (revision de4bbbfdccb6172c563b07889ecfb06bc4974a7e)
1 //===-- AArch64BuildAttributes.h - AARch64 Build Attributes -----*- 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 // This file contains enumerations and support routines for AArch64 build
10 // attributes as defined in Build Attributes for the AArch64 document.
11 //
12 // Build Attributes for the Arm® 64-bit Architecture (AArch64) 2024Q1
13 //
14 // https://github.com/ARM-software/abi-aa/pull/230
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_SUPPORT_AARCH64BUILDATTRIBUTES_H
19 #define LLVM_SUPPORT_AARCH64BUILDATTRIBUTES_H
20 
21 #include "llvm/ADT/StringRef.h"
22 
23 namespace llvm {
24 
25 namespace AArch64BuildAttrs {
26 
27 /// AArch64 build attributes vendors IDs (a.k.a subsection name)
28 enum VendorID : unsigned {
29   AEABI_FEATURE_AND_BITS = 0,
30   AEABI_PAUTHABI = 1,
31   VENDOR_UNKNOWN = 404 // Treated as a private subsection name
32 };
33 StringRef getVendorName(unsigned const Vendor);
34 VendorID getVendorID(StringRef const Vendor);
35 
36 enum SubsectionOptional : unsigned {
37   REQUIRED = 0,
38   OPTIONAL = 1,
39   OPTIONAL_NOT_FOUND = 404
40 };
41 StringRef getOptionalStr(unsigned Optional);
42 SubsectionOptional getOptionalID(StringRef Optional);
43 StringRef getSubsectionOptionalUnknownError();
44 
45 enum SubsectionType : unsigned { ULEB128 = 0, NTBS = 1, TYPE_NOT_FOUND = 404 };
46 StringRef getTypeStr(unsigned Type);
47 SubsectionType getTypeID(StringRef Type);
48 StringRef getSubsectionTypeUnknownError();
49 
50 enum PauthABITags : unsigned {
51   TAG_PAUTH_PLATFORM = 1,
52   TAG_PAUTH_SCHEMA = 2,
53   PAUTHABI_TAG_NOT_FOUND = 404
54 };
55 StringRef getPauthABITagsStr(unsigned PauthABITag);
56 PauthABITags getPauthABITagsID(StringRef PauthABITag);
57 
58 enum FeatureAndBitsTags : unsigned {
59   TAG_FEATURE_BTI = 0,
60   TAG_FEATURE_PAC = 1,
61   TAG_FEATURE_GCS = 2,
62   FEATURE_AND_BITS_TAG_NOT_FOUND = 404
63 };
64 StringRef getFeatureAndBitsTagsStr(unsigned FeatureAndBitsTag);
65 FeatureAndBitsTags getFeatureAndBitsTagsID(StringRef FeatureAndBitsTag);
66 
67 enum FeatureAndBitsFlag : unsigned {
68   Feature_BTI_Flag = 1 << 0,
69   Feature_PAC_Flag = 1 << 1,
70   Feature_GCS_Flag = 1 << 2
71 };
72 } // namespace AArch64BuildAttrs
73 } // namespace llvm
74 
75 #endif // LLVM_SUPPORT_AARCH64BUILDATTRIBUTES_H