LLVM: include/llvm/Support/Jobserver.h Source File (original) (raw)
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
57
58
59
60
61
62
63
64
65
66#ifndef LLVM_SUPPORT_JOBSERVER_H
67#define LLVM_SUPPORT_JOBSERVER_H
68
70
71namespace llvm {
72
73
74
76public:
77
79
80
82 Other.Value = kInvalidValue;
83 }
85 if (this != &Other) {
86 this->Value = Other.Value;
87 Other.Value = kInvalidValue;
88 }
89 return *this;
90 }
91
92
95
96
97 bool isValid() const { return Value >= 0; }
98
99
100 bool isImplicit() const { return Value == kImplicitValue; }
101
103 return JobSlot(static_cast<int16_t>(V));
104 }
105
107
110
111private:
114
115 JobSlot(int16_t V) : Value(V) {}
116
117
118
119
120
121
122
123
124
125
126 static constexpr int16_t kInvalidValue = -1;
127 static constexpr int16_t kImplicitValue = INT16_MAX;
128 int16_t Value = kInvalidValue;
129};
130
131
132
134public:
136
137
138
139
141
142
144
145
146
148
149
150
151
153
154
156};
157
158}
159
160#endif
#define LLVM_ABI_FOR_TEST
A JobSlot represents a single job slot that can be acquired from or released to a jobserver pool.
Definition Jobserver.h:75
static JobSlot createExplicit(uint8_t V)
Definition Jobserver.h:102
JobSlot()=default
Default constructor creates an invalid instance.
JobSlot & operator=(const JobSlot &)=delete
uint8_t getExplicitValue() const
JobSlot(JobSlot &&Other) noexcept
Definition Jobserver.h:81
bool isImplicit() const
Returns true if this instance represents the implicit job slot.
Definition Jobserver.h:100
JobSlot & operator=(JobSlot &&Other) noexcept
Definition Jobserver.h:84
bool isExplicit() const
Definition Jobserver.h:109
bool isValid() const
Returns true if this instance is valid (either implicit or explicit).
Definition Jobserver.h:97
friend class JobserverClient
Definition Jobserver.h:112
friend class JobserverClientImpl
Definition Jobserver.h:113
static JobSlot createImplicit()
Definition Jobserver.h:106
JobSlot(const JobSlot &)=delete
The public interface for a jobserver client.
Definition Jobserver.h:133
virtual JobSlot tryAcquire()=0
Tries to acquire a job slot from the pool.
virtual void release(JobSlot Slot)=0
Releases a job slot back to the pool.
static LLVM_ABI_FOR_TEST JobserverClient * getInstance()
Returns the singleton instance of the JobserverClient.
static LLVM_ABI_FOR_TEST void resetForTesting()
Resets the singleton instance. For testing purposes only.
virtual ~JobserverClient()
virtual unsigned getNumJobs() const =0
Returns the number of job slots available, as determined on first use.
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value