[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Evan Cheng
evan.cheng at apple.com
Wed Feb 22 16:14:10 PST 2006
Changes in directory llvm/lib/Target/X86:
X86ISelDAGToDAG.cpp updated: 1.50 -> 1.51
---
Log message:
X86 codegen tweak to use lea in another case:
Suppose base == %eax and it has multiple uses, then instead of
movl %eax, %ecx
addl $8, %ecx
use
leal 8(%eax), %ecx.
---
Diffs of the changes: (+12 -9)
X86ISelDAGToDAG.cpp | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.50 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.51
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.50 Fri Feb 17 18:15:05 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Feb 22 18:13:58 2006
@@ -457,23 +457,19 @@
SDOperand &Index, SDOperand &Disp) {
X86ISelAddressMode AM;
if (!MatchAddress(N, AM)) {
- bool SelectBase = false;
bool SelectIndex = false;
bool Check = false;
if (AM.BaseType == X86ISelAddressMode::RegBase) {
- if (AM.Base.Reg.Val) {
- Check = true;
- SelectBase = true;
- } else {
+ if (AM.Base.Reg.Val)
+ Check = true;
+ else
AM.Base.Reg = CurDAG->getRegister(0, MVT::i32);
- }
}
- if (AM.IndexReg.Val) {
+ if (AM.IndexReg.Val)
SelectIndex = true;
- } else {
+ else
AM.IndexReg = CurDAG->getRegister(0, MVT::i32);
- }
if (Check) {
unsigned Complexity = 0;
@@ -485,6 +481,13 @@
Complexity++;
else if (AM.Disp > 1)
Complexity++;
+ // Suppose base == %eax and it has multiple uses, then instead of
+ // movl %eax, %ecx
+ // addl $8, %ecx
+ // use
+ // leal 8(%eax), %ecx.
+ if (AM.Base.Reg.Val->use_size() > 1)
+ Complexity++;
if (Complexity <= 1)
return false;
}
More information about the llvm-commits
mailing list