xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/RISCVAttributes.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===-- RISCVAttributes.h - RISCV 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 for RISCV attributes as defined in RISC-V
10 // ELF psABI specification.
11 //
12 // RISC-V ELF psABI specification
13 //
14 // https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md
15 //
16 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_SUPPORT_RISCVATTRIBUTES_H
18 #define LLVM_SUPPORT_RISCVATTRIBUTES_H
19 
20 #include "llvm/Support/Compiler.h"
21 #include "llvm/Support/ELFAttributes.h"
22 
23 namespace llvm {
24 namespace RISCVAttrs {
25 
26 LLVM_ABI const TagNameMap &getRISCVAttributeTags();
27 
28 enum AttrType : unsigned {
29   // Attribute types in ELF/.riscv.attributes.
30   STACK_ALIGN = 4,
31   ARCH = 5,
32   UNALIGNED_ACCESS = 6,
33   PRIV_SPEC = 8,
34   PRIV_SPEC_MINOR = 10,
35   PRIV_SPEC_REVISION = 12,
36   ATOMIC_ABI = 14,
37 };
38 
39 enum class RISCVAtomicAbiTag : unsigned {
40   // Values for Tag_RISCV_atomic_abi
41   // Defined at
42   // https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#tag_riscv_atomic_abi-14-uleb128version
43   UNKNOWN = 0,
44   A6C = 1,
45   A6S = 2,
46   A7 = 3,
47 };
48 
49 enum { NOT_ALLOWED = 0, ALLOWED = 1 };
50 
51 } // namespace RISCVAttrs
52 } // namespace llvm
53 
54 #endif
55