mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.
No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -8197,14 +8197,6 @@ struct LoadedSlice {
|
||||
};
|
||||
}
|
||||
|
||||
/// \brief Sorts LoadedSlice according to their offset.
|
||||
struct LoadedSliceSorter {
|
||||
bool operator()(const LoadedSlice &LHS, const LoadedSlice &RHS) {
|
||||
assert(LHS.Origin == RHS.Origin && "Different bases not implemented.");
|
||||
return LHS.getOffsetFromBase() < RHS.getOffsetFromBase();
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Check that all bits set in \p UsedBits form a dense region, i.e.,
|
||||
/// \p UsedBits looks like 0..0 1..1 0..0.
|
||||
static bool areUsedBitsDense(const APInt &UsedBits) {
|
||||
@ -8248,7 +8240,11 @@ static void adjustCostForPairing(SmallVectorImpl<LoadedSlice> &LoadedSlices,
|
||||
|
||||
// Sort the slices so that elements that are likely to be next to each
|
||||
// other in memory are next to each other in the list.
|
||||
std::sort(LoadedSlices.begin(), LoadedSlices.end(), LoadedSliceSorter());
|
||||
std::sort(LoadedSlices.begin(), LoadedSlices.end(),
|
||||
[](const LoadedSlice &LHS, const LoadedSlice &RHS) {
|
||||
assert(LHS.Origin == RHS.Origin && "Different bases not implemented.");
|
||||
return LHS.getOffsetFromBase() < RHS.getOffsetFromBase();
|
||||
});
|
||||
const TargetLowering &TLI = LoadedSlices[0].DAG->getTargetLoweringInfo();
|
||||
// First (resp. Second) is the first (resp. Second) potentially candidate
|
||||
// to be placed in a paired load.
|
||||
@ -8852,17 +8848,6 @@ struct MemOpLink {
|
||||
unsigned SequenceNum;
|
||||
};
|
||||
|
||||
/// Sorts store nodes in a link according to their offset from a shared
|
||||
// base ptr.
|
||||
struct ConsecutiveMemoryChainSorter {
|
||||
bool operator()(MemOpLink LHS, MemOpLink RHS) {
|
||||
return
|
||||
LHS.OffsetFromBase < RHS.OffsetFromBase ||
|
||||
(LHS.OffsetFromBase == RHS.OffsetFromBase &&
|
||||
LHS.SequenceNum > RHS.SequenceNum);
|
||||
}
|
||||
};
|
||||
|
||||
bool DAGCombiner::MergeConsecutiveStores(StoreSDNode* St) {
|
||||
EVT MemVT = St->getMemoryVT();
|
||||
int64_t ElementSizeBytes = MemVT.getSizeInBits()/8;
|
||||
@ -8981,7 +8966,11 @@ bool DAGCombiner::MergeConsecutiveStores(StoreSDNode* St) {
|
||||
|
||||
// Sort the memory operands according to their distance from the base pointer.
|
||||
std::sort(StoreNodes.begin(), StoreNodes.end(),
|
||||
ConsecutiveMemoryChainSorter());
|
||||
[](MemOpLink LHS, MemOpLink RHS) {
|
||||
return LHS.OffsetFromBase < RHS.OffsetFromBase ||
|
||||
(LHS.OffsetFromBase == RHS.OffsetFromBase &&
|
||||
LHS.SequenceNum > RHS.SequenceNum);
|
||||
});
|
||||
|
||||
// Scan the memory operations on the chain and find the first non-consecutive
|
||||
// store memory address.
|
||||
|
Reference in New Issue
Block a user