diff options
author | Duncan Sands <baldrick@free.fr> | 2007-12-31 18:35:50 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-12-31 18:35:50 +0000 |
commit | b027fa001f16660a231a54ecea6a79f5c7855d7c (patch) | |
tree | 37e9242837fb31acda017e1a5e807a74595aad6e /lib | |
parent | d10fd9791c20fd8368fa0ce94b626b769c6c8ba0 (diff) |
Fix PR1833 - eh.exception and eh.selector return two
values, which means doing extra legalization work.
It would be easier to get this kind of thing right if
there was some documentation...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index e1540ea1d2..688e4f9fea 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -858,7 +858,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { unsigned Reg = TLI.getExceptionAddressRegister(); - Result = DAG.getCopyFromReg(Tmp1, Reg, VT).getValue(Op.ResNo); + Result = DAG.getCopyFromReg(Tmp1, Reg, VT); } break; case TargetLowering::Custom: @@ -868,12 +868,23 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp1 }; Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - Ops, 2).getValue(Op.ResNo); + Ops, 2); break; } } } - break; + if (Result.Val->getNumValues() == 1) break; + + assert(Result.Val->getNumValues() == 2 && + "Cannot return more than two values!"); + + // Since we produced two values, make sure to remember that we + // legalized both of them. + Tmp1 = LegalizeOp(Result); + Tmp2 = LegalizeOp(Result.getValue(1)); + AddLegalizedOperand(Op.getValue(0), Tmp1); + AddLegalizedOperand(Op.getValue(1), Tmp2); + return Op.ResNo ? Tmp2 : Tmp1; case ISD::EHSELECTION: { Tmp1 = LegalizeOp(Node->getOperand(0)); Tmp2 = LegalizeOp(Node->getOperand(1)); @@ -882,7 +893,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { unsigned Reg = TLI.getExceptionSelectorRegister(); - Result = DAG.getCopyFromReg(Tmp2, Reg, VT).getValue(Op.ResNo); + Result = DAG.getCopyFromReg(Tmp2, Reg, VT); } break; case TargetLowering::Custom: @@ -892,12 +903,23 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp2 }; Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - Ops, 2).getValue(Op.ResNo); + Ops, 2); break; } } } - break; + if (Result.Val->getNumValues() == 1) break; + + assert(Result.Val->getNumValues() == 2 && + "Cannot return more than two values!"); + + // Since we produced two values, make sure to remember that we + // legalized both of them. + Tmp1 = LegalizeOp(Result); + Tmp2 = LegalizeOp(Result.getValue(1)); + AddLegalizedOperand(Op.getValue(0), Tmp1); + AddLegalizedOperand(Op.getValue(1), Tmp2); + return Op.ResNo ? Tmp2 : Tmp1; case ISD::EH_RETURN: { MVT::ValueType VT = Node->getValueType(0); // The only "good" option for this node is to custom lower it. |