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

Evan Cheng evan.cheng at apple.com
Fri Aug 11 02:08:07 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.201 -> 1.202
---
Log message:

Match tablegen changes.

---
Diffs of the changes:  (+32 -53)

 PPCISelDAGToDAG.cpp |   85 +++++++++++++++++++---------------------------------
 1 files changed, 32 insertions(+), 53 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.201 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.202
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.201	Mon Aug  7 21:23:41 2006
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp	Fri Aug 11 04:07:52 2006
@@ -83,7 +83,7 @@
     
     // Select - Convert the specified operand from a target-independent to a
     // target-specific node if it hasn't already been changed.
-    void Select(SDOperand &Result, SDOperand Op);
+    SDNode *Select(SDOperand &Result, SDOperand Op);
     
     SDNode *SelectBitfieldInsert(SDNode *N);
 
@@ -166,8 +166,8 @@
     
 private:
     SDOperand SelectSETCC(SDOperand Op);
-    void MySelect_PPCbctrl(SDOperand &Result, SDOperand N);
-    void MySelect_PPCcall(SDOperand &Result, SDOperand N);
+    SDNode *MySelect_PPCbctrl(SDOperand &Result, SDOperand N);
+    SDNode *MySelect_PPCcall(SDOperand &Result, SDOperand N);
   };
 }
 
@@ -900,23 +900,22 @@
 
 // Select - Convert the specified operand from a target-independent to a
 // target-specific node if it hasn't already been changed.
-void PPCDAGToDAGISel::Select(SDOperand &Result, SDOperand Op) {
+SDNode *PPCDAGToDAGISel::Select(SDOperand &Result, SDOperand Op) {
   SDNode *N = Op.Val;
   if (N->getOpcode() >= ISD::BUILTIN_OP_END &&
       N->getOpcode() < PPCISD::FIRST_NUMBER) {
     Result = Op;
-    return;   // Already selected.
+    return NULL;   // Already selected.
   }
 
   switch (N->getOpcode()) {
   default: break;
   case ISD::SETCC:
     Result = SelectSETCC(Op);
-    return;
+    return NULL;
   case PPCISD::GlobalBaseReg:
     Result = getGlobalBaseReg();
-    ReplaceUses(Op, Result);
-    return;
+    return Result.Val;
     
   case ISD::FrameIndex: {
     int FI = cast<FrameIndexSDNode>(N)->getIndex();
@@ -925,13 +924,12 @@
     if (N->hasOneUse()) {
       Result = CurDAG->SelectNodeTo(N, Opc, Op.getValueType(), TFI,
                                     getSmallIPtrImm(0));
-      return;
+      return NULL;
     }
     Result =
       SDOperand(CurDAG->getTargetNode(Opc, Op.getValueType(), TFI,
                                       getSmallIPtrImm(0)), 0);
-    ReplaceUses(Op, Result);
-    return;
+    return Result.Val;
   }
 
   case PPCISD::MFCR: {
@@ -943,8 +941,7 @@
                                                N->getOperand(0), InFlag), 0);
     else
       Result = SDOperand(CurDAG->getTargetNode(PPC::MFCR, MVT::i32, InFlag), 0);
-    ReplaceUses(Op, Result);
-    return;
+    return Result.Val;
   }
     
   case ISD::SDIV: {
@@ -973,7 +970,7 @@
                     0);
         Result = CurDAG->SelectNodeTo(N, PPC::NEG, MVT::i32, PT);
       }
-      return;
+      return NULL;
     }
     
     // Other cases are autogenerated.
@@ -992,7 +989,7 @@
       } else if (Imm == 0) {
         // AND X, 0 -> 0, not "rlwinm 32".
         AddToQueue(Result, N->getOperand(1));
-        return ;
+        return NULL;
       } else {        
         AddToQueue(Val, N->getOperand(0));
         isRunOfOnes(Imm, MB, ME);
@@ -1001,7 +998,7 @@
       Result = CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Val,
                                     getI32Imm(SH), getI32Imm(MB),
                                     getI32Imm(ME));
-      return;
+      return NULL;
     }
     // ISD::OR doesn't get all the bitfield insertion fun.
     // (and (or x, c1), c2) where isRunOfOnes(~(c1^c2)) is a bitfield insert
@@ -1018,8 +1015,7 @@
                                                  Tmp1, Tmp2,
                                                  getI32Imm(0), getI32Imm(MB),
                                                  getI32Imm(ME)), 0);
-        ReplaceUses(Op, Result);
-        return;
+        return Result.Val;
       }
     }
     
@@ -1030,8 +1026,7 @@
     if (N->getValueType(0) == MVT::i32)
       if (SDNode *I = SelectBitfieldInsert(N)) {
         Result = SDOperand(I, 0);
-        ReplaceUses(Op, Result);
-        return;
+        return Result.Val;
       }
       
     // Other cases are autogenerated.
@@ -1045,7 +1040,7 @@
       Result = CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, 
                                     Val, getI32Imm(SH), getI32Imm(MB),
                                     getI32Imm(ME));
-      return;
+      return NULL;
     }
     
     // Other cases are autogenerated.
@@ -1060,7 +1055,7 @@
       Result = CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, 
                                     Val, getI32Imm(SH), getI32Imm(MB),
                                     getI32Imm(ME));
