[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-commits
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/VirtRegMap.cpp
From: "Chris Lattner" <lattner () cs ! uiuc ! edu>
Date: 2004-09-30 16:35:21
Message-ID: 200409301635.LAA14208 () apoc ! cs ! uiuc ! edu
[Download RAW message or body]
Changes in directory llvm/lib/CodeGen:
VirtRegMap.cpp updated: 1.25 -> 1.26
---
Log message:
Use more efficient map operations. Fix a bug that would affect hypothetical
targets that supported multiple memory operands.
---
Diffs of the changes: (+8 -6)
Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.25 llvm/lib/CodeGen/VirtRegMap.cpp:1.26
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.25 Thu Sep 30 11:10:45 2004
+++ llvm/lib/CodeGen/VirtRegMap.cpp Thu Sep 30 11:35:08 2004
@@ -79,17 +79,19 @@
MachineInstr* oldMI,
MachineInstr* newMI) {
// move previous memory references folded to new instruction
- MI2VirtMapTy::iterator i, e;
std::vector<MI2VirtMapTy::mapped_type> regs;
- for (tie(i, e) = MI2VirtMap.equal_range(oldMI); i != e; ) {
- regs.push_back(i->second);
- MI2VirtMap.erase(i++);
+ for (MI2VirtMapTy::iterator I = MI2VirtMap.lower_bound(oldMI),
+ E = MI2VirtMap.end(); I != E && I->first == oldMI; ) {
+ regs.push_back(I->second);
+ MI2VirtMap.erase(I++);
}
+
+ MI2VirtMapTy::iterator IP = MI2VirtMap.lower_bound(newMI);
for (unsigned i = 0, e = regs.size(); i != e; ++i)
- MI2VirtMap.insert(std::make_pair(newMI, i));
+ MI2VirtMap.insert(IP, std::make_pair(newMI, regs[i]));
// add new memory reference
- MI2VirtMap.insert(std::make_pair(newMI, virtReg));
+ MI2VirtMap.insert(IP, std::make_pair(newMI, virtReg));
}
void VirtRegMap::print(std::ostream &OS) const {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic