LLVM: lib/IR/BuiltinGCs.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
18
19using namespace llvm;
20
21namespace {
22
23
24
25
26
28public:
29 ErlangGC() {
30 NeededSafePoints = true;
31 UsesMetadata = true;
32 }
33};
34
35
36
37
39public:
40 OcamlGC() {
41 NeededSafePoints = true;
42 UsesMetadata = true;
43 }
44};
45
46
47
48
49
50
51
52
53
54class ShadowStackGC : public GCStrategy {
55public:
56 ShadowStackGC() = default;
57};
58
59
60
61
62
63
64
65class StatepointGC : public GCStrategy {
66public:
67 StatepointGC() {
68 UseStatepoints = true;
69 UseRS4GC = true;
70
71
72 NeededSafePoints = false;
73 UsesMetadata = false;
74 }
75
76 std::optional isGCManagedPointer(const Type *Ty) const override {
77
79
80
81
82
83
84 return (1 == PT->getAddressSpace());
85 }
86};
87
88
89
90
91
92
93
94
95
96
97
99public:
100 CoreCLRGC() {
101 UseStatepoints = true;
102 UseRS4GC = true;
103
104
105 NeededSafePoints = false;
106 UsesMetadata = false;
107 }
108
109 std::optional isGCManagedPointer(const Type *Ty) const override {
110
112
113 return (1 == PT->getAddressSpace());
114 }
115};
116
117}
118
119
120
121
122static GCRegistry::Add A("erlang",
123 "erlang-compatible garbage collector");
124static GCRegistry::Add B("ocaml", "ocaml 3.10-compatible GC");
125static GCRegistry::Add
126 C("shadow-stack", "Very portable GC for uncooperative code generators");
127static GCRegistry::Add D("statepoint-example",
128 "an example strategy for statepoint");
129static GCRegistry::Add E("coreclr", "CoreCLR-compatible GC");
130
131
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
GCStrategy describes a garbage collector algorithm's code generation requirements,...
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void linkAllBuiltinGCs()
FIXME: Collector instances are not useful on their own.
Definition BuiltinGCs.cpp:132
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.