summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* DebugInfo: Gut DINamespace and DITemplate*ParameterDuncan P. N. Exon Smith2015-04-141-18/+18
| | | | | | | Continue gutting `DIDescriptor` subclasses, turning them into as-bare-as-possible pointer wrappers. llvm-svn: 234843
* DebugInfo: Gut DIVariable and DIGlobalVariableDuncan P. N. Exon Smith2015-04-146-37/+37
| | | | | | | | | | Gut all the non-pointer API from the variable wrappers, except an implicit conversion from `DIGlobalVariable` to `DIDescriptor`. Note that if you're updating out-of-tree code, `DIVariable` wraps `MDLocalVariable` (`MDVariable` is a common base class shared with `MDGlobalVariable`). llvm-svn: 234840
* DebugInfo: Inline DIVariable::isBlockByrefVariable() into its callersDuncan P. N. Exon Smith2015-04-141-2/+4
| | | | | | | I don't think this API is helping much. Change the callers to call `MDType::isBlockByrefStruct()` directly. llvm-svn: 234837
* DebugInfo: Gut DIObjCProperty and DIImportedEntityDuncan P. N. Exon Smith2015-04-143-17/+14
| | | | | | | Gut a couple more classes in the DIDescriptor hierarchy. Leave behind an implicit conversion to `DIDescriptor`, the old base class. llvm-svn: 234836
* DebugInfo: Gut DILocationDuncan P. N. Exon Smith2015-04-141-3/+3
| | | | | | | | This is along the same lines as r234832, but for `DILocation`. Clean out all accessors from `DILocation`. Any callers should be using `MDLocation` directly (e.g., via `operator->()`). llvm-svn: 234835
* DebugInfo: Gut DIExpressionDuncan P. N. Exon Smith2015-04-144-22/+21
| | | | | | | | | | | | | | | | Completely gut `DIExpression`, turning it into a simple wrapper around `MDExpression *`. There are two bits of magic left: - It's constructed from `const MDExpression*` but convertible to `MDExpression*`. - It's default-constructed to `nullptr`. Otherwise, it should behave quite like a raw pointer. Once I've done the same to the rest of the `DIDescriptor` subclasses, I'll come back to delete them entirely (and update call sites as necessary to deal with the missing magic). llvm-svn: 234832
* DebugInfo: Remove DIObjCProperty attribute accessors, NFCDuncan P. N. Exon Smith2015-04-131-14/+1
| | | | | | | | | There's only one user of the various `DIObjCProperty::is*Property()` accessors -- `DwarfUnit::constructTypeDIE()` -- and it's just using the reverse logic to reconstruct the bitfield. Drop this API and simplify the only caller. llvm-svn: 234818
* DebugInfo: Remove DIGlobalVariable::getGlobal()Duncan P. N. Exon Smith2015-04-131-4/+3
| | | | | | | | `DIGlobalVariable::getGlobal()` isn't really helpful, it just does a `dyn_cast_or_null<>`. Simplify its only user by doing the cast directly and delete the code. llvm-svn: 234796
* Reapply "Verifier: Check for incompatible bit piece expressions"Duncan P. N. Exon Smith2015-04-131-9/+1
| | | | | | | | | | | | | | | | | | | | | This reverts commit r234717, reapplying r234698 (in spirit). As described in r234717, the original `Verifier` check had a use-after-free. Instead of storing pointers to "interesting" debug info intrinsics whose bit piece expressions should be verified once we have typerefs, do a second traversal. I've added a testcase to catch the `llc` crasher. Original commit message: Verifier: Check for incompatible bit piece expressions Convert an assertion into a `Verifier` check. Bit piece expressions must fit inside the variable, and mustn't be the entire variable. Catching this in the verifier will help us find bugs sooner, and makes `DIVariable::getSizeInBits()` dead code. llvm-svn: 234776
* Revert "Verifier: Check for incompatible bit piece expressions"Duncan P. N. Exon Smith2015-04-131-1/+9
| | | | | | | | | | | | | This reverts commit r234698. This caused a use-after-free: `QueuedBitPieceExpressions` holds onto references to `DbgInfoIntrinsic`s and references them past where they're deleted (this is because the verifier is run as a function pass, and then `verifyTypeRefs()` is called during `doFinalization()`). I'll include a reduced crasher for `llc` when I recommit the check. llvm-svn: 234717
* Verifier: Check for incompatible bit piece expressionsDuncan P. N. Exon Smith2015-04-111-9/+1
| | | | | | | | | Convert an assertion into a `Verifier` check. Bit piece expressions must fit inside the variable, and mustn't be the entire variable. Catching this in the verifier will help us find bugs sooner, and makes `DIVariable::getSizeInBits()` dead code. llvm-svn: 234698
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-114-5/+5
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* [WinEHPrepare] Don't rely on the order of IRDavid Majnemer2015-04-101-1/+5
| | | | | | | | | | The IPToState table must be emitted after we have generated labels for all functions in the table. Don't rely on the order of the list of globals. Instead, utilize WinEHFuncInfo to tell us how many catch handlers we expect to outline. Once we know we've visited all the catch handlers, emit the cppxdata. llvm-svn: 234566
* [WinEH] Fix xdata generation when no catch object is presentReid Kleckner2015-04-071-6/+14
| | | | | | | | The lack of a catch object is indicated by a frame escape index of -1. Fixes PR23137. llvm-svn: 234346
* Revert "Try a third time to fix MSVC build after r234290"Duncan P. N. Exon Smith2015-04-071-3/+3
| | | | | | | | | | This reverts commit r234295 (and r234294 and r234292 before it). I removed the implicit conversion to `MDTuple*` r234326, so there's no longer an ambiguity in `operator[]()`. I think MSVC should accept the original code now... llvm-svn: 234335
* Refactor a lot of duplicated code for stub output.Rafael Espindola2015-04-071-2/+22
| | | | | | | This also moves it earlier so that it they are produced before we print an end symbol for the data section. llvm-svn: 234315
OpenPOWER on IntegriCloud