blob: d5f088f792fbf0c9fab9599974f33f7950c371f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_TARGET_RISCV_RISCVSUBTARGET_H
#define RCC_TARGET_RISCV_RISCVSUBTARGET_H
#include "rcc/Support/Error.h"
#include <cstdint>
#include <span>
#include <string>
namespace rcc::riscv {
enum class RISCVExtension : std::uint8_t {
I,
M,
A,
F,
D,
C,
Zicsr,
Zifencei,
Zacas,
Zabha,
Count,
};
class RISCVSubtargetFeatures final {
public:
[[nodiscard]] static Expected<RISCVSubtargetFeatures>
fromFeatureList(std::span<const std::string> Features);
[[nodiscard]] static RISCVSubtargetFeatures rv64gc() noexcept;
[[nodiscard]] bool has(RISCVExtension Extension) const noexcept;
friend bool operator==(const RISCVSubtargetFeatures &Left,
const RISCVSubtargetFeatures &Right) = default;
private:
explicit constexpr RISCVSubtargetFeatures(std::uint16_t Enabled) noexcept : Enabled(Enabled) {}
std::uint16_t Enabled = 0;
};
} // namespace rcc::riscv
#endif // RCC_TARGET_RISCV_RISCVSUBTARGET_H
|