summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
Commit message (Collapse)AuthorAgeFilesLines
* Re-land "[WinEH] Add an EH registration and state insertion pass for 32-bit x86"Reid Kleckner2015-05-051-0/+2
| | | | | | | | | | | | This reverts commit r236360. This change exposed a bug in WinEHPrepare by opting win32 code into EH preparation. We already knew that WinEHPrepare has bugs, and is the status quo for x64, so I don't think that's a reason to hold off on this change. I disabled exceptions in the sanitizer tests in r236505 and an earlier revision. llvm-svn: 236508
* DebugInfo: Use low_pc relative debug_ranges under fission when the CU has a ↵David Blaikie2015-05-021-1/+1
| | | | | | | | | low_pc Seems we were setting the base address on the wrong DwarfCompileUnit object so it wasn't being used when generating the ranges. llvm-svn: 236377
* Revert "[WinEH] Add an EH registration and state insertion pass for 32-bit x86"Reid Kleckner2015-05-011-2/+0
| | | | | | This reverts commit r236359. Things are still broken despite testing. :( llvm-svn: 236360
* Re-land "[WinEH] Add an EH registration and state insertion pass for 32-bit x86"Reid Kleckner2015-05-011-0/+2
| | | | | | This reverts commit r236340. llvm-svn: 236359
* Revert "[WinEH] Add an EH registration and state insertion pass for 32-bit x86"Reid Kleckner2015-05-011-2/+0
| | | | | | This reverts commit r236339, it breaks the win32 clang-cl self-host. llvm-svn: 236340
* [WinEH] Add an EH registration and state insertion pass for 32-bit x86Reid Kleckner2015-05-011-0/+2
| | | | | | | | | | | | | | | | | This pass is responsible for constructing the EH registration object that gets linked into fs:00, which is all it does in this change. In the future, it will also insert stores to update the EH state number. I considered keeping this functionality in WinEHPrepare, but it's pretty separable and X86 specific. It has conceptually very little to do with the task of WinEHPrepare, which is currently outlining. WinEHPrepare is also in theory useful on ARM, but this logic is pretty x86 specific. Reviewers: andrew.w.kaylor, majnemer Differential Revision: http://reviews.llvm.org/D9422 llvm-svn: 236339
* IR: Give 'DI' prefix to debug info metadataDuncan P. N. Exon Smith2015-04-2915-265/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish off PR23080 by renaming the debug info IR constructs from `MD*` to `DI*`. The last of the `DIDescriptor` classes were deleted in r235356, and the last of the related typedefs removed in r235413, so this has all baked for about a week. Note: If you have out-of-tree code (like a frontend), I recommend that you get everything compiling and tests passing with the *previous* commit before updating to this one. It'll be easier to keep track of what code is using the `DIDescriptor` hierarchy and what you've already updated, and I think you're extremely unlikely to insert bugs. YMMV of course. Back to *this* commit: I did this using the rename-md-di-nodes.sh upgrade script I've attached to PR23080 (both code and testcases) and filtered through clang-format-diff.py. I edited the tests for test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns were off-by-three. It should work on your out-of-tree testcases (and code, if you've followed the advice in the previous paragraph). Some of the tests are in badly named files now (e.g., test/Assembler/invalid-mdcompositetype-missing-tag.ll should be 'dicompositetype'); I'll come back and move the files in a follow-up commit. llvm-svn: 236120
* [AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.Lang Hames2015-04-2419-427/+427
| | | | | | | AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a reference for this is crufty. llvm-svn: 235752
* Re-commit "[SEH] Remove the old __C_specific_handler code now that ↵Reid Kleckner2015-04-231-40/+0
| | | | | | | | | | WinEHPrepare works" This reverts commit r235617. r235649 should have addressed the problems. llvm-svn: 235667
* Revert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare ↵Reid Kleckner2015-04-231-0/+40
| | | | | | | | | | works" We still have some "uses remain after removal" issues in -O0 builds. This reverts commit r235557. llvm-svn: 235617
* [SEH] Remove the old __C_specific_handler code now that WinEHPrepare worksReid Kleckner2015-04-221-40/+0
| | | | | | | | | | This removes the -sehprepare flag and makes __C_specific_handler functions always to use WinEHPrepare. This was tested by building all of chromium_builder_tests and running a few tests that use SEH, but if something breaks, we can revert this. llvm-svn: 235557
* DebugInfo: Remove DIArray and DITypeArray typedefsDuncan P. N. Exon Smith2015-04-213-9/+9
| | | | | | | Remove the `DIArray` and `DITypeArray` typedefs, preferring the underlying types (`DebugNodeArray` and `MDTypeRefArray`, respectively). llvm-svn: 235413
* DebugInfo: Drop rest of DIDescriptor subclassesDuncan P. N. Exon Smith2015-04-2112-75/+77
| | | | | | | Delete the remaining subclasses of (the already deleted) `DIDescriptor`. Part of PR23080. llvm-svn: 235404
* Re-land r235154-r235156 under the existing -sehprepare flagReid Kleckner2015-04-211-0/+30
| | | | | | | | Keep the old SEH fan-in lowering on by default for now, since projects rely on it. This will make it easy to test this change with a simple flag flip. llvm-svn: 235399
* DebugInfo: Delete subclasses of DIScopeDuncan P. N. Exon Smith2015-04-208-43/+45
| | | | | | | Delete subclasses of (the already defunct) `DIScope`, updating users to use the raw pointers from the `Metadata` hierarchy directly. llvm-svn: 235356
* DebugInfo: Delete old subclasses of DITypeDuncan P. N. Exon Smith2015-04-204-32/+29
| | | | | | | | | | | Delete subclasses of (the already deleted) `DIType` in favour of directly using pointers from the `Metadata` hierarchy. While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType` wraps `MDDerivedTypeBase`, most uses of each really meant the more specific `MDCompositeType` and `MDDerivedType`. llvm-svn: 235351
* DwarfUnit: Split MDSubroutineType version of constructTypeDIE()Duncan P. N. Exon Smith2015-04-203-32/+36
| | | | | | | | | | | | | The version of `constructTypeDIE()` for `MDSubroutineType` is unrelated to (and has different callers than) the `MDCompositeType`. Split the two in half. This simplifies an upcoming patch to delete `DICompositeType`. There shouldn't be any real functionality change here. `createTypeDIE()` is `cast<>`'ing where it didn't need to before, but that function in turn is only called for true `MDCompositeType`s. llvm-svn: 235349
* DwarfUnit: Cleanup commentsDuncan P. N. Exon Smith2015-04-202-194/+87
| | | | | | | | | | | | | | Update comment style in `DwarfUnit`. - Drop duplicated comments at definition, and update the comments at the declaration where the definition comments looked newer or more complete. - Drop the `functionName -` prefix. - Add `\brief` in a few places. - Remove a few comments entirely that weren't adding value (just turned the function name and arguments into a sentence). llvm-svn: 235345
* DebugInfo: Remove DITypeDuncan P. N. Exon Smith2015-04-204-27/+27
| | | | | | | | This is the last major parent class, so I'll probably start deleting classes in batches now. Looks like many of the references to the DI* hierarchy were updated organically along the way. llvm-svn: 235331
* DebugInfo: Remove DIScopeDuncan P. N. Exon Smith2015-04-204-28/+29
| | | | | | | | | Replace uses of `DIScope` with `MDScope*`. There was one spot where I've left an `MDScope*` uninitialized (where `DIScope` would have been default-initialized to `nullptr`) -- this is intentional, since the if/else that follows should unconditional assign it to a value. llvm-svn: 235327
* DebugInfo: Remove typedefs for DITypeRef, etc.Duncan P. N. Exon Smith2015-04-202-4/+4
| | | | | | | | | | Remove typedefs for type refs: - DITypeRef => MDTypeRef - DIScopeRef => MDScopeRef - DIDescriptorRef => DebugNodeRef llvm-svn: 235323
* DebugInfo: Delete DIDescriptor (but not its subclasses)Duncan P. N. Exon Smith2015-04-183-21/+16
| | | | | | | Delete `DIDescriptor` and update the remaining users. I'll follow-up by deleting subclasses in manageable groups (top-down). llvm-svn: 235248
* DebugInfo: Remove DIDescriptor from the DebugInfo APIDuncan P. N. Exon Smith2015-04-171-1/+1
| | | | | | | Stop using `DIDescriptor` and its subclasses in the `DebugInfoFinder` API, as well as the rest of the API hanging around in `DebugInfo.h`. llvm-svn: 235240
* AsmPrinter: Create a unified .debug_loc streamDuncan P. N. Exon Smith2015-04-178-86/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes `DebugLocList` and replaces it with `DebugLocStream`. - `DebugLocEntry` no longer contains its byte/comment streams. - The `DebugLocEntry` list for a variable/inlined-at pair is allocated on the stack, and released right after `DebugLocEntry::finalize()` (possible because of the refactoring in r231023). Now, only one list is in memory at a time now. - There's a single unified stream for the `.debug_loc` section that persists, stored in the new `DebugLocStream` data structure. The last point is important: this collapses the nested `SmallVector<>`s from `DebugLocList` into unified streams. We previously had something like the following: vec<tuple<Label, CU, vec<tuple<BeginSym, EndSym, vec<Value>, vec<char>, vec<string>>>>> A `SmallVector` can avoid allocations, but is statically fairly large for a vector: three pointers plus the size of the small storage, which is the number of elements in small mode times the element size). Nesting these is expensive, since an inner vector's size contributes to the element size of an outer one. (Nesting any vector is expensive...) In the old data structure, the outer vector's *element* size was 632B, excluding allocation costs for when the middle and inner vectors exceeded their small sizes. 312B of this was for the "three" pointers in the vector-tree beneath it. If you assume 1M functions with an average of 10 variable/inlined-at pairs each (in an LTO scenario), that's almost 6GB (besides inner allocations), with almost 3GB for the "three" pointers. This came up in a heap profile a little while ago of a `clang -flto -g` bootstrap, with `DwarfDebug::collectVariableInfo()` using something like 10-15% of the total memory. With this commit, we have: tuple<vec<tuple<Label, CU, Offset>>, vec<tuple<BeginSym, EndSym, Offset, Offset>>, vec<char>, vec<string>> The offsets are used to create `ArrayRef` slices of adjacent `SmallVector`s. This reduces the number of vectors to four (unrelated to the number of variable/inlined-at pairs), and caps the number of allocations at the same number. Besides saving memory and limiting allocations, this is NFC. I don't know my way around this code very well yet, but I wonder if we could go further: why stream to a side-table, instead of directly to the output stream? llvm-svn: 235229
* Remove dead code, NFCDuncan P. N. Exon Smith2015-04-171-8/+0
| | | | llvm-svn: 235225
* [WinEH] Reusing HandlerType entries leads to small CatchHigh valuesDavid Majnemer2015-04-171-1/+0
| | | | | | | | | CatchHigh may be smaller than TryHigh if we reuse an outlined catch handler for two different invokes with different EH states. We have no evidence which shows that CatchHigh must be greater than TryHigh or TryLow. We can revisit this if we turn out to be wrong. llvm-svn: 235223
* [WinEH] Allow CatchHigh to be equal to TryHighDavid Majnemer2015-04-171-1/+1
| | | | | | | | Catch blocks which are empty may be in the same state as their try blocks. It is not meaningful to give the catch block its own state number in this case because it can't do anything exceptional. llvm-svn: 235212
* AsmPrinter: Store MDExpression directly instead of MDNode, NFCDuncan P. N. Exon Smith2015-04-172-10/+8
| | | | | | | Clean up `DebugLocEntry::Value::Expression`'s type while I'm messing around in here anyway. llvm-svn: 235203
* AsmPrinter: Stop storing MDLocalVariable in DebugLocEntryDuncan P. N. Exon Smith2015-04-172-31/+19
| | | | | | | | | | Stop storing the `MDLocalVariable` in the `DebugLocEntry::Value`s. We generate the list of `DebugLocEntry`s separately for each variable/inlined-at pair, so the variable never actually changes here. This is effectively NFC (aside from saving some memory and CPU time). llvm-svn: 235202
* AsmPrinter: Calculate type upfront for location lists, NFCDuncan P. N. Exon Smith2015-04-172-15/+15
| | | | | | | | | We can calculate the variable type up front before calling `DebugLocEntry::finalize()`. In fact, since we only care about the type if it's an `MDBasicType`, don't even bother resolving it using the type identifier map. llvm-svn: 235201
* Revert r235154-r235156, they cause asserts when building win64 code ↵Nico Weber2015-04-171-24/+34
| | | | | | (http://crbug.com/477988) llvm-svn: 235170
* Fix unused variable warningReid Kleckner2015-04-171-5/+0
| | | | llvm-svn: 235155
* [SEH] Reimplement x64 SEH using WinEHPrepareReid Kleckner2015-04-171-29/+24
| | | | | | | | | | | | | | | | This now emits simple, unoptimized xdata tables for __C_specific_handler based on the handlers listed in @llvm.eh.actions calls produced by WinEHPrepare. This adds support for running __finally blocks when exceptions are thrown, and removes the old landingpad fan-in codepath. I ran some manual execution tests on small basic test cases with and without optimization, as well as on Chrome base_unittests, which uses a small amount of SEH. I'm sure there are bugs, and we may need to revert. llvm-svn: 235154
* AsmPrinter: Remove dead code, NFCDuncan P. N. Exon Smith2015-04-161-1/+0
| | | | llvm-svn: 235139
* AsmPrinter: Simplify logic for debug info intrinsics' !dbg attachmentsDuncan P. N. Exon Smith2015-04-163-11/+6
| | | | | | These are required, so just assume they're there. llvm-svn: 235138
* DebugInfo: DIRef<> => TypedDebugNodeRef<>Duncan P. N. Exon Smith2015-04-163-8/+2
| | | | | | | | Delete `DIRef<>`, and replace the remaining uses of it with `TypedDebugNodeRef<>`. To minimize code churn, I've added typedefs from `MDTypeRef` to `DITypeRef` (etc.). llvm-svn: 235071
* DebugInfo: Gut DIDescriptorDuncan P. N. Exon Smith2015-04-161-3/+4
| | | | | | | | | | | | | | | PR23080 is almost finished. With this commit, there's no consequential API in `DIDescriptor` and its subclasses. What's left? - Default-constructed to `nullptr`. - Handy `const_cast<>` (constructed from `const`, but accessors are non-`const`). I think the safe way to catch those is to delete the classes and fix compile errors. That'll be my next step, after I delete the `DITypeRef` (etc.) wrapper around `MDTypeRef`. llvm-svn: 235069
* DebugInfo: Gut DIScope, DIEnumerator and DISubrangeDuncan P. N. Exon Smith2015-04-163-15/+15
| | | | | | The only class the still has API left is `DIDescriptor` itself. llvm-svn: 235067
* DebugInfo: Gut DIType and subclassesDuncan P. N. Exon Smith2015-04-164-91/+88
| | | | | | | | Continuing PR23080, gut `DIType` and its various subclasses, leaving behind thin wrappers around the pointer types in the new debug info hierarchy. llvm-svn: 235064
* DebugInfo: Remove unnecessary API from DIDerivedType and DITypeDuncan P. N. Exon Smith2015-04-151-29/+34
| | | | | | | | | Remove the accessors of `DIDerivedType` that downcast to `MDDerivedType`, shifting the `cast<MDDerivedType>` into the callers. Also remove `DIType::isValid()`, which is really just a check against `nullptr` at this point. llvm-svn: 235059
* DebugInfo: Gut DICompileUnit and DIFileDuncan P. N. Exon Smith2015-04-153-12/+12
| | | | | | | Continuing gutting `DIDescriptor` subclasses; this edition, `DICompileUnit` and `DIFile`. In the name of PR23080. llvm-svn: 235055
* DebugInfo: factor out dead variable in NDEBUG from r235050Duncan P. N. Exon Smith2015-04-151-2/+1
| | | | | | | | Caught by the lld bot: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/9832 llvm-svn: 235052
* DebugInfo: Remove 'inlinedAt:' field from MDLocalVariableDuncan P. N. Exon Smith2015-04-155-66/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove 'inlinedAt:' from MDLocalVariable. Besides saving some memory (variables with it seem to be single largest `Metadata` contributer to memory usage right now in -g -flto builds), this stops optimization and backend passes from having to change local variables. The 'inlinedAt:' field was used by the backend in two ways: 1. To tell the backend whether and into what a variable was inlined. 2. To create a unique id for each inlined variable. Instead, rely on the 'inlinedAt:' field of the intrinsic's `!dbg` attachment, and change the DWARF backend to use a typedef called `InlinedVariable` which is `std::pair<MDLocalVariable*, MDLocation*>`. This `DebugLoc` is already passed reliably through the backend (as verified by r234021). This commit removes the check from r234021, but I added a new check (that will survive) in r235048, and changed the `DIBuilder` API in r235041 to require a `!dbg` attachment whose 'scope:` is in the same `MDSubprogram` as the variable's. If this breaks your out-of-tree testcases, perhaps the script I used (mdlocalvariable-drop-inlinedat.sh) will help; I'll attach it to PR22778 in a moment. llvm-svn: 235050
* [WinEH] Try to make the MachineFunction CFG more accurateReid Kleckner2015-04-151-3/+7
| | | | | | | | | | | | This avoids emitting code for unreachable landingpad blocks that contain calls to llvm.eh.actions and indirectbr. It's also a first step towards unifying the SEH and WinEH lowering codepaths. I'm keeping the old fan-in lowering of SEH around until the preparation version works well enough that we can switch over without breaking existing users. llvm-svn: 235037
* Reland "[WinEH] Use the parent function when computing frameescape labels"Reid Kleckner2015-04-151-1/+1
| | | | | | Fixed the test by removing extraneous quotes. llvm-svn: 235028
* Revert "[WinEH] Use the parent function when computing frameescape labels"Reid Kleckner2015-04-151-1/+1
| | | | | | This reverts commit r235025. The test isn't passing yet. llvm-svn: 235027
* [WinEH] Use the parent function when computing frameescape labelsReid Kleckner2015-04-151-1/+1
| | | | | | Fixes assertions in MC when a local label wasn't defined. llvm-svn: 235025
* [WinEH] Avoid emitting xdata tables twice for cleanupsReid Kleckner2015-04-141-3/+5
| | | | | | | Since adding invokes of llvm.donothing to cleanups, we come here now, and trivial EH cleanup usage from clang fails to compile. llvm-svn: 234948
* DebugInfo: Pubnames: Do not include variable declarations in pubnamesDavid Blaikie2015-04-141-1/+2
| | | | | | | This causes badness for GDB which expects to find a definition in any compile_unit that has an entry for the variable in its pubnames. llvm-svn: 234915
* DebugInfo: Gut DISubprogram and DILexicalBlock*Duncan P. N. Exon Smith2015-04-145-45/+45
| | | | | | | Gut the `DIDescriptor` wrappers around `MDLocalScope` subclasses. Note that `DILexicalBlock` wraps `MDLexicalBlockBase`, not `MDLexicalBlock`. llvm-svn: 234850
OpenPOWER on IntegriCloud