diff options
author | Jim Laskey <jlaskey@mac.com> | 2005-12-16 22:45:29 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2005-12-16 22:45:29 +0000 |
commit | f5395cee6a24699a016b2e379cf4804b09ce5030 (patch) | |
tree | f3d1e7436810c4ed6e5bcbe66b60cb50ae866724 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | d9e0ba49a4cf288eee9b58857b92a89f5a141c4b (diff) |
Added source file/line correspondence for dwarf (PowerPC only at this point.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24748 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, 34 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 15376216a5..c5b7bf9f54 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -611,9 +611,18 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { 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; + case TargetLowering::Expand: { + MachineDebugInfo &DebugInfo = DAG.getMachineFunction().getDebugInfo(); + std::vector<SDOperand> Ops; + Ops.push_back(Tmp1); // chain + Ops.push_back(Node->getOperand(1)); // line # + Ops.push_back(Node->getOperand(2)); // col # + const std::string &fname = cast<StringSDNode>(Node->getOperand(3))->getValue(); + const std::string &dirname=cast<StringSDNode>(Node->getOperand(4))->getValue(); + unsigned id = DebugInfo.RecordSource(fname, dirname); + Ops.push_back(DAG.getConstant(id, MVT::i32)); // source file id + Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); + } break; case TargetLowering::Legal: if (Tmp1 != Node->getOperand(0) || @@ -635,6 +644,28 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; } break; + + case ISD::DEBUG_LOC: + assert(Node->getNumOperands() == 4 && "Invalid DEBUG_LOC node!"); + switch (TLI.getOperationAction(ISD::DEBUG_LOC, MVT::Other)) { + case TargetLowering::Promote: + case TargetLowering::Expand: + default: assert(0 && "This action is not supported yet!"); + case TargetLowering::Legal: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. + Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. + Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. + + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1) || + Tmp3 != Node->getOperand(2) || + Tmp4 != Node->getOperand(3)) { + Result = DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4); + } + break; + } + break; case ISD::Constant: // We know we don't need to expand constants here, constants only have one |