Commit Graph

48 Commits

Author SHA1 Message Date
Devang Patel e85806f0d1 Fix thinko.
llvm-svn: 76769
2009-07-22 18:56:16 +00:00
Devang Patel f03c9bec63 Add replaceAllUsesWith() to FE replace debug info constructs while building complex types.
llvm-svn: 76765
2009-07-22 18:23:44 +00:00
Owen Anderson 53a52215b5 Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Owen Anderson b17f32945f Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Owen Anderson 5948fdf68b Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson 9e2af02143 Re-LLVMContext-ize DebugInfo, now with less breakage.
llvm-svn: 74920
2009-07-07 17:12:53 +00:00
Owen Anderson 4f3675ca73 Revert part of r74873 that broke Clang's debug info generation.
llvm-svn: 74910
2009-07-07 16:31:25 +00:00
Owen Anderson f1f1743b2e Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
llvm-svn: 74873
2009-07-06 22:37:39 +00:00
Devang Patel 87127712b9 Simplify debug info intrisinc lowering.
llvm-svn: 74733
2009-07-02 22:43:26 +00:00
Devang Patel 526b17097a Fix typo.
Thanks Duncan!

llvm-svn: 74706
2009-07-02 17:17:03 +00:00
Devang Patel bbf38f8f3b Add debug info utility routines.
llvm-svn: 74680
2009-07-02 01:15:24 +00:00
Devang Patel b9fb595400 Keep DIDescriptor methods together.
No functionality change.

llvm-svn: 74652
2009-07-01 22:10:23 +00:00
Chris Lattner 96122debc1 improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!

llvm-svn: 74584
2009-07-01 04:13:31 +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 2ed89d7faa It is not a good idea to have data member's name match argument's name. In fact, it is a simple receipe to waste an hour or so.
llvm-svn: 74018
2009-06-23 22:25:41 +00:00
Dan Gohman 4fe64deb7b Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Bill Wendling 6ddc11aedd Non-functionality changes:
- Reformatting.
- Use while() instead of do-while().
- Move simple constructors into .h file.

llvm-svn: 71782
2009-05-14 18:26:15 +00:00
Bill Wendling eefdf8970e Print out nicer dump info for DIDescriptor.
llvm-svn: 71253
2009-05-08 20:28:06 +00:00
Dan Gohman 4bb6fa23cb Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.

llvm-svn: 71176
2009-05-07 19:46:24 +00:00
Bill Wendling 17f0f65499 Temporarily revert r71158. It was causing a failure during a full bootstrap:
checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....

llvm-svn: 71165
2009-05-07 17:26:14 +00:00
Bill Wendling b24b776208 Add dump method to DIDescriptor.
llvm-svn: 71028
2009-05-05 22:19:25 +00:00
Chris Lattner 929b644b0f Do not require variable debug info nodes to have a compile unit.
For implicit decls like "self" and "_cmd" in ObjC, these decls
should not have a location.

llvm-svn: 70964
2009-05-05 04:55:56 +00:00
Argyrios Kyrtzidis 97324cec99 -Move the DwarfWriter::ValidDebugInfo check to a static DIDescriptor::ValidDebugInfo
-Create DebugLocs without the need to have a DwarfWriter around

llvm-svn: 70682
2009-05-03 08:50:41 +00:00
Devang Patel 1be3b53d3c Add a method to check that the subprogram holds debug info for the given Function or not.
llvm-svn: 69113
2009-04-15 00:06:07 +00:00
Devang Patel 68b0881d94 Do not ignore DW_TAG_class_type!
llvm-svn: 67675
2009-03-25 03:52:06 +00:00
Bill Wendling fa54bc2052 Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling b02eadf660 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Torok Edwin 51b4a28878 Global variables don't have a corresponding llvm.dbg.declare, yet it is possible
to obtain debug info about them.
Introduce helpers to access debug info for global variables. Also introduce a
helper that works for both local and global variables.

llvm-svn: 66541
2009-03-10 13:41:26 +00:00
Bill Wendling c6869f4695 Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.

llvm-svn: 66396
2009-03-09 05:04:40 +00:00
Duncan Sands 12da8ce3d2 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Devang Patel 0c83e84f40 If compile unit's language is not set then don't crash while dump'ing compile unit.
llvm-svn: 65402
2009-02-24 23:15:09 +00:00
Devang Patel 4d20395a5f The debugger sometimes lookup dynamically in the runtime to find ivar info of any Objective-C classes. It would be very helpful to debugger if the compiler encodes runtime version number in DWARF.
Add support for two additional DWARF attributes to encode Objective-C runtime version number.

llvm-svn: 64834
2009-02-17 22:43:44 +00:00
Devang Patel 528987a1e8 Emit debug info for bitfields.
llvm-svn: 64815
2009-02-17 21:23:59 +00:00
Devang Patel c094970cd2 Each input file is encoded as a separate compile unit in LLVM debugging
information output. However, many target specific tool chains prefer to encode
only one compile unit in an object file. In this situation, the LLVM code
generator will include  debugging information entities in the compile unit 
that is marked as main compile unit. The code generator accepts maximum one main
compile unit per module. If a module does not contain any main compile unit 
then the code generator will emit multiple compile units in the output object 
file.

