23 #include <unordered_map> 30 return strchr(RegexAdvancedMetachars, Char) !=
nullptr;
35 std::set<unsigned> Was;
40 for (
unsigned Char : Regex) {
52 if (Char ==
'.' || Char ==
'*') {
58 if (Escaped && Char >=
'1' && Char <=
'9') {
64 Tri = ((Tri << 8) + Char) & 0xFFFFFF;
72 if (Index[Tri].
size() >= 4)
75 if (!Was.count(Tri)) {
77 Index[Tri].push_back(Counts.size());
87 Counts.push_back(Cnt);
93 std::vector<unsigned> CurCounts(Counts.size());
95 for (
size_t I = 0;
I < Query.
size();
I++) {
96 Tri = ((Tri << 8) + Query[
I]) & 0xFFFFFF;
99 const auto &II = Index.find(Tri);
100 if (II == Index.end())
102 for (
size_t J : II->second) {
106 if (CurCounts[J] >= Counts[J])
This class represents lattice values for constants.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isDefinitelyOut(StringRef Query) const
Returns true, if special case list definitely does not have a line that matches the query...
static const char RegexAdvancedMetachars[]
static bool isAdvancedMetachar(unsigned Char)
void insert(std::string Regex)
Inserts a new Regex into the index.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, bool &Write, bool &Effects, bool &StackPointer)
StringRef - Represent a constant reference to a string, i.e.