diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-10-22 23:16:21 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-10-22 23:16:21 +0000 |
| commit | ce64eddb7124bd2bcc1c6cdb3b2e68cdb041cd3f (patch) | |
| tree | 4b51ed9e8be88f0dfd1a2502ce071cdb905a8ca0 /llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | |
| parent | 51a2c3cc2d01bf9846074524d9ecda57ec36eb01 (diff) | |
| download | bcm5719-llvm-ce64eddb7124bd2bcc1c6cdb3b2e68cdb041cd3f.tar.gz bcm5719-llvm-ce64eddb7124bd2bcc1c6cdb3b2e68cdb041cd3f.zip | |
- Two minor improvements to the MachineInstr class to reduce footprint and
overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a
bitvector. Sped up LLC a little less than 10% in a debug build!
llvm-svn: 4261
Diffstat (limited to 'llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index c97028a683b..5fc6a4d5c00 100644 --- a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -691,10 +691,10 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR, int scratchReg = -1; if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) { - scratchReg = this->getUsableUniRegAtMI(scratchRegType, &LVSetBef, - MInst, MIBef, MIAft); + scratchReg = getUsableUniRegAtMI(scratchRegType, &LVSetBef, + MInst, MIBef, MIAft); assert(scratchReg != MRI.getInvalidRegNum()); - MInst->getRegsUsed().insert(scratchReg); + MInst->insertUsedReg(scratchReg); } if (!isDef || isDefAndUse) { @@ -774,7 +774,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType, // of copying it to memory and back. But we have to mark the // register as used by this instruction, so it does not get used // as a scratch reg. by another operand or anyone else. - MInst->getRegsUsed().insert(scratchReg); + MInst->insertUsedReg(scratchReg); MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType); MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType); } @@ -874,12 +874,11 @@ void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC, // Add the registers already marked as used by the instruction. // This should include any scratch registers that are used to save // values across the instruction (e.g., for saving state register values). - const hash_set<int>& regsUsed = MInst->getRegsUsed(); - for (hash_set<int>::const_iterator SI=regsUsed.begin(), SE=regsUsed.end(); - SI != SE; ++SI) - { + const vector<bool> ®sUsed = MInst->getRegsUsed(); + for (unsigned i = 0, e = regsUsed.size(); i != e; ++i) + if (regsUsed[i]) { unsigned classId = 0; - int classRegNum = MRI.getClassRegNum(*SI, classId); + int classRegNum = MRI.getClassRegNum(i, classId); if (RC->getID() == classId) { assert(classRegNum < (int) IsColorUsedArr.size() && |

