diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-01-11 09:18:45 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-01-11 09:18:45 +0000 |
commit | 52a714b45bb682f8ba4689ad80ad560a57ece563 (patch) | |
tree | 062d5fe2fdafa379015846b64e2df65278e04e8d /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | 65f901e23bf59d4cc211650aea29113325332dc7 (diff) | |
download | bcm5719-llvm-52a714b45bb682f8ba4689ad80ad560a57ece563.tar.gz bcm5719-llvm-52a714b45bb682f8ba4689ad80ad560a57ece563.zip |
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.
llvm-svn: 10755
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index 4d8db815b20..2cb393ee489 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -120,8 +120,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) { // a = a op c unsigned regA = mi->getOperand(0).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 // instruction (a = b + a for example) because our @@ -132,10 +134,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) { mi->getOperand(i).getAllocatedRegNum() != (int)regA); } - const TargetRegisterClass* rc = regAisPhysical ? - mri_->getRegClass(regA) : + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(regA); - numInstrsAdded += mri_->copyRegToReg(*mbbi, mii, regA, regB, rc); MachineInstr* prevMi = *(mii - 1); @@ -143,25 +143,15 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &fn) { prevMi->print(std::cerr, *tm_)); // update live variables for regA - if (regAisPhysical) { - lv_->HandlePhysRegDef(regA, prevMi); - } - else { - LiveVariables::VarInfo& varInfo = lv_->getVarInfo(regA); - varInfo.DefInst = prevMi; - } + LiveVariables::VarInfo& varInfo = lv_->getVarInfo(regA); + varInfo.DefInst = prevMi; // update live variables for regB - if (regBisPhysical) { - lv_->HandlePhysRegUse(regB, prevMi); - } - else { - if (lv_->removeVirtualRegisterKilled(regB, &*mbbi, mi)) - lv_->addVirtualRegisterKilled(regB, &*mbbi, prevMi); + if (lv_->removeVirtualRegisterKilled(regB, &*mbbi, mi)) + lv_->addVirtualRegisterKilled(regB, &*mbbi, prevMi); - if (lv_->removeVirtualRegisterDead(regB, &*mbbi, mi)) - lv_->addVirtualRegisterDead(regB, &*mbbi, prevMi); - } + if (lv_->removeVirtualRegisterDead(regB, &*mbbi, mi)) + lv_->addVirtualRegisterDead(regB, &*mbbi, prevMi); // replace all occurences of regB with regA for (unsigned i = 1; i < mi->getNumOperands(); ++i) { |