mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 01:43:06 +00:00
Make LiveVariables::HandlePhysRegUse and
LiveVariables::HandlePhysRegDef private they use information that is not in memory when LiveVariables finishes the analysis. Also update the TwoAddressInstructionPass to not use this interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a14b0d441d
commit
b08bdc4a16
@ -109,6 +109,9 @@ private: // Intermediate data structures
|
|||||||
MachineInstr **PhysRegInfo;
|
MachineInstr **PhysRegInfo;
|
||||||
bool *PhysRegUsed;
|
bool *PhysRegUsed;
|
||||||
|
|
||||||
|
void HandlePhysRegUse(unsigned Reg, MachineInstr *MI);
|
||||||
|
void HandlePhysRegDef(unsigned Reg, MachineInstr *MI);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||||
@ -253,8 +256,6 @@ public:
|
|||||||
void MarkVirtRegAliveInBlock(VarInfo &VRInfo, const BasicBlock *BB);
|
void MarkVirtRegAliveInBlock(VarInfo &VRInfo, const BasicBlock *BB);
|
||||||
void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
|
void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
|
||||||
MachineInstr *MI);
|
MachineInstr *MI);
|
||||||
void HandlePhysRegUse(unsigned Reg, MachineInstr *MI);
|
|
||||||
void HandlePhysRegDef(unsigned Reg, MachineInstr *MI);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -120,8 +120,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
// a = a op c
|
// a = a op c
|
||||||
unsigned regA = mi->getOperand(0).getAllocatedRegNum();
|
unsigned regA = mi->getOperand(0).getAllocatedRegNum();
|
||||||
unsigned regB = mi->getOperand(1).getAllocatedRegNum();
|
unsigned regB = mi->getOperand(1).getAllocatedRegNum();
|
||||||
bool regAisPhysical = regA < MRegisterInfo::FirstVirtualRegister;
|
|
||||||
bool regBisPhysical = regB < MRegisterInfo::FirstVirtualRegister;
|
assert(regA >= MRegisterInfo::FirstVirtualRegister &&
|
||||||
|
regB >= MRegisterInfo::FirstVirtualRegister &&
|
||||||
|
"cannot update physical register live information");
|
||||||
|
|
||||||
// first make sure we do not have a use of a in the
|
// first make sure we do not have a use of a in the
|
||||||
// instruction (a = b + a for example) because our
|
// instruction (a = b + a for example) because our
|
||||||
@ -132,10 +134,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
mi->getOperand(i).getAllocatedRegNum() != (int)regA);
|
mi->getOperand(i).getAllocatedRegNum() != (int)regA);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetRegisterClass* rc = regAisPhysical ?
|
const TargetRegisterClass* rc =
|
||||||
mri_->getRegClass(regA) :
|
|
||||||
mf_->getSSARegMap()->getRegClass(regA);
|
mf_->getSSARegMap()->getRegClass(regA);
|
||||||
|
|
||||||
numInstrsAdded += mri_->copyRegToReg(*mbbi, mii, regA, regB, rc);
|
numInstrsAdded += mri_->copyRegToReg(*mbbi, mii, regA, regB, rc);
|
||||||
|
|
||||||
MachineInstr* prevMi = *(mii - 1);
|
MachineInstr* prevMi = *(mii - 1);
|
||||||
@ -143,25 +143,15 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
prevMi->print(std::cerr, *tm_));
|
prevMi->print(std::cerr, *tm_));
|
||||||
|
|
||||||
// update live variables for regA
|
// update live variables for regA
|
||||||
if (regAisPhysical) {
|
LiveVariables::VarInfo& varInfo = lv_->getVarInfo(regA);
|
||||||
lv_->HandlePhysRegDef(regA, prevMi);
|
varInfo.DefInst = prevMi;
|
||||||
}
|
|
||||||
else {
|
|
||||||
LiveVariables::VarInfo& varInfo = lv_->getVarInfo(regA);
|
|
||||||
varInfo.DefInst = prevMi;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update live variables for regB
|
// update live variables for regB
|
||||||
if (regBisPhysical) {
|
if (lv_->removeVirtualRegisterKilled(regB, &*mbbi, mi))
|
||||||
lv_->HandlePhysRegUse(regB, prevMi);
|
lv_->addVirtualRegisterKilled(regB, &*mbbi, prevMi);
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (lv_->removeVirtualRegisterKilled(regB, &*mbbi, mi))
|
|
||||||
lv_->addVirtualRegisterKilled(regB, &*mbbi, prevMi);
|
|
||||||
|
|
||||||
if (lv_->removeVirtualRegisterDead(regB, &*mbbi, mi))
|
if (lv_->removeVirtualRegisterDead(regB, &*mbbi, mi))
|
||||||
lv_->addVirtualRegisterDead(regB, &*mbbi, prevMi);
|
lv_->addVirtualRegisterDead(regB, &*mbbi, prevMi);
|
||||||
}
|
|
||||||
|
|
||||||
// replace all occurences of regB with regA
|
// replace all occurences of regB with regA
|
||||||
for (unsigned i = 1; i < mi->getNumOperands(); ++i) {
|
for (unsigned i = 1; i < mi->getNumOperands(); ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user