Go to the documentation of this file.
29 unsigned char LHC = toLower(
LHS[
I]);
30 unsigned char RHC = toLower(
RHS[
I]);
32 return LHC < RHC ? -1 : 1;
40 if (Length ==
RHS.Length)
42 return Length <
RHS.Length ? -1 : 1;
46 return Length >=
Prefix.Length &&
51 return Length >= Suffix.Length &&
57 return find_if([L](
char D) {
return toLower(
D) == L; },
From);
68 for (J =
I + 1; J !=
E + 1; ++J) {
69 bool ld = J < Length &&
isDigit(Data[J]);
77 if (
int Res = compareMemory(Data +
I,
RHS.Data +
I, J -
I))
78 return Res < 0 ? -1 : 1;
83 if (Data[
I] !=
RHS.Data[
I])
84 return (
unsigned char)Data[
I] < (
unsigned char)
RHS.Data[
I] ? -1 : 1;
86 if (Length ==
RHS.Length)
88 return Length <
RHS.Length ? -1 : 1;
93 bool AllowReplacements,
94 unsigned MaxEditDistance)
const {
97 AllowReplacements, MaxEditDistance);
101 StringRef Other,
bool AllowReplacements,
unsigned MaxEditDistance)
const {
104 llvm::toLower, AllowReplacements, MaxEditDistance);
134 const char *Start = Data +
From;
135 size_t Size = Length -
From;
137 const char *Needle = Str.data();
138 size_t N = Str.size();
144 const char *
Ptr = (
const char *)::memchr(Start, Needle[0], Size);
148 const char *Stop = Start + (Size -
N + 1);
158 }
while (Start < Stop);
163 if (Size < 16 || N > 255) {
168 }
while (Start < Stop);
173 uint8_t BadCharSkip[256];
174 std::memset(BadCharSkip,
N, 256);
175 for (
unsigned i = 0;
i !=
N-1; ++
i)
176 BadCharSkip[(uint8_t)Str[
i]] =
N-1-
i;
179 uint8_t
Last = Start[
N - 1];
185 Start += BadCharSkip[
Last];
186 }
while (Start < Stop);
193 while (
This.size() >= Str.size()) {
194 if (
This.startswith_insensitive(Str))
207 if (toLower(Data[
i]) == toLower(
C))
218 return std::string_view(*this).rfind(Str);
222 size_t N = Str.size();
225 for (
size_t i = Length -
N + 1,
e = 0;
i !=
e;) {
239 std::bitset<1 << CHAR_BIT> CharBits;
241 CharBits.set((
unsigned char)
C);
244 if (CharBits.test((
unsigned char)Data[
i]))
252 return std::string_view(*this).find_first_not_of(
C,
From);
261 std::bitset<1 << CHAR_BIT> CharBits;
263 CharBits.set((
unsigned char)
C);
266 if (!CharBits.test((
unsigned char)Data[
i]))
277 std::bitset<1 << CHAR_BIT> CharBits;
279 CharBits.set((
unsigned char)
C);
282 if (CharBits.test((
unsigned char)Data[
i]))
302 std::bitset<1 << CHAR_BIT> CharBits;
304 CharBits.set((
unsigned char)
C);
307 if (!CharBits.test((
unsigned char)Data[
i]))
314 bool KeepEmpty)
const {
321 while (MaxSplit-- != 0) {
322 size_t Idx =
S.find(Separator);
327 if (KeepEmpty || Idx > 0)
328 A.push_back(
S.slice(0, Idx));
335 if (KeepEmpty || !
S.empty())
340 int MaxSplit,
bool KeepEmpty)
const {
347 while (MaxSplit-- != 0) {
348 size_t Idx =
S.find(Separator);
353 if (KeepEmpty || Idx > 0)
354 A.push_back(
S.slice(0, Idx));
357 S =
S.slice(Idx + 1,
npos);
361 if (KeepEmpty || !
S.empty())
374 size_t N = Str.size();
380 while ((Pos =
find(Str, Pos)) !=
npos) {
391 if (Str.startswith(
"0x") || Str.startswith(
"0X")) {
396 if (Str.startswith(
"0b") || Str.startswith(
"0B")) {
401 if (Str.startswith(
"0o")) {
406 if (Str[0] ==
'0' && Str.size() > 1 &&
isDigit(Str[1])) {
415 unsigned long long &Result) {
421 if (Str.empty())
return true;
426 while (!Str2.
empty()) {
428 if (Str2[0] >=
'0' && Str2[0] <=
'9')
429 CharVal = Str2[0] -
'0';
430 else if (Str2[0] >=
'a' && Str2[0] <=
'z')
431 CharVal = Str2[0] -
'a' + 10;
432 else if (Str2[0] >=
'A' && Str2[0] <=
'Z')
433 CharVal = Str2[0] -
'A' + 10;
439 if (CharVal >= Radix)
443 unsigned long long PrevResult = Result;
444 Result = Result * Radix + CharVal;
447 if (Result / Radix < PrevResult)
455 if (Str.size() == Str2.
size())
464 unsigned long long ULLVal;
467 if (Str.empty() || Str.front() !=
'-') {
470 (
long long)ULLVal < 0)
482 (
long long)-ULLVal > 0)
493 unsigned long long &Result) {
519 assert(Radix > 1 && Radix <= 36);
522 if (Str.empty())
return true;
526 while (!Str.empty() && Str.front() ==
'0')
531 Result =
APInt(64, 0);
536 unsigned Log2Radix = 0;
537 while ((1U << Log2Radix) < Radix) Log2Radix++;
538 bool IsPowerOf2Radix = ((1U << Log2Radix) == Radix);
540 unsigned BitWidth = Log2Radix * Str.size();
541 if (
BitWidth < Result.getBitWidth())
543 else if (
BitWidth > Result.getBitWidth())
546 APInt RadixAP, CharAP;
547 if (!IsPowerOf2Radix) {
555 while (!Str.empty()) {
557 if (Str[0] >=
'0' && Str[0] <=
'9')
558 CharVal = Str[0]-
'0';
559 else if (Str[0] >=
'a' && Str[0] <=
'z')
560 CharVal = Str[0]-
'a'+10;
561 else if (Str[0] >=
'A' && Str[0] <=
'Z')
562 CharVal = Str[0]-
'A'+10;
568 if (CharVal >= Radix)
572 if (IsPowerOf2Radix) {
573 Result <<= Log2Radix;
599 Result =
F.convertToDouble();
610 "Cannot hash the empty key!");
611 assert(Val.
data() != getTombstoneKey().data() &&
612 "Cannot hash the tombstone key!");
opStatus
IEEE-754R 7: Default exception handling.
This is an optimization pass for GlobalISel generic memory operations.
size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
static constexpr size_t npos
Merge contiguous icmps into a memcmp
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
bool getAsDouble(double &Result, bool AllowInexact=true) const
Parse the current string as an IEEE double-precision floating point value.
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
bool consumeSignedInteger(StringRef &Str, unsigned Radix, long long &Result)
An information struct used to provide DenseMap with the various necessary components for a given valu...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
unsigned ComputeMappedEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, Functor Map, bool AllowReplacements=true, unsigned MaxEditDistance=0)
Determine the edit distance between two sequences.
(vector float) vec_cmpeq(*A, *B) C
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
constexpr bool empty() const
empty - Check if the string is empty.
size_t rfind_insensitive(char C, size_t From=npos) const
Search for the last character C in the string, ignoring case.
std::string upper() const
Convert the given ASCII string to uppercase.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool consumeUnsignedInteger(StringRef &Str, unsigned Radix, unsigned long long &Result)
static int ascii_strncasecmp(const char *LHS, const char *RHS, size_t Length)
std::string lower() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
bool errorToBool(Error Err)
Helper for converting an Error to a bool.
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Class for arbitrary precision integers.
static bool isDigit(const char C)
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
StringRef - Represent a constant reference to a string, i.e.
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
size_t find_last_of(char C, size_t From=npos) const
Find the last character in the string that is C, or npos if not found.
size_t count(char C) const
Return the number of occurrences of C in the string.
constexpr size_t size() const
size - Get the string size.
bool starts_with_insensitive(StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
unsigned edit_distance_insensitive(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
constexpr unsigned BitWidth
size_t find_if(function_ref< bool(char)> F, size_t From=0) const
Search for the first character satisfying the predicate F.
hash_code hash_value(const FixedPointSemantics &Val)
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 This
bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result)
unsigned ComputeEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, bool AllowReplacements=true, unsigned MaxEditDistance=0)
static constexpr roundingMode rmNearestTiesToEven
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
std::optional< std::vector< StOtherPiece > > Other
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
int compare_insensitive(StringRef RHS) const
Compare two strings, ignoring case.
size_t find_insensitive(char C, size_t From=0) const
Search for the first character C in the string, ignoring case.
ArrayRef(const T &OneElt) -> ArrayRef< T >
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
size_t find_last_not_of(char C, size_t From=npos) const
Find the last character in the string that is not C, or npos if not found.
unsigned edit_distance(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
Determine the edit distance between this string and another string.
static unsigned GetAutoSenseRadix(StringRef &Str)
BlockVerifier::State From
#define LLVM_UNLIKELY(EXPR)
bool ends_with_insensitive(StringRef Suffix) const
Check if this string ends with the given Suffix, ignoring case.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
An opaque object representing a hash code.