[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp SparcV8InstrInfo.td

Chris Lattner lattner at cs.uiuc.edu
Sat Dec 17 13:25:39 PST 2005



Changes in directory llvm/lib/Target/SparcV8:

SparcV8ISelDAGToDAG.cpp updated: 1.6 -> 1.7
SparcV8InstrInfo.td updated: 1.64 -> 1.65
---
Log message:

Make the addressing modes smarter


---
Diffs of the changes:  (+21 -10)

 SparcV8ISelDAGToDAG.cpp |   27 +++++++++++++++++++++------
 SparcV8InstrInfo.td     |    4 ----
 2 files changed, 21 insertions(+), 10 deletions(-)


Index: llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp
diff -u llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.6 llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.7
--- llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp:1.6	Sat Dec 17 14:59:06 2005
+++ llvm/lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp	Sat Dec 17 15:25:27 2005
@@ -235,18 +235,33 @@
   ScheduleAndEmitDAG(DAG);
 }
 
-bool SparcV8DAGToDAGISel::SelectADDRrr(SDOperand N, SDOperand &R1, 
+bool SparcV8DAGToDAGISel::SelectADDRrr(SDOperand Addr, SDOperand &R1, 
                                        SDOperand &R2) {
-  // FIXME: This should obviously be smarter.
-  R1 = Select(N);
+  if (Addr.getOpcode() == ISD::ADD) {
+    if (isa<ConstantSDNode>(Addr.getOperand(1)) &&
+        Predicate_simm13(Addr.getOperand(1).Val))
+      return false;  // Let the reg+imm pattern catch this!
+    R1 = Addr.getOperand(0);
+    R2 = Addr.getOperand(1);
+    return true;
+  }
+
+  R1 = Select(Addr);
   R2 = CurDAG->getRegister(V8::G0, MVT::i32);
   return true;
 }
 
-bool SparcV8DAGToDAGISel::SelectADDRri(SDOperand N, SDOperand &Base,
+bool SparcV8DAGToDAGISel::SelectADDRri(SDOperand Addr, SDOperand &Base,
                                        SDOperand &Offset) {
-  // FIXME: This should obviously be smarter.
-  Base = Select(N);
+  if (Addr.getOpcode() == ISD::ADD) {
+    if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1)))
+      if (Predicate_simm13(CN)) {
+        Base = Addr.getOperand(0);
+        Offset = CurDAG->getTargetConstant(CN->getValue(), MVT::i32);
+        return true;
+      }
+  }
+  Base = Select(Addr);
   Offset = CurDAG->getTargetConstant(0, MVT::i32);
   return true;
 }


Index: llvm/lib/Target/SparcV8/SparcV8InstrInfo.td
diff -u llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.64 llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.65
--- llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.64	Sat Dec 17 15:13:50 2005
+++ llvm/lib/Target/SparcV8/SparcV8InstrInfo.td	Sat Dec 17 15:25:27 2005
@@ -90,10 +90,6 @@
 // Section A.3 - Synthetic Instructions, p. 85
 // special cases of JMPL:
 let isReturn = 1, isTerminator = 1, hasDelaySlot = 1 in {
-  let rd = I7.Num, rs1 = G0.Num, simm13 = 8 in
-    def RET : F3_2<2, 0b111000,
-                   (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
-                   "ret $b, $c, $dst", []>;
   let rd = O7.Num, rs1 = G0.Num, simm13 = 8 in
     def RETL: F3_2<2, 0b111000, (ops),
                    "retl", [(ret)]>;






More information about the llvm-commits mailing list