LLVM  14.0.0git
StringExtras.h
Go to the documentation of this file.
1 //===- llvm/ADT/StringExtras.h - Useful string functions --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains some functions that are useful when dealing with strings.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_ADT_STRINGEXTRAS_H
14 #define LLVM_ADT_STRINGEXTRAS_H
15 
16 #include "llvm/ADT/APSInt.h"
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/ADT/Twine.h"
21 #include <cassert>
22 #include <cstddef>
23 #include <cstdint>
24 #include <cstdlib>
25 #include <cstring>
26 #include <iterator>
27 #include <string>
28 #include <utility>
29 
30 namespace llvm {
31 
32 class raw_ostream;
33 
34 /// hexdigit - Return the hexadecimal character for the
35 /// given number \p X (which should be less than 16).
36 inline char hexdigit(unsigned X, bool LowerCase = false) {
37  assert(X < 16);
38  static const char LUT[] = "0123456789ABCDEF";
39  const uint8_t Offset = LowerCase ? 32 : 0;
40  return LUT[X] | Offset;
41 }
42 
43 /// Given an array of c-style strings terminated by a null pointer, construct
44 /// a vector of StringRefs representing the same strings without the terminating
45 /// null string.
46 inline std::vector<StringRef> toStringRefArray(const char *const *Strings) {
47  std::vector<StringRef> Result;
48  while (*Strings)
49  Result.push_back(*Strings++);
50  return Result;
51 }
52 
53 /// Construct a string ref from a boolean.
54 inline StringRef toStringRef(bool B) { return StringRef(B ? "true" : "false"); }
55 
56 /// Construct a string ref from an array ref of unsigned chars.
57 inline StringRef toStringRef(ArrayRef<uint8_t> Input) {
58  return StringRef(reinterpret_cast<const char *>(Input.begin()), Input.size());
59 }
60 
61 /// Construct a string ref from an array ref of unsigned chars.
62 inline ArrayRef<uint8_t> arrayRefFromStringRef(StringRef Input) {
63  return {Input.bytes_begin(), Input.bytes_end()};
64 }
65 
66 /// Interpret the given character \p C as a hexadecimal digit and return its
67 /// value.
68 ///
69 /// If \p C is not a valid hex digit, -1U is returned.
70 inline unsigned hexDigitValue(char C) {
71  /* clang-format off */
72  static const int16_t LUT[256] = {
73  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
74  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
75  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
76  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, // '0'..'9'
77  -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 'A'..'F'
78  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
79  -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 'a'..'f'
80  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
81  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
82  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
83  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
84  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
85  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
86  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
87  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
88  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
89  };
90  /* clang-format on */
91  return LUT[static_cast<unsigned char>(C)];
92 }
93 
94 /// Checks if character \p C is one of the 10 decimal digits.
95 inline bool isDigit(char C) { return C >= '0' && C <= '9'; }
96 
97 /// Checks if character \p C is a hexadecimal numeric character.
98 inline bool isHexDigit(char C) { return hexDigitValue(C) != ~0U; }
99 
100 /// Checks if character \p C is a valid letter as classified by "C" locale.
101 inline bool isAlpha(char C) {
102  return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z');
103 }
104 
105 /// Checks whether character \p C is either a decimal digit or an uppercase or
106 /// lowercase letter as classified by "C" locale.
107 inline bool isAlnum(char C) { return isAlpha(C) || isDigit(C); }
108 
109 /// Checks whether character \p C is valid ASCII (high bit is zero).
110 inline bool isASCII(char C) { return static_cast<unsigned char>(C) <= 127; }
111 
112 /// Checks whether all characters in S are ASCII.
113 inline bool isASCII(llvm::StringRef S) {
114  for (char C : S)
115  if (LLVM_UNLIKELY(!isASCII(C)))
116  return false;
117  return true;
118 }
119 
120 /// Checks whether character \p C is printable.
121 ///
122 /// Locale-independent version of the C standard library isprint whose results
123 /// may differ on different platforms.
124 inline bool isPrint(char C) {
125  unsigned char UC = static_cast<unsigned char>(C);
126  return (0x20 <= UC) && (UC <= 0x7E);
127 }
128 
129 /// Checks whether character \p C is whitespace in the "C" locale.
130 ///
131 /// Locale-independent version of the C standard library isspace.
132 inline bool isSpace(char C) {
133  return C == ' ' || C == '\f' || C == '\n' || C == '\r' || C == '\t' ||
134  C == '\v';
135 }
136 
137 /// Returns the corresponding lowercase character if \p x is uppercase.
138 inline char toLower(char x) {
139  if (x >= 'A' && x <= 'Z')
140  return x - 'A' + 'a';
141  return x;
142 }
143 
144 /// Returns the corresponding uppercase character if \p x is lowercase.
145 inline char toUpper(char x) {
146  if (x >= 'a' && x <= 'z')
147  return x - 'a' + 'A';
148  return x;
149 }
150 
151 inline std::string utohexstr(uint64_t X, bool LowerCase = false) {
152  char Buffer[17];
153  char *BufPtr = std::end(Buffer);
154 
155  if (X == 0) *--BufPtr = '0';
156 
157  while (X) {
158  unsigned char Mod = static_cast<unsigned char>(X) & 15;
159  *--BufPtr = hexdigit(Mod, LowerCase);
160  X >>= 4;
161  }
162 
163  return std::string(BufPtr, std::end(Buffer));
164 }
165 
166 /// Convert buffer \p Input to its hexadecimal representation.
167 /// The returned string is double the size of \p Input.
168 inline void toHex(ArrayRef<uint8_t> Input, bool LowerCase,
169  SmallVectorImpl<char> &Output) {
170  const size_t Length = Input.size();
171  Output.resize_for_overwrite(Length * 2);
172 
173  for (size_t i = 0; i < Length; i++) {
174  const uint8_t c = Input[i];
175  Output[i * 2 ] = hexdigit(c >> 4, LowerCase);
176  Output[i * 2 + 1] = hexdigit(c & 15, LowerCase);
177  }
178 }
179 
180 inline std::string toHex(ArrayRef<uint8_t> Input, bool LowerCase = false) {
181  SmallString<16> Output;
182  toHex(Input, LowerCase, Output);
183  return std::string(Output);
184 }
185 
186 inline std::string toHex(StringRef Input, bool LowerCase = false) {
187  return toHex(arrayRefFromStringRef(Input), LowerCase);
188 }
189 
190 /// Store the binary representation of the two provided values, \p MSB and
191 /// \p LSB, that make up the nibbles of a hexadecimal digit. If \p MSB or \p LSB
192 /// do not correspond to proper nibbles of a hexadecimal digit, this method
193 /// returns false. Otherwise, returns true.
194 inline bool tryGetHexFromNibbles(char MSB, char LSB, uint8_t &Hex) {
195  unsigned U1 = hexDigitValue(MSB);
196  unsigned U2 = hexDigitValue(LSB);
197  if (U1 == ~0U || U2 == ~0U)
198  return false;
199 
200  Hex = static_cast<uint8_t>((U1 << 4) | U2);
201  return true;
202 }
203 
204 /// Return the binary representation of the two provided values, \p MSB and
205 /// \p LSB, that make up the nibbles of a hexadecimal digit.
206 inline uint8_t hexFromNibbles(char MSB, char LSB) {
207  uint8_t Hex = 0;
208  bool GotHex = tryGetHexFromNibbles(MSB, LSB, Hex);
209  (void)GotHex;
210  assert(GotHex && "MSB and/or LSB do not correspond to hex digits");
211  return Hex;
212 }
213 
214 /// Convert hexadecimal string \p Input to its binary representation and store
215 /// the result in \p Output. Returns true if the binary representation could be
216 /// converted from the hexadecimal string. Returns false if \p Input contains
217 /// non-hexadecimal digits. The output string is half the size of \p Input.
218 inline bool tryGetFromHex(StringRef Input, std::string &Output) {
219  if (Input.empty())
220  return true;
221 
222  // If the input string is not properly aligned on 2 nibbles we pad out the
223  // front with a 0 prefix; e.g. `ABC` -> `0ABC`.
224  Output.resize((Input.size() + 1) / 2);
225  char *OutputPtr = const_cast<char *>(Output.data());
226  if (Input.size() % 2 == 1) {
227  uint8_t Hex = 0;
228  if (!tryGetHexFromNibbles('0', Input.front(), Hex))
229  return false;
230  *OutputPtr++ = Hex;
231  Input = Input.drop_front();
232  }
233 
234  // Convert the nibble pairs (e.g. `9C`) into bytes (0x9C).
235  // With the padding above we know the input is aligned and the output expects
236  // exactly half as many bytes as nibbles in the input.
237  size_t InputSize = Input.size();
238  assert(InputSize % 2 == 0);
239  const char *InputPtr = Input.data();
240  for (size_t OutputIndex = 0; OutputIndex < InputSize / 2; ++OutputIndex) {
241  uint8_t Hex = 0;
242  if (!tryGetHexFromNibbles(InputPtr[OutputIndex * 2 + 0], // MSB
243  InputPtr[OutputIndex * 2 + 1], // LSB
244  Hex))
245  return false;
246  OutputPtr[OutputIndex] = Hex;
247  }
248  return true;
249 }
250 
251 /// Convert hexadecimal string \p Input to its binary representation.
252 /// The return string is half the size of \p Input.
253 inline std::string fromHex(StringRef Input) {
254  std::string Hex;
255  bool GotHex = tryGetFromHex(Input, Hex);
256  (void)GotHex;
257  assert(GotHex && "Input contains non hex digits");
258  return Hex;
259 }
260 
261 /// Convert the string \p S to an integer of the specified type using
262 /// the radix \p Base. If \p Base is 0, auto-detects the radix.
263 /// Returns true if the number was successfully converted, false otherwise.
264 template <typename N> bool to_integer(StringRef S, N &Num, unsigned Base = 0) {
265  return !S.getAsInteger(Base, Num);
266 }
267 
268 namespace detail {
269 template <typename N>
270 inline bool to_float(const Twine &T, N &Num, N (*StrTo)(const char *, char **)) {
271  SmallString<32> Storage;
272  StringRef S = T.toNullTerminatedStringRef(Storage);
273  char *End;
274  N Temp = StrTo(S.data(), &End);
275  if (*End != '\0')
276  return false;
277  Num = Temp;
278  return true;
279 }
280 }
281 
282 inline bool to_float(const Twine &T, float &Num) {
283  return detail::to_float(T, Num, strtof);
284 }
285 
286 inline bool to_float(const Twine &T, double &Num) {
287  return detail::to_float(T, Num, strtod);
288 }
289 
290 inline bool to_float(const Twine &T, long double &Num) {
291  return detail::to_float(T, Num, strtold);
292 }
293 
294 inline std::string utostr(uint64_t X, bool isNeg = false) {
295  char Buffer[21];
296  char *BufPtr = std::end(Buffer);
297 
298  if (X == 0) *--BufPtr = '0'; // Handle special case...
299 
300  while (X) {
301  *--BufPtr = '0' + char(X % 10);
302  X /= 10;
303  }
304 
305  if (isNeg) *--BufPtr = '-'; // Add negative sign...
306  return std::string(BufPtr, std::end(Buffer));
307 }
308 
309 inline std::string itostr(int64_t X) {
310  if (X < 0)
311  return utostr(static_cast<uint64_t>(1) + ~static_cast<uint64_t>(X), true);
312  else
313  return utostr(static_cast<uint64_t>(X));
314 }
315 
316 inline std::string toString(const APInt &I, unsigned Radix, bool Signed,
317  bool formatAsCLiteral = false) {
318  SmallString<40> S;
319  I.toString(S, Radix, Signed, formatAsCLiteral);
320  return std::string(S.str());
321 }
322 
323 inline std::string toString(const APSInt &I, unsigned Radix) {
324  return toString(I, Radix, I.isSigned());
325 }
326 
327 /// StrInStrNoCase - Portable version of strcasestr. Locates the first
328 /// occurrence of string 's1' in string 's2', ignoring case. Returns
329 /// the offset of s2 in s1 or npos if s2 cannot be found.
330 StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2);
331 
332 /// getToken - This function extracts one token from source, ignoring any
333 /// leading characters that appear in the Delimiters string, and ending the
334 /// token at any of the characters that appear in the Delimiters string. If
335 /// there are no tokens in the source string, an empty string is returned.
336 /// The function returns a pair containing the extracted token and the
337 /// remaining tail string.
338 std::pair<StringRef, StringRef> getToken(StringRef Source,
339  StringRef Delimiters = " \t\n\v\f\r");
340 
341 /// SplitString - Split up the specified string according to the specified
342 /// delimiters, appending the result fragments to the output list.
343 void SplitString(StringRef Source,
344  SmallVectorImpl<StringRef> &OutFragments,
345  StringRef Delimiters = " \t\n\v\f\r");
346 
347 /// Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th).
348 inline StringRef getOrdinalSuffix(unsigned Val) {
349  // It is critically important that we do this perfectly for
350  // user-written sequences with over 100 elements.
351  switch (Val % 100) {
352  case 11:
353  case 12:
354  case 13:
355  return "th";
356  default:
357  switch (Val % 10) {
358  case 1: return "st";
359  case 2: return "nd";
360  case 3: return "rd";
361  default: return "th";
362  }
363  }
364 }
365 
366 /// Print each character of the specified string, escaping it if it is not
367 /// printable or if it is an escape char.
368 void printEscapedString(StringRef Name, raw_ostream &Out);
369 
370 /// Print each character of the specified string, escaping HTML special
371 /// characters.
372 void printHTMLEscaped(StringRef String, raw_ostream &Out);
373 
374 /// printLowerCase - Print each character as lowercase if it is uppercase.
375 void printLowerCase(StringRef String, raw_ostream &Out);
376 
377 /// Converts a string from camel-case to snake-case by replacing all uppercase
378 /// letters with '_' followed by the letter in lowercase, except if the
379 /// uppercase letter is the first character of the string.
380 std::string convertToSnakeFromCamelCase(StringRef input);
381 
382 /// Converts a string from snake-case to camel-case by replacing all occurrences
383 /// of '_' followed by a lowercase letter with the letter in uppercase.
384 /// Optionally allow capitalization of the first letter (if it is a lowercase
385 /// letter)
386 std::string convertToCamelFromSnakeCase(StringRef input,
387  bool capitalizeFirst = false);
388 
389 namespace detail {
390 
391 template <typename IteratorT>
392 inline std::string join_impl(IteratorT Begin, IteratorT End,
393  StringRef Separator, std::input_iterator_tag) {
394  std::string S;
395  if (Begin == End)
396  return S;
397 
398  S += (*Begin);
399  while (++Begin != End) {
400  S += Separator;
401  S += (*Begin);
402  }
403  return S;
404 }
405 
406 template <typename IteratorT>
407 inline std::string join_impl(IteratorT Begin, IteratorT End,
408  StringRef Separator, std::forward_iterator_tag) {
409  std::string S;
410  if (Begin == End)
411  return S;
412 
413  size_t Len = (std::distance(Begin, End) - 1) * Separator.size();
414  for (IteratorT I = Begin; I != End; ++I)
415  Len += (*I).size();
416  S.reserve(Len);
417  size_t PrevCapacity = S.capacity();
418  (void)PrevCapacity;
419  S += (*Begin);
420  while (++Begin != End) {
421  S += Separator;
422  S += (*Begin);
423  }
424  assert(PrevCapacity == S.capacity() && "String grew during building");
425  return S;
426 }
427 
428 template <typename Sep>
429 inline void join_items_impl(std::string &Result, Sep Separator) {}
430 
431 template <typename Sep, typename Arg>
432 inline void join_items_impl(std::string &Result, Sep Separator,
433  const Arg &Item) {
434  Result += Item;
435 }
436 
437 template <typename Sep, typename Arg1, typename... Args>
438 inline void join_items_impl(std::string &Result, Sep Separator, const Arg1 &A1,
439  Args &&... Items) {
440  Result += A1;
441  Result += Separator;
442  join_items_impl(Result, Separator, std::forward<Args>(Items)...);
443 }
444 
445 inline size_t join_one_item_size(char) { return 1; }
446 inline size_t join_one_item_size(const char *S) { return S ? ::strlen(S) : 0; }
447 
448 template <typename T> inline size_t join_one_item_size(const T &Str) {
449  return Str.size();
450 }
451 
452 inline size_t join_items_size() { return 0; }
453 
454 template <typename A1> inline size_t join_items_size(const A1 &A) {
455  return join_one_item_size(A);
456 }
457 template <typename A1, typename... Args>
458 inline size_t join_items_size(const A1 &A, Args &&... Items) {
459  return join_one_item_size(A) + join_items_size(std::forward<Args>(Items)...);
460 }
461 
462 } // end namespace detail
463 
464 /// Joins the strings in the range [Begin, End), adding Separator between
465 /// the elements.
466 template <typename IteratorT>
467 inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) {
468  using tag = typename std::iterator_traits<IteratorT>::iterator_category;
469  return detail::join_impl(Begin, End, Separator, tag());
470 }
471 
472 /// Joins the strings in the range [R.begin(), R.end()), adding Separator
473 /// between the elements.
474 template <typename Range>
475 inline std::string join(Range &&R, StringRef Separator) {
476  return join(R.begin(), R.end(), Separator);
477 }
478 
479 /// Joins the strings in the parameter pack \p Items, adding \p Separator
480 /// between the elements. All arguments must be implicitly convertible to
481 /// std::string, or there should be an overload of std::string::operator+=()
482 /// that accepts the argument explicitly.
483 template <typename Sep, typename... Args>
484 inline std::string join_items(Sep Separator, Args &&... Items) {
485  std::string Result;
486  if (sizeof...(Items) == 0)
487  return Result;
488 
489  size_t NS = detail::join_one_item_size(Separator);
490  size_t NI = detail::join_items_size(std::forward<Args>(Items)...);
491  Result.reserve(NI + (sizeof...(Items) - 1) * NS + 1);
492  detail::join_items_impl(Result, Separator, std::forward<Args>(Items)...);
493  return Result;
494 }
495 
496 /// A helper class to return the specified delimiter string after the first
497 /// invocation of operator StringRef(). Used to generate a comma-separated
498 /// list from a loop like so:
499 ///
500 /// \code
501 /// ListSeparator LS;
502 /// for (auto &I : C)
503 /// OS << LS << I.getName();
504 /// \end
505 class ListSeparator {
506  bool First = true;
507  StringRef Separator;
508 
509 public:
510  ListSeparator(StringRef Separator = ", ") : Separator(Separator) {}
511  operator StringRef() {
512  if (First) {
513  First = false;
514  return {};
515  }
516  return Separator;
517  }
518 };
519 
520 /// A forward iterator over partitions of string over a separator.
521 class SplittingIterator
522  : public iterator_facade_base<SplittingIterator, std::forward_iterator_tag,
523  StringRef> {
524  char SeparatorStorage;
525  StringRef Current;
526  StringRef Next;
527  StringRef Separator;
528 
529 public:
530  SplittingIterator(StringRef Str, StringRef Separator)
531  : Next(Str), Separator(Separator) {
532  ++*this;
533  }
534 
535  SplittingIterator(StringRef Str, char Separator)
536  : SeparatorStorage(Separator), Next(Str),
537  Separator(&SeparatorStorage, 1) {
538  ++*this;
539  }
540 
541  SplittingIterator(const SplittingIterator &R)
542  : SeparatorStorage(R.SeparatorStorage), Current(R.Current), Next(R.Next),
543  Separator(R.Separator) {
544  if (R.Separator.data() == &R.SeparatorStorage)
545  Separator = StringRef(&SeparatorStorage, 1);
546  }
547 
548  SplittingIterator &operator=(const SplittingIterator &R) {
549  if (this == &R)
550  return *this;
551 
552  SeparatorStorage = R.SeparatorStorage;
553  Current = R.Current;
554  Next = R.Next;
555  Separator = R.Separator;
556  if (R.Separator.data() == &R.SeparatorStorage)
557  Separator = StringRef(&SeparatorStorage, 1);
558  return *this;
559  }
560 
561  bool operator==(const SplittingIterator &R) const {
562  assert(Separator == R.Separator);
563  return Current.data() == R.Current.data();
564  }
565 
566  const StringRef &operator*() const { return Current; }
567 
568  StringRef &operator*() { return Current; }
569 
570  SplittingIterator &operator++() {
571  std::tie(Current, Next) = Next.split(Separator);
572  return *this;
573  }
574 };
575 
576 /// Split the specified string over a separator and return a range-compatible
577 /// iterable over its partitions. Used to permit conveniently iterating
578 /// over separated strings like so:
579 ///
580 /// \code
581 /// for (StringRef x : llvm::split("foo,bar,baz", ","))
582 /// ...;
583 /// \end
584 ///
585 /// Note that the passed string must remain valid throuhgout lifetime
586 /// of the iterators.
587 inline iterator_range<SplittingIterator> split(StringRef Str, StringRef Separator) {
588  return {SplittingIterator(Str, Separator),
589  SplittingIterator(StringRef(), Separator)};
590 }
591 
592 inline iterator_range<SplittingIterator> split(StringRef Str, char Separator) {
593  return {SplittingIterator(Str, Separator),
594  SplittingIterator(StringRef(), Separator)};
595 }
596 
597 } // end namespace llvm
598 
599 #endif // LLVM_ADT_STRINGEXTRAS_H
i
i
Definition: README.txt:29
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4644
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::StringRef::size_type
size_t size_type
Definition: StringRef.h:63
StringRef.h
llvm::toString
std::string toString(Error E)
Write all error messages (if any) in E to a string.
Definition: Error.h:1030
llvm::lltok::APSInt
@ APSInt
Definition: LLToken.h:498
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:236
T
#define T
Definition: Mips16ISelLowering.cpp:341
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:80
llvm::sys::locale::isPrint
bool isPrint(int c)
Definition: Locale.cpp:13
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:207
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:185
s2
_bar mov r0 mov r1 fldd LCPI1_0 fmrrd d0 bl _foo fmdrr r5 fmsr s2
Definition: README.txt:159
SmallString.h
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
Twine.h
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
llvm::dwarf::toStringRef
StringRef toStringRef(const Optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
Definition: DWARFFormValue.h:191
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
input
The initial backend is deliberately restricted to z10 We should add support for later architectures at some point If an asm ties an i32 r result to an i64 input
Definition: README.txt:10
c
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
Definition: README.txt:418
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
uint64_t
llvm::symbolize::toHex
static std::string toHex(uint64_t V)
Definition: DIPrinter.cpp:276
I
#define I(x, y, z)
Definition: MD5.cpp:58
ArrayRef.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::operator==
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1986
APSInt.h
llvm::operator*
APInt operator*(APInt a, uint64_t RHS)
Definition: APInt.h:2110
isDigit
static bool isDigit(const char C)
Definition: RustDemangle.cpp:206
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
split
coro split
Definition: CoroSplit.cpp:2350
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
x
TODO unsigned x
Definition: README.txt:10
s1
int s1
Definition: README.txt:182
N
#define N
isHexDigit
static bool isHexDigit(const char C)
Definition: RustDemangle.cpp:208
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
LLVM_UNLIKELY
#define LLVM_UNLIKELY(EXPR)
Definition: Compiler.h:230
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58