[Part 1]

Update DebugInfo APIs to accept optional boolean value while creating DICompileUnit  to mark the unit as "main" unit. By defaults all units are considered  non-main.  Update SourceLevelDebugging.html to document "main" compile unit.

Update DebugInfo APIs to not accept and encode separate source file/directory entries while creating various llvm.dbg.* entities. There was a recent, yet to be documented, change to include this additional information so no documentation changes are required here.

Update DwarfDebug to handle "main" compile unit. If "main" compile unit is seen then all DIEs are inserted into "main" compile unit. All other compile units are used to find source location for llvm.dbg.* values. If there is not any "main" compile unit then create unique compile unit DIEs for each llvm.dbg.compile_unit.

[Part 2]

Create separate llvm.dbg.compile_unit for each input file. Mark compile unit create for main_input_filename as "main" compile unit. Use appropriate compile unit, based on source location information collected from the tree node, while creating llvm.dbg.* values using DebugInfo APIs.

---

This is Part 1.

llvm-svn: 63400
2009-01-30 18:20:31 +00:00
Devang Patel 199740651c Add dump() routines to help debug debug info :)
llvm-svn: 63353
2009-01-30 01:03:10 +00:00
Devang Patel ccfacfff9a Introduce two DWARF attribute extentions DW_AT_APPLE_optimized, DW_AT_APPLE_flags.
DW_AT_APPLE_optimized flag is set when a compile_unit is optimized. The debugger takes advantage of this information some way.

DW_AT_APPLE_flags encodes command line options when certain env. variable is set. This is used by build engineers to track various gcc command lines used by by  a project, irrespective of whether the project used makefile, Xcode or something else.

llvm-gcc patch is next.

llvm-svn: 62888
2009-01-23 22:33:47 +00:00
Devang Patel 2333409d06 Need only one set of debug info versions enum.
llvm-svn: 62602
2009-01-20 19:22:03 +00:00
Devang Patel 44afc82ebe Verify debug info.
llvm-svn: 62545
2009-01-19 23:21:49 +00:00
Devang Patel 45d2cfd064 Add classof() methods to support isa<> and other related facilities.
llvm-svn: 62104
2009-01-12 21:38:43 +00:00
Devang Patel 57edbbf1b0 Add classof() methods so that dwarf writer can decide what DIDescriptor is in its hand.
llvm-svn: 61740
2009-01-05 19:55:07 +00:00
Devang Patel 758e7d7781 Construct array/vector type DIEs using DebugInfo.
llvm-svn: 61724
2009-01-05 18:33:01 +00:00
Devang Patel 90ba91574a Today the front-ends (llvm-gcc and clang) generate multiple llvm.dbg.compile_units to identify source file for various debug entities. Each llvm.dbg.compile_unit matches one file on the disk. However, the backend only supports one DW_TAG_compile_unit per .o file. The backend selects first compile_unit from the vector to construct DW_TAG_compile_unit entry, which is not correct in all cases.
First step to resolve this is, record file name and directory directly in debug info for various debug entities. 

llvm-svn: 61164
2008-12-17 22:39:29 +00:00
Torok Edwin 8926139252 Add utility functions to search for DbgStopPointInst corresponding to an
instruction or BasicBlock, and to search for DbgDeclareInst corresponding to a
variable.

llvm-svn: 61084
2008-12-16 09:07:36 +00:00
Torok Edwin f49b028780 use different name for parameter to make it clear that we set DIDescriptor::GV
llvm-svn: 61083
2008-12-16 09:06:01 +00:00
Torok Edwin 040688f1b2 Fix getFieldAs() to use the parameter instead of 6.
Add missing DIType constructor, needed by DIVariable::getType().

llvm-svn: 60976
2008-12-13 08:25:29 +00:00
Chris Lattner 53c56e4176 Move getCastToEmpty out of DIDescriptor into DIFactory. It is an
implementation detail of DIFactory anyway, and this allows it to avoid
recomputing the same type over and over.

llvm-svn: 58960
2008-11-10 04:10:34 +00:00
Chris Lattner 6d3893359e Add a new set of helper classes for creating and reading debug
information.  This logically replaces the "Desc" classes in
MachineModuleInfo.  Nice features of these classes are that they:

1. Are much more efficient than MMI because they don't create a 
   temporary parallel data structure for debug info that has to be
   'serialized' and 'deserialized' into/out of the module.
2. These provide a much cleaner abstraction for debug info than 
   MMI, which will make it easier to change the implementation in 
   the future (to be MDNode-based).
3. These are much easier to use than the MMI interfaces, requiring
   a lot less code in the front-ends.
4. These can be used to both create (for frontends) and read (for
   codegen) debug information.  DebugInfoBuilder can only be used
   to create the nodes.

So far, this is implemented just enough to support the debug info
generation needs of clang.  This can and should be extended to 
support the full set of debug info constructs, and we should switch
llvm-gcc and llc over to using this in the near future.

This code also has a ton of FIXMEs in it, because the way we 
currently represent debug info in LLVM IR is basically insane in a
variety of details.  This sort of issue should be fixed when we
eventually reimplement debug info on top of MDNodes.

llvm-svn: 58954
2008-11-10 02:56:27 +00:00