Commit Graph

214 Commits

Author SHA1 Message Date
Devang Patel 0fde4aeedd Rename InsnAfterLabelMap and InsnBeforeLabelMap.
llvm-svn: 102106
2010-04-22 18:43:35 +00:00
Devang Patel 53f530d44c Keep track of MCSymbol used to mark beginning of a function.
llvm-svn: 102104
2010-04-22 18:39:21 +00:00
Devang Patel 0940a8085e Identify when a lexical scope is split in to multiple instruction ranges. Emit such ranges using DW_AT_ranges.
llvm-svn: 102004
2010-04-21 16:32:19 +00:00
Devang Patel 12563b3495 Add support to emit dwarf ranges.
llvm-svn: 101575
2010-04-16 23:33:45 +00:00
Devang Patel 3d6c40c616 Add comment.
llvm-svn: 101317
2010-04-15 00:02:49 +00:00
Devang Patel 97bdf94da3 There is no need to track compile unit offsets if there is only one compile unit.
llvm-svn: 101315
2010-04-14 23:56:24 +00:00
Devang Patel b08ccb62d5 Remove dead code.
llvm-svn: 101314
2010-04-14 23:54:13 +00:00
Devang Patel 359b013129 Rename a function.
llvm-svn: 100797
2010-04-08 18:43:56 +00:00
Devang Patel 3ebd8931fb One instruction may start (or end) multiple lexical scopes.
There is no need to remember labels identifying regions marked by such instructions in each scope.

llvm-svn: 100781
2010-04-08 16:50:29 +00:00
Devang Patel 2abed283e5 Remove dead code.
llvm-svn: 100771
2010-04-08 15:48:02 +00:00
Devang Patel f1d5a1e994 Refactor.
llvm-svn: 100768
2010-04-08 15:37:09 +00:00
Benjamin Kramer f2351a7a6e Remove unused method.
llvm-svn: 100620
2010-04-07 11:23:46 +00:00
Bill Wendling fcc14141c7 Use the "NamedGroupTimer" class to categorize DWARF emission better.
llvm-svn: 100616
2010-04-07 09:28:04 +00:00
Stuart Hastings 4bd3dd956f Reverting 100530 & 100531 due to regressions in the GDB test suite.
llvm-svn: 100563
2010-04-06 21:38:29 +00:00
Stuart Hastings c067196984 Revise debug info machinery to digest nested functions and classes.
A certain GDB testsuite case (local.cc) has a function nested inside a
class nested inside another function.  GCC presents the innermost
function to llvm-convert first.  Heretofore, the debug info mistakenly
placed the inner function at module scope.  This patch walks the GCC
context links and instantiates the outer class and function so the
debug info is properly nested.  Radar 7426545.

llvm-svn: 100530
2010-04-06 17:19:32 +00:00
Chris Lattner 28f2fdafcd hopefully sate the clang self host build, which is apparently
instantiating some folding set stuff that GCC isn't, requiring 
some types to not be incomplete.

I don't know if clang is right or wrong, but unbreaking the
bot is goodness.  Here's the broken build:
http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/1813/steps/compile.llvm.stage2/logs/stdio

llvm-svn: 100418
2010-04-05 06:12:01 +00:00
Chris Lattner 64a168efb6 privatize more stuff, eliminate vtables.
llvm-svn: 100410
2010-04-05 05:32:45 +00:00
Chris Lattner acda87bdb1 reprivatize now that DwarfWriter is gone.
llvm-svn: 100409
2010-04-05 05:31:04 +00:00
Chris Lattner 3f3fb970e4 prune #includes, realize the MMI can never be null.
llvm-svn: 100407
2010-04-05 05:24:55 +00:00
Chris Lattner f0d6bd3ef4 change AsmPrinter to use DwarfDebug/DwarfException directly
instead of going through DwarfWriter.

llvm-svn: 100405
2010-04-05 05:11:15 +00:00
Chris Lattner 196dbdc160 eliminate DwarfDebug::shouldEmit, which is the same now as MMI::hasDebugInfo
llvm-svn: 100386
2010-04-05 03:52:55 +00:00
Chris Lattner 7cfa70e9b3 fastisel doesn't need DwarfWriter, remove some tendricles.
llvm-svn: 100381
2010-04-05 02:19:28 +00:00
Chris Lattner 3a383cb7d9 1) make DIE take AsmPrinter instead of DwarfPrinter.
2) change DwarfDebug to not inherit from DwarfPrinter.

