[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 17 10:02:28 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.128 -> 1.129
---
Log message:

Teach the selector to fold lo(g) into load instruction immediate fields


---
Diffs of the changes:  (+8 -0)

 PPCISelDAGToDAG.cpp |    8 ++++++++
 1 files changed, 8 insertions(+)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.128 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.129
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.128	Thu Nov 17 01:30:41 2005
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp	Thu Nov 17 12:02:16 2005
@@ -413,6 +413,14 @@
         Op2 = Select(Addr.getOperand(0));
       }
       return false;
+    } else if (Addr.getOperand(1).getOpcode() == PPCISD::Lo) {
+      // Match LOAD (ADD (X, Lo(G))).
+      assert(!cast<ConstantSDNode>(Addr.getOperand(1).getOperand(1))->getValue()
+             && "Cannot handle constant offsets yet!");
+      Op1 = Addr.getOperand(1).getOperand(0);  // The global address.
+      assert(Op1.getOpcode() == ISD::TargetGlobalAddress);
+      Op2 = Select(Addr.getOperand(0));
+      return false;   // [&g+r]
     } else {
       Op1 = Select(Addr.getOperand(0));
       Op2 = Select(Addr.getOperand(1));






More information about the llvm-commits mailing list