diff options
author | Duncan Sands <baldrick@free.fr> | 2008-07-02 17:40:58 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-07-02 17:40:58 +0000 |
commit | 739a0548c46314edb09f5006f18c825ae148e780 (patch) | |
tree | 37f1063868df315aac0b351ead4854d8e01d5817 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | 9edcf24da9789f5c48276a75062b752fedb56708 (diff) | |
download | bcm5719-llvm-739a0548c46314edb09f5006f18c825ae148e780.tar.gz bcm5719-llvm-739a0548c46314edb09f5006f18c825ae148e780.zip |
Add a new getMergeValues method that does not need
to be passed the list of value types, and use this
where appropriate. Inappropriate places are where
the value type list is already known and may be
long, in which case the existing method is more
efficient.
llvm-svn: 53035
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 12ba6ac3583..4f67dd4a227 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1158,17 +1158,13 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { if (isa<ConstantStruct>(C) || isa<ConstantArray>(C)) { SmallVector<SDOperand, 4> Constants; - SmallVector<MVT, 4> ValueVTs; for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end(); OI != OE; ++OI) { SDNode *Val = getValue(*OI).Val; - for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) { + for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) Constants.push_back(SDOperand(Val, i)); - ValueVTs.push_back(Val->getValueType(i)); - } } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } if (const ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) { @@ -1179,7 +1175,6 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { return SDOperand(); // empty array MVT EltVT = TLI.getValueType(ATy->getElementType()); SmallVector<SDOperand, 4> Constants(NumElts); - SmallVector<MVT, 4> ValueVTs(NumElts, EltVT); for (unsigned i = 0, e = NumElts; i != e; ++i) { if (isa<UndefValue>(C)) Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); @@ -1188,8 +1183,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } if (const StructType *STy = dyn_cast<StructType>(C->getType())) { @@ -1199,10 +1193,8 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { if (NumElts == 0) return SDOperand(); // empty struct SmallVector<SDOperand, 4> Constants(NumElts); - SmallVector<MVT, 4> ValueVTs(NumElts); for (unsigned i = 0, e = NumElts; i != e; ++i) { MVT EltVT = TLI.getValueType(STy->getElementType(i)); - ValueVTs[i] = EltVT; if (isa<UndefValue>(C)) Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); else if (EltVT.isFloatingPoint()) @@ -1210,8 +1202,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } const VectorType *VecTy = cast<VectorType>(V->getType()); @@ -3771,10 +3762,7 @@ SDOperand RegsForValue::getCopyFromRegs(SelectionDAG &DAG, ValueVT); Part += NumRegs; } - - if (ValueVTs.size() == 1) - return Values[0]; - + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), &Values[0], ValueVTs.size()); } @@ -4944,13 +4932,7 @@ LowerArguments(BasicBlock *LLVMBB, SelectionDAGLowering &SDL) { ComputeValueVTs(TLI, AI->getType(), ValueVTs); unsigned NumValues = ValueVTs.size(); if (!AI->use_empty()) { - SmallVector<MVT, 4> LegalValueVTs(NumValues); - for (unsigned VI = 0; VI != NumValues; ++VI) - LegalValueVTs[VI] = Args[a + VI].getValueType(); - SDL.setValue(AI, - SDL.DAG.getMergeValues(SDL.DAG.getVTList(&LegalValueVTs[0], - NumValues), - &Args[a], NumValues)); + SDL.setValue(AI, SDL.DAG.getMergeValues(&Args[a], NumValues)); // 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. DenseMap<const Value*, unsigned>::iterator VMI=FuncInfo.ValueMap.find(AI); |