llvm-svn: 100372
2010-04-05 00:13:49 +00:00
Chris Lattner e58b547460 I was wrong, ocaml isn't referencing 'Ldata_begin', so remove it.
llvm-svn: 100365
2010-04-04 23:10:38 +00:00
Chris Lattner 6629ca978e Store an use the symbols emitted at the start of the debug
sections instead of magically rematerializing them later.

llvm-svn: 100362
2010-04-04 22:59:04 +00:00
Chris Lattner 46355d87a8 remove the didInitial ivar, rename emitInitial to be more
descriptive, change EmitSectionOffset back to taking a
symbol instead of a string.

llvm-svn: 100361
2010-04-04 22:33:59 +00:00
Chris Lattner 1198002c81 remove the raw_ostream from various dwarf printing things.
The only thing left is LEB printing, which uses EmitRawText
for now.

llvm-svn: 100325
2010-04-04 07:48:20 +00:00
Chris Lattner 915c5f9862 Switch the code generator (except the JIT) onto the new DebugLoc
representation.  This eliminates the 'DILocation' MDNodes for 
file/line/col tuples from -O0 -g codegen.

This remove the old DebugLoc class, making it a typedef for DebugLoc,
I'll rename NewDebugLoc next.

I didn't update the JIT to use the new apis, so it will continue to
work, but be as slow as before.  Someone should eventually do this
or, better yet, rip out the JIT debug info stuff and build the JIT
on top of MC.

llvm-svn: 100209
2010-04-02 19:42:39 +00:00
Stuart Hastings 7f89a0ac88 Reverting 100048; it broke two Frontend debug info tests.
llvm-svn: 100058
2010-03-31 23:08:46 +00:00
Stuart Hastings f3e5afd6d3 Debug info can now properly represent functions inside classes inside other functions. Partial fix for Radar 7424645.
llvm-svn: 100048
2010-03-31 21:10:54 +00:00
Benjamin Kramer 74729ae094 DwarfDebug: Allocate DIEValues with a BumpPtrAllocator. Most of them are
POD-like anyway, so we don't even care about calling their d'tors (DIEBlock
being the exception).

~6% less mallocs and ~1% compile time improvement on clang -O0 -g oggenc.c

llvm-svn: 100035
2010-03-31 19:34:01 +00:00
Devang Patel 23b2ae621c Encode start location of debug value, communicated through DBG_VALUE machine instruction, in a variable's DIE.
llvm-svn: 99845
2010-03-29 22:59:58 +00:00
Devang Patel bd477bef25 Refactor code to push DILocation prcessing into DwarfDebug.cpp from AsmPrinter.cpp.
This is same as r99772 (which was reverted) with just one meaningful difference where two source lines exchanged their positions.

llvm-svn: 99816
2010-03-29 17:20:31 +00:00
Devang Patel 1e8ccb5f8b Revert 99772.
llvm-svn: 99778
2010-03-28 21:23:37 +00:00
Devang Patel 32bdaef3fe Refactoring. Push DILocation processing in to DwarfDebug from AsmPrinter.
llvm-svn: 99772
2010-03-28 18:57:09 +00:00
Devang Patel 95cd4b9c0a Add comment.
llvm-svn: 99507
2010-03-25 15:09:44 +00:00
Devang Patel 53e91f0836 DW_AT_stmt_list attribute attached with a compile unit encodes offset of line number information for this compile unit in debug_line section. This offset is always zero when only one compile unit is emitted in a object file.
llvm-svn: 99223
2010-03-22 22:38:48 +00:00
Devang Patel a3e9c9ca7b Emit dwarf variable info communicated by code generator through DBG_VALUE machine instructions.
This is a work in progress.

llvm-svn: 98556
2010-03-15 18:33:46 +00:00
Chris Lattner b4666f4517 change SrcLineInfo to contain a label instead of a label ID.
llvm-svn: 98483
2010-03-14 08:15:55 +00:00
Chris Lattner b7aa9527ef reimplement the string pool used for inlined function
entries to not thrash std::strings and MCSymbols.

llvm-svn: 98415
2010-03-13 02:17:42 +00:00
Jeffrey Yasskin 35b4e4f641 Free DbgScopes in DwarfDebug::endFunction(). Also increased the const-ness of
several fields to make it easier to figure out where bugs might be creeping in.

llvm-svn: 98358
2010-03-12 17:45:06 +00:00
Jeffrey Yasskin 0708de1f97 Avoid leaking CompileUnits in DwarfDebug.cpp.
llvm-svn: 98268
2010-03-11 18:29:55 +00:00
Chris Lattner ba35a67062 reapply r98035:
Now that setStartLabel takes an MCSymbol, we can de-ID'ize
beginScope and RecordSourceLine.

