Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.60 -> 1.61 MachineDebugInfo.cpp updated: 1.38 -> 1.39 --- Log message: Place dwarf headers at earliest possible point. Well behaved when skipping functions. --- Diffs of the changes: (+57 -51) DwarfWriter.cpp | 100 +++++++++++++++++++++++++++------------------------ MachineDebugInfo.cpp | 8 ++-- 2 files changed, 57 insertions(+), 51 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.60 llvm/lib/CodeGen/DwarfWriter.cpp:1.61 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.60 Fri May 12 01:33:48 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Wed Jun 14 06:35:03 2006 @@ -1646,7 +1646,11 @@ /// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc /// tools to recognize the object file contains Dwarf information. /// -void DwarfWriter::EmitInitial() const { +void DwarfWriter::EmitInitial() { + // Check to see if we already emitted intial headers. + if (didInitial) return; + didInitial = true; + // Dwarf sections base addresses. Asm->SwitchToDataSection(DwarfFrameSection, 0); EmitLabel("section_frame", 0); @@ -1676,6 +1680,9 @@ EmitLabel("text_begin", 0); Asm->SwitchToDataSection(DataSection, 0); EmitLabel("data_begin", 0); + + // Emit common frame information. + EmitInitialDebugFrame(); } /// EmitDIE - Recusively Emits a debug information entry. @@ -2286,35 +2293,6 @@ } } -/// ShouldEmitDwarf - Determine if Dwarf declarations should be made. -/// -bool DwarfWriter::ShouldEmitDwarf() { - // Check if debug info is present. - if (!DebugInfo || !DebugInfo->hasInfo()) return false; - - // Make sure initial declarations are made. - if (!didInitial) { - EmitInitial(); - - // Emit common frame information. - EmitInitialDebugFrame(); - - // Create all the compile unit DIEs. - ConstructCompileUnitDIEs(); - - // Create DIEs for each of the externally visible global variables. - ConstructGlobalDIEs(); - - // Create DIEs for each of the externally visible subprograms. - ConstructSubprogramDIEs(); - - didInitial = true; - } - - // Okay to emit. - return true; -} - //===----------------------------------------------------------------------===// // Main entry points. // @@ -2328,6 +2306,8 @@ , MF(NULL) , DebugInfo(NULL) , didInitial(false) +, shouldEmit(false) +, IsNormalText(false) , SubprogramCount(0) , CompileUnits() , Abbreviations() @@ -2363,7 +2343,23 @@ /// SetDebugInfo - Set DebugInfo when it's known that pass manager has /// created it. Set by the target AsmPrinter. void DwarfWriter::SetDebugInfo(MachineDebugInfo *DI) { - DebugInfo = DI; + // Make sure initial declarations are made. + if (!DebugInfo && DI->hasInfo()) { + DebugInfo = DI; + shouldEmit = true; + + // Emit initial sections + EmitInitial(); + + // Create all the compile unit DIEs. + ConstructCompileUnitDIEs(); + + // Create DIEs for each of the externally visible global variables. + ConstructGlobalDIEs(); + + // Create DIEs for each of the externally visible subprograms. + ConstructSubprogramDIEs(); + } } /// BeginModule - Emit all Dwarf sections that should come prior to the content. @@ -2420,17 +2416,24 @@ /// BeginFunction - Gather pre-function debug information. Assumes being /// emitted immediately after the function entry point. -void DwarfWriter::BeginFunction(MachineFunction *MF) { +void DwarfWriter::BeginFunction(MachineFunction *MF, bool IsNormalText) { this->MF = MF; + // FIXME - should be able to debug coalesced functions. + this->IsNormalText = IsNormalText; - // Begin accumulating function debug information. - DebugInfo->BeginFunction(MF); - - if (!ShouldEmitDwarf()) return; - EOL("Dwarf Begin Function"); - - // Assumes in correct section after the entry point. - EmitLabel("func_begin", ++SubprogramCount); + // FIXME - should be able to debug coalesced functions. + if (IsNormalText) { + // Begin accumulating function debug information. + DebugInfo->BeginFunction(MF); + + if (!ShouldEmitDwarf()) return; + EOL("Dwarf Begin Function"); + + // Assumes in correct section after the entry point. + EmitLabel("func_begin", ++SubprogramCount); + } else { + ShouldEmitDwarf(); + } } /// EndFunction - Gather and emit post-function debug information. @@ -2439,14 +2442,17 @@ if (!ShouldEmitDwarf()) return; EOL("Dwarf End Function"); - // Define end label for subprogram. - EmitLabel("func_end", SubprogramCount); - - // Construct scopes for subprogram. - ConstructRootScope(DebugInfo->getRootScope()); + // FIXME - should be able to debug coalesced functions. + if (IsNormalText) { + // Define end label for subprogram. + EmitLabel("func_end", SubprogramCount); - // Emit function frame information. - EmitFunctionDebugFrame(); + // Construct scopes for subprogram. + ConstructRootScope(DebugInfo->getRootScope()); + + // Emit function frame information. + EmitFunctionDebugFrame(); + } // Clear function debug information. DebugInfo->EndFunction(); Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.38 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.39 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.38 Thu Apr 13 13:29:58 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Wed Jun 14 06:35:03 2006 @@ -262,10 +262,10 @@ Elements.push_back(ConstantUInt::get(Type::UIntTy, Field)); } virtual void Apply(int64_t &Field) { - Elements.push_back(ConstantSInt::get(Type::IntTy, Field)); + Elements.push_back(ConstantSInt::get(Type::LongTy, Field)); } virtual void Apply(uint64_t &Field) { - Elements.push_back(ConstantUInt::get(Type::UIntTy, Field)); + Elements.push_back(ConstantUInt::get(Type::ULongTy, Field)); } virtual void Apply(bool &Field) { Elements.push_back(ConstantBool::get(Field)); @@ -345,10 +345,10 @@ Fields.push_back(Type::UIntTy); } virtual void Apply(int64_t &Field) { - Fields.push_back(Type::IntTy); + Fields.push_back(Type::LongTy); } virtual void Apply(uint64_t &Field) { - Fields.push_back(Type::UIntTy); + Fields.push_back(Type::ULongTy); } virtual void Apply(bool &Field) { Fields.push_back(Type::BoolTy); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits