summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineRegisterInfo.cpp
diff options
context:
space:
mode:
authorPedro Artigas <partigas@apple.com>2014-08-04 23:07:49 +0000
committerPedro Artigas <partigas@apple.com>2014-08-04 23:07:49 +0000
commitec7cbd7d14db9aee087394488b8e9aa16742e597 (patch)
tree42e54e5cc395f082603b3904bb2b7a899ad94a3d /llvm/lib/CodeGen/MachineRegisterInfo.cpp
parent51cf733427c6076bce76a057b4e9b593f3a8b407 (diff)
downloadbcm5719-llvm-ec7cbd7d14db9aee087394488b8e9aa16742e597.tar.gz
bcm5719-llvm-ec7cbd7d14db9aee087394488b8e9aa16742e597.zip
Changed the liveness tracking in the RegisterScavenger
to use register units instead of registers. reviewed by Jakob Stoklund Olesen. llvm-svn: 214798
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineRegisterInfo.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index 8be6d718098..6da1b685a91 100644
--- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -284,18 +284,25 @@ void MachineRegisterInfo::moveOperands(MachineOperand *Dst,
/// replaceRegWith - Replace all instances of FromReg with ToReg in the
/// machine function. This is like llvm-level X->replaceAllUsesWith(Y),
/// except that it also changes any definitions of the register as well.
+/// If ToReg is a physical register we apply the sub register to obtain the
+/// final/proper physical register.
void MachineRegisterInfo::replaceRegWith(unsigned FromReg, unsigned ToReg) {
assert(FromReg != ToReg && "Cannot replace a reg with itself");
+ const TargetRegisterInfo *TRI = getTargetRegisterInfo();
+
// TODO: This could be more efficient by bulk changing the operands.
for (reg_iterator I = reg_begin(FromReg), E = reg_end(); I != E; ) {
MachineOperand &O = *I;
++I;
- O.setReg(ToReg);
+ if (TargetRegisterInfo::isPhysicalRegister(ToReg)) {
+ O.substPhysReg(ToReg, *TRI);
+ } else {
+ O.setReg(ToReg);
+ }
}
}
-
/// getVRegDef - Return the machine instr that defines the specified virtual
/// register or null if none is found. This assumes that the code is in SSA
/// form, so there should only be one definition.
OpenPOWER on IntegriCloud