llvm-svn: 98047
2010-03-09 04:54:43 +00:00
Eric Christopher 66194fbf86 Speculatively revert r98035. It appears to have caused a set of buildbot
failures.

llvm-svn: 98039
2010-03-09 02:36:31 +00:00
Chris Lattner 06c5e9060c Now that setStartLabel takes an MCSymbol, we can de-ID'ize
beginScope and RecordSourceLine.

llvm-svn: 98035
2010-03-09 02:08:02 +00:00
Chris Lattner 085b65283c make InlineInfoLabels hold MCSymbol*'s, avoiding
recomputation of the labels.

llvm-svn: 98016
2010-03-09 00:31:02 +00:00
Chris Lattner 27a9732450 simplify EmitSectionOffset to always use .set if it is
available, the only thing this affects is that we produce
.set in one case we didn't before, which shouldn't harm
anything.  Make EmitSectionOffset call EmitDifference
instead of duplicating it.

llvm-svn: 98005
2010-03-08 23:23:25 +00:00
Chris Lattner 8dcf41ed66 merge DIEObjectLabel and DIEDwarfLabel into DIELabel.
Yes, DIE you fiendish labels, die all of you.

llvm-svn: 97995
2010-03-08 22:31:46 +00:00
Chris Lattner bc9210cb70 elimiante the DWLabel class, using MCSymbol instead. Start
switching some stuff over to passing around MCSymbol* instead
of stem+ID.

llvm-svn: 97993
2010-03-08 22:23:36 +00:00
Devang Patel 8119fe87d8 Derive DIType from DIScope. This simplifies getContext() where for members the context is a type. This also eliminates need of CompileUnitMaps maintained by dwarf writer.
llvm-svn: 97990
2010-03-08 22:02:50 +00:00
Devang Patel 3b548aa8e2 Avoid using DIDescriptor.isNull().
This is a first step towards eliminating checks in Descriptor constructors.

llvm-svn: 97975
2010-03-08 20:52:55 +00:00
Devang Patel bc97f6b757 Revert r97947.
llvm-svn: 97963
2010-03-08 19:20:38 +00:00
Devang Patel fe28599f6f Avoid using DIDescriptor.isNull().
This is a first step towards eliminating unncessary constructor checks in light weight DIDescriptor wrappers.

llvm-svn: 97947
2010-03-08 18:25:48 +00:00
Douglas Gregor 9abb538be0 Revert r97917, which was causing Clang Debug self-host failures.
llvm-svn: 97932
2010-03-08 02:58:37 +00:00
Jeffrey Yasskin 37a0372fc4 Roll r97906 forward again, without double-deleting CompileUnit::IndexTyDie.
llvm-svn: 97917
2010-03-07 17:10:13 +00:00
Jeffrey Yasskin 7068bdba50 _2_ gcc crashes, ah, ah, ah...
(Rolling back r97906.)

llvm-svn: 97909
2010-03-07 07:16:49 +00:00
Jeffrey Yasskin 413721b050 Avoid leaking CompileUnits and DbgScopes from DwarfDebug. Leaks found by Valgrind!
llvm-svn: 97906
2010-03-07 06:55:35 +00:00
Dan Gohman 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Chris Lattner 76555b513c constify a bunch of dwarf stuff now that the registerinfo method
is constified.

llvm-svn: 94613
2010-01-26 23:18:02 +00:00
Chris Lattner 69bb026835 rename the dwarf class to DwarfPrinter. This matches the filename
and much more accurately describes what it is all about.

llvm-svn: 94233
2010-01-22 22:23:57 +00:00
Devang Patel 018b29b039 MDNodes are not expected to disappear or replaced by another MDNode, so there is no need to pay the cost of WeakVH and ValueMaps.
llvm-svn: 93865
2010-01-19 06:19:05 +00:00
Chris Lattner 06d45f6e75 Change DIEObjectLabel to take an MCSymbol instead of std::string.
llvm-svn: 93647
2010-01-16 18:50:28 +00:00
Devang Patel 1f4690c624 Add support to emit debug info for C++ namespaces.
llvm-svn: 91440
2009-12-15 19:16:48 +00:00
Devang Patel 525dda05a0 Use DW_AT_specification to point to DIE describing function declaration.
llvm-svn: 91278
2009-12-14 16:18:45 +00:00
Devang Patel b314bd688a Construct CompileUnits lazily.
llvm-svn: 91159
2009-12-11 21:37:07 +00:00
Devang Patel 2b75ed2c3d Refactor code that finds context for a given die.
Create global variable DIEs after creating subprogram DIEs. This allows function level static variable's to find their context at the time of DIE creation.

