summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeView] Refactor enumerator emissionDavid Majnemer2016-06-171-9/+17
| | | | | | This addresses Amjad's review comments on D21442. llvm-svn: 273010
* [codeview] Make function names more consistent with MSVCReid Kleckner2016-06-171-29/+38
| | | | | | | | | | | | | | | Names in function id records don't include nested name specifiers or template arguments, but names in the symbol stream include both. For the symbol stream, instead of having Clang put the fully qualified name in the subprogram display name, recreate it from the subprogram scope chain. For the type stream, take the unqualified name and chop of any template arguments. This makes it so that CodeView DI metadata is more similar to DWARF DI metadata. llvm-svn: 273009
* [CodeView] Implement support for enumsDavid Majnemer2016-06-162-0/+22
| | | | | | | | | | MSVC handles enums differently from structs and classes: a forward declaration is not emitted unconditionally. MSVC does not emit an S_UDT record for the enum. Differential Revision: http://reviews.llvm.org/D21442 llvm-svn: 272960
* NFC; refactor getFrameIndexReferenceFromSPSanjoy Das2016-06-161-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: ... into getFrameIndexReferencePreferSP. This change folds the fail-then-retry logic into getFrameIndexReferencePreferSP. There is a non-functional but behaviorial change in WinException -- earlier if `getFrameIndexReferenceFromSP` failed we'd trip an assert, but now we'll silently use the (wrong) offset from the base pointer. I could not write the assert I'd like to write ("FrameReg == StackRegister", like I've done in X86FrameLowering) since there is no easy way to get to the stack register from WinException (happy to be proven wrong here). One solution to this is to add a `bool OnlyStackPointer` parameter to `getFrameIndexReferenceFromSP` that asserts if it could not satisfy its promise of returning an offset from a stack pointer, but that seems overkill. Reviewers: rnk Subscribers: sanjoy, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D21427 llvm-svn: 272938
* Resubmit "[pdb] Change type visitor pattern to be dynamic."Zachary Turner2016-06-161-4/+3
| | | | | | | There was a regression introduced during type stream merging when visiting a field list record. This has been fixed in this patch. llvm-svn: 272929
* Revert "[pdb] Change type visitor pattern to be dynamic."Zachary Turner2016-06-161-3/+4
| | | | | | | | This reverts commit fb0dd311e1ad945827b8ffd5354f4810e2be1579. This breaks some llvm-readobj tests. llvm-svn: 272927
* [pdb] Change type visitor pattern to be dynamic.Zachary Turner2016-06-161-4/+3
| | | | | | | | | | | | | | | This allows better catching of compiler errors since we can use the override keyword to verify that methods are actually overridden. Also in this patch I've changed from storing a boolean Error code everywhere to returning an llvm::Error, to propagate richer error information up the call stack. Reviewed By: ruiu, rnk Differential Revision: http://reviews.llvm.org/D21410 llvm-svn: 272926
* [CodeView] Add support for emitting S_UDT for typedefsDavid Majnemer2016-06-152-4/+100
| | | | | | | | | Emit a S_UDT record for typedefs. We still need to do something for class types. Differential Revision: http://reviews.llvm.org/D21149 llvm-svn: 272813
* Don't force SP-relative addressing for statepointsSanjoy Das2016-06-151-1/+2
| | | | | | | | | | | | | | | | | | | Summary: ... when the offset is not statically known. Prioritize addresses relative to the stack pointer in the stackmap, but fallback gracefully to other modes of addressing if the offset to the stack pointer is not a known constant. Patch by Oscar Blumberg! Reviewers: sanjoy Subscribers: llvm-commits, majnemer, rnk, sanjoy, thanm Differential Revision: http://reviews.llvm.org/D21259 llvm-svn: 272756
* [CodeView] Don't emit debuginfo for imported symbolsDavid Majnemer2016-06-151-2/+3
| | | | | | | | | Emitting symbol information requires us to have a definition for the symbol. A symbol reference is insufficient. This fixes PR28123. llvm-svn: 272738
* IR: Introduce local_unnamed_addr attribute.Peter Collingbourne2016-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a local_unnamed_addr attribute is attached to a global, the address is known to be insignificant within the module. It is distinct from the existing unnamed_addr attribute in that it only describes a local property of the module rather than a global property of the symbol. This attribute is intended to be used by the code generator and LTO to allow the linker to decide whether the global needs to be in the symbol table. It is possible to exclude a global from the symbol table if three things are true: - This attribute is present on every instance of the global (which means that the normal rule that the global must have a unique address can be broken without being observable by the program by performing comparisons against the global's address) - The global has linkonce_odr linkage (which means that each linkage unit must have its own copy of the global if it requires one, and the copy in each linkage unit must be the same) - It is a constant or a function (which means that the program cannot observe that the unique-address rule has been broken by writing to the global) Although this attribute could in principle be computed from the module contents, LTO clients (i.e. linkers) will normally need to be able to compute this property as part of symbol resolution, and it would be inefficient to materialize every module just to compute it. See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html for earlier discussion. Part of the fix for PR27553. Differential Revision: http://reviews.llvm.org/D20348 llvm-svn: 272709
* Fix BSS global handling in AsmPrinterNirav Dave2016-06-141-35/+33
| | | | | | | | | | | | | | | | Change EmitGlobalVariable to check final assembler section is in BSS before using .lcomm/.comm directive. This prevents globals from being put into .bss erroneously when -data-sections is used. This fixes PR26570. Reviewers: echristo, rafael Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21146 llvm-svn: 272674
* Run clang-tidy's performance-unnecessary-copy-initialization over LLVM.Benjamin Kramer2016-06-121-1/+1
| | | | | | No functionality change intended. llvm-svn: 272516
* Pass DebugLoc and SDLoc by const ref.Benjamin Kramer2016-06-122-2/+2
| | | | | | | | This used to be free, copying and moving DebugLocs became expensive after the metadata rewrite. Passing by reference eliminates a ton of track/untrack operations. No functionality change intended. llvm-svn: 272512
* [codeview] Skip DIGlobalVariables with no variableReid Kleckner2016-06-091-2/+3
| | | | | | They have probably been discarded during optimization. llvm-svn: 272231
* [DebugInfo] Add calling convention support for DWARF and CodeViewReid Kleckner2016-06-082-6/+31
| | | | | | | | | | | | | | | | | | | | | Summary: Now DISubroutineType has a 'cc' field which should be a DW_CC_ enum. If it is present and non-zero, the backend will emit it as a DW_AT_calling_convention attribute. On the CodeView side, we translate it to the appropriate enum for the LF_PROCEDURE record. I added a new LLVM vendor specific enum to the list of DWARF calling conventions. DWARF does not appear to attempt to standardize these, so I assume it's OK to do this until we coordinate with GCC on how to emit vectorcall convention functions. Reviewers: dexonsmith, majnemer, aaboud, amccarth Subscribers: mehdi_amini, llvm-commits Differential Revision: http://reviews.llvm.org/D21114 llvm-svn: 272197
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-082-2/+2
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* Generate codeview for array type metadata.Adrian McCarthy2016-06-082-0/+15
| | | | | | Differential Revision: http://reviews.llvm.org/D21107 llvm-svn: 272187
* Re-land "[codeview] Emit information about global variables"Reid Kleckner2016-06-072-21/+101
| | | | | | | | | | | | This reverts commit r271962 and reinstantes r271957. MSVC's linker doesn't appear to like it if you have an empty symbol substream, so only open a symbol substream if we're going to emit something about globals into it. Makes check-asan pass. llvm-svn: 271965
* Revert "[codeview] Emit information about global variables"Reid Kleckner2016-06-062-95/+21
| | | | | | This reverts commit r271957, it broke check-asan on Windows. llvm-svn: 271962
* [codeview] Emit information about global variablesReid Kleckner2016-06-062-21/+95
| | | | | | | This currently emits everything as S_GDATA32, which isn't right for things like thread locals, but it's a start. llvm-svn: 271957
* [AsmPrinter, CodeView] There are some more ways of getting wchar_tDavid Majnemer2016-06-041-3/+5
| | | | | | | | | C++ has a builtin type called wchar_t. Clang also provides a type called __wchar_t in C mode. In C mode, wchar_t can be a typedef to unsigned short. llvm-svn: 271793
* [codeview] Add basic record type translationReid Kleckner2016-06-032-9/+227
| | | | | | | | | | | This only translates data members for now. Translating overloaded methods is complicated, so I stopped short of doing that. Reviewers: aaboud Differential Revision: http://reviews.llvm.org/D20924 llvm-svn: 271680
* [CodeView] Use None instead of Void if there is no subprogramDavid Majnemer2016-06-021-1/+1
| | | | llvm-svn: 271566
* [codeview] Fix crash when handling qualified void typesReid Kleckner2016-06-021-2/+1
| | | | | | | | | | The DIType* for void is the null pointer. A null DIType can never be a qualified type, so we can just exit the loop at this point and go to getTypeIndex(BaseTy). Fixes PR27984 llvm-svn: 271550
* [CodeView] Implement function-type indicesDavid Majnemer2016-06-022-23/+47
| | | | | | | | | We still need to do something about member functions and calling conventions. Differential Revision: http://reviews.llvm.org/D20900 llvm-svn: 271541
* [CodeView] Use the right type index for long longDavid Majnemer2016-06-021-12/+17
| | | | | | We used T_INT8 instead of T_QUAD. llvm-svn: 271497
* [CodeView] Remove superfluous bitmathDavid Majnemer2016-06-021-1/+1
| | | | llvm-svn: 271495
* [codeview] Return type indices for typedefsDavid Majnemer2016-06-022-0/+13
| | | | | | | Use the type index of the underlying type unless we have a typedef from long to HRESULT; HRESULT typedefs are translated to T_HRESULT. llvm-svn: 271494
* Fix the NDEBUG buildReid Kleckner2016-06-011-0/+1
| | | | llvm-svn: 271411
* [codeview] Translate basic DITypes to CV type recordsReid Kleckner2016-06-012-3/+224
| | | | | | | | | | | | | | | Summary: This is meant to be the tiniest step towards DIType to CV type index translation that I could come up with. Whenever translation fails, we use type index zero, which is the unknown type. Reviewers: aaboud, zturner Subscribers: llvm-commits, amccarth Differential Revision: http://reviews.llvm.org/D20840 llvm-svn: 271408
* DwarfDebug: Simplify. NFC.Peter Collingbourne2016-06-011-6/+2
| | | | llvm-svn: 271360
* [MC] Rename EmitFill to emitFillPetr Hosek2016-06-012-3/+3
| | | | | | | | This is to match the overloaded variants as well as the new style. Differential Revision: http://reviews.llvm.org/D20690 llvm-svn: 271359
* [codeview] Improve readability of type record assemblyReid Kleckner2016-05-311-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the method MCStreamer::EmitBinaryData, which is usually an alias for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex dump output like this: .byte 0x0e, 0x00, 0x08, 0x10 .byte 0x03, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x10, 0x00, 0x00 Also, when verbose asm comments are enabled, this patch prints the dump output for each comment before its record, like this: # ArgList (0x1000) { # TypeLeafKind: LF_ARGLIST (0x1201) # NumArgs: 0 # Arguments [ # ] # } .byte 0x06, 0x00, 0x01, 0x12 .byte 0x00, 0x00, 0x00, 0x00 This should make debugging easier and testing more convenient. Reviewers: aaboud Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits Differential Revision: http://reviews.llvm.org/D20711 llvm-svn: 271313
* [codeview] Use comdats for debug info describing comdat functionsReid Kleckner2016-05-252-12/+57
| | | | | | | | | | | | | | | | | | Summary: This allows the linker to discard unused symbol information for comdat functions that were discarded during the link. Before this change, searching for the name of an inline function in the debugger would return multiple results, one per symbol subsection in the object file. After this change, there is only one result, the result for the function chosen by the linker. Reviewers: zturner, majnemer Subscribers: aaboud, amccarth, llvm-commits Differential Revision: http://reviews.llvm.org/D20642 llvm-svn: 270792
* DWARF: Omit DW_AT_APPLE attributes (except ObjC ones) when not targeting LLDBDavid Blaikie2016-05-244-13/+25
| | | | | | | | | | | | | | | These attributes aren't used by other debuggers (& may be confused with other DWARF extensions) so they just waste space (about 1.5% on .dwo file size on a random large program I tested). We could remove the ObjC property ones too, but I figured they were probably more necessary when trying to understand ObjC (I could be wrong though) & so any debugger interested in working with ObjC would use them, perhaps? (also, there are some legacy tests in Clang that test for them - making it one of those annoying cross-project commits and/or cleanup to refactor those tests) llvm-svn: 270613
* Modify emitTypeInformation to use MemoryTypeTableBuilder, take 2Reid Kleckner2016-05-232-87/+64
| | | | | | | | | | | | | | This effectively revers commit r270389 and re-lands r270106, but it's almost a rewrite. The behavior change in r270106 was that we could no longer assume that each LF_FUNC_ID record got its own type index. This patch adds a map from DINode* to TypeIndex, so we can stop making that assumption. This change also emits padding bytes between type records similar to the way MSVC does. The size of the type record includes the padding bytes. llvm-svn: 270485
* [codeview] Refactor symbol records to use same pattern as types.Zachary Turner2016-05-231-11/+11
| | | | | | | | | | | This will pave the way to introduce a full fledged symbol visitor similar to how we have a type visitor, thus allowing the same dumping code to be used in llvm-readobj and llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D20384 Reviewed By: rnk llvm-svn: 270475
* Revert "Modify emitTypeInformation to use MemoryTypeTableBuilder"David Majnemer2016-05-232-19/+42
| | | | | | | This reverts commit r270106. It results in certain function types omitted in the output. llvm-svn: 270389
* CodeGen: Move the call to DwarfDebug::beginModule() out of the constructor.Peter Collingbourne2016-05-202-5/+2
| | | | | | | | | This gives AsmPrinter a chance to initialize its DD field before we call beginModule(), which is about to start using it. Differential Revision: http://reviews.llvm.org/D20413 llvm-svn: 270258
* CodeGen: Do not require a MachineFunction just to create a DIEDwarfExpression.Peter Collingbourne2016-05-206-41/+49
| | | | | | | | | We are about to start using DIEDwarfExpression to create global variable DIEs, which happens before we generate code for functions. Differential Revision: http://reviews.llvm.org/D20412 llvm-svn: 270257
* Fix pr27728.Rafael Espindola2016-05-201-16/+8
| | | | | | | | | | | | | | | Sorry for the lack testcase. There is one in the pr, but it depends on std::sort and the .ll version is 110 lines, so I don't think it is wort it. The bug was that we were sorting after adding a terminator, and the sorting algorithm could end up putting the terminator in the middle of the List vector. With that we would create a Spans map entry keyed on nullptr which would then be added to CUs and fail in that sorting. llvm-svn: 270165
* clang-format. NFC.Rafael Espindola2016-05-191-13/+13
| | | | llvm-svn: 270156
* Modify emitTypeInformation to use MemoryTypeTableBuilderAdrian McCarthy2016-05-192-42/+19
| | | | | | | | A baby step toward translating DIType records to CodeView. This does not (yet) combine the record length with the record data. I'm going back and forth trying to determine if that's a good idea. llvm-svn: 270106
* [codeview] Some cleanup of Symbol Records.Zachary Turner2016-05-171-9/+9
| | | | | | | | | | | | | | * Reworks the CVSymbolTypes.def to work similarly to TypeRecords.def. * Moves some enums from SymbolRecords.h to CodeView.h to maintain consistency with how we do type records. * Generalize a few simple things like the record prefix * Define the leaf enum and the kind enum similar to how we do with tyep records. Differential Revision: http://reviews.llvm.org/D20342 Reviewed By: amccarth, rnk llvm-svn: 269867
* [DwarfDebug] Make tuning predicates private, should be used only in ctor.Paul Robinson2016-05-171-9/+10
| | | | llvm-svn: 269859
* Debug Info: Introduce a DwarfDebug::UseDWARF2Bitfields flagAdrian Prantl2016-05-173-6/+13
| | | | | | | | | instead of having DwarfUnit query the debugger tuning options. Follow-up commmit to r269827. Thanks to Paul Robinson for pointing this out! llvm-svn: 269840
* Debug Info: Don't emit bitfields in the DWARF4 format when tuning for GDB.Adrian Prantl2016-05-171-6/+11
| | | | | | | As discovered in PR27758, GDB does not fully support the DWARF 4 format. This patch ensures we always emit bitfields in the DWARF 2 when tuning for GDB. llvm-svn: 269827
* Debug Info: Don't emit a DW_AT_data_member_location for DWARF bitfields.Adrian Prantl2016-05-171-3/+3
| | | | | | | | | The DWARF spec states that a member entry may have either a DW_AT_data_member_location or a DW_AT_data_bit_offset, but not both. This fixes a bug found in PR 27758. llvm-svn: 269731
* Debug info: Don't emit a DW_AT_byte_size when emitting a DWARF4 bit field.Adrian Prantl2016-05-161-1/+2
| | | | | | | | | | The DWARF spec clearly states that a bit field member should have either a DW_AT_byte_size or a DW_AT_bit_size, but not both. Also the DW_AT_byte_size is redundant with the size of the type of the member. This fixes a bug found in PR 27758. llvm-svn: 269714
OpenPOWER on IntegriCloud