mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-23 20:45:06 +00:00
Improve debugging output and clean up some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10288 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d866473094
commit
69546d5f84
@ -150,10 +150,9 @@ namespace {
|
|||||||
/// stack slot
|
/// stack slot
|
||||||
void assignVirt2StackSlot(unsigned virtReg);
|
void assignVirt2StackSlot(unsigned virtReg);
|
||||||
|
|
||||||
/// findOrCreateStackSlot - returns the offset of the
|
/// getStackSlot - returns the offset of the specified
|
||||||
/// specified register on the stack allocating space if
|
/// register on the stack
|
||||||
/// necessary
|
int getStackSlot(unsigned virtReg);
|
||||||
int findOrCreateStackSlot(unsigned virtReg);
|
|
||||||
|
|
||||||
/// spillVirtReg - spills the virtual register
|
/// spillVirtReg - spills the virtual register
|
||||||
void spillVirtReg(unsigned virtReg);
|
void spillVirtReg(unsigned virtReg);
|
||||||
@ -749,29 +748,27 @@ void RA::assignVirt2StackSlot(unsigned virtReg)
|
|||||||
if (v2pMap_.find(virtReg) != v2pMap_.end()) {
|
if (v2pMap_.find(virtReg) != v2pMap_.end()) {
|
||||||
clearVirtReg(virtReg);
|
clearVirtReg(virtReg);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
v2pMap_[virtReg] = 0; // this marks that this virtual register
|
||||||
|
// lives on the stack
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RA::findOrCreateStackSlot(unsigned virtReg)
|
int RA::getStackSlot(unsigned virtReg)
|
||||||
{
|
{
|
||||||
// use lower_bound so that we can do a possibly O(1) insert later
|
// use lower_bound so that we can do a possibly O(1) insert later
|
||||||
// if necessary
|
// if necessary
|
||||||
Virt2StackSlotMap::iterator it = v2ssMap_.lower_bound(virtReg);
|
Virt2StackSlotMap::iterator it = v2ssMap_.find(virtReg);
|
||||||
if (it != v2ssMap_.end() && it->first == virtReg) {
|
assert(it != v2ssMap_.end() &&
|
||||||
return it->second;
|
"attempt to get stack slot on register that does not live on the stack");
|
||||||
}
|
return it->second;
|
||||||
const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg);
|
|
||||||
int frameIndex = mf_->getFrameInfo()->CreateStackObject(rc);
|
|
||||||
|
|
||||||
v2ssMap_.insert(it, std::make_pair(virtReg, frameIndex));
|
|
||||||
|
|
||||||
return frameIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RA::spillVirtReg(unsigned virtReg)
|
void RA::spillVirtReg(unsigned virtReg)
|
||||||
{
|
{
|
||||||
DEBUG(std::cerr << "\t\t\tspilling register: " << virtReg);
|
DEBUG(std::cerr << "\t\t\tspilling register: " << virtReg);
|
||||||
const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg);
|
const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg);
|
||||||
int frameIndex = findOrCreateStackSlot(virtReg);
|
int frameIndex = getStackSlot(virtReg);
|
||||||
DEBUG(std::cerr << " to stack slot #" << frameIndex << '\n');
|
DEBUG(std::cerr << " to stack slot #" << frameIndex << '\n');
|
||||||
++numSpilled;
|
++numSpilled;
|
||||||
instrAdded_ += mri_->storeRegToStackSlot(*currentMbb_, currentInstr_,
|
instrAdded_ += mri_->storeRegToStackSlot(*currentMbb_, currentInstr_,
|
||||||
@ -783,7 +780,7 @@ void RA::loadVirt2PhysReg(unsigned virtReg, unsigned physReg)
|
|||||||
{
|
{
|
||||||
DEBUG(std::cerr << "\t\t\tloading register: " << virtReg);
|
DEBUG(std::cerr << "\t\t\tloading register: " << virtReg);
|
||||||
const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg);
|
const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg);
|
||||||
int frameIndex = findOrCreateStackSlot(virtReg);
|
int frameIndex = getStackSlot(virtReg);
|
||||||
DEBUG(std::cerr << " from stack slot #" << frameIndex << '\n');
|
DEBUG(std::cerr << " from stack slot #" << frameIndex << '\n');
|
||||||
instrAdded_ += mri_->loadRegFromStackSlot(*currentMbb_, currentInstr_,
|
instrAdded_ += mri_->loadRegFromStackSlot(*currentMbb_, currentInstr_,
|
||||||
physReg, frameIndex, rc);
|
physReg, frameIndex, rc);
|
||||||
|
Loading…
Reference in New Issue
Block a user