llvm-svn: 91055
2009-12-10 19:14:49 +00:00
Devang Patel b5b60ea4f9 Refactor.
llvm-svn: 91051
2009-12-10 18:05:33 +00:00
Devang Patel 9ccfb641d1 Reapply r90858, a cleanup patch.
llvm-svn: 90979
2009-12-09 18:24:21 +00:00
Devang Patel 512001ac7d Revert 90858 90875 and 90805 for now.
llvm-svn: 90898
2009-12-08 23:21:45 +00:00
Devang Patel 24c0bb1ca1 Cleanup.
There is no need to supply ModuleCU to addType() as a parameter.

llvm-svn: 90858
2009-12-08 15:31:31 +00:00
Devang Patel b074d1783b Add support to emit debug info for c++ style namespaces.
llvm-svn: 90805
2009-12-07 21:41:32 +00:00
Devang Patel eb57c59b66 Add support to emit debug info for virtual functions and virtual base classes.
llvm-svn: 90474
2009-12-03 19:11:07 +00:00
Devang Patel 236526dd18 Emit method definition DIE at module level (even for methods with inlined functino body at soure level) so that the debugger can invoke it. This fixes many test failures in gdb test suite.
llvm-svn: 90375
2009-12-03 01:25:38 +00:00
Devang Patel 2d9caf9fe5 Use StringRef (again) in DebugInfo interface.
llvm-svn: 89866
2009-11-25 17:36:49 +00:00
Devang Patel b3e0168428 Use StringRef instead of std::string in DIEString.
llvm-svn: 89793
2009-11-24 19:42:17 +00:00
Devang Patel 04d2f2d192 Emit pubtypes.
llvm-svn: 89725
2009-11-24 01:14:22 +00:00
Devang Patel 930143b0dc Cosmetic changes, which were long overdue, in DwarfDebug.cpp.
llvm-svn: 89537
2009-11-21 02:48:08 +00:00
Devang Patel 92e8c655b2 There is no need to use FoldingSet to unique DIEs.
DIEs are created from MDNode, which are already uniqued. And DwarfDebug already uses ValueMaps to find and use existing DIE for a given MDNode.

llvm-svn: 89518
2009-11-21 00:31:03 +00:00
Nick Lewycky a1c09d674e Remove VISIBILITY_HIDDEN from the classes in this directory. Fixes bug 5507.
llvm-svn: 89075
2009-11-17 09:17:08 +00:00
Devang Patel 2904aa9f6e "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Devang Patel f6eeaebd76 Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Devang Patel cfeaa48642 Do not held on to DenseMap slot accross map insertion. The insertion may cause the map to grow rending the slot invalid.
Use this opportunity to use ValueMap instead of DenseMap.

llvm-svn: 85298
2009-10-27 20:47:17 +00:00
Devang Patel 6875c5ebe4 Add support to record DbgScope as inlined scope.
llvm-svn: 84134
2009-10-14 21:08:09 +00:00
Devang Patel df45c7f642 Extract scope information from the variable itself, instead of relying on alloca or llvm.dbg.declare location.
While recording beginning of a function, use scope info from the first location entry instead of just relying on first location entry itself.

llvm-svn: 83684
2009-10-09 22:42:28 +00:00
Devang Patel 20b2a77765 Do not record line number to implicitly mark start of function if function has arguments. Extra line number entries trip gdb in some cases.
llvm-svn: 83563
2009-10-08 18:48:03 +00:00
Devang Patel 2980a22028 Remove dead code.
llvm-svn: 83362
2009-10-06 02:01:32 +00:00
Devang Patel 8db360da7b Add utility routine to set begin and end labels for DbgScopes.
This will be used by processDebugLoc().

llvm-svn: 83361
2009-10-06 01:50:42 +00:00
Devang Patel 849e59abb2 Remove unintentional function decl.
llvm-svn: 83356
2009-10-06 01:31:35 +00:00
Devang Patel 475d32a987 Add utility routine to collect variable debug info. This is not yet used.
llvm-svn: 83355
2009-10-06 01:26:37 +00:00
Devang Patel 4c420eca41 Adjust context for the global variables that are not at file scope, e.g.
void foo() { static int bar = 42; }
Here, foo's DIE is parent of bar's DIE.

