blob: 1b7b8787860a7efd0876e1791517d3ed5fb3bd08 (
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
48
49
50
51
52
53
54
55
56
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_MC_MCSYMBOL_H
#define RCC_MC_MCSYMBOL_H
#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
namespace rcc::mc {
class MCContext;
enum class MCSymbolKind : std::uint8_t {
Generic,
Function,
Object,
BasicBlock,
ConstantPool,
JumpTable,
LiteralIsland,
Section,
Temporary,
};
class MCSymbol final {
public:
[[nodiscard]] std::string_view name() const noexcept {
return Name;
}
[[nodiscard]] MCSymbolKind kind() const noexcept {
return Kind;
}
[[nodiscard]] bool isTemporary() const noexcept {
return Kind == MCSymbolKind::Temporary || Kind == MCSymbolKind::BasicBlock ||
Kind == MCSymbolKind::ConstantPool || Kind == MCSymbolKind::JumpTable ||
Kind == MCSymbolKind::LiteralIsland;
}
private:
MCSymbol(std::string Name, MCSymbolKind Kind) : Name(std::move(Name)), Kind(Kind) {}
std::string Name;
MCSymbolKind Kind;
friend class MCContext;
};
using MCSymbolRef = std::shared_ptr<const MCSymbol>;
} // namespace rcc::mc
#endif // RCC_MC_MCSYMBOL_H
|