summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-05 02:12:02 +0000
committerChris Lattner <sabre@nondot.org>2006-09-05 02:12:02 +0000
commit13a5dcddceca452d1dcc8c964d6c28c27ad025c1 (patch)
tree6ae41f56eba0f3a01ecbfa362e929b4d4abbc83d /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
parent3852b2ce7eb0cbdbc0191c8738646197af4f5e47 (diff)
downloadbcm5719-llvm-13a5dcddceca452d1dcc8c964d6c28c27ad025c1.tar.gz
bcm5719-llvm-13a5dcddceca452d1dcc8c964d6c28c27ad025c1.zip
Fix a long-standing wart in the code generator: two-address instruction lowering
actually *removes* one of the operands, instead of just assigning both operands the same register. This make reasoning about instructions unnecessarily complex, because you need to know if you are before or after register allocation to match up operand #'s with the target description file. Changing this also gets rid of a bunch of hacky code in various places. This patch also includes changes to fold loads into cmp/test instructions in the X86 backend, along with a significant simplification to the X86 spill folding code. llvm-svn: 30108
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index f1e41d21de1..7db9958bc00 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -206,9 +206,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
}
}
- assert(mi->getOperand(0).isDef());
- mi->getOperand(0).setUse();
- mi->RemoveOperand(1);
+ assert(mi->getOperand(0).isDef() && mi->getOperand(1).isUse());
+ mi->getOperand(1).setReg(mi->getOperand(0).getReg());
MadeChange = true;
DEBUG(std::cerr << "\t\trewrite to:\t"; mi->print(std::cerr, &TM));
OpenPOWER on IntegriCloud