diff options
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 23 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 20 |
2 files changed, 15 insertions, 28 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index aad1f87ed9..3ecd623c81 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -711,28 +711,7 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, } } - // Now that we have emitted all operands, emit this instruction itself. - if (ISD::isDebugLabel(Node) && - !BB->empty() && &MF->front() == BB) { - // If we are inserting a debug label and this happens to be the first - // debug label in the entry block, it is the "function start" label. - // Make sure there are no other instructions before it. - unsigned NumLabels = 0; - MachineBasicBlock::iterator MBBI = BB->begin(); - while (MBBI != BB->end()) { - // FIXME: This is a nasty short term workaround. For now, we are - // assuming there are two debug labels at the beginning of the - // entry block: one for dbg_func_start, one for the first - // dbg_stoppoint before actual code. - if (!MBBI->isDebugLabel() || ++NumLabels > 1) - break; - ++MBBI; - } - if (NumLabels <= 1) - BB->insert(BB->begin(), MI); - else - BB->push_back(MI); - } else if (II.usesCustomDAGSchedInsertionHook()) + if (II.usesCustomDAGSchedInsertionHook()) // Insert this instruction into the basic block using a target // specific inserter which may returns a new basic block. BB = DAG.getTargetLoweringInfo().EmitInstrWithCustomInserter(MI, BB); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 4d1e7ebefb..2d883878ce 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2641,13 +2641,21 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { } case Intrinsic::dbg_func_start: { MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); + if (!MMI) return 0; DbgFuncStartInst &FSI = cast<DbgFuncStartInst>(I); - if (MMI && FSI.getSubprogram() && - MMI->Verify(FSI.getSubprogram())) { - unsigned LabelID = MMI->RecordRegionStart(FSI.getSubprogram()); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(LabelID, MVT::i32), - DAG.getConstant(0, MVT::i32))); + Value *SP = FSI.getSubprogram(); + if (SP && MMI->Verify(SP)) { + // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is + // what (most?) gdb expects. + DebugInfoDesc *DD = MMI->getDescFor(SP); + assert(DD && "Not a debug information descriptor"); + SubprogramDesc *Subprogram = cast<SubprogramDesc>(DD); + const CompileUnitDesc *CompileUnit = Subprogram->getFile(); + unsigned SrcFile = MMI->RecordSource(CompileUnit->getDirectory(), + CompileUnit->getFileName()); + // Record the source line but does create a label. It will be emitted + // at asm emission time. + MMI->RecordSourceLine(Subprogram->getLine(), 0, SrcFile); } return 0; |