diff options
author | Chris Lattner <sabre@nondot.org> | 2006-01-29 07:58:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-01-29 07:58:15 +0000 |
commit | 70814bc38435d61a8c7cc32f2375c09e21f12a8a (patch) | |
tree | a4b4e82cacc0ff4fb205a45b57d69617c6ed883d /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | c1857c23f5be80681e0a268dcd66146480315385 (diff) |
Remove some special case hacks for CALLSEQ_*, using UpdateNodeOperands
instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index fb5329a5c0..57e0077d91 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -589,22 +589,24 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case ISD::CALLSEQ_START: case ISD::CALLSEQ_END: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. - // Do not try to legalize the target-specific arguments (#1+) - Tmp2 = Node->getOperand(0); - if (Tmp1 != Tmp2) - Node->setAdjCallChain(Tmp1); - - // If this has a flag input, do legalize it. - if (Node->getOperand(Node->getNumOperands()-1).getValueType() == MVT::Flag){ - Tmp1 = LegalizeOp(Node->getOperand(Node->getNumOperands()-1)); - if (Tmp1 != Node->getOperand(Node->getNumOperands()-1)) - Node->setAdjCallFlag(Tmp1); + // Do not try to legalize the target-specific arguments (#1+), except for + // an optional flag input. + if (Node->getOperand(Node->getNumOperands()-1).getValueType() != MVT::Flag){ + if (Tmp1 != Node->getOperand(0)) { + std::vector<SDOperand> Ops(Node->op_begin(), Node->op_end()); + Ops[0] = Tmp1; + Result = DAG.UpdateNodeOperands(Result, Ops); + } + } else { + Tmp2 = LegalizeOp(Node->getOperand(Node->getNumOperands()-1)); + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(Node->getNumOperands()-1)) { + std::vector<SDOperand> Ops(Node->op_begin(), Node->op_end()); + Ops[0] = Tmp1; + Ops.back() = Tmp2; + Result = DAG.UpdateNodeOperands(Result, Ops); + } } - - // Note that we do not create new CALLSEQ_DOWN/UP nodes here. These - // nodes are treated specially and are mutated in place. This makes the dag - // legalization process more efficient and also makes libcall insertion - // easier. break; case ISD::DYNAMIC_STACKALLOC: { Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. @@ -2964,7 +2966,10 @@ void SelectionDAGLegalize::SpliceCallInto(const SDOperand &CallResult, SDOperand InToken = DAG.getNode(ISD::TokenFactor, MVT::Other, CallResult, OutChain->getOperand(0)); // Change the node to refer to the new token. - OutChain->setAdjCallChain(InToken); + std::vector<SDOperand> Ops(OutChain->op_begin(), OutChain->op_end()); + Ops[0] = InToken; + SDOperand Res = DAG.UpdateNodeOperands(SDOperand(OutChain, 0), Ops); + assert(Res.Val == OutChain && "Didn't update in place!"); } |