diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-29 06:21:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-29 06:21:05 +0000 |
commit | 36ce69195ed488034d0bb11180cc2ebd923679c8 (patch) | |
tree | 0233e6a89710fe69222f7d1e3b25bb553df3e45f /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 02fc8ff80091c38760670c2b91e0f487dcc6b8a3 (diff) |
Add support for a new STRING and LOCATION node for line number support, patch
contributed by Daniel Berlin, with a few cleanups here and there by me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index abc850a0f5..2f3d21d81b 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -540,6 +540,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case ISD::CONDCODE: case ISD::VALUETYPE: case ISD::SRCVALUE: + case ISD::STRING: switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { default: assert(0 && "This action is not supported yet!"); case TargetLowering::Custom: { @@ -601,6 +602,32 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { } break; } + + case ISD::LOCATION: + assert(Node->getNumOperands() == 5 && "Invalid LOCATION node!"); + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the input chain. + + switch (TLI.getOperationAction(ISD::LOCATION, MVT::Other)) { + case TargetLowering::Promote: + default: assert(0 && "This action is not supported yet!"); + case TargetLowering::Expand: + // If the target doesn't support line numbers, ignore this node. + Result = Tmp1; + break; + case TargetLowering::Legal: + if (Tmp1 != Node->getOperand(0)) { + std::vector<SDOperand> Ops; + Ops.push_back(Tmp1); + Ops.push_back(Node->getOperand(1)); // line # must be legal. + Ops.push_back(Node->getOperand(2)); // col # must be legal. + Ops.push_back(Node->getOperand(3)); // filename must be legal. + Ops.push_back(Node->getOperand(4)); // working dir # must be legal. + Result = DAG.getNode(ISD::LOCATION, MVT::Other, Ops); + } + break; + } + break; + case ISD::Constant: // We know we don't need to expand constants here, constants only have one // value and we check that it is fine above. |