forked from OSchip/llvm-project
TargetLowering::LowerArguments should return a VBIT_CONVERT of
FORMAL_ARGUMENTS SDOperand in the return result vector. llvm-svn: 28009
This commit is contained in:
parent
79c50d96c9
commit
d43c5c6046
|
@ -2447,14 +2447,25 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, this is a vector type. We only support legal vectors
|
// Otherwise, this is a vector type. We only support legal vectors
|
||||||
// right now.
|
// right now.
|
||||||
unsigned NumElems = cast<PackedType>(I->getType())->getNumElements();
|
const PackedType *PTy = cast<PackedType>(I->getType());
|
||||||
const Type *EltTy = cast<PackedType>(I->getType())->getElementType();
|
unsigned NumElems = PTy->getNumElements();
|
||||||
|
const Type *EltTy = PTy->getElementType();
|
||||||
|
|
||||||
// Figure out if there is a Packed type corresponding to this Vector
|
// Figure out if there is a Packed type corresponding to this Vector
|
||||||
// type. If so, convert to the packed type.
|
// type. If so, convert to the packed type.
|
||||||
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
|
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
|
||||||
if (TVT != MVT::Other && isTypeLegal(TVT)) {
|
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 {
|
} else {
|
||||||
assert(0 && "Don't support illegal by-val vector arguments yet!");
|
assert(0 && "Don't support illegal by-val vector arguments yet!");
|
||||||
}
|
}
|
||||||
|
@ -2996,19 +3007,6 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL,
|
||||||
if (!AI->use_empty()) {
|
if (!AI->use_empty()) {
|
||||||
SDL.setValue(AI, Args[a]);
|
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
|
// 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.
|
// whereever we got it to the vreg that other BB's will reference it as.
|
||||||
if (FuncInfo.ValueMap.count(AI)) {
|
if (FuncInfo.ValueMap.count(AI)) {
|
||||||
|
|
|
@ -453,7 +453,7 @@ static std::vector<SDOperand> getFormalArgObjects(SDOperand Op) {
|
||||||
assert(Op.getOpcode() == ISD::AssertSext ||
|
assert(Op.getOpcode() == ISD::AssertSext ||
|
||||||
Op.getOpcode() == ISD::AssertZext);
|
Op.getOpcode() == ISD::AssertZext);
|
||||||
Objs.push_back(Op.getOperand(0));
|
Objs.push_back(Op.getOperand(0));
|
||||||
} else if (Opc == ISD::FP_ROUND) {
|
} else if (Opc == ISD::FP_ROUND || Opc == ISD::VBIT_CONVERT) {
|
||||||
Objs.push_back(Op.getOperand(0));
|
Objs.push_back(Op.getOperand(0));
|
||||||
} else if (Opc == ISD::BUILD_PAIR) {
|
} else if (Opc == ISD::BUILD_PAIR) {
|
||||||
Objs.push_back(Op.getOperand(0));
|
Objs.push_back(Op.getOperand(0));
|
||||||
|
|
Loading…
Reference in New Issue