summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-20 06:38:32 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-20 06:38:32 +0000
commita103a516c6f516ef2fa104718594515cae5a00b9 (patch)
treecea295fcd462b1046c844f9587e0bcf77cc37b7d /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
parentb8f950650b469f20d539fd6c219b56426899c21f (diff)
downloadbcm5719-llvm-a103a516c6f516ef2fa104718594515cae5a00b9.tar.gz
bcm5719-llvm-a103a516c6f516ef2fa104718594515cae5a00b9.zip
Properly constrain register classes in 2-addr.
X86 has 2-addr instructions with different constraints on the tied def and use operands. One is GR32, one is GR32_NOSP. llvm-svn: 157149
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 8164690e40a..5218aa1f7a8 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1555,6 +1555,12 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
MO.setIsKill(false);
RemovedKillFlag = true;
}
+
+ // Make sure regA is a legal regclass for the SrcIdx operand.
+ if (TargetRegisterInfo::isVirtualRegister(regA) &&
+ TargetRegisterInfo::isVirtualRegister(regB))
+ MRI->constrainRegClass(regA, MRI->getRegClass(regB));
+
MO.setReg(regA);
if (isCopy)
OpenPOWER on IntegriCloud