[llvm-commits] [llvm] r56628 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/Target/CellSPU/SPUAsmPrinter.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Thu Sep 25 17:45:04 PDT 2008
On Sep 25, 2008, at 5:28 PM, Bill Wendling wrote:
Thanks for doing this.
>
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Thu Sep 25
> 19:28:12 2008
> @@ -2031,6 +2031,39 @@
> ConstructScope(RootScope, 0, 0, SPDie, Unit);
> }
>
> + /// ConstructDefaultScope - Construct a default scope for the
> subprogram.
> + ///
> + void ConstructDefaultScope(MachineFunction *MF) {
> + // Find the correct subprogram descriptor.
> + std::vector<SubprogramDesc *> Subprograms;
> + MMI->getAnchoredDescriptors<SubprogramDesc>(*M, Subprograms);
> +
> + for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) {
> + SubprogramDesc *SPD = Subprograms[i];
> +
> + if (SPD->getName() == MF->getFunction()->getName()) {
There has got to be a better way?! This is slow.
Evan
>
> + // Get the compile unit context.
> + CompileUnit *Unit = GetBaseCompileUnit();
> +
> + // Get the subprogram die.
>
> + DIE *SPDie = Unit->getDieMapSlotFor(SPD);
> + assert(SPDie && "Missing subprogram descriptor");
> +
> + // Add the function bounds.
> + AddLabel(SPDie, DW_AT_low_pc, DW_FORM_addr,
> + DWLabel("func_begin", SubprogramCount));
> + AddLabel(SPDie, DW_AT_high_pc, DW_FORM_addr,
> + DWLabel("func_end", SubprogramCount));
> +
> + MachineLocation Location(RI->getFrameRegister(*MF));
> + AddAddress(SPDie, DW_AT_frame_base, Location);
> + return;
> + }
> + }
> +
> + assert(0 && "Couldn't find DIE for machine function!");
> + }
> +
> /// EmitInitial - Emit initial Dwarf declarations. This is
> necessary for cc
> /// tools to recognize the object file contains Dwarf information.
> void EmitInitial() {
> @@ -2588,7 +2621,7 @@
> Asm->SwitchToDataSection(TAI->getDwarfARangesSection());
>
> // FIXME - Mock up
> - #if 0
> +#if 0
> CompileUnit *Unit = GetBaseCompileUnit();
>
> // Don't include size of length
> @@ -2612,7 +2645,7 @@
>
> Asm->EmitInt32(0); Asm->EOL("EOM (1)");
> Asm->EmitInt32(0); Asm->EOL("EOM (2)");
> - #endif
> +#endif
>
> Asm->EOL();
> }
> @@ -2822,7 +2855,7 @@
>
> /// EndFunction - Gather and emit post-function debug information.
> ///
> - void EndFunction() {
> + void EndFunction(MachineFunction *MF) {
> if (!ShouldEmitDwarf()) return;
>
> // Define end label for subprogram.
> @@ -2842,7 +2875,18 @@
> }
>
> // Construct scopes for subprogram.
> - ConstructRootScope(MMI->getRootScope());
> + if (MMI->getRootScope())
> + ConstructRootScope(MMI->getRootScope());
> + else
> + // FIXME: This is wrong. We are essentially getting past a
> problem with
> + // debug information not being able to handle unreachable
> blocks that have
> + // debug information in them. In particular, those
> unreachable blocks that
> + // have "region end" info in them. That situation results in
> the "root
> + // scope" not being created. If that's the case, then emit a
> "default"
> + // scope, i.e., one that encompasses the whole function. This
> isn't
> + // desirable. And a better way of handling this (and all of
> the debugging
> + // information) needs to be explored.
> + ConstructDefaultScope(MF);
>
> DebugFrames.push_back(FunctionDebugFrameInfo(SubprogramCount,
> MMI-
> >getFrameMoves()));
> @@ -3922,8 +3966,8 @@
>
> /// EndFunction - Gather and emit post-function debug information.
> ///
> -void DwarfWriter::EndFunction() {
> - DD->EndFunction();
> +void DwarfWriter::EndFunction(MachineFunction *MF) {
> + DD->EndFunction(MF);
> DE->EndFunction();
>
> if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE-
> >getMMI())
>
> Modified: llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp?rev=56628&r1=56627&r2=56628&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp Thu Sep 25
> 19:28:12 2008
> @@ -461,7 +461,7 @@
> EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
>
> // Emit post-function debug information.
> - DW.EndFunction();
> + DW.EndFunction(&MF);
>
> // We didn't modify anything.
> return false;
>
> Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=56628&r1=56627&r2=56628&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
> (original)
> +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Thu
> Sep 25 19:28:12 2008
> @@ -617,7 +617,7 @@
> EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
>
> // Emit post-function debug information.
> - DW.EndFunction();
> + DW.EndFunction(&MF);
>
> // We didn't modify anything.
> return false;
> @@ -809,7 +809,7 @@
> EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
>
> // Emit post-function debug information.
> - DW.EndFunction();
> + DW.EndFunction(&MF);
>
> // We didn't modify anything.
> return false;
>
> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=56628&r1=56627&r2=56628&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
> (original)
> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Thu
> Sep 25 19:28:12 2008
> @@ -260,7 +260,7 @@
>
> // Emit post-function debug information.
> if (TAI->doesSupportDebugInformation())
> - DW.EndFunction();
> + DW.EndFunction(&MF);
>
> // Print out jump tables referenced by the function.
> EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list