mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Use std::set_union instead of nasty custom code.
I just noticed Jakob's examples of the proper application of std::set... routines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6126a1e189
commit
f1275959b2
@ -91,21 +91,11 @@ const std::string &CodeGenRegister::getName() const {
|
|||||||
// Merge two RegUnitLists maintaining the order and removing duplicates.
|
// Merge two RegUnitLists maintaining the order and removing duplicates.
|
||||||
// Overwrites MergedRU in the process.
|
// Overwrites MergedRU in the process.
|
||||||
static void mergeRegUnits(CodeGenRegister::RegUnitList &MergedRU,
|
static void mergeRegUnits(CodeGenRegister::RegUnitList &MergedRU,
|
||||||
const CodeGenRegister::RegUnitList &RRU)
|
const CodeGenRegister::RegUnitList &RRU) {
|
||||||
{
|
|
||||||
CodeGenRegister::RegUnitList LRU = MergedRU;
|
CodeGenRegister::RegUnitList LRU = MergedRU;
|
||||||
MergedRU.clear();
|
MergedRU.clear();
|
||||||
for (CodeGenRegister::RegUnitList::const_iterator
|
std::set_union(LRU.begin(), LRU.end(), RRU.begin(), RRU.end(),
|
||||||
RI = RRU.begin(), RE = RRU.end(), LI = LRU.begin(), LE = LRU.end();
|
std::inserter(MergedRU, MergedRU.begin()));
|
||||||
RI != RE || LI != LE;) {
|
|
||||||
|
|
||||||
CodeGenRegister::RegUnitList::const_iterator &NextI =
|
|
||||||
(RI != RE && (LI == LE || *RI < *LI)) ? RI : LI;
|
|
||||||
|
|
||||||
if (MergedRU.empty() || *NextI != MergedRU.back())
|
|
||||||
MergedRU.push_back(*NextI);
|
|
||||||
++NextI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CodeGenRegister::SubRegMap &
|
const CodeGenRegister::SubRegMap &
|
||||||
|
Loading…
Reference in New Issue
Block a user