llvm.org GIT mirror llvm / 2d9eb72
Fix Doxygen issues: * wrap code blocks in \code ... \endcode; * refer to parameter names in paragraphs correctly (\arg is not what most people want -- it starts a new paragraph). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163790 91177308-0d34-0410-b5e6-96231b3b80d8 Dmitri Gribenko 7 years ago
17 changed file(s) with 247 addition(s) and 246 deletion(s). Raw diff Collapse all Expand all
250250 /// constructor.
251251 APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
252252
253 /// This constructor interprets the string \arg str in the given radix. The
253 /// This constructor interprets the string \p str in the given radix. The
254254 /// interpretation stops when the first character that is not suitable for the
255255 /// radix is encountered, or the end of the string. Acceptable radix values
256256 /// are 2, 8, 10, 16, and 36. It is an error for the value implied by the
12301230 }
12311231
12321232 /// This method determines how many bits are required to hold the APInt
1233 /// equivalent of the string given by \arg str.
1233 /// equivalent of the string given by \p str.
12341234 /// @brief Get bits required for string value.
12351235 static unsigned getBitsNeeded(StringRef str, uint8_t radix);
12361236
5656 ///
5757 /// \param Dependencies The list of dependencies amongst changes. For each
5858 /// (x,y) in \arg Dependencies, both x and y must be in \arg Changes. The
59 /// minimization algorithm guarantees that for each tested changed set S, x
60 /// \in S implies y \in S. It is an error to have cyclic dependencies.
59 /// minimization algorithm guarantees that for each tested changed set S,
60 /// \f$ x \in S \f$ implies \f$ y \in S \f$. It is an error to have cyclic
61 /// dependencies.
6162 changeset_ty Run(const changeset_ty &Changes,
6263 const std::vector &Dependencies);
6364
4343 /// @name String Assignment
4444 /// @{
4545
46 /// Assign from a repeated element
46 /// Assign from a repeated element.
4747 void assign(size_t NumElts, char Elt) {
4848 this->SmallVectorImpl::assign(NumElts, Elt);
4949 }
5050
51 /// Assign from an iterator pair
51 /// Assign from an iterator pair.
5252 template
5353 void assign(in_iter S, in_iter E) {
5454 this->clear();
5555 SmallVectorImpl::append(S, E);
5656 }
5757
58 /// Assign from a StringRef
58 /// Assign from a StringRef.
5959 void assign(StringRef RHS) {
6060 this->clear();
6161 SmallVectorImpl::append(RHS.begin(), RHS.end());
6262 }
6363
64 /// Assign from a SmallVector
64 /// Assign from a SmallVector.
6565 void assign(const SmallVectorImpl &RHS) {
6666 this->clear();
6767 SmallVectorImpl::append(RHS.begin(), RHS.end());
7171 /// @name String Concatenation
7272 /// @{
7373
74 /// Append from an iterator pair
74 /// Append from an iterator pair.
7575 template
7676 void append(in_iter S, in_iter E) {
7777 SmallVectorImpl::append(S, E);
8282 }
8383
8484
85 /// Append from a StringRef
85 /// Append from a StringRef.
8686 void append(StringRef RHS) {
8787 SmallVectorImpl::append(RHS.begin(), RHS.end());
8888 }
8989
90 /// Append from a SmallVector
90 /// Append from a SmallVector.
9191 void append(const SmallVectorImpl &RHS) {
9292 SmallVectorImpl::append(RHS.begin(), RHS.end());
9393 }
9696 /// @name String Comparison
9797 /// @{
9898
99 /// equals - Check for string equality, this is more efficient than
100 /// compare() when the relative ordering of inequal strings isn't needed.
99 /// Check for string equality. This is more efficient than compare() when
100 /// the relative ordering of inequal strings isn't needed.
101101 bool equals(StringRef RHS) const {
102102 return str().equals(RHS);
103103 }
104104
105 /// equals_lower - Check for string equality, ignoring case.
105 /// Check for string equality, ignoring case.
106106 bool equals_lower(StringRef RHS) const {
107107 return str().equals_lower(RHS);
108108 }
109109
110 /// compare - Compare two strings; the result is -1, 0, or 1 if this string
111 /// is lexicographically less than, equal to, or greater than the \arg RHS.
110 /// Compare two strings; the result is -1, 0, or 1 if this string is
111 /// lexicographically less than, equal to, or greater than the \p RHS.
112112 int compare(StringRef RHS) const {
113113 return str().compare(RHS);
114114 }
128128 /// @name String Predicates
129129 /// @{
130130
131 /// startswith - Check if this string starts with the given \arg Prefix.
131 /// startswith - Check if this string starts with the given \p Prefix.
132132 bool startswith(StringRef Prefix) const {
133133 return str().startswith(Prefix);
134134 }
135135
136 /// endswith - Check if this string ends with the given \arg Suffix.
136 /// endswith - Check if this string ends with the given \p Suffix.
137137 bool endswith(StringRef Suffix) const {
138138 return str().endswith(Suffix);
139139 }
142142 /// @name String Searching
143143 /// @{
144144
145 /// find - Search for the first character \arg C in the string.
146 ///
147 /// \return - The index of the first occurrence of \arg C, or npos if not
145 /// find - Search for the first character \p C in the string.
146 ///
147 /// \return - The index of the first occurrence of \p C, or npos if not
148148 /// found.
149149 size_t find(char C, size_t From = 0) const {
150150 return str().find(C, From);
151151 }
152152
153 /// find - Search for the first string \arg Str in the string.
154 ///
155 /// \return - The index of the first occurrence of \arg Str, or npos if not
153 /// Search for the first string \p Str in the string.
154 ///
155 /// \returns The index of the first occurrence of \p Str, or npos if not
156156 /// found.
157157 size_t find(StringRef Str, size_t From = 0) const {
158158 return str().find(Str, From);
159159 }
160160
161 /// rfind - Search for the last character \arg C in the string.
162 ///
163 /// \return - The index of the last occurrence of \arg C, or npos if not
161 /// Search for the last character \p C in the string.
162 ///
163 /// \returns The index of the last occurrence of \p C, or npos if not
164164 /// found.
165165 size_t rfind(char C, size_t From = StringRef::npos) const {
166166 return str().rfind(C, From);
167167 }
168168
169 /// rfind - Search for the last string \arg Str in the string.
170 ///
171 /// \return - The index of the last occurrence of \arg Str, or npos if not
169 /// Search for the last string \p Str in the string.
170 ///
171 /// \returns The index of the last occurrence of \p Str, or npos if not
172172 /// found.
173173 size_t rfind(StringRef Str) const {
174174 return str().rfind(Str);
175175 }
176176
177 /// find_first_of - Find the first character in the string that is \arg C,
178 /// or npos if not found. Same as find.
177 /// Find the first character in the string that is \p C, or npos if not
178 /// found. Same as find.
179179 size_t find_first_of(char C, size_t From = 0) const {
180180 return str().find_first_of(C, From);
181181 }
182182
183 /// find_first_of - Find the first character in the string that is in \arg
184 /// Chars, or npos if not found.
185 ///
186 /// Note: O(size() + Chars.size())
183 /// Find the first character in the string that is in \p Chars, or npos if
184 /// not found.
185 ///
186 /// Complexity: O(size() + Chars.size())
187187 size_t find_first_of(StringRef Chars, size_t From = 0) const {
188188 return str().find_first_of(Chars, From);
189189 }
190190
191 /// find_first_not_of - Find the first character in the string that is not
192 /// \arg C or npos if not found.
191 /// Find the first character in the string that is not \p C or npos if not
192 /// found.
193193 size_t find_first_not_of(char C, size_t From = 0) const {
194194 return str().find_first_not_of(C, From);
195195 }
196196
197 /// find_first_not_of - Find the first character in the string that is not
198 /// in the string \arg Chars, or npos if not found.
199 ///
200 /// Note: O(size() + Chars.size())
197 /// Find the first character in the string that is not in the string
198 /// \p Chars, or npos if not found.
199 ///
200 /// Complexity: O(size() + Chars.size())
201201 size_t find_first_not_of(StringRef Chars, size_t From = 0) const {
202202 return str().find_first_not_of(Chars, From);
203203 }
204204
205 /// find_last_of - Find the last character in the string that is \arg C, or
206 /// npos if not found.
205 /// Find the last character in the string that is \p C, or npos if not
206 /// found.
207207 size_t find_last_of(char C, size_t From = StringRef::npos) const {
208208 return str().find_last_of(C, From);
209209 }
210210
211 /// find_last_of - Find the last character in the string that is in \arg C,
212 /// or npos if not found.
213 ///
214 /// Note: O(size() + Chars.size())
211 /// Find the last character in the string that is in \p C, or npos if not
212 /// found.
213 ///
214 /// Complexity: O(size() + Chars.size())
215215 size_t find_last_of(
216216 StringRef Chars, size_t From = StringRef::npos) const {
217217 return str().find_last_of(Chars, From);
221221 /// @name Helpful Algorithms
222222 /// @{
223223
224 /// count - Return the number of occurrences of \arg C in the string.
224 /// Return the number of occurrences of \p C in the string.
225225 size_t count(char C) const {
226226 return str().count(C);
227227 }
228228
229 /// count - Return the number of non-overlapped occurrences of \arg Str in
230 /// the string.
229 /// Return the number of non-overlapped occurrences of \p Str in the
230 /// string.
231231 size_t count(StringRef Str) const {
232232 return str().count(Str);
233233 }
236236 /// @name Substring Operations
237237 /// @{
238238
239 /// substr - Return a reference to the substring from [Start, Start + N).
240 ///
241 /// \param Start - The index of the starting character in the substring; if
239 /// Return a reference to the substring from [Start, Start + N).
240 ///
241 /// \param Start The index of the starting character in the substring; if
242242 /// the index is npos or greater than the length of the string then the
243243 /// empty substring will be returned.
244244 ///
245 /// \param N - The number of characters to included in the substring. If N
245 /// \param N The number of characters to included in the substring. If \p N
246246 /// exceeds the number of characters remaining in the string, the string
247 /// suffix (starting with \arg Start) will be returned.
247 /// suffix (starting with \p Start) will be returned.
248248 StringRef substr(size_t Start, size_t N = StringRef::npos) const {
249249 return str().substr(Start, N);
250250 }
251251
252 /// slice - Return a reference to the substring from [Start, End).
253 ///
254 /// \param Start - The index of the starting character in the substring; if
252 /// Return a reference to the substring from [Start, End).
253 ///
254 /// \param Start The index of the starting character in the substring; if
255255 /// the index is npos or greater than the length of the string then the
256256 /// empty substring will be returned.
257257 ///
258 /// \param End - The index following the last character to include in the
259 /// substring. If this is npos, or less than \arg Start, or exceeds the
258 /// \param End The index following the last character to include in the
259 /// substring. If this is npos, or less than \p Start, or exceeds the
260260 /// number of characters remaining in the string, the string suffix
261 /// (starting with \arg Start) will be returned.
261 /// (starting with \p Start) will be returned.
262262 StringRef slice(size_t Start, size_t End) const {
263263 return str().slice(Start, End);
264264 }
265265
266266 // Extra methods.
267267
268 /// Explicit conversion to StringRef
268 /// Explicit conversion to StringRef.
269269 StringRef str() const { return StringRef(this->begin(), this->size()); }
270270
271271 // TODO: Make this const, if it's safe...
683683 RHS.begin(), RHS.end());
684684 }
685685
686 /// set_size - Set the array size to \arg N, which the current array must have
687 /// enough capacity for.
686 /// Set the array size to \p N, which the current array must have enough
687 /// capacity for.
688688 ///
689689 /// This does not construct or destroy any elements in the vector.
690690 ///
2020 template class SmallVectorImpl;
2121
2222 /// hexdigit - Return the hexadecimal character for the
23 /// given number \arg X (which should be less than 16).
23 /// given number \p X (which should be less than 16).
2424 static inline char hexdigit(unsigned X, bool LowerCase = false) {
2525 const char HexChar = LowerCase ? 'a' : 'A';
2626 return X < 10 ? '0' + X : HexChar + X - 10;
137137 }
138138
139139 /// compare - Compare two strings; the result is -1, 0, or 1 if this string
140 /// is lexicographically less than, equal to, or greater than the \arg RHS.
140 /// is lexicographically less than, equal to, or greater than the \p RHS.
141141 int compare(StringRef RHS) const {
142142 // Check the prefix for a mismatch.
143143 if (int Res = compareMemory(Data, RHS.Data, min(Length, RHS.Length)))
204204 /// @name String Predicates
205205 /// @{
206206
207 /// startswith - Check if this string starts with the given \arg Prefix.
207 /// Check if this string starts with the given \p Prefix.
208208 bool startswith(StringRef Prefix) const {
209209 return Length >= Prefix.Length &&
210210 compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
211211 }
212212
213 /// endswith - Check if this string ends with the given \arg Suffix.
213 /// Check if this string ends with the given \p Suffix.
214214 bool endswith(StringRef Suffix) const {
215215 return Length >= Suffix.Length &&
216216 compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0;
220220 /// @name String Searching
221221 /// @{
222222
223 /// find - Search for the first character \arg C in the string.
224 ///
225 /// \return - The index of the first occurrence of \arg C, or npos if not
223 /// Search for the first character \p C in the string.
224 ///
225 /// \returns The index of the first occurrence of \p C, or npos if not
226226 /// found.
227227 size_t find(char C, size_t From = 0) const {
228228 for (size_t i = min(From, Length), e = Length; i != e; ++i)
231231 return npos;
232232 }
233233
234 /// find - Search for the first string \arg Str in the string.
235 ///
236 /// \return - The index of the first occurrence of \arg Str, or npos if not
234 /// Search for the first string \p Str in the string.
235 ///
236 /// \returns The index of the first occurrence of \p Str, or npos if not
237237 /// found.
238238 size_t find(StringRef Str, size_t From = 0) const;
239239
240 /// rfind - Search for the last character \arg C in the string.
241 ///
242 /// \return - The index of the last occurrence of \arg C, or npos if not
240 /// Search for the last character \p C in the string.
241 ///
242 /// \returns The index of the last occurrence of \p C, or npos if not
243243 /// found.
244244 size_t rfind(char C, size_t From = npos) const {
245245 From = min(From, Length);
252252 return npos;
253253 }
254254
255 /// rfind - Search for the last string \arg Str in the string.
256 ///
257 /// \return - The index of the last occurrence of \arg Str, or npos if not
255 /// Search for the last string \p Str in the string.
256 ///
257 /// \returns The index of the last occurrence of \p Str, or npos if not
258258 /// found.
259259 size_t rfind(StringRef Str) const;
260260
261 /// find_first_of - Find the first character in the string that is \arg C,
262 /// or npos if not found. Same as find.
261 /// Find the first character in the string that is \p C, or npos if not
262 /// found. Same as find.
263263 size_type find_first_of(char C, size_t From = 0) const {
264264 return find(C, From);
265265 }
266266
267 /// find_first_of - Find the first character in the string that is in \arg
268 /// Chars, or npos if not found.
269 ///
270 /// Note: O(size() + Chars.size())
267 /// Find the first character in the string that is in \p Chars, or npos if
268 /// not found.
269 ///
270 /// Complexity: O(size() + Chars.size())
271271 size_type find_first_of(StringRef Chars, size_t From = 0) const;
272272
273 /// find_first_not_of - Find the first character in the string that is not
274 /// \arg C or npos if not found.
273 /// Find the first character in the string that is not \p C or npos if not
274 /// found.
275275 size_type find_first_not_of(char C, size_t From = 0) const;
276276
277 /// find_first_not_of - Find the first character in the string that is not
278 /// in the string \arg Chars, or npos if not found.
279 ///
280 /// Note: O(size() + Chars.size())
277 /// Find the first character in the string that is not in the string
278 /// \p Chars, or npos if not found.
279 ///
280 /// Complexity: O(size() + Chars.size())
281281 size_type find_first_not_of(StringRef Chars, size_t From = 0) const;
282282
283 /// find_last_of - Find the last character in the string that is \arg C, or
284 /// npos if not found.
283 /// Find the last character in the string that is \p C, or npos if not
284 /// found.
285285 size_type find_last_of(char C, size_t From = npos) const {
286286 return rfind(C, From);
287287 }
288288
289 /// find_last_of - Find the last character in the string that is in \arg C,
290 /// or npos if not found.
291 ///
292 /// Note: O(size() + Chars.size())
289 /// Find the last character in the string that is in \p C, or npos if not
290 /// found.
291 ///
292 /// Complexity: O(size() + Chars.size())
293293 size_type find_last_of(StringRef Chars, size_t From = npos) const;
294294
295 /// find_last_not_of - Find the last character in the string that is not
296 /// \arg C, or npos if not found.
295 /// Find the last character in the string that is not \p C, or npos if not
296 /// found.
297297 size_type find_last_not_of(char C, size_t From = npos) const;
298298
299 /// find_last_not_of - Find the last character in the string that is not in
300 /// \arg Chars, or npos if not found.
301 ///
302 /// Note: O(size() + Chars.size())
299 /// Find the last character in the string that is not in \p Chars, or
300 /// npos if not found.
301 ///
302 /// Complexity: O(size() + Chars.size())
303303 size_type find_last_not_of(StringRef Chars, size_t From = npos) const;
304304
305305 /// @}
306306 /// @name Helpful Algorithms
307307 /// @{
308308
309 /// count - Return the number of occurrences of \arg C in the string.
309 /// Return the number of occurrences of \p C in the string.
310310 size_t count(char C) const {
311311 size_t Count = 0;
312312 for (size_t i = 0, e = Length; i != e; ++i)
315315 return Count;
316316 }
317317
318 /// count - Return the number of non-overlapped occurrences of \arg Str in
318 /// Return the number of non-overlapped occurrences of \p Str in
319319 /// the string.
320320 size_t count(StringRef Str) const;
321321
322 /// getAsInteger - Parse the current string as an integer of the specified
323 /// radix. If Radix is specified as zero, this does radix autosensing using
322 /// Parse the current string as an integer of the specified radix. If
323 /// \p Radix is specified as zero, this does radix autosensing using
324324 /// extended C rules: 0 is octal, 0x is hex, 0b is binary.
325325 ///
326326 /// If the string is invalid or if only a subset of the string is valid,
327327 /// this returns true to signify the error. The string is considered
328328 /// erroneous if empty or if it overflows T.
329 ///
330329 template
331330 typename enable_if_c::is_signed, bool>::type
332331 getAsInteger(unsigned Radix, T &Result) const {
349348 return false;
350349 }
351350
352 /// getAsInteger - Parse the current string as an integer of the
353 /// specified radix, or of an autosensed radix if the radix given
354 /// is 0. The current value in Result is discarded, and the
355 /// storage is changed to be wide enough to store the parsed
356 /// integer.
357 ///
358 /// Returns true if the string does not solely consist of a valid
351 /// Parse the current string as an integer of the specified \p Radix, or of
352 /// an autosensed radix if the \p Radix given is 0. The current value in
353 /// \p Result is discarded, and the storage is changed to be wide enough to
354 /// store the parsed integer.
355 ///
356 /// \returns true if the string does not solely consist of a valid
359357 /// non-empty number in the appropriate base.
360358 ///
361359 /// APInt::fromString is superficially similar but assumes the
366364 /// @name String Operations
367365 /// @{
368366
369 // lower - Convert the given ASCII string to lowercase.
367 // Convert the given ASCII string to lowercase.
370368 std::string lower() const;
371369
372 /// upper - Convert the given ASCII string to uppercase.
370 /// Convert the given ASCII string to uppercase.
373371 std::string upper() const;
374372
375373 /// @}
376374 /// @name Substring Operations
377375 /// @{
378376
379 /// substr - Return a reference to the substring from [Start, Start + N).
380 ///
381 /// \param Start - The index of the starting character in the substring; if
377 /// Return a reference to the substring from [Start, Start + N).
378 ///
379 /// \param Start The index of the starting character in the substring; if
382380 /// the index is npos or greater than the length of the string then the
383381 /// empty substring will be returned.
384382 ///
385 /// \param N - The number of characters to included in the substring. If N
383 /// \param N The number of characters to included in the substring. If N
386384 /// exceeds the number of characters remaining in the string, the string
387 /// suffix (starting with \arg Start) will be returned.
385 /// suffix (starting with \p Start) will be returned.
388386 StringRef substr(size_t Start, size_t N = npos) const {
389387 Start = min(Start, Length);
390388 return StringRef(Data + Start, min(N, Length - Start));
391389 }
392390
393 /// drop_front - Return a StringRef equal to 'this' but with the first
394 /// elements dropped.
391 /// Return a StringRef equal to 'this' but with the first \p N elements
392 /// dropped.
395393 StringRef drop_front(unsigned N = 1) const {
396394 assert(size() >= N && "Dropping more elements than exist");
397395 return substr(N);
398396 }
399397
400 /// drop_back - Return a StringRef equal to 'this' but with the last
401 /// elements dropped.
398 /// Return a StringRef equal to 'this' but with the last \p N elements
399 /// dropped.
402400 StringRef drop_back(unsigned N = 1) const {
403401 assert(size() >= N && "Dropping more elements than exist");
404402 return substr(0, size()-N);
405403 }
406404
407 /// slice - Return a reference to the substring from [Start, End).
408 ///
409 /// \param Start - The index of the starting character in the substring; if
405 /// Return a reference to the substring from [Start, End).
406 ///
407 /// \param Start The index of the starting character in the substring; if
410408 /// the index is npos or greater than the length of the string then the
411409 /// empty substring will be returned.
412410 ///
413 /// \param End - The index following the last character to include in the
414 /// substring. If this is npos, or less than \arg Start, or exceeds the
411 /// \param End The index following the last character to include in the
412 /// substring. If this is npos, or less than \p Start, or exceeds the
415413 /// number of characters remaining in the string, the string suffix
416 /// (starting with \arg Start) will be returned.
414 /// (starting with \p Start) will be returned.
417415 StringRef slice(size_t Start, size_t End) const {
418416 Start = min(Start, Length);
419417 End = min(max(Start, End), Length);
420418 return StringRef(Data + Start, End - Start);
421419 }
422420
423 /// split - Split into two substrings around the first occurrence of a
424 /// separator character.
425 ///
426 /// If \arg Separator is in the string, then the result is a pair (LHS, RHS)
421 /// Split into two substrings around the first occurrence of a separator
422 /// character.
423 ///
424 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
427425 /// such that (*this == LHS + Separator + RHS) is true and RHS is
428 /// maximal. If \arg Separator is not in the string, then the result is a
426 /// maximal. If \p Separator is not in the string, then the result is a
429427 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
430428 ///
431 /// \param Separator - The character to split on.
432 /// \return - The split substrings.
429 /// \param Separator The character to split on.
430 /// \returns The split substrings.
433431 std::pair split(char Separator) const {
434432 size_t Idx = find(Separator);
435433 if (Idx == npos)
437435 return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
438436 }
439437
440 /// split - Split into two substrings around the first occurrence of a
441 /// separator string.
442 ///
443 /// If \arg Separator is in the string, then the result is a pair (LHS, RHS)
438 /// Split into two substrings around the first occurrence of a separator
439 /// string.
440 ///
441 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
444442 /// such that (*this == LHS + Separator + RHS) is true and RHS is
445 /// maximal. If \arg Separator is not in the string, then the result is a
443 /// maximal. If \p Separator is not in the string, then the result is a
446444 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
447445 ///
448446 /// \param Separator - The string to split on.
454452 return std::make_pair(slice(0, Idx), slice(Idx + Separator.size(), npos));
455453 }
456454
457 /// split - Split into substrings around the occurrences of a separator
458 /// string.
459 ///
460 /// Each substring is stored in \arg A. If \arg MaxSplit is >= 0, at most
461 /// \arg MaxSplit splits are done and consequently <= \arg MaxSplit
455 /// Split into substrings around the occurrences of a separator string.
456 ///
457 /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most
458 /// \p MaxSplit splits are done and consequently <= \p MaxSplit
462459 /// elements are added to A.
463 /// If \arg KeepEmpty is false, empty strings are not added to \arg A. They
464 /// still count when considering \arg MaxSplit
460 /// If \p KeepEmpty is false, empty strings are not added to \p A. They
461 /// still count when considering \p MaxSplit
465462 /// An useful invariant is that
466463 /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
467464 ///
473470 StringRef Separator, int MaxSplit = -1,
474471 bool KeepEmpty = true) const;
475472
476 /// rsplit - Split into two substrings around the last occurrence of a
477 /// separator character.
478 ///
479 /// If \arg Separator is in the string, then the result is a pair (LHS, RHS)
473 /// Split into two substrings around the last occurrence of a separator
474 /// character.
475 ///
476 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
480477 /// such that (*this == LHS + Separator + RHS) is true and RHS is
481 /// minimal. If \arg Separator is not in the string, then the result is a
478 /// minimal. If \p Separator is not in the string, then the result is a
482479 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
483480 ///
484481 /// \param Separator - The character to split on.
490487 return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
491488 }
492489
493 /// ltrim - Return string with consecutive characters in \arg Chars starting
494 /// from the left removed.
490 /// Return string with consecutive characters in \p Chars starting from
491 /// the left removed.
495492 StringRef ltrim(StringRef Chars = " \t\n\v\f\r") const {
496493 return drop_front(std::min(Length, find_first_not_of(Chars)));
497494 }
498495
499 /// rtrim - Return string with consecutive characters in \arg Chars starting
500 /// from the right removed.
496 /// Return string with consecutive characters in \p Chars starting from
497 /// the right removed.
501498 StringRef rtrim(StringRef Chars = " \t\n\v\f\r") const {
502499 return drop_back(Length - std::min(Length, find_last_not_of(Chars) + 1));
503500 }
504501
505 /// trim - Return string with consecutive characters in \arg Chars starting
506 /// from the left and right removed.
502 /// Return string with consecutive characters in \p Chars starting from
503 /// the left and right removed.
507504 StringRef trim(StringRef Chars = " \t\n\v\f\r") const {
508505 return ltrim(Chars).rtrim(Chars);
509506 }
341341 /// to a known type.
342342 void setEnvironment(EnvironmentType Kind);
343343
344 /// setTriple - Set all components to the new triple \arg Str.
344 /// setTriple - Set all components to the new triple \p Str.
345345 void setTriple(const Twine &Str);
346346
347347 /// setArchName - Set the architecture (first) component of the
392392 /// @name Static helpers for IDs.
393393 /// @{
394394
395 /// getArchTypeName - Get the canonical name for the \arg Kind
396 /// architecture.
395 /// getArchTypeName - Get the canonical name for the \p Kind architecture.
397396 static const char *getArchTypeName(ArchType Kind);
398397
399 /// getArchTypePrefix - Get the "prefix" canonical name for the \arg Kind
398 /// getArchTypePrefix - Get the "prefix" canonical name for the \p Kind
400399 /// architecture. This is the prefix used by the architecture specific
401400 /// builtins, and is suitable for passing to \see
402401 /// Intrinsic::getIntrinsicForGCCBuiltin().
404403 /// \return - The architecture prefix, or 0 if none is defined.
405404 static const char *getArchTypePrefix(ArchType Kind);
406405
407 /// getVendorTypeName - Get the canonical name for the \arg Kind
408 /// vendor.
406 /// getVendorTypeName - Get the canonical name for the \p Kind vendor.
409407 static const char *getVendorTypeName(VendorType Kind);
410408
411 /// getOSTypeName - Get the canonical name for the \arg Kind operating
412 /// system.
409 /// getOSTypeName - Get the canonical name for the \p Kind operating system.
413410 static const char *getOSTypeName(OSType Kind);
414411
415 /// getEnvironmentTypeName - Get the canonical name for the \arg Kind
412 /// getEnvironmentTypeName - Get the canonical name for the \p Kind
416413 /// environment.
417414 static const char *getEnvironmentTypeName(EnvironmentType Kind);
418415
4343 /// itself, and renders as an empty string. This can be returned from APIs to
4444 /// effectively nullify any concatenations performed on the result.
4545 ///
46 /// \b Implementation \n
46 /// \b Implementation
4747 ///
4848 /// Given the nature of a Twine, it is not possible for the Twine's
4949 /// concatenation method to construct interior nodes; the result must be
6666 ///
6767 /// These invariants are check by \see isValid().
6868 ///
69 /// \b Efficiency Considerations \n
69 /// \b Efficiency Considerations
7070 ///
7171 /// The Twine is designed to yield efficient and small code for common
7272 /// situations. For this reason, the concat() method is inlined so that
302302 LHS.character = static_cast(Val);
303303 }
304304
305 /// Construct a twine to print \arg Val as an unsigned decimal integer.
305 /// Construct a twine to print \p Val as an unsigned decimal integer.
306306 explicit Twine(unsigned Val)
307307 : LHSKind(DecUIKind), RHSKind(EmptyKind) {
308308 LHS.decUI = Val;
309309 }
310310
311 /// Construct a twine to print \arg Val as a signed decimal integer.
311 /// Construct a twine to print \p Val as a signed decimal integer.
312312 explicit Twine(int Val)
313313 : LHSKind(DecIKind), RHSKind(EmptyKind) {
314314 LHS.decI = Val;
315315 }
316316
317 /// Construct a twine to print \arg Val as an unsigned decimal integer.
317 /// Construct a twine to print \p Val as an unsigned decimal integer.
318318 explicit Twine(const unsigned long &Val)
319319 : LHSKind(DecULKind), RHSKind(EmptyKind) {
320320 LHS.decUL = &Val;
321321 }
322322
323 /// Construct a twine to print \arg Val as a signed decimal integer.
323 /// Construct a twine to print \p Val as a signed decimal integer.
324324 explicit Twine(const long &Val)
325325 : LHSKind(DecLKind), RHSKind(EmptyKind) {
326326 LHS.decL = &Val;
327327 }
328328
329 /// Construct a twine to print \arg Val as an unsigned decimal integer.
329 /// Construct a twine to print \p Val as an unsigned decimal integer.
330330 explicit Twine(const unsigned long long &Val)
331331 : LHSKind(DecULLKind), RHSKind(EmptyKind) {
332332 LHS.decULL = &Val;
333333 }
334334
335 /// Construct a twine to print \arg Val as a signed decimal integer.
335 /// Construct a twine to print \p Val as a signed decimal integer.
336336 explicit Twine(const long long &Val)
337337 : LHSKind(DecLLKind), RHSKind(EmptyKind) {
338338 LHS.decLL = &Val;
369369 /// @name Numeric Conversions
370370 /// @{
371371
372 // Construct a twine to print \arg Val as an unsigned hexadecimal integer.
372 // Construct a twine to print \p Val as an unsigned hexadecimal integer.
373373 static Twine utohexstr(const uint64_t &Val) {
374374 Child LHS, RHS;
375375 LHS.uHex = &Val;
446446 /// The returned StringRef's size does not include the null terminator.
447447 StringRef toNullTerminatedStringRef(SmallVectorImpl &Out) const;
448448
449 /// print - Write the concatenated string represented by this twine to the
450 /// stream \arg OS.
449 /// Write the concatenated string represented by this twine to the
450 /// stream \p OS.
451451 void print(raw_ostream &OS) const;
452452
453 /// dump - Dump the concatenated string represented by this twine to stderr.
453 /// Dump the concatenated string represented by this twine to stderr.
454454 void dump() const;
455455
456 /// print - Write the representation of this twine to the stream \arg OS.
456 /// Write the representation of this twine to the stream \p OS.
457457 void printRepr(raw_ostream &OS) const;
458458
459 /// dumpRepr - Dump the representation of this twine to stderr.
459 /// Dump the representation of this twine to stderr.
460460 void dumpRepr() const;
461461
462462 /// @}
12601260 // Utility creation methods
12611261 //===--------------------------------------------------------------------===//
12621262
1263 /// CreateIsNull - Return an i1 value testing if \arg Arg is null.
1263 /// CreateIsNull - Return an i1 value testing if \p Arg is null.
12641264 Value *CreateIsNull(Value *Arg, const Twine &Name = "") {
12651265 return CreateICmpEQ(Arg, Constant::getNullValue(Arg->getType()),
12661266 Name);
12671267 }
12681268
1269 /// CreateIsNotNull - Return an i1 value testing if \arg Arg is not null.
1269 /// CreateIsNotNull - Return an i1 value testing if \p Arg is not null.
12701270 Value *CreateIsNotNull(Value *Arg, const Twine &Name = "") {
12711271 return CreateICmpNE(Arg, Constant::getNullValue(Arg->getType()),
12721272 Name);
430430 return A + 1;
431431 }
432432
433 /// RoundUpToAlignment - Returns the next integer (mod 2**64) that is
434 /// greater than or equal to \arg Value and is a multiple of \arg
435 /// Align. Align must be non-zero.
433 /// Returns the next integer (mod 2**64) that is greater than or equal to
434 /// \p Value and is a multiple of \p Align. \p Align must be non-zero.
436435 ///
437436 /// Examples:
438 /// RoundUpToAlignment(5, 8) = 8
439 /// RoundUpToAlignment(17, 8) = 24
440 /// RoundUpToAlignment(~0LL, 8) = 0
437 /// \code
438 /// RoundUpToAlignment(5, 8) = 8
439 /// RoundUpToAlignment(17, 8) = 24
440 /// RoundUpToAlignment(~0LL, 8) = 0
441 /// \endcode
441442 inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) {
442443 return ((Value + Align - 1) / Align) * Align;
443444 }
444445
445 /// OffsetToAlignment - Return the offset to the next integer (mod 2**64) that
446 /// is greater than or equal to \arg Value and is a multiple of \arg
447 /// Align. Align must be non-zero.
446 /// Returns the offset to the next integer (mod 2**64) that is greater than
447 /// or equal to \p Value and is a multiple of \p Align. \p Align must be
448 /// non-zero.
448449 inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) {
449450 return RoundUpToAlignment(Value, Align) - Value;
450451 }
270270 /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified
271271 /// target triple.
272272 ///
273 /// \arg Triple - This argument is used to determine the target machine
273 /// \param Triple This argument is used to determine the target machine
274274 /// feature set; it should always be provided. Generally this should be
275275 /// either the target triple from the module, or the target triple of the
276276 /// host if that does not exist.
316316
317317 /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
318318 ///
319 /// \arg Triple - This argument is used to determine the target machine
319 /// \param Triple This argument is used to determine the target machine
320320 /// feature set; it should always be provided. Generally this should be
321321 /// either the target triple from the module, or the target triple of the
322322 /// host if that does not exist.
323 /// \arg CPU - This specifies the name of the target CPU.
324 /// \arg Features - This specifies the string representation of the
323 /// \param CPU This specifies the name of the target CPU.
324 /// \param Features This specifies the string representation of the
325325 /// additional target features.
326326 MCSubtargetInfo *createMCSubtargetInfo(StringRef Triple, StringRef CPU,
327327 StringRef Features) const {
331331 }
332332
333333 /// createTargetMachine - Create a target specific machine implementation
334 /// for the specified \arg Triple.
335 ///
336 /// \arg Triple - This argument is used to determine the target machine
334 /// for the specified \p Triple.
335 ///
336 /// \param Triple This argument is used to determine the target machine
337337 /// feature set; it should always be provided. Generally this should be
338338 /// either the target triple from the module, or the target triple of the
339339 /// host if that does not exist.
350350
351351 /// createMCAsmBackend - Create a target specific assembly parser.
352352 ///
353 /// \arg Triple - The target triple string.
354 /// \arg Backend - The target independent assembler object.
353 /// \param Triple The target triple string.
354 /// \param Backend The target independent assembler object.
355355 MCAsmBackend *createMCAsmBackend(StringRef Triple) const {
356356 if (!MCAsmBackendCtorFn)
357357 return 0;
369369
370370 /// createMCAsmParser - Create a target specific assembly parser.
371371 ///
372 /// \arg Parser - The target independent parser implementation to use for
372 /// \param Parser The target independent parser implementation to use for
373373 /// parsing and lexing.
374374 MCTargetAsmParser *createMCAsmParser(MCSubtargetInfo &STI,
375375 MCAsmParser &Parser) const {
415415
416416 /// createMCObjectStreamer - Create a target specific MCStreamer.
417417 ///
418 /// \arg TT - The target triple.
419 /// \arg Ctx - The target context.
420 /// \arg TAB - The target assembler backend object. Takes ownership.
421 /// \arg _OS - The stream object.
422 /// \arg _Emitter - The target independent assembler object.Takes ownership.
423 /// \arg RelaxAll - Relax all fixups?
424 /// \arg NoExecStack - Mark file as not needing a executable stack.
418 /// \param TT The target triple.
419 /// \param Ctx The target context.
420 /// \param TAB The target assembler backend object. Takes ownership.
421 /// \param _OS The stream object.
422 /// \param _Emitter The target independent assembler object.Takes ownership.
423 /// \param RelaxAll Relax all fixups?
424 /// \param NoExecStack Mark file as not needing a executable stack.
425425 MCStreamer *createMCObjectStreamer(StringRef TT, MCContext &Ctx,
426426 MCAsmBackend &TAB,
427427 raw_ostream &_OS,
4040 /// before llvm_start_multithreaded().
4141 void llvm_release_global_lock();
4242
43 /// llvm_execute_on_thread - Execute the given \arg UserFn on a separate
44 /// thread, passing it the provided \arg UserData.
43 /// llvm_execute_on_thread - Execute the given \p UserFn on a separate
44 /// thread, passing it the provided \p UserData.
4545 ///
4646 /// This function does not guarantee that the code will actually be executed
4747 /// on a separate thread or honoring the requested stack size, but tries to do
190190
191191 raw_ostream &operator<<(double N);
192192
193 /// write_hex - Output \arg N in hexadecimal, without any prefix or padding.
193 /// write_hex - Output \p N in hexadecimal, without any prefix or padding.
194194 raw_ostream &write_hex(unsigned long long N);
195195
196 /// write_escaped - Output \arg Str, turning '\\', '\t', '\n', '"', and
196 /// write_escaped - Output \p Str, turning '\\', '\t', '\n', '"', and
197197 /// anything that doesn't satisfy std::isprint into an escape sequence.
198198 raw_ostream &write_escaped(StringRef Str, bool UseHexEscapes = false);
199199
244244
245245 private:
246246 /// write_impl - The is the piece of the class that is implemented
247 /// by subclasses. This writes the \args Size bytes starting at
248 /// \arg Ptr to the underlying stream.
247 /// by subclasses. This writes the \p Size bytes starting at
248 /// \p Ptr to the underlying stream.
249249 ///
250250 /// This function is guaranteed to only be called at a point at which it is
251251 /// safe for the subclass to install a new buffer via SetBuffer.
252252 ///
253 /// \arg Ptr - The start of the data to be written. For buffered streams this
253 /// \param Ptr The start of the data to be written. For buffered streams this
254254 /// is guaranteed to be the start of the buffer.
255 /// \arg Size - The number of bytes to be written.
255 ///
256 /// \param Size The number of bytes to be written.
256257 ///
257258 /// \invariant { Size > 0 }
258259 virtual void write_impl(const char *Ptr, size_t Size) = 0;
472473 public:
473474 /// Construct a new raw_svector_ostream.
474475 ///
475 /// \arg O - The vector to write to; this should generally have at least 128
476 /// \param O The vector to write to; this should generally have at least 128
476477 /// bytes free to avoid any extraneous memory overhead.
477478 explicit raw_svector_ostream(SmallVectorImpl &O);
478479 ~raw_svector_ostream();
119119 /// setName() - Change the name of the value, choosing a new unique name if
120120 /// the provided name is taken.
121121 ///
122 /// \arg Name - The new name; or "" if the value's name should be removed.
122 /// \param Name The new name; or "" if the value's name should be removed.
123123 void setName(const Twine &Name);
124124
125125
661661 /// DupRetToEnableTailCallOpts - Look for opportunities to duplicate return
662662 /// instructions to the predecessor to enable tail call optimizations. The
663663 /// case it is currently looking for is:
664 /// @code
664665 /// bb0:
665666 /// %tmp0 = tail call i32 @f0()
666667 /// br label %return
673674 /// return:
674675 /// %retval = phi i32 [ %tmp0, %bb0 ], [ %tmp1, %bb1 ], [ %tmp2, %bb2 ]
675676 /// ret i32 %retval
677 /// @endcode
676678 ///
677679 /// =>
678680 ///
681 /// @code
679682 /// bb0:
680683 /// %tmp0 = tail call i32 @f0()
681684 /// ret i32 %tmp0
685688 /// bb2:
686689 /// %tmp2 = tail call i32 @f2()
687690 /// ret i32 %tmp2
688 ///
691 /// @endcode
689692 bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
690693 if (!TLI)
691694 return false;
6969 public:
7070 /// Constructor
7171 ///
72 /// @r - True if the mod bits of the ModR/M byte must be 11; false
72 /// \param r True if the mod bits of the ModR/M byte must be 11; false
7373 /// otherwise. The name r derives from the fact that the mod
7474 /// bits indicate whether the R/M bits [bits 2-0] signify a
7575 /// register or a memory operand.
9797 public:
9898 /// Constructor
9999 ///
100 /// @c0_ff - True if the ModR/M byte must fall between 0xc0 and 0xff;
101 /// false otherwise.
102 /// @nnn_or_modRM - If c0_ff is true, the required value of the entire ModR/M
103 /// byte. If c0_ff is false, the required value of the nnn
104 /// field.
100 /// \param c0_ff True if the ModR/M byte must fall between 0xc0 and 0xff;
101 /// false otherwise.
102 ///
103 /// \param nnn_or_modRM If c0_ff is true, the required value of the entire
104 /// ModR/M byte. If c0_ff is false, the required value
105 /// of the nnn field.
105106 EscapeFilter(bool c0_ff, uint8_t nnn_or_modRM) :
106107 ModRMFilter(),
107108 C0_FF(c0_ff),
127128 public:
128129 /// Constructor
129130 ///
130 /// @modRM - The value of the ModR/M byte when the register operand
131 /// refers to the first register in the register set.
131 /// \param modRM The value of the ModR/M byte when the register operand
132 /// refers to the first register in the register set.
132133 AddRegEscapeFilter(uint8_t modRM) : ModRM(modRM) {
133134 }
134135
149150 public:
150151 /// Constructor
151152 ///
152 /// @r - True if the mod field must be set to 11; false otherwise.
153 /// The name is explained at ModFilter.
154 /// @nnn - The required value of the nnn field.
153 /// \param r True if the mod field must be set to 11; false otherwise.
154 /// The name is explained at ModFilter.
155 /// \param nnn The required value of the nnn field.
155156 ExtendedFilter(bool r, uint8_t nnn) :
156157 ModRMFilter(),
157158 R(r),
176177 public:
177178 /// Constructor
178179 ///
179 /// @modRM - The required value of the full ModR/M byte.
180 /// \param modRM The required value of the full ModR/M byte.
180181 ExactFilter(uint8_t modRM) :
181182 ModRMFilter(),
182183 ModRM(modRM) {
224224 /// emitInstructionSpecifier - Loads the instruction specifier for the current
225225 /// instruction into a DisassemblerTables.
226226 ///
227 /// @arg tables - The DisassemblerTables to populate with the specifier for
227 /// \param tables The DisassemblerTables to populate with the specifier for
228228 /// the current instruction.
229229 void emitInstructionSpecifier(DisassemblerTables &tables);
230230
231231 /// emitDecodePath - Populates the proper fields in the decode tables
232232 /// corresponding to the decode paths for this instruction.
233233 ///
234 /// @arg tables - The DisassemblerTables to populate with the decode
234 /// \param tables The DisassemblerTables to populate with the decode
235235 /// decode information for the current instruction.
236236 void emitDecodePath(DisassemblerTables &tables) const;
237237
238238 /// Constructor - Initializes a RecognizableInstr with the appropriate fields
239239 /// from a CodeGenInstruction.
240240 ///
241 /// @arg tables - The DisassemblerTables that the specifier will be added to.
242 /// @arg insn - The CodeGenInstruction to extract information from.
243 /// @arg uid - The unique ID of the current instruction.
241 /// \param tables The DisassemblerTables that the specifier will be added to.
242 /// \param insn The CodeGenInstruction to extract information from.
243 /// \param uid The unique ID of the current instruction.
244244 RecognizableInstr(DisassemblerTables &tables,
245245 const CodeGenInstruction &insn,
246246 InstrUID uid);
248248 /// processInstr - Accepts a CodeGenInstruction and loads decode information
249249 /// for it into a DisassemblerTables if appropriate.
250250 ///
251 /// @arg tables - The DiassemblerTables to be populated with decode
251 /// \param tables The DiassemblerTables to be populated with decode
252252 /// information.
253 /// @arg insn - The CodeGenInstruction to be used as a source for this
253 /// \param insn The CodeGenInstruction to be used as a source for this
254254 /// information.
255 /// @uid - The unique ID of the instruction.
255 /// \param uid The unique ID of the instruction.
256256 static void processInstr(DisassemblerTables &tables,
257257 const CodeGenInstruction &insn,
258258 InstrUID uid);