-      return;
+      return NULL;
     }
     
     // Other cases are autogenerated.
@@ -1085,7 +1080,7 @@
             Result = CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32,
                                           SDOperand(Tmp, 0), LHS,
                                           SDOperand(Tmp, 1));
-            return;
+            return NULL;
           }
 
     SDOperand CCReg = SelectCC(N->getOperand(0), N->getOperand(1), CC);
@@ -1109,7 +1104,7 @@
     AddToQueue(N3, N->getOperand(3));
     Result = CurDAG->SelectNodeTo(N, SelectCCOp, N->getValueType(0), CCReg,
                                   N2, N3, getI32Imm(BROpc));
-    return;
+    return NULL;
   }
   case ISD::BR_CC: {
     SDOperand Chain;
@@ -1119,7 +1114,7 @@
     Result = CurDAG->SelectNodeTo(N, PPC::COND_BRANCH, MVT::Other, 
                                   CondCode, getI32Imm(getBCCForSetCC(CC)), 
                                   N->getOperand(4), Chain);
-    return;
+    return NULL;
   }
   case ISD::BRIND: {
     // FIXME: Should custom lower this.
@@ -1130,23 +1125,22 @@
     Chain = SDOperand(CurDAG->getTargetNode(Opc, MVT::Other, Target,
                                             Chain), 0);
     Result = CurDAG->SelectNodeTo(N, PPC::BCTR, MVT::Other, Chain);
-    return;
+    return NULL;
   }
   // FIXME: These are manually selected because tblgen isn't handling varargs
   // nodes correctly.
-  case PPCISD::BCTRL:            MySelect_PPCbctrl(Result, Op); return;
-  case PPCISD::CALL:             MySelect_PPCcall(Result, Op); return;
+  case PPCISD::BCTRL:            return MySelect_PPCbctrl(Result, Op);
+  case PPCISD::CALL:             return MySelect_PPCcall(Result, Op);
   }
   
-  SelectCode(Result, Op);
+  return SelectCode(Result, Op);
 }
 
 
 // FIXME: This is manually selected because tblgen isn't handling varargs nodes
 // correctly.
-void PPCDAGToDAGISel::MySelect_PPCbctrl(SDOperand &Result, SDOperand N) {
+SDNode *PPCDAGToDAGISel::MySelect_PPCbctrl(SDOperand &Result, SDOperand N) {
   SDOperand Chain(0, 0);
-  SDOperand InFlag(0, 0);
   SDNode *ResNode;
   
   bool hasFlag =
@@ -1169,19 +1163,14 @@
   
   ResNode = CurDAG->getTargetNode(PPC::BCTRL, MVT::Other, MVT::Flag,
                                   &Ops[0], Ops.size());
-  Chain = SDOperand(ResNode, 0);
-  InFlag = SDOperand(ResNode, 1);
-  ReplaceUses(SDOperand(N.Val, 0), Chain);
-  ReplaceUses(SDOperand(N.Val, 1), InFlag);
   Result = SDOperand(ResNode, N.ResNo);
-  return;
+  return ResNode;
 }
 
 // FIXME: This is manually selected because tblgen isn't handling varargs nodes
 // correctly.
-void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) {
+SDNode *PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) {
   SDOperand Chain(0, 0);
-  SDOperand InFlag(0, 0);
   SDOperand N1(0, 0);
   SDOperand Tmp0(0, 0);
   SDNode *ResNode;
@@ -1214,12 +1203,8 @@
     ResNode = CurDAG->getTargetNode(PPC::BLA, MVT::Other, MVT::Flag,
                                     &Ops[0], Ops.size());
     
-    Chain = SDOperand(ResNode, 0);
-    InFlag = SDOperand(ResNode, 1);
-    ReplaceUses(SDOperand(N.Val, 0), Chain);
-    ReplaceUses(SDOperand(N.Val, 1), InFlag);
     Result = SDOperand(ResNode, N.ResNo);
-    return;
+    return ResNode;
   }
   
   // Pattern: (PPCcall:void (tglobaladdr:i32):$dst)
@@ -1247,12 +1232,8 @@
     ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag,
                                     &Ops[0], Ops.size());
     
-    Chain = SDOperand(ResNode, 0);
-    InFlag = SDOperand(ResNode, 1);
-    ReplaceUses(SDOperand(N.Val, 0), Chain);
-    ReplaceUses(SDOperand(N.Val, 1), InFlag);
     Result = SDOperand(ResNode, N.ResNo);
-    return;
+    return ResNode;
   }
   
   // Pattern: (PPCcall:void (texternalsym:i32):$dst)
@@ -1280,17 +1261,15 @@
     ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag,
                                     &Ops[0], Ops.size());
 
-    Chain = SDOperand(ResNode, 0);
-    InFlag = SDOperand(ResNode, 1);
-    ReplaceUses(SDOperand(N.Val, 0), Chain);
-    ReplaceUses(SDOperand(N.Val, 1), InFlag);
     Result = SDOperand(ResNode, N.ResNo);
-    return;
+    return ResNode;
   }
   std::cerr << "Cannot yet select: ";
   N.Val->dump(CurDAG);
   std::cerr << '\n';
   abort();
+
+  return NULL;
 }
 
 






More information about the llvm-commits mailing list