Retire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.

llvm-svn: 369674
This commit is contained in:
Benjamin Kramer 2019-08-22 17:31:59 +00:00
parent fba82858f2
commit d5aecb9486
6 changed files with 23 additions and 34 deletions

View File

@ -61,7 +61,7 @@ struct CommentInfo {
return false;
return std::equal(Children.begin(), Children.end(), Other.Children.begin(),
llvm::deref<llvm::equal>{});
llvm::deref<std::equal_to<>>{});
}
// This operator is used to sort a vector of CommentInfos.
@ -82,7 +82,7 @@ struct CommentInfo {
if (FirstCI == SecondCI) {
return std::lexicographical_compare(
Children.begin(), Children.end(), Other.Children.begin(),
Other.Children.end(), llvm::deref<llvm::less>());
Other.Children.end(), llvm::deref<std::less<>>());
}
return false;

View File

@ -1389,20 +1389,6 @@ struct pair_hash {
}
};
/// A functor like C++14's std::less<void> in its absence.
struct less {
template <typename A, typename B> bool operator()(A &&a, B &&b) const {
return std::forward<A>(a) < std::forward<B>(b);
}
};
/// A functor like C++14's std::equal<void> in its absence.
struct equal {
template <typename A, typename B> bool operator()(A &&a, B &&b) const {
return std::forward<A>(a) == std::forward<B>(b);
}
};
/// Binary functor that adapts to any other binary functor after dereferencing
/// operands.
template <typename T> struct deref {

View File

@ -1393,7 +1393,7 @@ std::string PatternToMatch::getPredicateCheck() const {
if (!P.getCondString().empty())
PredList.push_back(&P);
}
llvm::sort(PredList, deref<llvm::less>());
llvm::sort(PredList, deref<std::less<>>());
std::string Check;
for (unsigned i = 0, e = PredList.size(); i != e; ++i) {

View File

@ -734,8 +734,8 @@ struct TupleExpander : SetTheory::Expander {
//===----------------------------------------------------------------------===//
static void sortAndUniqueRegisters(CodeGenRegister::Vec &M) {
llvm::sort(M, deref<llvm::less>());
M.erase(std::unique(M.begin(), M.end(), deref<llvm::equal>()), M.end());
llvm::sort(M, deref<std::less<>>());
M.erase(std::unique(M.begin(), M.end(), deref<std::equal_to<>>()), M.end());
}
CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R)
@ -860,7 +860,7 @@ void CodeGenRegisterClass::inheritProperties(CodeGenRegBank &RegBank) {
bool CodeGenRegisterClass::contains(const CodeGenRegister *Reg) const {
return std::binary_search(Members.begin(), Members.end(), Reg,
deref<llvm::less>());
deref<std::less<>>());
}
namespace llvm {
@ -896,7 +896,7 @@ static bool testSubClass(const CodeGenRegisterClass *A,
return A->RSI.isSubClassOf(B->RSI) &&
std::includes(A->getMembers().begin(), A->getMembers().end(),
B->getMembers().begin(), B->getMembers().end(),
deref<llvm::less>());
deref<std::less<>>());
}
/// Sorting predicate for register classes. This provides a topological
@ -2140,9 +2140,10 @@ void CodeGenRegBank::inferCommonSubClass(CodeGenRegisterClass *RC) {
const CodeGenRegister::Vec &Memb1 = RC1->getMembers();
const CodeGenRegister::Vec &Memb2 = RC2->getMembers();
CodeGenRegister::Vec Intersection;
std::set_intersection(
Memb1.begin(), Memb1.end(), Memb2.begin(), Memb2.end(),
std::inserter(Intersection, Intersection.begin()), deref<llvm::less>());
std::set_intersection(Memb1.begin(), Memb1.end(), Memb2.begin(),
Memb2.end(),
std::inserter(Intersection, Intersection.begin()),
deref<std::less<>>());
// Skip disjoint class pairs.
if (Intersection.empty())
@ -2167,7 +2168,8 @@ void CodeGenRegBank::inferCommonSubClass(CodeGenRegisterClass *RC) {
void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) {
// Map SubRegIndex to set of registers in RC supporting that SubRegIndex.
typedef std::map<const CodeGenSubRegIndex *, CodeGenRegister::Vec,
deref<llvm::less>> SubReg2SetMap;
deref<std::less<>>>
SubReg2SetMap;
// Compute the set of registers supporting each SubRegIndex.
SubReg2SetMap SRSets;

View File

@ -93,7 +93,8 @@ namespace llvm {
// Map of composite subreg indices.
typedef std::map<CodeGenSubRegIndex *, CodeGenSubRegIndex *,
deref<llvm::less>> CompMap;
deref<std::less<>>>
CompMap;
// Returns the subreg index that results from composing this with Idx.
// Returns NULL if this and Idx don't compose.
@ -137,15 +138,14 @@ namespace llvm {
/// list of subregisters they are composed of (if any). Do this recursively.
void computeConcatTransitiveClosure();
bool operator<(const CodeGenSubRegIndex &RHS) const {
return this->EnumValue < RHS.EnumValue;
}
private:
CompMap Composed;
};
inline bool operator<(const CodeGenSubRegIndex &A,
const CodeGenSubRegIndex &B) {
return A.EnumValue < B.EnumValue;
}
/// CodeGenRegister - Represents a register definition.
struct CodeGenRegister {
Record *TheDef;
@ -156,7 +156,8 @@ namespace llvm {
bool Artificial;
// Map SubRegIndex -> Register.
typedef std::map<CodeGenSubRegIndex *, CodeGenRegister *, deref<llvm::less>>
typedef std::map<CodeGenSubRegIndex *, CodeGenRegister *,
deref<std::less<>>>
SubRegMap;
CodeGenRegister(Record *R, unsigned Enum);

View File

@ -888,7 +888,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
// Keep track of sub-register names as well. These are not differentially
// encoded.
typedef SmallVector<const CodeGenSubRegIndex*, 4> SubRegIdxVec;
SequenceToOffsetTable<SubRegIdxVec, deref<llvm::less>> SubRegIdxSeqs;
SequenceToOffsetTable<SubRegIdxVec, deref<std::less<>>> SubRegIdxSeqs;
SmallVector<SubRegIdxVec, 4> SubRegIdxLists(Regs.size());
SequenceToOffsetTable<std::string> RegStrings;
@ -1315,7 +1315,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
// Compress the sub-reg index lists.
typedef std::vector<const CodeGenSubRegIndex*> IdxList;
SmallVector<IdxList, 8> SuperRegIdxLists(RegisterClasses.size());
SequenceToOffsetTable<IdxList, deref<llvm::less>> SuperRegIdxSeqs;
SequenceToOffsetTable<IdxList, deref<std::less<>>> SuperRegIdxSeqs;
BitVector MaskBV(RegisterClasses.size());
for (const auto &RC : RegisterClasses) {