LLVM 24.0.0git
Spelling.cpp
Go to the documentation of this file.
1//===-------------------------------------------------------------- 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
10
11#include "llvm/ADT/StringRef.h"
13
14#include <cassert>
15
16using namespace llvm;
17
21 // Do a linear search to find the first Spelling that contains Version.
22 // The condition "contains(S, Version)" does not partition the list of
23 // spellings, so std::[lower|upper]_bound cannot be used.
24 // In practice the list of spellings is expected to be very short, so
25 // linear search seems appropriate. In general, an interval tree may be
26 // a better choice, but in this case it may be an overkill.
27 for (auto &S : Range) {
28 if (S.Versions.contains(Ver))
29 return S.Name;
30 }
31 return StringRef();
32}
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
A range adaptor for a pair of iterators.
LLVM_ABI StringRef FindName(llvm::iterator_range< const Spelling * >, Version Version)
Definition Spelling.cpp:18
This is an optimization pass for GlobalISel generic memory operations.