[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Evan Cheng evan.cheng at apple.com
Thu Apr 27 22:25:30 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.229 -> 1.230
---
Log message:

TargetLowering::LowerArguments should return a VBIT_CONVERT of
FORMAL_ARGUMENTS SDOperand in the return result vector. 


---
Diffs of the changes:  (+14 -16)

 SelectionDAGISel.cpp |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.229 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.230
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.229	Thu Apr 27 21:09:19 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Fri Apr 28 00:25:15 2006
@@ -2447,14 +2447,25 @@
       } else {
         // Otherwise, this is a vector type.  We only support legal vectors
         // right now.
-        unsigned NumElems = cast<PackedType>(I->getType())->getNumElements();
-        const Type *EltTy = cast<PackedType>(I->getType())->getElementType();
+        const PackedType *PTy = cast<PackedType>(I->getType());
+        unsigned NumElems = PTy->getNumElements();
+        const Type *EltTy = PTy->getElementType();
 
         // Figure out if there is a Packed type corresponding to this Vector
         // type.  If so, convert to the packed type.
         MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
         if (TVT != MVT::Other && isTypeLegal(TVT)) {
-          Ops.push_back(SDOperand(Result, i++));
+          SDOperand N = SDOperand(Result, i++);
+          // Handle copies from generic vectors to registers.
+          MVT::ValueType PTyElementVT, PTyLegalElementVT;
+          unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT,
+                                               PTyLegalElementVT);
+          // Insert a VBIT_CONVERT of the FORMAL_ARGUMENTS to a
+          // "N x PTyElementVT" MVT::Vector type.
+          N = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, N,
+                          DAG.getConstant(NE, MVT::i32), 
+                          DAG.getValueType(PTyElementVT));
+          Ops.push_back(N);
         } else {
           assert(0 && "Don't support illegal by-val vector arguments yet!");
         }
@@ -2996,19 +3007,6 @@
     if (!AI->use_empty()) {
       SDL.setValue(AI, Args[a]);
 
-      MVT::ValueType VT = TLI.getValueType(AI->getType());
-      if (VT == MVT::Vector) {
-        // Insert a VBIT_CONVERT between the FORMAL_ARGUMENT node and its uses.
-        // Or else legalizer will balk.
-        BasicBlock::iterator InsertPt = BB->begin();
-        Value *NewVal = new CastInst(AI, AI->getType(), AI->getName(), InsertPt);
-        for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
-             UI != E; ++UI) {
-          Instruction *User = cast<Instruction>(*UI);
-          if (User != NewVal)
-            User->replaceUsesOfWith(AI, NewVal);
-        }
-      }
       // If this argument is live outside of the entry block, insert a copy from
       // whereever we got it to the vreg that other BB's will reference it as.
       if (FuncInfo.ValueMap.count(AI)) {






More information about the llvm-commits mailing list