llvm-svn: 83344
2009-10-05 23:40:42 +00:00
Devang Patel 75cc16c0f2 Add support to extract lexical scope information from DebugLoc attached with an machine instruction.
This is not yet enabled.

llvm-svn: 83210
2009-10-01 20:31:14 +00:00
Devang Patel 3256c751f5 Use MDNode * directly as an RecordSourceLine() argument.
llvm-svn: 83182
2009-09-30 22:51:28 +00:00
Mike Stump 14cf8ecf0b Add a way for a frontend to generate more complex dwarf location
information.  This allows arbitrary code involving DW_OP_plus_uconst
and DW_OP_deref.  The scheme allows for easy extention to include,
any, or all of the DW_OP_ opcodes.  I thought about just exposing all
of them, but, wasn't sure if people wanted the dwarf opcodes exposed
in the api.  Is that a layering violation?

With this scheme, the entire existing block scheme used by llvm-gcc
can be switched over to the new scheme.  I think that would be
cleaner, as then the compiler specific bits are not present in llvm
proper.  Before the old code can be yanked however, similar code in
clang would have to be removed.

Next up, more testing.

llvm-svn: 83120
2009-09-30 00:08:22 +00:00
Devang Patel b296942f6d Remove std::string uses from DebugInfo interface.
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Devang Patel b2de5fa689 Subprogram is a scope. Derive DISubprogram from DIScope.
llvm-svn: 80637
2009-08-31 22:47:13 +00:00
Caroline Tice c87c1e2cfd Add flag to mark structs for Apple Block "byref" variables; also add code to
modify the type and location debug information for these variables to match the
programmer's expectations.

llvm-svn: 80625
2009-08-31 21:19:37 +00:00
Devang Patel 80ae34974b Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Devang Patel f08e35d9dc Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Devang Patel 02aac922b4 Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Chris Lattner 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Devang Patel 0939595711 Record variable debug info at ISel time directly.
llvm-svn: 79742
2009-08-22 17:12:53 +00:00
Chris Lattner 4d2c0f9008 switch off of 'Section' onto MCSection. We're not properly using
MCSection subclasses yet, but this is a step in the right direction.

llvm-svn: 77708
2009-07-31 18:48:30 +00:00
Devang Patel b4c9579e69 revert rev. 75503 for now.
llvm-svn: 75507
2009-07-13 21:26:33 +00:00
Devang Patel 31b3d7b53f Use Mangler to remove leading '1' from linkage names.
llvm-svn: 75503
2009-07-13 21:19:56 +00:00
Devang Patel 270d747359 Remove dead code.
llvm-svn: 74949
2009-07-07 21:12:32 +00:00
Devang Patel 40d784180b s/MainCU/ModuleCU/g
llvm-svn: 74452
2009-06-29 20:45:18 +00:00
Devang Patel 0751a28888 Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.

llvm-svn: 74251
2009-06-26 01:49:18 +00:00
Devang Patel 0c044ecdb0 Simplify.
llvm-svn: 74215
2009-06-25 22:36:02 +00:00
Bill Wendling 744668d5af Merge 'ConstructFunctionDbgScope' and 'ConstructAbstractDbgScope'.
llvm-svn: 72197
2009-05-20 23:28:48 +00:00
Bill Wendling bcad77a8d5 Rename 'New*' methods to 'Create*' to be consistent. 'NewString' isn't used.
llvm-svn: 72196
2009-05-20 23:24:48 +00:00
Bill Wendling 2b128d70c5 Revert r72192. It was causing a build failure.
llvm-svn: 72193
2009-05-20 23:19:06 +00:00
Bill Wendling 8d7533d3e5 Do some mechanical changes. Combine the 'construct abastract dbg thingy' in with
the 'constract function dbg thingy'. Rename some methods to make them consistent
with the rest of the methods. Move the 'Emit' methods to the end of the file.

llvm-svn: 72192
2009-05-20 23:04:56 +00:00
Bill Wendling bc308569a3 RecordVariable is called each time a DECLARE node is encountered. For an inlined
function, this could be many, many times. We don't want to re-add variables to
that DIE for each time. We just want to add them once. Check to make sure that
we haven't added them already.

llvm-svn: 72047
2009-05-18 22:02:36 +00:00
Bill Wendling 2f921f82e4 Split out the DwarfDebug module from the DwarfWriter module.
Again, no intendtional functionality change.

llvm-svn: 71854
2009-05-15 09:23:25 +00:00